/* ===== VARIABLES ===== */
:root {
    --bg: #0a0a0a;
    --surface: #141418;
    --surface2: #1c1c22;
    --surface3: #25252d;
    --gold: #C9A84C;
    --gold-dim: #8a7535;
    --gold-glow: rgba(201, 168, 76, 0.3);
    --crimson: #8B1A1A;
    --crimson-light: #C0392B;
    --green: #2D8B4E;
    --green-light: #3DDC84;
    --text: #E8E8E8;
    --text-dim: #888;
    --text-muted: #555;
    --border: #2a2a32;
    --radius: 12px;
}

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ===== SCREENS ===== */
.screen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
    transform: translateY(12px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    z-index: 10;
}

/* ===== SPLASH ===== */
.splash-bg {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(201,168,76,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(139,26,26,0.06) 0%, transparent 50%),
        var(--bg);
    z-index: 0;
}
.splash-bg::after {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255,255,255,0.015) 2px,
        rgba(255,255,255,0.015) 4px
    );
}
.splash-content {
    position: relative; z-index: 1;
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 40px 24px;
}
.splash-photo {
    width: 140px; height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--gold-dim);
    margin-bottom: 24px;
    animation: fadeUp 0.6s ease-out both;
    box-shadow: 0 0 30px rgba(201,168,76,0.2);
}
.splash-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 15%;
}
.splash-photo img[src=""] { visibility: hidden; }
.splash-logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(52px, 14vw, 80px);
    letter-spacing: 6px;
    line-height: 1;
    animation: logoIn 0.8s ease-out both;
}
.logo-gaku {
    color: var(--gold);
    text-shadow: 0 0 40px var(--gold-glow);
}
.logo-lingo {
    color: var(--text);
}
.splash-sub {
    font-size: 16px;
    color: var(--text-dim);
    letter-spacing: 8px;
    margin-top: 8px;
    animation: fadeUp 0.6s 0.3s ease-out both;
}
.splash-tagline {
    font-size: 14px;
    color: var(--gold-dim);
    margin-top: 40px;
    letter-spacing: 2px;
    animation: fadeUp 0.6s 0.6s ease-out both;
}
.btn-start {
    margin-top: 32px;
    animation: fadeUp 0.6s 0.9s ease-out both;
}
.splash-footer {
    position: relative; z-index: 1;
    text-align: center;
    padding: 24px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 3px;
}

@keyframes logoIn {
    from { opacity: 0; transform: scale(0.9) translateY(10px); letter-spacing: 20px; }
    to { opacity: 1; transform: scale(1) translateY(0); letter-spacing: 6px; }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== COMMON HEADER ===== */
.screen-header {
    display: flex; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-shrink: 0;
}
.screen-header h2 {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}
.header-spacer { width: 40px; }

.btn-back {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}
.btn-back:hover { background: var(--surface2); }

/* ===== BUTTONS ===== */
.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 36px;
    background: var(--gold);
    color: #0a0a0a;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s;
}
.btn-primary:hover { background: #d4b55a; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    padding: 12px 28px;
    background: none;
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 15px;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--text-dim); }

