.navbar a {
    color: var(--text-main);
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
    transition: opacity 0.15s ease-in-out;
}

.navbar a:hover {
    opacity: 0.6;
}

.brand {
    font-weight: bold;
    font-size: 1.2em;
}

main {
    padding: 20px 32px 40px;
    text-align: center;
}

footer {
    text-align: center;
    padding: 20px;
    font-size: 0.9em;
    color: #555;
}

:root {
    --bg: #e5ecf5;
    --card-bg: #f5f8ff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --shadow-soft: 12px 12px 24px rgba(15, 23, 42, 0.15);
    --shadow-soft-inset: inset 8px 8px 16px rgba(15, 23, 42, 0.1),
    inset -8px -8px 16px rgba(255, 255, 255, 0.8);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-pill: 999px;
    --transition-fast: 0.18s ease-out;
    --font-main: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --gold-bg: #fde68a;
    --silver-bg: #71706e;
    --bronze-bg: #fed7aa;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: radial-gradient(circle at top left, #f9fbff 0%, var(--bg) 60%, #dde3f0 100%);
    color: var(--text-main);
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 40px;
}

.app-main {
    flex: 1;
    max-width: 1100px;
    margin: 2px auto 40px;
    padding: 0 16px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 24px 28px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 16px 16px 32px rgba(15, 23, 42, 0.22);
}

.btn-primary {
    border: none;
    border-radius: var(--radius-pill);
    padding: 20px 52px;
    background: linear-gradient(135deg, #d5dfe8, #f7f9fc, #d5dfe8);
    color: #1f2937;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 7px 7px 14px rgba(180, 188, 199, 0.45),
    -5px -5px 12px rgba(255, 255, 255, 0.9);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 12px 12px 24px rgba(180, 188, 199, 0.55),
    -6px -6px 12px rgba(255, 255, 255, 1);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}


.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}


.main-content {
    margin-top: 14px;
}

.page-content {
    max-width: 960px;
    margin: 0 auto;
}


.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-radius: 18px;
    background: #e3edf7;
    box-shadow: 9px 9px 18px #c7d0dd,
    -9px -9px 18px #ffffff;
}

.nav-left .brand {
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    color: #1f2933;
}

.nav-right a {
    color: #4b5563;
    text-decoration: none;
    margin-left: 18px;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-right a:hover {
    color: #111827;
}

/* ----- Neumorphic action cards grid ----- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.action-card {
    display: block;
    padding: 24px 24px 26px;
    border-radius: 24px;
    background: #e3edf7;
    box-shadow: 16px 16px 32px #c3cedc,
    -16px -16px 32px #ffffff;
    text-decoration: none;
    color: #111827;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 10px 10px 22px #c3cedc,
    -10px -10px 22px #ffffff;
}

.action-card h2 {
    margin: 12px 0 6px;
    font-size: 1.25rem;
    font-weight: 600;
}

.action-card p {
    margin: 0;
    font-size: 0.95rem;
    color: #6b7280;
}


.card-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    background: #e3edf7;
    box-shadow: 8px 8px 16px #c3cedc,
    -8px -8px 16px #ffffff;
    color: #2563eb;
}


.card-icon-history {
    font-size: 1.4rem;
}

/* ----- Footer ----- */

.app-footer {
    margin-top: 36px;
    text-align: center;
    font-size: 0.85rem;
    color: #9ca3af;
}


.flash-container {
    margin-bottom: 18px;
}

.flash {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}



/* ----- Hero Neumorphism Card ----- */

.hero-card {
    padding: 36px 42px;
    border-radius: 28px;
    background: #e3edf7;
    box-shadow: 18px 18px 36px #c3cedc,
    -18px -18px 36px #ffffff;
    margin-bottom: 38px;
}

.hero-card h1 {
    font-size: 2.3rem;
    font-weight: 800;
    color: #111827;
    margin: 0 0 14px 0;
}

.hero-card p {
    font-size: 1.05rem;
    line-height: 1.55rem;
    color: #6b7280;
    max-width: 760px;
}

@media (max-width: 700px) {

    /* NAVBAR: brand centered, links stacked & centered */
    .navbar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 16px;
        gap: 4px;
    }

    .nav-left {
        width: 100%;
        display: flex;
        justify-content: left;
        margin-bottom: 4px;
    }

    .nav-right {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .nav-right a {
        margin: 0;
        font-size: 0.9rem;
    }
}


/* Start New Tournament page */

.tournament-page {
    margin-top: 28px;
}

.form-card {
    background: #e3edf7;
    border-radius: 28px;
    box-shadow: 18px 18px 36px #c3cedc,
    -18px -18px 36px #ffffff;
    padding: 32px 32px 36px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #111827;
}
.page-subtitle {
    margin: 0;
    font-size: 0.98rem;
    color: var(--text-muted);
}

.tournament-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.tournament-form input[type="text"],
.tournament-form input[type="email"],
.tournament-form select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 999px;
    border: none;
    outline: none;
    background: #e3edf7;
    box-shadow: inset 4px 4px 8px #c3cedc,
    inset -4px -4px 8px #ffffff;
    font-size: 0.95rem;
    color: #111827;
}

