/* Peeky Quiz — /quiz */
:root {
    --bg: #0A0E1A;
    --bg2: #0F1525;
    --cyan: #00E5FF;
    --purple: #7B61FF;
    --white: #F0F4FF;
    --muted: #8892A4;
    --border: rgba(255,255,255,.08);
    --green: #10B981;
    --red: #FF6B6B;
    --yellow: #FBBF24;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--white);
    min-height: 100vh;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.container { width: min(920px, calc(100% - 2rem)); margin: 0 auto; }

.quiz-nav {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(10px);
    background: rgba(10,14,26,.85);
    border-bottom: 1px solid var(--border);
}
.quiz-nav .container {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; min-height: 64px;
}
.nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    flex-shrink: 0;
    line-height: 1;
    text-decoration: none;
}
.nav-links-row { display: flex; gap: 1rem; }
.nav-link { color: var(--muted); font-size: .9rem; font-weight: 500; }
.nav-link:hover, .nav-link.active { color: var(--cyan); }
.nav-auth-area { display: flex; align-items: center; gap: .6rem; }
.btn-nav-login, .btn-signout {
    color: var(--muted); font-weight: 500; padding: .4rem .7rem;
}
.btn-nav-signup {
    background: var(--cyan); color: var(--bg); font-weight: 700;
    border-radius: 8px; padding: .45rem .9rem;
}

.quiz-page { padding: 2rem 0 4rem; }
.panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.panel h1, .panel h2 {
    font-family: var(--font-heading);
    font-weight: 800;
    margin-bottom: .5rem;
}
.muted { color: var(--muted); }
.hidden { display: none !important; }

.limit-bar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem;
}
.progress-track {
    width: 100%; height: 8px; border-radius: 999px;
    background: rgba(255,255,255,.06); overflow: hidden;
}
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--purple));
    transition: width .3s ease;
}
.pro-pill {
    display: inline-flex; align-items: center; gap: .35rem;
    background: rgba(123,97,255,.15); color: #c4b5ff;
    border: 1px solid rgba(123,97,255,.35);
    border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; font-weight: 600;
}

.mode-grid, .count-grid {
    display: grid; gap: .85rem;
}
.mode-grid { grid-template-columns: repeat(3, 1fr); margin: 1rem 0; }
.count-grid { grid-template-columns: repeat(3, 1fr); margin: 1rem 0 1.25rem; }

.mode-card, .count-chip {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: rgba(255,255,255,.02);
    transition: .2s ease;
    text-align: left;
}
.mode-card:hover, .count-chip:hover { border-color: rgba(0,229,255,.35); }
.mode-card.active, .count-chip.active {
    border-color: var(--cyan);
    box-shadow: 0 0 0 1px rgba(0,229,255,.25);
    background: rgba(0,229,255,.06);
}
.mode-card h3 { font-size: 1rem; margin-bottom: .25rem; }
.mode-card p, .count-chip small { color: var(--muted); font-size: .82rem; }
.count-chip {
    text-align: center; font-weight: 700; font-size: 1.1rem;
    position: relative;
}
.count-chip.locked { opacity: .55; }
.count-chip .lock { font-size: .75rem; color: var(--yellow); }

.mastery-preview {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem;
    margin: 1rem 0 1.25rem;
}
.mastery-chip {
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .7rem .55rem;
    text-align: center;
    font-size: .82rem;
}
.mastery-chip strong { display: block; font-size: 1.15rem; margin-top: .15rem; }

.btn-primary {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%;
    background: var(--cyan); color: var(--bg);
    font-weight: 800; font-size: 1.05rem;
    border-radius: 12px; padding: .95rem 1.2rem;
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%;
    border: 1.5px solid var(--border); color: var(--cyan);
    font-weight: 700; border-radius: 12px; padding: .85rem 1.1rem;
}
.btn-secondary:hover { border-color: var(--cyan); }
.btn-row { display: grid; gap: .75rem; margin-top: 1rem; }
.btn-row.two { grid-template-columns: 1fr 1fr; }

.limit-locked {
    text-align: center; padding: 1rem 0 .25rem;
}
.countdown { font-family: var(--font-heading); font-size: 1.4rem; color: var(--cyan); margin: .5rem 0 1rem; }