.btn-danger {
    padding: 12px 28px;
    background: var(--crimson);
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-danger:hover { background: var(--crimson-light); }

.btn-small { padding: 10px 24px; font-size: 14px; }

.btn-next {
    width: 100%;
    padding: 14px;
    background: var(--surface3);
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.2s;
}
.btn-next:hover { background: var(--border); }

.btn-dashboard {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px;
    background: none;
    color: var(--gold);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s;
}
.btn-dashboard:hover { background: rgba(201,168,76,0.1); }
.btn-dashboard svg { stroke: var(--gold); }

/* ===== LANGUAGE SELECT ===== */
.language-ask {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 20px 8px;
}
.language-ask-photo {
    width: 100px; height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gold);
}
.language-ask-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: top center;
}
.language-ask-photo img[src=""] { visibility: hidden; }
.language-ask-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.language-grid {
    flex: 1;
    display: flex; flex-direction: column;
    padding: 24px 20px;
    gap: 16px;
}
.language-card {
    display: flex; align-items: center; gap: 16px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.25s;
    text-align: left;
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
}
.language-card:hover {
    border-color: var(--gold-dim);
    background: var(--surface2);
    transform: translateX(4px);
}
.lang-flag { font-size: 36px; }
.lang-name { font-size: 20px; font-weight: 700; flex: 1; }
.lang-name-jp { font-size: 13px; color: var(--text-dim); }
.lang-progress {
    width: 100%;
    height: 3px;
    background: var(--surface3);
    border-radius: 2px;
    margin-top: 8px;
    display: none;
}
.lang-progress-bar {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ===== LEVEL SELECT ===== */
.level-list {
    flex: 1;
    display: flex; flex-direction: column;
    padding: 16px 20px;
    gap: 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.level-group-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 12px 0 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
    font-family: 'Noto Sans JP', sans-serif;
}
.level-group-header:first-child { padding-top: 0; }
.level-card {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.25s;
    text-align: left;
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
}
.level-card:hover:not(.locked) {
    border-color: var(--gold-dim);
    transform: translateX(4px);
}
.level-card.locked {
    opacity: 0.35;
    cursor: default;
}
.level-card.locked.locked-challenge {
    opacity: 0.7;
    cursor: pointer;
    border-color: var(--gold-dim);
    border-style: dashed;
}
.level-card.locked.locked-challenge:hover {
    border-color: var(--gold);
    background: var(--surface2);
    transform: translateX(4px);
}
.level-card.locked.locked-challenge.challenge-used {
    opacity: 0.35;
    cursor: default;
    border-style: solid;
    border-color: var(--border);
}
.level-card.locked.locked-challenge.challenge-used:hover {
    border-color: var(--border);
    background: var(--surface);
    transform: none;
}
.lock-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.lock-icon.challenge-available {
    color: var(--gold);
    font-size: 16px;
}
.challenge-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 1px;
}
.lock-icon.challenge-used-icon {
    opacity: 0.5;
}
.level-rank-badge {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface3);
    border: 2px solid var(--gold-dim);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
    font-family: 'Space Mono', monospace;
}
.level-card.locked .level-rank-badge {
    border-color: var(--border);
    color: var(--text-dim);
}
.level-info { flex: 1; }
.level-name { font-size: 16px; font-weight: 700; }
.level-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.level-score {
    font-family: 'Space Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--gold);
}
.level-bottom {
    padding: 20px;
    display: flex; justify-content: center;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ===== BRIEFING ===== */
#screen-briefing {
    align-items: center; justify-content: center;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(201,168,76,0.05) 0%, transparent 50%),
        var(--bg);
}
.briefing-content {
    text-align: center;
    padding: 40px 32px;
    max-width: 400px;
}
.briefing-stamp {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 14px;
    letter-spacing: 8px;
    color: var(--crimson-light);
    border: 2px solid var(--crimson-light);
    display: inline-block;
    padding: 4px 16px;
    transform: rotate(-3deg);
    margin-bottom: 24px;
    animation: stampIn 0.4s ease-out both;
}
@keyframes stampIn {
    from { opacity: 0; transform: rotate(-3deg) scale(1.3); }
    to { opacity: 1; transform: rotate(-3deg) scale(1); }
}
.briefing-title {
    font-size: 22px;
    margin-bottom: 28px;
}
.briefing-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 28px;
}
.briefing-row {
    display: flex; justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}
.briefing-row + .briefing-row { border-top: 1px solid var(--border); }
.briefing-row span:first-child { color: var(--text-dim); }
.briefing-row span:last-child { font-weight: 700; }
.briefing-message {
    font-size: 14px;
    color: var(--gold);
    line-height: 1.8;
    margin-bottom: 32px;
    font-style: italic;
}

/* ===== QUIZ ===== */
.quiz-header {
    display: flex; align-items: center;
    padding: 12px 16px;
    gap: 12px;
    flex-shrink: 0;
}
.quiz-progress {
    flex: 1;
    height: 6px;
    background: var(--surface3);
    border-radius: 3px;
    overflow: hidden;
}
.quiz-progress-bar {
    height: 100%;
    background: var(--gold);
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}
.quiz-counter {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: var(--text-dim);
    min-width: 40px;
    text-align: right;
}

.quiz-body {
    flex: 1;
    padding: 24px 20px;
    display: flex; flex-direction: column;
}
.quiz-question {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.6;
    margin-bottom: 8px;
    animation: fadeUp 0.3s ease-out both;
}
.quiz-hint {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 28px;
}
.quiz-answers {
    display: flex; flex-direction: column;
    gap: 10px;
    flex: 1;
}

/* Choice buttons */
.choice-btn {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    animation: fadeUp 0.3s ease-out both;
}
.choice-btn:nth-child(1) { animation-delay: 0.05s; }
.choice-btn:nth-child(2) { animation-delay: 0.1s; }
.choice-btn:nth-child(3) { animation-delay: 0.15s; }
.choice-btn:nth-child(4) { animation-delay: 0.2s; }