/* Players area */

.players-section {
    margin-top: 8px;
    text-align: left;
}

.players-title {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
}

.players-helper {
    margin: 0 0 14px;
    font-size: 0.9rem;
    color: #6b7280;
}

.players-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

.player-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 4px;
}

.form-actions .btn-primary {
    font-size: 0.95rem;
}

/* Mobile tweaks */

@media (max-width: 700px) {
    .form-card {
        padding: 22px 18px 26px;
    }

    .form-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .player-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .page-title {
        font-size: 1.35rem;
    }

    .page-subtitle {
        font-size: 0.9rem;
    }

    .form-actions {
        justify-content: center;
    }
}

/* --- Start Tournament page layout --- */

.page-header {
    max-width: 900px;
    margin: 0 auto 12px;
    text-align: left;
}


/* reuse .card for the boxes */
.form-card {
    max-width: 1100px;
    margin: 0 auto 20px;
    text-align: left;
}

.section-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 600;
}

.section-help {
    margin: 0 0 18px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Tournament name + num players row */
.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    align-items: flex-end;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

/* Unified input / select styling */
.field-input {
    padding: 10px 14px;
    border-radius: 999px;
    border: none;
    outline: none;
    font-size: 0.95rem;
    background: var(--card-bg);
    box-shadow: inset 4px 4px 8px rgba(15, 23, 42, 0.08),
    inset -4px -4px 8px rgba(255, 255, 255, 0.9);
}

.field-input:focus {
    box-shadow: inset 2px 2px 6px rgba(37, 99, 235, 0.35),
    inset -3px -3px 7px rgba(255, 255, 255, 0.95);
}

/* Make the select look like the text field */
.select-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Players section */
.players-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.player-row {
    display: grid;
    grid-template-columns: 1.4fr 1.2fr;
    gap: 16px;
}

/* Button alignment inside Players card */
.form-actions {
    margin-top: 22px;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .player-row {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 20px 18px;
    }

    .page-header {
        padding: 0 4px;
    }
}

.select-input option[disabled] {
    color: var(--text-muted);
}

.select-input {
    color: var(--text-main);
}

.select-input:invalid {
    color: var(--text-muted);
}

/* ---------- Fixtures page ---------- */

.fixtures-page {
  margin-top: 24px;
}


.fixtures-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  margin-bottom: 24px;
}

.fixtures-summary-text {
  font-size: 0.95rem;
  color: #4b5563;
}

