:root {
    --navy: #1D2A4F;
    --navy-light: #162344;
    --red: #D9323F;
    --red-dark: #B8232F;
    --gold: #B38F5B;
    --cream: #F5F1E9;
    --cream-dark: #EBE5D8;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Montserrat', -apple-system, sans-serif;
    background: var(--cream);
    color: var(--navy);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── HEADER ─────────────────────────────────────── */
.app-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    padding: 12px 20px; flex-shrink: 0; position: relative; z-index: 10000;
}
.header-content {
    max-width: 1600px; margin: 0 auto;
    display: flex; align-items: center; gap: 16px;
}
.fo-hamburger {
    background: none; border: none; cursor: pointer;
    padding: 8px 6px; display: flex; flex-direction: column;
    justify-content: center; gap: 5px; flex-shrink: 0;
    border-radius: 8px; transition: background 0.2s;
    margin-left: -4px; margin-right: 4px;
}
.fo-hamburger:hover { background: rgba(255,255,255,0.12); }
.fo-hamburger span { display: block; width: 26px; height: 2.5px; background: white; border-radius: 2px; pointer-events: none; }
.logo { display: flex; align-items: center; gap: 10px; color: white; text-decoration: none; cursor: pointer; }
.stadr-main-logo { height: 38px; width: auto; flex-shrink: 0; transition: transform 0.2s; }
.logo:hover .stadr-main-logo { transform: scale(1.04); }
.lang-selector { display: flex; align-items: center; margin-left: auto; }
.lang-globe-wrap { position: relative; display: flex; align-items: center; }
.lang-globe-btn {
    display: flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,0.08); border: none; border-radius: 20px;
    color: rgba(255,255,255,0.75); padding: 6px 10px; cursor: pointer;
    font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 600;
    transition: background 0.15s; letter-spacing: 0.3px;
}
.lang-globe-btn:hover { background: rgba(255,255,255,0.16); color: white; }
.lang-globe-icon { width: 15px; height: 15px; flex-shrink: 0; }
.lang-globe-current { line-height: 1; }
.lang-globe-caret { width: 8px; height: 5px; flex-shrink: 0; opacity: 0.7; transition: transform 0.2s; }
.lang-globe-wrap.open .lang-globe-caret { transform: rotate(180deg); }
.lang-globe-menu {
    display: none; position: absolute;
    top: calc(100% + 8px); right: 0;
    background: white; border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    min-width: 140px; overflow: hidden; z-index: 20000;
}
.lang-globe-wrap.open .lang-globe-menu { display: block; }
.lang-globe-menu .lang-btn {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 10px 14px;
    background: none; border: none;
    font-family: 'Montserrat', sans-serif; font-size: 13px; color: #374151;
    cursor: pointer; text-align: left; transition: background 0.12s;
}
.lang-globe-menu .lang-btn:hover { background: #f3f4f6; }
.lang-globe-menu .lang-btn.active { color: var(--navy); font-weight: 700; background: #f0f4ff; }
.auth-section { flex-shrink: 0; margin-left: 12px; }
.login-btn {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px; color: white; padding: 7px 16px; cursor: pointer;
    font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 600;
    transition: background 0.15s;
}
.login-btn:hover { background: rgba(255,255,255,0.18); }

/* ── FO-MENU ─────────────────────────────────────── */
.fo-menu {
    position: fixed; top: 0; left: -280px; width: 260px; height: 100vh;
    background: var(--navy); z-index: 1000001;
    transition: left 0.25s ease; box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
}
.fo-menu.open { left: 0; }
.fo-menu-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    z-index: 1000000; display: none;
}
.fo-menu-overlay.open { display: block; }
.fo-menu-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: space-between;
}
.fo-menu-brand { height: 34px; width: auto; display: block; }
.fo-menu-close {
    background: none; border: none; color: rgba(255,255,255,0.6);
    font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1;
}
.fo-menu-close:hover { color: white; }
.fo-menu-items { padding: 12px 0; flex: 1; }
.fo-menu-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 24px; color: rgba(255,255,255,0.8);
    cursor: pointer; transition: all 0.15s;
    background: none; border: none; width: 100%;
    font-family: 'Montserrat', sans-serif; font-size: 14px;
    text-decoration: none; text-align: left;
}
.fo-menu-item:hover { background: rgba(255,255,255,0.08); color: white; }
.fo-menu-item.active { background: rgba(217,50,63,0.15); color: white; border-left: 3px solid var(--red); padding-left: 21px; }
.fo-menu-icon { font-size: 18px; width: 24px; text-align: center; }
.fo-menu-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 24px; }