.choice-btn:hover:not(.disabled) {
    border-color: var(--gold-dim);
    background: var(--surface2);
}
.choice-btn .choice-key {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface3);
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    flex-shrink: 0;
}
.choice-btn.correct {
    border-color: var(--green);
    background: rgba(45,139,78,0.15);
}
.choice-btn.correct .choice-key {
    background: var(--green);
    color: #fff;
}
.choice-btn.wrong {
    border-color: var(--crimson-light);
    background: rgba(192,57,43,0.15);
}
.choice-btn.wrong .choice-key {
    background: var(--crimson-light);
    color: #fff;
}
.choice-btn.disabled { pointer-events: none; }
.choice-btn.disabled:not(.correct):not(.wrong) { opacity: 0.4; }

/* Fill input */
.fill-input-wrap {
    display: flex; gap: 10px;
    animation: fadeUp 0.3s ease-out both;
}
.fill-input {
    flex: 1;
    padding: 16px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 18px;
    outline: none;
    transition: border-color 0.2s;
}
.fill-input:focus { border-color: var(--gold); }
.fill-input.correct { border-color: var(--green); }
.fill-input.wrong { border-color: var(--crimson-light); }

.fill-submit {
    padding: 16px 24px;
    background: var(--gold);
    color: #0a0a0a;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}
.fill-submit:hover { background: #d4b55a; }

/* Order words */
.order-container {
    animation: fadeUp 0.3s ease-out both;
}
.order-slots {
    min-height: 56px;
    padding: 12px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.order-slots.correct { border-color: var(--green); border-style: solid; }
.order-slots.wrong { border-color: var(--crimson-light); border-style: solid; }

.order-pool {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 12px;
}
.order-word {
    padding: 10px 18px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}
.order-word:hover { border-color: var(--gold-dim); }
.order-word.placed {
    opacity: 0.3;
    pointer-events: none;
}
.order-word.in-slot {
    background: var(--gold);
    color: #0a0a0a;
    font-weight: 700;
    border-color: var(--gold);
}
.order-check {
    padding: 12px 24px;
    background: var(--gold);
    color: #0a0a0a;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Feedback */
.quiz-feedback {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 20px 20px 32px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 20;
}
.quiz-feedback.show { transform: translateY(0); }
.quiz-feedback.correct-fb { background: linear-gradient(to top, rgba(45,139,78,0.95), rgba(45,139,78,0.85)); }
.quiz-feedback.wrong-fb { background: linear-gradient(to top, rgba(139,26,26,0.95), rgba(139,26,26,0.85)); }

.feedback-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.feedback-photo {
    width: 44px; height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}
.feedback-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 15%;
}
.feedback-body { flex: 1; min-width: 0; }
.feedback-headline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.feedback-text { font-size: 16px; font-weight: 700; }
.feedback-explanation { font-size: 13px; opacity: 0.85; line-height: 1.5; }

/* GACKT comment */
.gackt-comment {
    position: fixed;
    top: 70px; left: 20px; right: 20px;
    padding: 12px 16px;
    background: rgba(201,168,76,0.12);
    border: 1px solid var(--gold-dim);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--gold);
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 15;
}
.gackt-comment.show {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESULTS ===== */
#screen-results {
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(201,168,76,0.06) 0%, transparent 50%),
        var(--bg);
}
#confetti-canvas {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 30;
}
.results-content {
    text-align: center;
    padding: 32px 24px;
    position: relative;
    z-index: 10;
}
.results-rank {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 72px;
    color: var(--gold);
    text-shadow: 0 0 40px var(--gold-glow);
    line-height: 1;
    animation: rankPop 0.5s ease-out both;
}
@keyframes rankPop {
    0% { opacity: 0; transform: scale(0.5); }
    60% { transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}
.results-title {
    font-size: 20px;
    margin: 8px 0 24px;
    animation: fadeUp 0.4s 0.2s ease-out both;
}
.score-circle {
    position: relative;
    width: 120px; height: 120px;
    display: inline-block;
    animation: fadeUp 0.4s 0.4s ease-out both;
}
.score-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-bg { fill: none; stroke: var(--surface3); stroke-width: 8; }
.score-fill {
    fill: none; stroke: var(--gold); stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 1.5s ease 0.6s;
}
.score-number {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Space Mono', monospace;
    font-size: 28px;
    font-weight: 700;
}
.results-stats {
    display: flex; gap: 24px;
    justify-content: center;
    margin: 24px 0;
    animation: fadeUp 0.4s 0.6s ease-out both;
}
.stat { text-align: center; }
.stat-val {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 24px;
    font-weight: 700;
}
.stat-label { font-size: 12px; color: var(--text-dim); }

.results-gackt {
    font-size: 14px;
    color: var(--gold);
    font-style: italic;
    margin-bottom: 28px;
    line-height: 1.7;
    animation: fadeUp 0.4s 0.8s ease-out both;
}
.results-actions {
    display: flex; gap: 12px;
    justify-content: center;
    animation: fadeUp 0.4s 1s ease-out both;
}

/* ===== DASHBOARD ===== */
.dashboard-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex; flex-direction: column;
    gap: 16px;
    padding-bottom: 40px;
}
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.dash-card h3 {
    font-size: 14px;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-bottom: 16px;
}