.fixtures-summary-separator {
  color: #9ca3af;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Status colors */
.status-inprogress {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-created {
  background: #fef3c7;
  color: #92400e;
}

.status-finalized {
  background: #dcfce7;
  color: #166534;
}

.fixtures-card {
  margin-top: 12px;
  padding: 20px 24px;
  overflow-x: auto;
}

/* Table styling */

.fixtures-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.fixtures-table thead {
  background: #e5ecf5;
}

.fixtures-table th,
.fixtures-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #d1d9e6;
}

.fixtures-table th {
  text-align: left;
  font-weight: 600;
  color: #4b5563;
}

.fixtures-table .col-seq {
  width: 40px;
  text-align: center;
}

.fixtures-table .col-team {
  min-width: 160px;
}

.fixtures-table .col-score {
  width: 120px;
}

/* Neumorphic selects for scores */
.score-select {
  width: 80px;
  padding: 4px 8px;
  border-radius: 999px;
  border: none;
  background: #e3edf7;
  box-shadow:
    inset 4px 4px 8px #c3cedc,
    inset -4px -4px 8px #ffffff;
  font-size: 0.9rem;
}

/* Finalize button area */
.fixtures-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.fixtures-header-actions{
    margin-top: 18px;
}

.fixtures-empty {
  margin-top: 12px;
  color: #6b7280;
}

.fixtures-finalized-note {
  margin-top: 16px;
  color: #4b5563;
}

/* Mobile tweaks */
@media (max-width: 700px) {
  .fixtures-card {
    padding: 16px 12px;
  }

  .fixtures-table th,
  .fixtures-table td {
    padding: 8px 6px;
    font-size: 0.85rem;
  }

  .score-select {
    width: 68px;
  }
}

.fixtures-table th:nth-child(2),
.fixtures-table th:nth-child(4) {
  text-align: center;
}

.fixtures-actions .btn-primary {
  padding: 12px 32px;
  font-size: 0.95rem;
}

.fixtures-header .page-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 6px;
}

.fixtures-header .btn-primary {
  font-size: 16px;      /* default is ~14px */
  padding: 12px 45px;   /* keeps proportions right */
  font-weight: 800;
}

.finalized-banner {
  margin-top: 16px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.finalized-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.finalized-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e3edf7;
  box-shadow: 6px 6px 12px rgba(148, 163, 184, 0.45),
              -5px -5px 10px #ffffff;
  font-size: 1.1rem;
}

.finalized-title {
  font-weight: 700;
  font-size: 1rem;
  color: #111827;
  line-height: 1.2;
}

.finalized-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.finalized-pill {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.85rem;
  background: #dcfce7;
  color: #166534;
}

/* Mobile: stack nicely */
@media (max-width: 700px) {
  .finalized-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .finalized-pill {
    align-self: flex-start;
  }
}

.previous-page .page-title {
    text-align: left;
}

.fixtures-summary-inline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.previous-card {
  margin-top: 18px;
  padding: 24px 28px;
}

.previous-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.previous-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.previous-item:last-child {
  border-bottom: none;
}