/* ── PAGE WRAPPER ───────────────────────────────── */
.sd-page {
    max-width: 540px;
    margin: 0 auto;
    padding: 56px 16px 60px;
}

/* ── GAME HEADER ────────────────────────────────── */
.sd-game-header {
    text-align: center;
    margin-bottom: 20px;
}
.sd-title-tiles {
    display: flex; gap: 6px; justify-content: center;
    margin-bottom: 0;
}
.sd-mode-bar {
    margin-top: 52px !important;
}
.sd-tile {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    background: var(--navy); border-radius: 8px;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 30px; font-weight: 700; color: white;
}
.sd-tile-accent { background: var(--red); }
.sd-help-btn {
    width: 36px; height: 36px;
    background: rgba(29,42,79,0.1); border: 1.5px solid rgba(29,42,79,0.2);
    border-radius: 50%; cursor: pointer;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 18px; font-weight: 700; color: var(--navy);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; flex-shrink: 0;
    align-self: center;
}
.sd-help-btn:hover { background: rgba(29,42,79,0.18); }

/* ── HELP MODAL ─────────────────────────────────── */
.sd-help-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    z-index: 5000;
}
.sd-help-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
    z-index: 5001;
    background: white; border-radius: 16px;
    width: min(500px, calc(100vw - 32px));
    max-height: 80vh; overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.sd-help-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(29,42,79,0.08);
    position: sticky; top: 0; background: white; z-index: 1;
}
.sd-help-header span {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 20px; font-weight: 700; color: var(--navy);
}
.sd-help-close {
    background: none; border: none; cursor: pointer;
    font-size: 20px; color: rgba(29,42,79,0.4);
    padding: 4px 8px; border-radius: 6px;
    transition: color 0.15s;
}
.sd-help-close:hover { color: var(--navy); }
.sd-help-body {
    padding: 16px 20px 20px;
}
.sd-help-body p {
    font-size: 13px; color: rgba(29,42,79,0.7);
    padding: 5px 0; line-height: 1.5;
}
.sd-help-goal {
    font-size: 15px !important; color: var(--navy) !important;
    font-weight: 600; margin-bottom: 4px;
}
.sd-help-section {
    font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
    text-transform: uppercase; color: rgba(29,42,79,0.35);
    margin: 14px 0 4px;
}
.sd-subtitle {
    font-size: 12px; color: rgba(29,42,79,0.45);
    margin-top: 4px; letter-spacing: 0.5px;
}
.sd-description {
    font-size: 13px; color: rgba(29,42,79,0.55);
    margin-top: 10px; line-height: 1.5;
    max-width: 320px; margin-left: auto; margin-right: auto;
}
.sd-mode-bar {
    display: flex; gap: 8px; justify-content: center;
    margin: 28px 0 4px;
}
.sd-mode-btn {
    padding: 7px 18px; border-radius: 20px; border: 1px solid rgba(29,42,79,0.15); cursor: pointer;
    font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 600;
    transition: all 0.15s;
    background: white; color: rgba(29,42,79,0.55);
}
.sd-mode-btn.active { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.sd-mode-btn:not(.active):hover { background: var(--cream-dark); color: var(--navy); }

/* ── HINTS PANEL ────────────────────────────────── */
.sd-hints {
    background: white;
    border: 1px solid rgba(29,42,79,0.1);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(29,42,79,0.06);
}
.sd-hints-title {
    font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
    color: rgba(29,42,79,0.35); text-transform: uppercase;
    margin-bottom: 10px;
}
.sd-hint-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(29,42,79,0.06);
    animation: hintReveal 0.4s ease;
}
.sd-hint-row:last-child { border-bottom: none; }
.sd-hint-icon { font-size: 18px; flex-shrink: 0; width: 26px; text-align: center; }
.sd-hint-label {
    font-size: 10px; font-weight: 600; color: rgba(29,42,79,0.45);
    text-transform: uppercase; letter-spacing: 0.8px; min-width: 90px;
}
.sd-hint-value {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 18px; font-weight: 700; color: var(--navy);
}
.sd-hint-locked {
    width: 80px; height: 12px;
    background: rgba(29,42,79,0.07); border-radius: 6px;
    margin-left: auto;
}

/* ── GRID GUESSES ───────────────────────────────── */
.sd-grid-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}
/* ── GRID HEADER ────────────────────────────────── */
.sd-grid-hdr {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    margin-bottom: 4px;
    padding: 0 1px;
}
.sd-hdr-cell {
    font-size: 9px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: rgba(29,42,79,0.4);
    text-align: center; padding: 4px 2px;
}

