/* Guessable — App styles
   Shared design tokens come from ../shared/style.css (loaded first).
   Local aliases map the Statabble variable names to the shared palette.
*/
:root {
    --card:       var(--surface);
    --neon:       var(--accent);
    --neon-dim:   var(--accent-dim);
    --neon-glow:  rgba(46, 163, 242, 0.3);
    --text-muted: var(--muted);
}

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
    padding-bottom: 90px;
}

/* ─── Header ─── */
header {
    width: 100%;
    max-width: 480px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.header-left  { display: flex; align-items: center; }
.header-right { display: flex; align-items: center; justify-content: flex-end; }

.logo {
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.back-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    letter-spacing: 0.3px;
    transition: color 0.15s;
    font-family: 'Inter', sans-serif;
}

.back-btn:hover { color: var(--text); }

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s;
    font-family: 'Inter', sans-serif;
}

.icon-btn:hover { border-color: var(--neon); color: var(--neon); }

/* ─── Menu Screen ─── */
#menu-screen {
    width: 100%;
    max-width: 480px;
    padding: 20px 16px 16px;
}

.tagline {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

#game-list { display: flex; flex-direction: column; gap: 8px; }

.game-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    font-family: 'Inter', sans-serif;
}

.game-list-item:hover  { border-color: #3d444d; }
.game-list-item:active { background: var(--surface-bright); }

.game-item-emoji { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.game-item-name  { font-size: 1rem; font-weight: 700; color: var(--text); flex: 1; }
.game-item-arrow { font-size: 1.3rem; color: var(--text-muted); line-height: 1; }

/* ─── Coming Soon ─── */
.game-list-item.coming-soon {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.coming-soon-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
    background: var(--border);
    padding: 2px 8px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* ─── Loading Screen ─── */
#loading-screen {
    width: 100%;
    max-width: 480px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    text-align: center;
    min-height: 300px;
}

#loading-screen.hidden { display: none; }

.loading-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--neon);
    animation: pulse 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 80%, 100% { transform: scale(0.55); opacity: 0.3; }
    40%           { transform: scale(1);    opacity: 1;   }
}

.loading-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.loading-sub {
    font-size: 0.8rem;
    color: var(--muted);
}

/* ─── Game Screen ─── */
#game-screen { width: 100%; max-width: 480px; }

main { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }

/* ─── Question Cards ─── */
.q-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.q-card.locked { border-color: var(--neon); box-shadow: 0 0 14px var(--neon-dim); }

.q-label {
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--neon);
    text-transform: uppercase;
    margin-right: 7px;
    vertical-align: middle;
}

.q-text { font-size: 0.93rem; font-weight: 500; line-height: 1.5; color: var(--text); margin-bottom: 10px; }

/* ─── Guess Tiles ─── */
.guess-tiles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }

.guess-tile {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 7px;
    border: 2px solid transparent;
    font-weight: 700;
    font-size: 0.82rem;
    user-select: none;
    opacity: 0.5;
}

.guess-tile.latest { opacity: 1; }
.guess-tile.close  { background: #14532d; color: #4ade80; }
.guess-tile.near   { background: #451a03; color: #fbbf24; }
.guess-tile.far    { background: #450a0a; color: #f87171; }
.guess-tile.miss   { background: var(--surface-bright); color: var(--text-muted); }

.guess-tile.is-locked { border-color: var(--neon); box-shadow: 0 0 8px var(--neon-glow); opacity: 1; }

.tile-check { font-size: 0.72rem; color: var(--neon); font-weight: 900; }

/* ─── Lock Icon Button ─── */
.lock-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    border: 1.5px solid var(--border);
    background: transparent;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.lock-icon-btn:hover  { border-color: #3d444d; background: var(--surface-bright); }
.lock-icon-btn.locked { border-color: var(--neon); background: var(--neon-dim); }

/* ─── Number Input ─── */
.input-row { display: flex; }

input[type="number"] {
    width: 100%;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 600;
    padding: 13px 16px;
    outline: none;
    font-family: 'Inter', sans-serif;
    -moz-appearance: textfield;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: center;
    letter-spacing: 1px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

input[type="number"]:focus { border-color: var(--neon); box-shadow: 0 0 0 3px var(--neon-dim); }

input[type="number"]::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.88rem;
    letter-spacing: 0;
}

/* ─── Action Bar ─── */
.action-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 10px 16px 14px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    z-index: 10;
}

.action-bar .btn-primary { max-width: 480px; width: 100%; }

/* ─── Buttons ─── */
.btn {
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.88rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    display: block;
    text-align: center;
    font-family: 'Inter', sans-serif;
}

.btn-primary  { background: var(--neon); color: var(--bg); }
.btn-secondary { background: var(--surface-bright); color: var(--text); }

.btn-primary:disabled {
    background: var(--border);
    color: #3d444d;
    cursor: default;
    box-shadow: none;
}

/* ─── Overlay & Modal ─── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    backdrop-filter: blur(6px);
}

.modal {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    padding: 26px 22px;
    width: 100%;
    max-width: 380px;
    position: relative;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h2 {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.close-x {
    position: absolute;
    top: 14px; right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

/* ─── How to Play ─── */
.how-rules p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.65; margin-bottom: 8px; text-align: left; }

.accuracy-legend { margin: 16px 0 12px; text-align: left; }

.legend-row { display: flex; align-items: center; gap: 10px; font-size: 0.83rem; color: var(--text-muted); margin-bottom: 8px; }

.legend-tile { width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0; }
.legend-tile.close { background: #14532d; }
.legend-tile.near  { background: #451a03; }
.legend-tile.far   { background: #450a0a; }
.legend-tile.miss  { background: var(--surface-bright); border: 1px solid #30363d; }

.mult-info {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding: 11px 14px;
    background: var(--bg);
    border-radius: 8px;
    line-height: 1.6;
    text-align: left;
}

/* ─── Results Modal ─── */
.score-big {
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--neon);
    letter-spacing: -3px;
    line-height: 1.05;
    margin: 10px 0 4px;
    filter: drop-shadow(0 0 16px var(--neon-glow));
}

.rank-label { font-size: 0.8rem; font-weight: 800; letter-spacing: 2px; color: var(--neon); margin-bottom: 16px; text-transform: uppercase; }

.breakdown-table { width: 100%; border-collapse: collapse; margin: 6px 0 16px; text-align: left; font-size: 0.83rem; }

.breakdown-table td { padding: 10px 0; border-bottom: 1px solid var(--border); vertical-align: top; }

.breakdown-q   { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.breakdown-ans { font-size: 0.73rem; color: var(--text-muted); }

.breakdown-pts { text-align: right; color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; padding-left: 10px; }
.breakdown-pts strong { display: block; color: var(--neon); font-size: 0.9rem; }

.share-box {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: monospace;
    font-size: 0.78rem;
    text-align: left;
    color: var(--text-muted);
    margin-bottom: 16px;
    white-space: pre;
    overflow-x: auto;
}

.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.modal-actions .btn { width: 100%; }
