/* style.css — Wordtexto */

/* ─── Reset & Variables ─────────────────────────────────────────── */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* Default: dark mode */
:root {
    color-scheme: dark;
    --bg: #0F0D1A;
    --bg-card: #1A1833;
    --text: #E8E5F5;
    --text-muted: #9B97B0;
    --placeholder: #332F4A;
    --primary: #2DD4BF;
    --primary-hover: #22b8a5;
    --accent-purple: #7C3AED;
    --accent-purple-dark: #6D28D9;
    --border: #2D2A45;
    --input-bg: #13112A;
    --bg-inset: #1E1B35;
    --error: #F87171;
    --success: #34D399;
    --rank-found: #2DD4BF;
    --rank-hot: #34D399;
    --rank-warm: #FBBF24;
    --rank-cool: #FB923C;
    --rank-cold: #F87171;
}

/* Light mode — controlled by data-theme attribute (set server-side from cookie). */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #F8F7FC;
    --bg-card: #FFFFFF;
    --text: #1A1833;
    --text-muted: #6B6B80;
    --placeholder: #CBC9D4;
    --border: #CBC8DC;
    --input-bg: #F0EFF5;
    --bg-inset: #F0EFF5;
}

/* JS-driven dark mode (explicit reset) */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0F0D1A;
    --bg-card: #1A1833;
    --text: #E8E5F5;
    --text-muted: #9B97B0;
    --placeholder: #332F4A;
    --border: #2D2A45;
    --input-bg: #13112A;
    --bg-inset: #1E1B35;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scrollbar-gutter: stable;
    background: var(--bg);
    min-height: 100%;
    min-height: -webkit-fill-available;
}

html, body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100%;
    min-height: 100dvh;
    min-height: var(--app-height, 100dvh);
    min-height: -webkit-fill-available;
    max-width: 480px;
    margin: 0 auto;
    padding: env(safe-area-inset-top, 0px) 1rem 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    position: relative;
}

/* ─── Subtle Background Decoration ─────────────────────────────── */

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.07;
}

/* Top-right teal swoosh */
body::before {
    width: 350px;
    height: 350px;
    top: -80px;
    right: -100px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

/* Bottom-left purple swoosh */
body::after {
    width: 300px;
    height: 300px;
    bottom: 10%;
    left: -120px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
}

.hidden { display: none !important; }

/* Page fade-in: content hidden behind splash until app is ready */
body:not(.app-ready) > .app-header,
body:not(.app-ready) > .app-nav,
body:not(.app-ready) > main.view {
    opacity: 0 !important;
    transform: translateY(8px);
}

/* ─── Animations ────────────────────────────────────────────────── */

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes popIn {
    0%   { transform: scale(0.8); opacity: 0; }
    60%  { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes barFill {
    from { width: 0; }
}

/* ─── Header ────────────────────────────────────────────────────── */

.app-header {
    position: relative;
    text-align: center;
    padding: 1.25rem 0 0.25rem;
}

.app-logo {
    display: block;
    width: 180px;
    height: auto;
    margin: 0 auto;
}

.app-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, var(--accent-purple), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.1rem;
}

/* ─── Nav Tabs ──────────────────────────────────────────────────── */

.app-nav {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem;
    margin: 0.75rem 0;
}

.nav-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.6rem 0.5rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-tab.active {
    background: var(--primary);
    color: #0F0D1A;
}

#nav-practice.active {
    background: var(--rank-warm);
    color: #0F0D1A;
}

#nav-practice .nav-refresh {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-left: 2px;
}

/* Practice action bar */
.practice-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    margin: 0 0 4px 0;
    border-radius: 6px;
    background: color-mix(in srgb, var(--rank-warm) 15%, var(--card));
    border: 1px solid color-mix(in srgb, var(--rank-warm) 30%, transparent);
}

.practice-bar-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--rank-warm);
    display: flex;
    align-items: center;
    gap: 5px;
}

.practice-bar-actions {
    display: flex;
    gap: 6px;
}

.practice-bar-btn {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.15s;
}

.practice-bar-btn:active {
    opacity: 0.7;
}

.practice-reset-btn {
    background: var(--rank-warm);
    color: #0F0D1A;
}

.nav-tab:not(.active):hover {
    color: var(--text);
    background: var(--border);
}

.nav-tab:not(.active):active {
    transform: scale(0.97);
}