/* ── GUESS ROW ──────────────────────────────────── */
.sd-guess-row {
    display: flex; flex-direction: column;
    background: white;
    border: 1px solid rgba(29,42,79,0.09);
    border-radius: 10px; overflow: hidden;
    margin-bottom: 6px;
    box-shadow: 0 1px 4px rgba(29,42,79,0.05);
    animation: guessSlide 0.3s ease;
}
.sd-grid-name-top {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px 7px;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 14px; font-weight: 700; color: var(--navy);
    border-bottom: 1px solid rgba(29,42,79,0.07);
}
.sd-grid-cells {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px; padding: 4px;
}
.sd-grid-cell {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: 6px; padding: 6px 3px;
    font-size: 11px; font-weight: 700;
    text-align: center; line-height: 1.2;
    min-height: 44px;
}
.sd-grid-cell.green {
    background: rgba(74,222,128,0.18);
    border: 1px solid rgba(74,222,128,0.45);
    color: #166534;
}
.sd-grid-cell.yellow {
    background: rgba(251,191,36,0.18);
    border: 1px solid rgba(251,191,36,0.5);
    color: #92400e;
}
.sd-grid-cell.gray {
    background: rgba(29,42,79,0.05);
    border: 1px solid rgba(29,42,79,0.1);
    color: rgba(29,42,79,0.55);
}
.sd-cell-arrow {
    font-size: 13px; line-height: 1; margin-top: 2px;
    opacity: 0.8;
}
.sd-cell-small { font-size: 10px; }

/* ── LEGEND ─────────────────────────────────────── */
.sd-legend {
    margin-top: 24px;
    border: 1px solid rgba(29,42,79,0.1);
    border-radius: 12px;
    overflow: hidden;
    background: white;
}
.sd-legend-toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: none; border: none; cursor: pointer;
    font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 600;
    color: rgba(29,42,79,0.6); text-align: left;
}
.sd-legend-toggle:hover { background: rgba(29,42,79,0.03); color: var(--navy); }
.sd-legend-arrow { font-size: 10px; margin-left: 6px; }
.sd-legend-body {
    padding: 4px 16px 14px;
    border-top: 1px solid rgba(29,42,79,0.07);
}
.sd-legend-body p {
    font-size: 11px; color: rgba(29,42,79,0.6);
    padding: 4px 0; line-height: 1.4;
    border-bottom: 1px solid rgba(29,42,79,0.04);
}
.sd-legend-body p:last-child { border-bottom: none; }
.sd-legend-link {
    color: var(--red); text-decoration: none; font-weight: 600;
}
.sd-legend-link:hover { text-decoration: underline; }

/* ── INPUT ──────────────────────────────────────── */
.sd-input-wrap { position: relative; margin-bottom: 10px; }
.sd-input {
    width: 100%; padding: 14px 52px 14px 16px;
    background: white;
    border: 1.5px solid rgba(29,42,79,0.2);
    border-radius: 12px; color: var(--navy);
    font-family: 'Montserrat', sans-serif; font-size: 14px;
    outline: none; transition: border-color 0.15s;
    box-shadow: 0 1px 4px rgba(29,42,79,0.06);
}
.sd-input::placeholder { color: rgba(29,42,79,0.35); }
.sd-input:focus { border-color: var(--gold); }
.sd-input-clear {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: rgba(29,42,79,0.35);
    font-size: 18px; cursor: pointer; line-height: 1; padding: 4px;
}
.sd-input-clear:hover { color: var(--navy); }

.sd-autocomplete {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    background: white;
    border: 1px solid rgba(29,42,79,0.12);
    border-radius: 10px; margin-top: 4px;
    overflow: hidden; box-shadow: 0 8px 24px rgba(29,42,79,0.12);
}
.sd-ac-item {
    padding: 12px 16px; cursor: pointer;
    font-size: 14px; color: var(--navy);
    border-bottom: 1px solid rgba(29,42,79,0.06);
    display: flex; align-items: center; gap: 10px;
    transition: background 0.1s;
}
.sd-ac-item:last-child { border-bottom: none; }
.sd-ac-item:hover, .sd-ac-item.selected { background: var(--cream); }
.sd-ac-team {
    font-size: 11px; color: rgba(29,42,79,0.4);
    margin-left: auto; white-space: nowrap;
}
.sd-ac-logo {
    width: 22px; height: 22px; object-fit: contain; flex-shrink: 0;
}