/* In progress */
.quiz-top {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.score-live { display: flex; gap: .8rem; font-weight: 700; }
.score-live .ok { color: var(--green); }
.score-live .bad { color: var(--red); }
.timer {
    font-family: var(--font-heading); font-weight: 800;
    color: var(--yellow); min-width: 3rem; text-align: right;
}
.timer.urgent { color: var(--red); }

.prompt-word {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 6vw, 2.6rem);
    font-weight: 800;
    text-align: center;
    margin: 1.2rem 0 .4rem;
    letter-spacing: -.02em;
}
.prompt-hint { text-align: center; color: var(--muted); margin-bottom: 1.25rem; }

.options { display: grid; gap: .7rem; }
.option-btn {
    width: 100%; text-align: left;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: .95rem 1rem;
    background: rgba(255,255,255,.03);
    font-size: 1rem;
    transition: .15s ease;
}
.option-btn:hover:not(:disabled) { border-color: rgba(0,229,255,.4); }
.option-btn.correct { border-color: var(--green); background: rgba(16,185,129,.12); }
.option-btn.wrong { border-color: var(--red); background: rgba(255,107,107,.12); }
.option-btn:disabled { cursor: default; }

.typing-wrap { display: grid; gap: .75rem; }
.typing-input {
    width: 100%;
    background: rgba(255,255,255,.04);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--white);
    font-size: 1.15rem;
    text-align: center;
    outline: none;
}
.typing-input:focus { border-color: var(--cyan); }
.feedback {
    margin-top: 1rem; padding: .85rem 1rem; border-radius: 10px;
    border: 1px solid var(--border); display: none;
}
.feedback.show { display: block; }
.feedback.ok { border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.08); }
.feedback.bad { border-color: rgba(255,107,107,.4); background: rgba(255,107,107,.08); }

/* Results */
.results-hero { text-align: center; padding: 1rem 0 1.5rem; }
.score-ring {
    width: 150px; height: 150px; margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid; place-items: center;
    background:
      radial-gradient(closest-side, var(--bg2) 78%, transparent 80% 100%),
      conic-gradient(var(--cyan) calc(var(--p) * 1%), rgba(255,255,255,.08) 0);
}
.score-ring strong { font-family: var(--font-heading); font-size: 1.8rem; }
.grade-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 3.2rem; height: 3.2rem;
    border-radius: 12px; background: rgba(0,229,255,.12);
    color: var(--cyan); font-family: var(--font-heading);
    font-size: 1.6rem; font-weight: 800; margin-bottom: .5rem;
}
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }
.chip {
    border: 1px solid var(--border); border-radius: 999px;
    padding: .3rem .7rem; font-size: .82rem; color: var(--muted);
}
.upgrade-box {
    margin-top: 1rem;
    border: 1px solid rgba(123,97,255,.35);
    background: rgba(123,97,255,.08);
    border-radius: 12px; padding: 1rem;
}

.toast {
    position: fixed; left: 50%; bottom: 1.25rem;
    transform: translateX(-50%) translateY(1rem);
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 10px; padding: .7rem 1rem; opacity: 0;
    pointer-events: none; transition: .25s ease; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(5,8,16,.72);
    display: none; align-items: center; justify-content: center;
    z-index: 200; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
    width: min(420px, 100%); background: var(--bg2);
    border: 1px solid var(--border); border-radius: 16px; padding: 1.4rem;
}
.modal h3 { font-family: var(--font-heading); margin-bottom: .25rem; }
.form-group { margin: .8rem 0; }
.form-group label { display: block; color: var(--muted); font-size: .82rem; margin-bottom: .35rem; }
.form-group input {
    width: 100%; background: rgba(255,255,255,.04); border: 1px solid var(--border);
    border-radius: 10px; padding: .7rem .85rem; color: var(--white);
}
.modal-error { color: var(--red); min-height: 1.1rem; font-size: .85rem; margin-bottom: .4rem; }
.modal-switch { margin-top: .8rem; color: var(--muted); font-size: .85rem; text-align: center; }
.modal-switch button { color: var(--cyan); font-weight: 700; }

@media (max-width: 768px) {
    .nav-links-row { display: none; }
    .mode-grid, .count-grid, .mastery-preview { grid-template-columns: 1fr 1fr; }
    .mode-grid { grid-template-columns: 1fr; }
    .btn-row.two { grid-template-columns: 1fr; }
    .panel { padding: 1.1rem; }
}
@media (max-width: 480px) {
    .mastery-preview, .count-grid { grid-template-columns: 1fr 1fr; }
    .prompt-word { font-size: 1.6rem; }
}