/* Streak */
.streak-card {
    text-align: center;
    background: linear-gradient(135deg, var(--surface), var(--surface2));
    border-color: var(--gold-dim);
}
.streak-fire { font-size: 40px; margin-bottom: 4px; }
.streak-count {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 56px;
    color: var(--gold);
    line-height: 1;
}
.streak-label { font-size: 14px; color: var(--text-dim); margin-bottom: 12px; }
.streak-week {
    display: flex; justify-content: center; gap: 8px;
}
.streak-day {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--surface3);
}
.streak-day.done { background: var(--gold); color: #0a0a0a; font-weight: 700; }
.streak-day.today { border: 2px solid var(--gold); }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.sg-item { text-align: center; }
.sg-val {
    display: block;
    font-family: 'Space Mono', 'Noto Sans JP', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--gold);
}
.sg-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* Team */
.team-list { display: flex; flex-direction: column; gap: 8px; }
.team-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    background: var(--surface2);
    border-radius: 8px;
}
.team-row.my-team {
    border: 1px solid var(--gold-dim);
    background: rgba(201,168,76,0.08);
}
.team-pos {
    font-family: 'Space Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    width: 28px;
    text-align: center;
}
.team-pos.gold { color: var(--gold); }
.team-name { flex: 1; font-size: 14px; font-weight: 700; }
.team-xp {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: var(--gold);
}

/* Achievements */
.achieve-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.achieve-item {
    text-align: center;
    padding: 12px 4px;
}
.achieve-icon {
    font-size: 28px;
    margin-bottom: 4px;
    filter: grayscale(1) opacity(0.3);
    transition: filter 0.3s;
}
.achieve-icon.unlocked { filter: none; }
.achieve-label {
    font-size: 10px;
    color: var(--text-muted);
}
.achieve-label.unlocked { color: var(--text-dim); }

/* Weekly command */
.command-card {
    background: linear-gradient(135deg, var(--surface), rgba(139,26,26,0.1));
    border-color: var(--crimson);
    text-align: center;
}
.command-label {
    font-size: 11px;
    letter-spacing: 4px;
    color: var(--crimson-light);
    margin-bottom: 12px;
}
.command-text {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.7;
    margin-bottom: 12px;
}
.command-author {
    font-size: 13px;
    color: var(--gold);
    font-style: italic;
}

/* ===== ACHIEVEMENT POPUP ===== */
.achievement-popup {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.achievement-popup.show {
    opacity: 1;
    pointer-events: auto;
}
.achieve-inner {
    position: relative;
    text-align: center;
    padding: 40px 32px;
}
.achieve-glow {
    position: absolute;
    top: 50%; left: 50%;
    width: 200px; height: 200px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
    animation: glowPulse 1.5s ease-in-out infinite;
}
@keyframes glowPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}
.achieve-badge {
    position: relative;
    font-size: 64px;
    margin-bottom: 16px;
    animation: badgePop 0.5s ease-out both;
}
@keyframes badgePop {
    0% { transform: scale(0) rotate(-20deg); }
    60% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0); }
}
.achieve-title {
    font-size: 14px;
    color: var(--text-dim);
    letter-spacing: 3px;
    margin-bottom: 8px;
}
.achieve-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 24px;
}

/* ===== QUIT MODAL ===== */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    max-width: 320px;
}
.modal-photo {
    width: 80px; height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gold-dim);
    margin: 0 auto 16px;
}
.modal-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 15%;
}
.modal-content p {
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 24px;
    font-style: italic;
}
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

/* ===== MOBILE SAFE AREA ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    .screen-header { padding-top: calc(16px + env(safe-area-inset-top)); }
    .quiz-header { padding-top: calc(12px + env(safe-area-inset-top)); }
    .splash-content { padding-top: calc(40px + env(safe-area-inset-top)); }
    .quiz-feedback { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}