.previous-main {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.previous-name {
  font-weight: 600;
  text-decoration: none;
  color: #2563eb;
}

.previous-name:hover {
  text-decoration: underline;
}

.previous-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* small tweak for mobile */
@media (max-width: 700px) {
  .previous-card {
    padding: 18px 16px;
  }

  .previous-item {
    align-items: flex-start;
  }

  .previous-main {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.previous-page {
  margin-top: 10px;
}

.previous-table-card {
  margin-top: 18px;
  padding: 0;
}

.previous-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

.previous-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.previous-table thead tr {
  background: rgba(148, 163, 184, 0.12);
}

.previous-table th,
.previous-table td {
  padding: 14px 20px;
  text-align: left;
}

.previous-table th {
  font-weight: 600;
  color: #111827;
}

.previous-table tbody tr {
  background: var(--card-bg);
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  transition: background 0.15s ease, transform 0.15s ease,
              box-shadow 0.15s ease;
}

.previous-table tbody tr:last-child {
  border-bottom: none;
}

.previous-table tbody tr:hover {
  background: #e3edf7;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.previous-icon {
  margin-right: 10px;
  font-size: 1.1rem;
}


.previous-name-link:hover {
  color: #2563eb;
}

.cell-status {
  text-align: left;
}

/* columns sizing hints */
.col-name { width: 40%; }
.col-created { width: 30%; }
.col-players { width: 10%; }
.col-status { width: 20%; }

/* mobile adjustments */
@media (max-width: 700px) {
  .previous-table {
    font-size: 0.85rem;
  }

  .previous-table th,
  .previous-table td {
    padding: 10px 12px;
  }

  .previous-icon {
    margin-right: 6px;
  }
}

.previous-subtitle {
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: left;
}

.col-created,
.cell-created,
.col-players,
.cell-players,
.col-status,
.cell-status,
.col-actions,
.cell-actions {
  text-align: center;
}

.cell-name {
  display: block;
}

.previous-name-link {
  text-decoration: none;
  color: #111827;
  font-weight: 600;
}

.btn-secondary {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  background: #e5ecf5;
  color: #2563eb;
  font-weight: 500;
  font-size: 0.85rem;
  text-decoration: none;
  box-shadow:
    4px 4px 8px rgba(148, 163, 184, 0.5),
    -3px -3px 7px #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow:
    6px 6px 12px rgba(148, 163, 184, 0.55),
    -4px -4px 10px #ffffff;
}

.btn-small {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.fixtures-actions-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
}

.fixtures-actions-vertical .btn-primary {
  font-size: 18px;      /* default is ~14px */
  padding: 12px 120px;   /* keeps proportions right */
  font-weight: 800;
}

/* Ensure Add Game text stays black */
.fixtures-actions-vertical .btn-secondary {
    color: #000;
}


/* Desktop by default */
.fixtures-mobile { display: none; }

/* Mobile cards */
@media (max-width: 900px) {
  .fixtures-desktop { display: none; }
  .fixtures-mobile { display: block; }

  .game-card {
    margin-top: 14px;
    padding: 18px 16px;
  }

  .game-card-header {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: #e3edf7;
    box-shadow: 6px 6px 12px rgba(148, 163, 184, 0.45),
                -5px -5px 10px #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 14px;
  }

  .game-team-block {
    text-align: center;
    margin: 6px 0 10px;
  }

  .game-team-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 10px;
  }

  /* Default: still looks like normal text */
.team-pair {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0;
}

.team-amp {
  padding: 0 6px;
  flex: 0 0 auto;
}

/* Mobile: force the ampersand to be between the names on its own line */
@media (max-width: 520px) {
  .team-pair {
    flex-direction: column;
    gap: 4px;
  }

  .team-amp {
    padding: 0;
    line-height: 1;
    font-size: x-small;
  }
}

  .game-vs {
    text-align: center;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0.12em;
    margin: 10px 0;
  }

  .game-score-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
  }

  .game-score-label {
    font-size: 0.8rem;
    color: #6b7280;
  }

  .score-select-mobile {
    width: 92px;          /* a bit larger for touch */
    padding: 8px 12px;
    font-size: 1rem;
  }
}

/* ---------- Standings (Tournament Stats) ---------- */

.standings-card {
  margin-top: 14px;
  margin-bottom: 12px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding: 20px 24px;

}

.standings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.standings-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
  text-align: left;
}

.standings-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e3edf7;
  box-shadow: 6px 6px 12px rgba(148, 163, 184, 0.45),
              -5px -5px 10px #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  color: #374151;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.standings-table thead {
  background: #e5ecf5;
}

.standings-table th,
.standings-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #d1d9e6;
}

.standings-table th {
  text-align: left;
  font-weight: 700;
  color: #4b5563;
}

.col-rank { width: 60px; text-align: center; }
.cell-rank { text-align: center; font-weight: 800; }

.cell-player .player-name {
  font-weight: 800;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.player-sub {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #6b7280;
}

.cell-num {
  text-align: center;
  font-weight: 600;
  color: #111827;
}

.cell-num.strong {
  font-weight: 800;
}

.winner-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 800;
}

.row-winner {
  background: rgba(220, 252, 231, 0.35);
}