.nav-logout:hover {
    color: var(--error) !important;
    background: rgba(248, 113, 113, 0.1) !important;
}

/* ─── Views ─────────────────────────────────────────────────────── */

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease-out; }

/* ─── Live Score Bar ────────────────────────────────────────────── */

.live-score-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 0 2px;
    margin-bottom: 15px;
    min-height: 32px;
}


.live-score-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2DD4BF;
    text-shadow: 0 0 10px rgba(45, 212, 191, 0.5), 0 0 20px rgba(45, 212, 191, 0.25);
}

/* ─── Stats Bar ─────────────────────────────────────────────────── */

.stats-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.stat {
    flex: 1;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.25rem;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Guess Input ───────────────────────────────────────────────── */

.guess-input-area {
    margin-bottom: 0.75rem;
}

.input-row {
    display: flex;
    gap: 0.5rem;
}

#guess-input {
    flex: 1;
    min-height: 48px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

#guess-input:focus {
    border-color: var(--primary);
}

#guess-input::placeholder {
    color: var(--placeholder);
    font-size: 0.9rem;
}

#guess-input:disabled {
    opacity: 0.5;
}

.btn-guess {
    min-width: 48px;
    min-height: 48px;
    padding: 0 1.1rem;
    background: var(--primary);
    color: #0F0D1A;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.btn-guess:hover { background: var(--primary-hover); }
.btn-guess:active { transform: scale(0.95); }
.btn-guess:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Spinner inside button */
.btn-guess .spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(15, 13, 26, 0.3);
    border-top-color: #0F0D1A;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.guess-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

.guess-error:empty {
    margin-top: 0;
}

/* ─── (Clue slots removed — now auto-clue cards) ─────────────────── */

/* ─── Auto-Clue Display ───────────────────────────────────────── */

.clue-display-area {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.clue-inline-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    animation: clueCardReveal 0.5s ease-out;
}

.clue-inline-label {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
}

.clue-inline-label[data-clue="1"] {
    background: var(--accent-purple);
}
.clue-inline-label[data-clue="2"] {
    background: var(--primary);
    color: #0F0D1A;
}
.clue-inline-label[data-clue="3"] {
    background: var(--rank-warm);
    color: #0F0D1A;
}

.clue-inline-text {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.35;
    font-style: italic;
}

@keyframes clueCardReveal {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Win Score ──────────────────────────────────────────────────── */

.win-score {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2DD4BF;
    margin: 4px 0 12px;
}

/* ─── Confirm Overlay (practice reset) ──────────────────────────── */

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn .2s ease;
}
.confirm-overlay.hidden { display: none; }

.confirm-card {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 28px 24px 20px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}

.confirm-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #e8e8e8);
    margin: 0 0 10px;
}
.confirm-title i { margin-right: 6px; }

.confirm-info {
    font-size: .92rem;
    color: var(--text-secondary, #aaa);
    margin: 0 0 4px;
    line-height: 1.45;
}

.confirm-sub {
    font-size: .82rem;
    color: var(--text-muted, #777);
    margin: 0 0 18px;
}

.confirm-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-confirm {
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #f97316, #ef4444);
    color: #fff;
    transition: opacity .15s;
}
.btn-confirm:hover { opacity: .88; }

.btn-cancel {
    padding: 10px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary, #aaa);
    transition: background .15s;
}
.btn-cancel:hover { background: rgba(255,255,255,.06); }

/* ─── Loading ───────────────────────────────────────────────────── */

.loading {
    text-align: center;
    padding: 1rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    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; }

/* ─── Guess List ────────────────────────────────────────────────── */

.guess-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 50vh;
}

.guess-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    animation: slideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

/* Progress bar background fill */
.guess-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--bar-width, 0%);
    border-radius: 6px 0 0 6px;
    opacity: 0.1;
    z-index: 0;
    animation: barFill 0.6s ease-out;
}

.guess-row > * {
    position: relative;
    z-index: 1;
}