.sd-guess-btn {
    padding: 14px 18px;
    background: var(--red);
    border: none; border-radius: 12px;
    color: white; font-family: 'Montserrat', sans-serif;
    font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
    cursor: pointer; transition: background 0.15s;
    white-space: nowrap; flex-shrink: 0;
}
.sd-guess-btn:hover:not(:disabled) { background: var(--red-dark); }
.sd-guess-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.sd-unit-btn {
    cursor: pointer;
    border-bottom: 1px dotted rgba(29,42,79,0.4);
    transition: border-color 0.15s;
}
.sd-unit-btn:hover { border-bottom-color: var(--navy); }

/* ── COUNTER ────────────────────────────────────── */
.sd-counter {
    text-align: center; margin-top: 12px; margin-bottom: 20px;
    font-size: 12px; color: rgba(29,42,79,0.45);
    font-weight: 600; letter-spacing: 0.5px;
}
.sd-streak {
    display: inline-flex; align-items: center; gap: 4px;
    margin-left: 10px; color: var(--gold);
}

/* ── RESULT CARD ────────────────────────────────── */
.sd-result {
    background: white;
    border: 1px solid rgba(29,42,79,0.1);
    border-radius: 16px; padding: 24px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(29,42,79,0.07);
    animation: resultPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.sd-result.won { border-color: rgba(74,222,128,0.45); background: rgba(74,222,128,0.06); }
.sd-result.lost { border-color: rgba(217,50,63,0.25); }
.sd-result-emoji { font-size: 48px; margin-bottom: 8px; }
.sd-result-title {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 26px; font-weight: 700; margin-bottom: 4px; color: var(--navy);
}
.sd-result-subtitle { font-size: 13px; color: rgba(29,42,79,0.55); margin-bottom: 16px; }
.sd-result-photo {
    width: 100%; max-height: 200px; object-fit: cover;
    border-radius: 10px; margin-bottom: 16px;
    background: rgba(29,42,79,0.05);
    min-height: 120px;
}
.sd-result-photo-placeholder {
    width: 100%; height: 140px;
    background: rgba(29,42,79,0.05);
    border-radius: 10px; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; color: rgba(29,42,79,0.2);
}
.sd-result-actions {
    display: flex; flex-direction: column; gap: 10px;
}
.sd-result-actions a, .sd-result-actions button {
    display: block; padding: 12px;
    border-radius: 10px; font-family: 'Montserrat', sans-serif;
    font-size: 13px; font-weight: 700; cursor: pointer;
    text-decoration: none; text-align: center;
    transition: opacity 0.15s;
}
.sd-result-actions a:hover, .sd-result-actions button:hover { opacity: 0.85; }
.btn-share {
    background: var(--gold); color: var(--navy);
    border: none;
}
.btn-stadium {
    background: rgba(29,42,79,0.08); color: var(--navy);
    border: 1px solid rgba(29,42,79,0.15);
}
.btn-newgame {
    background: var(--red); color: white;
    border: none;
}

/* ── SHARE TOAST ────────────────────────────────── */
.sd-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: rgba(30,40,70,0.98); color: white;
    padding: 12px 24px; border-radius: 12px;
    font-size: 13px; font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    z-index: 9999; pointer-events: none;
    opacity: 0; transition: opacity 0.2s;
    border: 1px solid rgba(179,143,91,0.4);
    white-space: nowrap;
}
.sd-toast.show { opacity: 1; }

/* ── PHOTO HINT (indice 5) ──────────────────────── */
.sd-hint-photo {
    width: 100%; border-radius: 8px; margin-top: 6px;
    max-height: 110px; object-fit: cover;
    filter: blur(6px) brightness(0.7);
}
.sd-hint-photo.revealed { filter: none; }

/* ── ANIMATIONS ─────────────────────────────────── */
@keyframes hintReveal {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes guessSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes resultPop {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── UNIT TOGGLE ────────────────────────────────── */
.sd-unit-toggle {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: rgba(29,42,79,0.4);
    cursor: pointer; user-select: none;
}
.sd-unit-toggle span { font-weight: 600; }
.sd-unit-toggle .active-unit { color: var(--gold); }

/* ── BACK LINK ──────────────────────────────────── */
.sd-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: rgba(29,42,79,0.45); font-size: 13px;
    text-decoration: none; margin-bottom: 18px;
    transition: color 0.15s;
}
.sd-back:hover { color: var(--navy); }

/* ── ALREADY PLAYED ─────────────────────────────── */
.sd-already {
    text-align: center; padding: 20px 0;
    font-size: 14px; color: rgba(29,42,79,0.5);
}
.sd-next-reset {
    font-size: 12px; color: rgba(29,42,79,0.35);
    margin-top: 6px;
}

@media (min-width: 600px) {
    .sd-result-actions { flex-direction: row; }
    .sd-result-actions a, .sd-result-actions button { flex: 1; }
}