.pd-pos { color: #166534; font-weight: 800; }
.pd-neg { color: #991b1b; font-weight: 800; }

/* Desktop default */
.standings-mobile { display: none; }

/* Mobile standings cards */
@media (max-width: 700px) {
  .standings-desktop { display: none; }
  .standings-mobile { display: block; }

  .standings-card {
    padding: 18px 16px;
  }

  .standings-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .standings-player-card {
    background: #e3edf7;
    border-radius: 18px;
    padding: 14px 14px 12px;
    box-shadow: inset 4px 4px 8px #c3cedc,
                inset -4px -4px 8px #ffffff;
  }

  .standings-player-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
  }

  .standings-rank {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    background: #f5f8ff;
    box-shadow: 6px 6px 12px rgba(148, 163, 184, 0.45),
                -5px -5px 10px #ffffff;
  }

  .standings-player-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  .standings-player-sub {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 10px;
  }

  .standings-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .metric {
    text-align: center;
    padding: 10px 8px;
    border-radius: 14px;
    background: #f5f8ff;
    box-shadow: 6px 6px 12px rgba(148, 163, 184, 0.35),
                -5px -5px 10px #ffffff;
  }

  .metric-label {
    font-size: 0.5rem;
    color: #6b7280;
    font-weight: 700;
    margin-bottom: 4px;
    text-align: center;
  }

  .metric-value {
    font-size: 1rem;
    font-weight: 900;
    color: #111827;
  }

  .card-winner {
    outline: 2px solid rgba(22, 101, 52, 0.22);
  }
}

/* ---------- Finals card ---------- */

.finals-card {
  margin-top: 16px;
  margin-bottom: 12px;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.finals-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.finals-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.finals-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: #dbeafe;
  color: #1d4ed8;
}

.finals-pill-muted {
  background: #e5e7eb;
  color: #6b7280;
}

.finals-match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}

.finals-team {
  text-align: center;
}

.finals-team-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.finals-vs {
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #6b7280;
}

.finals-score {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.finals-score-label {
  color: #6b7280;
  font-size: 0.8rem;
}

.finals-empty {
  margin: 0;
  color: #6b7280;
  text-align: center;
}

.finals-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}



/* Make all cards use full container width */
.card {
  max-width: 100%;
}

@media (max-width: 1200px) {
  .app-shell {
    padding: 16px 12px 18px;
  }

  .app-main {
    padding: 0 8px;
  }
}

/* Let the "actions" section stretch full width (so Finals can fill it) */
.fixtures-actions-vertical {
  align-items: stretch;
}

/* Keep the button rows centered */
.fixtures-actions-vertical > div {
  display: flex;
  justify-content: center;
}

/* Finals container + card fill the available width */
#finals_container {
  width: 100%;
}

#finals_container .finals-card {
  width: 100%;
}

/* 1) Let children stretch full width */
.fixtures-actions-vertical {
  align-items: stretch;
}

/* 2) Every direct row takes full width */
.fixtures-actions-vertical > div {
  width: 100%;
}

/* 3) Center ONLY the button rows (NOT the finals container) */
.fixtures-actions-vertical > div:not(#finals_container) {
  display: flex;
  justify-content: center;
}

/* 4) Finals container + card must be normal block + full width */
#finals_container {
  display: block !important;
  width: 100% !important;
}

#finals_container .finals-card {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ---------- Tournament list cards (Previous/Current) ---------- */

.tournament-cards{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.tournament-card{
  padding: 18px 18px 16px;
}

.tcard-top{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tcard-name{
  font-weight: 800;
  font-size: 1.05rem;
  text-align: left;
}

.tcard-meta{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--text-muted);
  text-align: left;
  margin-bottom: 14px;
}

.meta-label{
  display: inline-block;
  font-weight: 700;
  color: #111827;
  margin-right: 6px;
}

.tcard-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}


/* Mobile: stack meta rows */
@media (max-width: 520px){
  .tcard-meta{
    grid-template-columns: 1fr;
  }
}