/* Latest guess highlight */
.guess-row-latest {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* AI commentary bubble */
.guess-commentary {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.commentary-who {
    font-style: normal;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--primary);
    margin-right: 0.4rem;
}

/* Bar widths + colors by rank tier */
.guess-row[data-rank-tier="found"]::before {
    width: 100%;
    background: var(--rank-found);
    opacity: 0.2;
    border-radius: 6px;
}

.guess-row[data-rank-tier="hot"]::before {
    background: var(--rank-hot);
}

.guess-row[data-rank-tier="warm"]::before {
    background: var(--rank-warm);
}

.guess-row[data-rank-tier="cool"]::before {
    background: var(--rank-cool);
}

.guess-row[data-rank-tier="cold"]::before {
    background: var(--rank-cold);
}

.guess-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 1.5rem;
    text-align: center;
}

.guess-word {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
}

.guess-temp {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.guess-rank {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    min-width: 3.5rem;
    text-align: center;
    color: #fff;
}

/* Rank colour pills */
.rank-found  { background: var(--rank-found); color: #0F0D1A; }
.rank-hot    { background: var(--rank-hot); color: #0F0D1A; }
.rank-warm   { background: var(--rank-warm); color: #1A1833; }
.rank-cool   { background: var(--rank-cool); color: #1A1833; }
.rank-cold   { background: var(--rank-cold); }

/* ─── Win Message ───────────────────────────────────────────────── */

.win-message {
    text-align: center;
    padding: 1.5rem;
    margin-bottom: 0.75rem;
    background: var(--bg-card);
    border: 2px solid var(--rank-found);
    border-radius: 8px;
    animation: popIn 0.5s ease-out;
}

.win-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--rank-found);
}

.win-message h2 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-purple), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.win-message p {
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-size: 0.95rem;
}

/* ─── Neon Chart ───────────────────────────────────────────────── */

.neon-chart-container {
    width: 100%;
    margin: 0.75rem 0 0.25rem;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.neon-chart-container canvas {
    display: block;
    width: 100%;
    border-radius: 6px;
}

/* ─── Confetti Canvas ───────────────────────────────────────────── */

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* ─── Leaderboard ───────────────────────────────────────────────── */

.lb-section {
    margin-bottom: 1.5rem;
}

.lb-heading {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.lb-heading i {
    color: var(--primary);
}

.lb-table {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    animation: fadeIn 0.3s ease-out;
}

.lb-position {
    font-size: 1.1rem;
    min-width: 1.8rem;
    text-align: center;
}

.lb-info {
    flex: 1;
    min-width: 0;
}

.lb-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.lb-badge {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #fff;
    white-space: nowrap;
}

.lb-solved {
    background: var(--rank-found);
    color: #0F0D1A;
}

.lb-unsolved {
    background: var(--border);
    color: var(--text-muted);
}

.lb-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 2rem 0;
}

/* All-time stats grid */
.alltime-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.alltime-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
}

.alltime-stat .stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

.alltime-stat .stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
}

/* ─── Modal ─────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    top: -10px;
    left: 0;
    width: 100%;
    height: calc(100vh + 20px); /* Overshoot top & bottom for Dynamic Island */
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 1rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.75rem;
    max-width: 400px;
    width: 100%;
    border: 1px solid var(--border);
    animation: popIn 0.3s ease-out;
    position: relative;
}

.info-modal {
    padding: 1rem 0 0;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.modal-close-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
}

.modal-close-btn:hover {
    color: var(--text);
    background: var(--border);
}

.modal h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.modal h2 i {
    color: var(--primary);
}