/* --- HERO: prevent title overflow on mobile --- */
.hero-title {
  max-width: 100%;
  overflow-wrap: anywhere;   /* key: allows breaking long words */
  word-break: break-word;
  line-height: 1.05;
}

/* If you prefer targeting only inside the hero-card */
.hero-card h1 {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.05;
}

/* Mobile scaling */
@media (max-width: 520px) {
  .hero-card {
    padding: 28px 18px;
  }

  .hero-card h1,
  .hero-title {
    font-size: 1.75rem;      /* was 2.3rem */
  }

  .hero-card p {
    font-size: 0.98rem;
  }
}

/* ---------- Home: single dashboard card ---------- */

.home-stats-card{
  margin: 18px 0 26px;
  padding: 18px 18px 14px;
  text-align: left;
}

.home-stats-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.home-stats-title{
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
}

.home-stats-rows{
  display: flex;
  flex-direction: column;
}

.home-stat-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.home-stat-row:last-child{
  border-bottom: none;
}

.home-stat-left{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.home-stat-label{
  font-size: 0.92rem;
  font-weight: 700;
  color: #374151;
}

.home-stat-value{
  font-size: 1.35rem;
  font-weight: 900;
  color: #111827;
}

/* ---------- Navbar icon buttons ---------- */

.nav-icons {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 1.4rem;
    font-weight: 900;
    text-decoration: none;

    background: #e3edf7;
    color: #2563eb;

    box-shadow:
        6px 6px 12px rgba(148, 163, 184, 0.45),
        -5px -5px 10px #ffffff;

    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nav-icon:hover {
    transform: translateY(-1px);
    box-shadow:
        8px 8px 16px rgba(148, 163, 184, 0.55),
        -6px -6px 12px #ffffff;
}

/* Brand always left */
.nav-left {
    display: flex;
    align-items: center;
}

/* Keep layout correct on mobile */
@media (max-width: 700px) {
    .navbar {
        flex-direction: row;
        justify-content: space-between;
    }

    .nav-right {
        gap: 10px;
    }
}

/* --- Force navbar icons to stay horizontal --- */

.nav-right.nav-icons {
    flex-direction: row !important;
    width: auto !important;
    gap: 12px;
}


/* ---------- Footer nav ---------- */


.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.footer-links a {
  text-decoration: none;
  color: #4b5563;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e3edf7;
  box-shadow: 6px 6px 12px rgba(148, 163, 184, 0.35),
              -5px -5px 10px #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.footer-links a:hover {
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 8px 8px 16px rgba(148, 163, 184, 0.45),
              -6px -6px 12px #ffffff;
}

.footer-copy {
  color: #9ca3af;
  font-size: 0.85rem;
  font-weight: 600;
}

.footer-links a {
  background: none;
  box-shadow: none;
  padding: 0;
  font-weight: 600;
  color: #6b7280;
}

.footer-links a:hover {
  color: #111827;
  transform: none;
  box-shadow: none;
  text-decoration: underline;
}

/* Mobile: center footer content */
@media (max-width: 700px) {
  .footer-inner {
    justify-content: center;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

/* ---------- Leaderboard (Podium) ---------- */

.podium-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.podium-card{
  padding: 18px 18px 16px;
}

.podium-top{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  text-align: left;
}

.podium-rank{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: #e3edf7;
  box-shadow: 6px 6px 12px rgba(148, 163, 184, 0.35),
              -5px -5px 10px #ffffff;
  width: fit-content;
}

.podium-name{
  font-weight: 900;
  font-size: 1.15rem;
  color: #111827;
}

.podium-metrics{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.podium-metric{
  background: #f5f8ff;
  border-radius: 16px;
  padding: 10px 10px 8px;
  box-shadow: inset 4px 4px 8px #c3cedc,
              inset -4px -4px 8px #ffffff;
  text-align: left;
}

.pm-label{
  font-size: 0.75rem;
  font-weight: 800;
  color: #6b7280;
  margin-bottom: 6px;
}

.pm-value{
  font-size: 1.05rem;
  font-weight: 900;
  color: #111827;
}

/* Make 1st place visually a bit more prominent */
.podium-1{
  transform: translateY(-4px);
}

@media (max-width: 900px){
  .podium-grid{
    grid-template-columns: 1fr;
  }
  .podium-1{
    transform: none;
  }
}

/* ---------- Leaderboard cards (no table) ---------- */

.leaderboard-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.leaderboard-card{
  padding: 18px 18px 16px;
}


/* Podium card backgrounds */
.leaderboard-card.rank-1 {
  background: linear-gradient(135deg, #fff7cc, var(--gold-bg));
}

.leaderboard-card.rank-2 {
  background: linear-gradient(135deg, #f9fafb, var(--silver-bg));
}

.leaderboard-card.rank-3 {
  background: linear-gradient(135deg, #fff1e6, var(--bronze-bg));
}

/* Rank pill coloring */
.leaderboard-card.rank-1 .lb-rank {
  background: var(--gold-bg);
}

.leaderboard-card.rank-2 .lb-rank {
  background: var(--silver-bg);
}

.leaderboard-card.rank-3 .lb-rank {
  background: var(--bronze-bg);
}

/* Titles badge */
.winner-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  color: #166534;
  background: #dcfce7;
}


.lb-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.lb-rank{
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: #e3edf7;
  box-shadow: 6px 6px 12px rgba(148, 163, 184, 0.35),
              -5px -5px 10px #ffffff;
  font-weight: 900;
  font-size: 0.95rem;
}

.lb-name{
  font-weight: 900;
  font-size: 1.1rem;
  color: #111827;
  flex: 1;
  text-align: left;
  min-width: 140px;
}

.lb-metrics{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lb-metric{
  background: #f5f8ff;
  border-radius: 16px;
  padding: 10px 10px 8px;
  box-shadow: inset 4px 4px 8px #c3cedc,
              inset -4px -4px 8px #ffffff;
  text-align: left;
}

.lb-label{
  font-size: 0.72rem;
  font-weight: 800;
  color: #6b7280;
  margin-bottom: 6px;
}

.lb-value{
  font-size: 1.05rem;
  font-weight: 900;
  color: #111827;
}


@media (max-width: 700px){
  .lb-metrics{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Show a dropdown caret so selects don't look like buttons */
.select-caret{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  padding-right: 42px; /* space for caret */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%236b7280' d='M5.5 7.5l4.5 4.5 4.5-4.5 1.2 1.2-5.7 5.7-5.7-5.7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
}

/* Placeholder text color for Sort / Per Page (the disabled option) */
.select-input option[disabled] {
  color: #9ca3af;   /* same vibe as placeholders */
}

/* When the placeholder is currently selected, make the select text muted */
.select-input:has(option[disabled]:checked) {
  color: #9ca3af;
}

/* ---------- Tournaments controls layout (Search + Sort + Per Page) ---------- */

.tournaments-controls{
  display: flex;
  justify-content: center;
  align-items: center;

  /* key: makes search go on its own row, selects below */
  flex-wrap: wrap;

  /* key: adds spacing between search row and dropdown row */
  gap: 12px;
}

/* Make search bar same width as Sort + Per Page (combined) */
.tournaments-controls input[name="q"]{
  /* force it to occupy its own row */
  flex: 0 0 78%;

  /* match your inline max-widths:
     sort max-width 200px + per_page max-width 140px + typical gap ~ 12px */
  max-width: calc(200px + 140px + 12px);
}

.tcard-actions-split{
  display: flex;
  justify-content: space-between; /* left + right */
  align-items: center;
  gap: 10px;
}

.tcard-actions-split > *{
  flex: 0 0 auto;
}

.leaderboard-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin: 12px 0 18px;
}

/* Make both selects share the row nicely */
.leaderboard-controls select {
    flex: 1;
    max-width: 180px;
}