.modal-body {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.modal-scroll {
    overflow-y: auto;
    padding: 0 1.25rem 1.25rem;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
}

.modal-body p {
    margin-bottom: 0.75rem;
}

.modal-body strong {
    color: var(--text);
}

/* ─── Info Sections ────────────────────────────────────────────── */

.info-section {
    padding: 0.75rem 0;
}

.info-section + .info-section {
    border-top: 1px solid var(--border);
}

.info-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.info-section h3 i {
    color: var(--primary);
    font-size: 0.85rem;
}

.info-sub {
    font-size: 0.8rem;
    margin-bottom: 0.5rem !important;
}

.info-personalities {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-personality {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.info-personality-avatar {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.info-personality strong {
    font-size: 0.82rem;
}

.info-personality-origin {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.info-personality p {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0 !important;
    color: var(--text-muted);
}

.info-footer-section {
    text-align: center;
    padding-bottom: 0.25rem;
}

.info-slogan {
    font-style: italic;
    color: var(--primary) !important;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0 !important;
}

.modal-ranks {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0.75rem 0;
}

.rank-demo {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

.rank-demo.rank-found { background: var(--rank-found); color: #0F0D1A; }
.rank-demo.rank-hot   { background: var(--rank-hot); color: #0F0D1A; }
.rank-demo.rank-warm  { background: var(--rank-warm); color: #1A1833; }
.rank-demo.rank-cool  { background: var(--rank-cool); color: #1A1833; }
.rank-demo.rank-cold  { background: var(--rank-cold); }

.modal-btn {
    width: 100%;
    min-height: 48px;
    padding: 0.8rem;
    background: var(--primary);
    color: #0F0D1A;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-btn:hover { background: var(--primary-hover); }
.modal-btn:active { transform: scale(0.97); }

/* ─── Auth Pages (Login/Register) ───────────────────────────────── */

.auth-container {
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.4s ease-out;
}

.auth-logo {
    display: block;
    width: 180px;
    margin: 0 auto 0.5rem;
}

.auth-slogan {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    font-style: italic;
}

.auth-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 2rem;
    border: 1px solid var(--border);
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    border-color: var(--primary);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    min-height: 44px;
}

.form-check input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    min-height: 48px;
    padding: 0.8rem;
    background: var(--primary);
    color: #0F0D1A;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.97); }

.auth-error {
    background: rgba(248, 113, 113, 0.1);
    color: var(--error);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.auth-success {
    background: rgba(52, 211, 153, 0.1);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ─── Scrollbar ─────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

::selection {
    background: var(--primary);
    color: #0F0D1A;
}

/* ─── PWA Install Banner ───────────────────────────────────────── */

.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 400;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.install-banner-inner {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.install-banner-text {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.install-banner-text > i {
    font-size: 1.4rem;
    color: var(--primary);
    flex-shrink: 0;
}

.install-banner-text div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.install-banner-text strong {
    font-size: 0.9rem;
    font-weight: 700;
}

.install-banner-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.install-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.btn-install {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: #0F0D1A;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.btn-install:hover { background: var(--primary-hover); }

.btn-install-dismiss {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.btn-install-dismiss:hover {
    color: var(--text);
    background: var(--border);
}

/* ─── Splash Screen ────────────────────────────────────────────── */

.splash-screen {
    position: fixed;
    top: -10px;
    left: 0;
    width: 100%;
    height: calc(100vh + 20px); /* Overshoot top & bottom for Dynamic Island */
    z-index: 2000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
}

/* Lock body scroll while splash is showing */
html.splash-active,
body.splash-active {
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    animation: splashFadeIn 0.8s ease-out;
}

.splash-logo {
    width: 200px;
    height: auto;
    animation: splashLogoIn 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.splash-tagline {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0;
    animation: splashFadeIn 0.6s ease-out 0.4s forwards;
}

.splash-go-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.8rem 2rem;
    background: var(--primary);
    color: #0F0D1A;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    animation: splashFadeIn 0.6s ease-out 0.7s forwards;
}

.splash-go-btn:hover { background: var(--primary-hover); }
.splash-go-btn:active { transform: scale(0.95); }

.splash-version {
    position: absolute;
    bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    right: 1.25rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.35;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Splash exit animation */
.splash-screen.splash-exit {
    animation: splashOut 0.45s ease-in forwards;
    pointer-events: none;
}

@keyframes splashLogoIn {
    0%   { opacity: 0; transform: scale(0.6); }
    60%  { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes splashFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes splashOut {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.05); }
}

/* ─── Settings Button ──────────────────────────────────────────── */

/* ─── Header Buttons (info + settings) ────────────────────────── */

.header-btn {
    position: absolute;
    top: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.header-btn-left {
    left: 0;
}

.header-btn-right {
    right: 0;
}

.header-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(45, 212, 191, 0.06);
}

.header-btn:active {
    transform: scale(0.9);
}

/* ─── Settings Panel ───────────────────────────────────────────── */

.settings-overlay {
    position: fixed;
    top: -10px;
    left: 0;
    width: 100%;
    height: calc(100vh + 20px); /* Overshoot top & bottom for Dynamic Island */
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 500;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.settings-panel {
    background: var(--bg-card);
    border-radius: 12px 12px 0 0;
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    animation: slideUp 0.3s ease-out;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}

.settings-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.settings-header h2 i {
    color: var(--primary);
}

.settings-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.settings-close:hover {
    color: var(--text);
    background: var(--border);
}

.settings-section {
    margin-bottom: 1.25rem;
}

.settings-section h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
}

.theme-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem;
}

.theme-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 40px;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.theme-option.active {
    background: var(--primary);
    color: #0F0D1A;
}

.theme-option:not(.active):hover {
    color: var(--text);
    background: var(--border);
}

.theme-option:not(.active):active {
    transform: scale(0.97);
}

/* ─── Commentator Grid ─────────────────────────────────────────── */

.commentator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.commentator-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.6rem 0.4rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    color: var(--text);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.commentator-card:hover {
    border-color: var(--text-muted);
}

.commentator-card:active {
    transform: scale(0.97);
}

.commentator-card.active {
    border-color: var(--primary);
    background: rgba(45, 212, 191, 0.08);
    box-shadow: 0 0 0 1px var(--primary);
}

.commentator-avatar {
    font-size: 1.4rem;
    line-height: 1;
}

.commentator-info {
    display: flex;
    flex-direction: column;
}

.commentator-name {
    font-size: 0.82rem;
    font-weight: 700;
}

.commentator-origin {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}

.commentator-desc {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.3;
    max-width: 140px;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 44px;
    padding: 0.7rem;
    flex-shrink: 0;
    background: transparent;
    color: var(--error);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-logout:hover {
    background: rgba(248, 113, 113, 0.1);
}

/* ─── Now Playing Toast ───────────────────────────────────────── */

.now-playing-toast {
    position: fixed;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    animation: toastLife 3.5s ease forwards;
}

.now-playing-toast i {
    font-size: 0.65rem;
    color: var(--primary);
}

@keyframes toastLife {
    0%   { opacity: 0; transform: translateX(-50%) translateY(20px); }
    8%   { opacity: 1; transform: translateX(-50%) translateY(0); }
    80%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* ─── Audio Controls (Settings) ───────────────────────────────── */

.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.audio-toggles {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem;
}

.audio-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 40px;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.audio-toggle-btn.active {
    background: var(--primary);
    color: #0F0D1A;
}

.audio-toggle-btn:not(.active):hover {
    color: var(--text);
    background: var(--border);
}

.audio-toggle-btn:not(.active):active {
    transform: scale(0.97);
}

.volume-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.25rem;
}

.volume-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.volume-track {
    flex: 1;
    height: 28px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.volume-track::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
}

.volume-fill {
    position: absolute;
    left: 0;
    height: 4px;
    border-radius: 2px;
    background: var(--primary);
    pointer-events: none;
    width: 50%;
}

.volume-thumb {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
    touch-action: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

.volume-thumb:active {
    transform: translateX(-50%) scale(1.15);
}

/* ─── Share Button ─────────────────────────────────────────────── */

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.6rem 1.5rem;
    margin-top: 0.75rem;
    background: var(--primary);
    color: #0F0D1A;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-share:hover { background: var(--primary-hover); }
.btn-share:active { transform: scale(0.95); }

.btn-share .spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(15, 13, 26, 0.3);
    border-top-color: #0F0D1A;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Share toast (reuses now-playing-toast pattern) */
.share-toast {
    position: fixed;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    padding: 0.5rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    animation: toastLife 3s ease forwards;
}

/* ─── Temperature Gauge ────────────────────────────────────────── */

.temp-gauge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    animation: fadeIn 0.3s ease-out;
}

.temp-gauge-track {
    flex: 1;
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.temp-gauge-fill {
    height: 100%;
    width: var(--gauge-pct, 0%);
    border-radius: 5px;
    background: var(--rank-cold);
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.4s ease;
    position: relative;
}

/* Animated glow effect on the fill */
.temp-gauge-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.6;
    box-shadow: 0 0 6px 2px currentColor;
}

.temp-gauge-label {
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    min-width: 5.5rem;
    text-align: right;
}

/* ─── Achievements ─────────────────────────────────────────────── */

.achievements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.achievement-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.achievement-card.locked {
    opacity: 0.35;
}

.achievement-card.unlocked {
    border-color: var(--primary);
    background: rgba(45, 212, 191, 0.05);
}

.achievement-icon {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
}

.achievement-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.achievement-name {
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.achievement-desc {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* ─── Practice Mode ──────────────────────────────────────────────── */

.practice-new-word-btn {
    margin-top: 12px;
}

