:root {
    --bg: #070b1f;
    --bg2: #0d1230;
    --panel: rgba(255, 255, 255, .055);
    --panel-2: rgba(255, 255, 255, .09);
    --line: rgba(255, 255, 255, .13);
    --text: #f6f7ff;
    --muted: #a4aed2;
    --violet: #8b5cf6;
    --cyan: #22d3ee;
    --pink: #f472b6;
    --gold: #fbbf24;
    --ok: #34d399;
    --bad: #fb7185;
    --radius: 24px;
    --shadow: 0 24px 70px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: Vazir, 'Segoe UI', Tahoma, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    z-index: -1;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(110px);
    opacity: .45;
    pointer-events: none;
}

body::before {
    top: -25vw;
    right: -15vw;
    background: radial-gradient(circle, #5b21b6, transparent 65%);
}

body::after {
    bottom: -30vw;
    left: -15vw;
    background: radial-gradient(circle, #0e7490, transparent 65%);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }

.wrap {
    width: min(1180px, 92vw);
    margin: 0 auto;
    padding: 22px 0 70px;
}

.narrow { width: min(760px, 92vw); }

/* ---------- topbar ---------- */
.topbar {
    width: min(1180px, 92vw);
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 14px;
    display: grid; place-items: center; font-size: 22px;
    background: linear-gradient(135deg, var(--violet), var(--cyan));
    box-shadow: 0 8px 24px rgba(139, 92, 246, .5);
    transform: rotate(-8deg);
}
.brand span em { font-style: normal; color: var(--cyan); }
.nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav a {
    padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
    color: var(--muted); border: 1px solid transparent; transition: .2s;
}
.nav a:hover { color: var(--text); background: var(--panel); border-color: var(--line); }
.nav a.active { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.nav-link-btn {
    padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
    color: var(--muted); border: 1px solid transparent; background: transparent; cursor: pointer;
}
.nav-link-btn:hover { color: var(--text); background: var(--panel); border-color: var(--line); }
.user-box { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); padding: 0 6px; }
.badge.role { background: rgba(251, 191, 36, .16); color: var(--gold); border: 1px solid rgba(251, 191, 36, .3); }
.auth-card { max-width: 460px; margin-inline: auto; }
.auth-title { font-size: 32px; margin-top: 18px; }
.teacher-list { display: flex; flex-direction: column; gap: 10px; }
.teacher-item {
    display: flex; align-items: center; gap: 12px;
    border: 1px solid var(--line); border-radius: 16px; padding: 12px;
    background: rgba(255,255,255,.03);
}
.teacher-avatar { font-size: 24px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); }
.teacher-item .quiz-meta { direction: rtl; }
.teacher-info, .quiz-info { flex: 1; min-width: 0; }
.teacher-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.quiz-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; }
.quiz-actions .btn { flex: 1 1 auto; min-width: 96px; white-space: nowrap; }
.quiz-list { display: flex; flex-direction: column; gap: 10px; }

/* ---------- generic ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    padding: 26px;
}
.card + .card { margin-top: 18px; }
.card-tight { padding: 18px; }

h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.2; letter-spacing: -1px; margin-bottom: 14px; }
h2 { font-size: clamp(22px, 3vw, 30px); margin-bottom: 14px; }
h3 { font-size: 18px; margin-bottom: 10px; }
p { color: var(--muted); line-height: 1.85; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.left { text-align: left; }
.dir-ltr { direction: ltr; unicode-bidi: isolate; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.score-row { justify-content: center; gap: 34px; }
.feature-cards { align-items: stretch; }
.feature-card { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }

.gradient-text {
    background: linear-gradient(90deg, #c4b5fd, #67e8f9, #f9a8d4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    padding: 13px 22px; border-radius: 14px; border: 1px solid var(--line);
    background: var(--panel-2); color: var(--text); font-weight: 700; font-size: 15px;
    cursor: pointer; transition: transform .18s, box-shadow .18s, background .18s, opacity .18s;
    user-select: none;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255,255,255,.14); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-primary {
    border-color: transparent;
    background: linear-gradient(120deg, var(--violet), #6366f1 55%, var(--cyan));
    box-shadow: 0 12px 30px rgba(124, 77, 255, .38);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 16px 38px rgba(124, 77, 255, .55); background: linear-gradient(120deg, #9b6dff, #7376ff 55%, #4ad9ef); }
.btn-ok { border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.14); color: #a7f3d0; }
.btn-danger { border-color: rgba(251,113,133,.35); background: rgba(251,113,133,.1); color: #fecdd3; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 11px; }
.btn-lg { padding: 17px 30px; font-size: 18px; border-radius: 17px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
input, textarea, select {
    width: 100%; padding: 13px 15px; border-radius: 13px;
    border: 1px solid var(--line); background: rgba(5, 8, 25, .55);
    color: var(--text); outline: none; font-size: 15px; transition: .2s;
}
input::placeholder, textarea::placeholder { color: #6b7398; }
input:focus, textarea:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(139,92,246,.16); }
textarea { resize: vertical; min-height: 86px; line-height: 1.7; }
select { cursor: pointer; }
select option { background: #121732; color: #fff; }
.pin-input { font-family: ui-monospace, 'Courier New', monospace; font-size: 30px !important; letter-spacing: 12px; text-align: center; direction: ltr; font-weight: 800; }
.code-input { font-family: ui-monospace, monospace; letter-spacing: 2px; direction: ltr; text-align: center; }

.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.avatar-option {
    aspect-ratio: 1; min-width: 0; display: grid; place-items: center; font-size: 24px;
    border-radius: 14px; border: 2px solid var(--line); background: rgba(255,255,255,.05);
    cursor: pointer; transition: .18s; line-height: 1;
}
.avatar-option:hover { transform: translateY(-3px) scale(1.06); background: rgba(255,255,255,.12); }
.avatar-option.selected {
    border-color: var(--cyan); background: rgba(34,211,238,.16);
    box-shadow: 0 0 0 3px rgba(34,211,238,.18), 0 8px 20px rgba(34,211,238,.2);
    transform: scale(1.08);
}
.avatar-chip { font-size: 20px; line-height: 1; }
.question-image {
    display: block; max-width: 100%; max-height: 230px; object-fit: contain;
    margin: 0 auto 20px; border-radius: 16px; border: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.radio-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.radio-label input { width: 17px; height: 17px; accent-color: var(--violet); }

.seg { display: flex; background: rgba(4,7,22,.5); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.seg label { flex: 1; text-align: center; padding: 10px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); transition: .2s; }
.seg input { display: none; }
.seg input:checked + span { color: #fff; }
.seg label:has(input:checked) { background: linear-gradient(120deg, var(--violet), #6366f1); color: #fff; box-shadow: 0 6px 18px rgba(124,77,255,.3); }

/* ---------- hero / landing ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 30px; align-items: center; padding-top: 34px; }
.hero p { font-size: 17px; max-width: 560px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.pill-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.pill {
    padding: 8px 14px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.pill b { color: var(--cyan); }
.hero-art { position: relative; min-height: 340px; display: grid; place-items: center; }
.orbit {
    position: absolute; width: 300px; height: 300px; border-radius: 50%;
    border: 1px dashed rgba(255,255,255,.16); animation: spin 26s linear infinite;
}
.orbit:nth-child(2) { width: 220px; height: 220px; animation-duration: 18s; animation-direction: reverse; }
.orbit-dot { position: absolute; top: -9px; right: 44%; width: 18px; height: 18px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 22px var(--cyan); }
.float-card {
    position: relative; z-index: 2; width: 280px; padding: 22px; border-radius: 22px;
    background: linear-gradient(150deg, rgba(139,92,246,.24), rgba(34,211,238,.1));
    border: 1px solid rgba(255,255,255,.2); box-shadow: var(--shadow);
    animation: float 6s ease-in-out infinite;
}
.mini-q { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.mini-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.06); margin-top: 7px; font-size: 13px; }
.mini-opt.win { background: rgba(52,211,153,.22); border: 1px solid rgba(52,211,153,.5); }

/* ---------- quiz list ---------- */
.quiz-item {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
    gap: 12px 14px; padding: 16px 18px;
    border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.035);
    transition: .2s;
}
.quiz-item .quiz-actions { grid-column: 1 / -1; }
.quiz-item:hover { background: rgba(255,255,255,.075); }
.quiz-icon { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 21px; background: linear-gradient(135deg, rgba(139,92,246,.5), rgba(34,211,238,.3)); }
.quiz-title { font-weight: 700; font-size: 16px; margin-bottom: 3px; overflow-wrap: anywhere; line-height: 1.5; }
.quiz-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; line-height: 1.7; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(139,92,246,.18); color: #c4b5fd; border: 1px solid rgba(139,92,246,.35); }
.badge.team { background: rgba(34,211,238,.14); color: #a5f3fc; border-color: rgba(34,211,238,.35); }
.badge.ok { background: rgba(52,211,153,.14); color: #a7f3d0; border-color: rgba(52,211,153,.35); }

/* ---------- builder ---------- */
.q-block { border: 1px solid var(--line); border-radius: 18px; padding: 18px; background: rgba(4,7,22,.35); margin-bottom: 14px; }
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.q-number { font-weight: 800; color: var(--cyan); font-size: 15px; }
.opt-row { display: grid; grid-template-columns: 22px 1fr 32px; gap: 10px; align-items: center; margin-bottom: 9px; }
.opt-row input[type="text"] { padding: 10px 12px; font-size: 14px; }
.opt-row select { padding: 10px 8px; font-size: 13px; }
.icon-btn {
    width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
    background: rgba(251,113,133,.12); color: #fda4af; border: 1px solid rgba(251,113,133,.28);
    cursor: pointer; font-size: 17px; line-height: 1;
}
.icon-btn:hover { background: rgba(251,113,133,.25); }
.opt-correct { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.45); }
.opt-correct-label { font-size: 11px; color: var(--ok); font-weight: 700; }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.img-preview { margin-top: 10px; }
.img-preview img { max-width: 100%; max-height: 150px; border-radius: 12px; border: 1px solid var(--line); display: block; }

/* ---------- pin / lobby ---------- */
.pin-wrap { text-align: center; padding: 10px 0 4px; }
.pin-label { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.pin {
    display: inline-block; font-family: ui-monospace, 'Courier New', monospace;
    font-size: clamp(44px, 9vw, 88px); font-weight: 800; letter-spacing: 12px;
    direction: ltr; line-height: 1.1;
    background: linear-gradient(90deg, #fff, #a5f3fc, #c4b5fd);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 0 24px rgba(34,211,238,.35));
}
.lobby-grid { display: grid; grid-template-columns: 1.4fr .6fr; gap: 20px; align-items: start; }
.count-big { font-size: 46px; font-weight: 800; line-height: 1; color: var(--cyan); }
.player-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; max-height: 220px; overflow: auto; }
.lobby-players { justify-content: center; }
.w-100 { width: 100%; }
.player-chip {
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
    background: rgba(255,255,255,.06); border: 1px solid var(--line); font-size: 13px;
    animation: pop .35s ease both;
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---------- question / options ---------- */
.q-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.q-counter { font-size: 13px; font-weight: 700; color: var(--muted); }
.timer-track { height: 9px; border-radius: 999px; background: rgba(255,255,255,.09); overflow: hidden; margin: 12px 0 22px; }
.timer-fill { height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink)); transition: width .25s linear; }
.timer-fill.danger { background: linear-gradient(90deg, #fb7185, #f59e0b); }
.question-text { font-size: clamp(21px, 3.4vw, 34px); font-weight: 700; line-height: 1.55; margin-bottom: 22px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.options.single { grid-template-columns: 1fr; }
.option {
    position: relative; overflow: hidden; min-height: 92px; padding: 16px 18px;
    display: flex; align-items: center; gap: 14px; cursor: pointer;
    border-radius: 18px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 12%, rgba(10,14,35,.9));
    color: #fff; font-size: 17px; font-weight: 700; text-align: right; transition: .18s;
}
.option:hover:not(.disabled) { transform: translateY(-3px); box-shadow: 0 12px 28px color-mix(in srgb, var(--c) 35%, transparent); }
.option.disabled { cursor: default; opacity: .82; }
.option.selected { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 45%, transparent), 0 12px 30px rgba(0,0,0,.35); }
.option.correct { border-color: var(--ok) !important; background: rgba(52,211,153,.18) !important; }
.option.wrong { border-color: var(--bad) !important; background: rgba(251,113,133,.16) !important; }
.option .fill { position: absolute; inset: auto auto 0 0; height: 100%; width: 0; background: color-mix(in srgb, var(--c) 28%, transparent); transition: width .5s ease; z-index: 0; }
.option > * { position: relative; z-index: 1; }
.option .label { flex: 1; }
.option .pct { font-size: 13px; color: rgba(255,255,255,.8); }
.shape { width: 34px; height: 34px; flex: none; background: var(--c); display: block; }
.shape.circle { border-radius: 50%; }
.shape.square { border-radius: 7px; }
.shape.triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.shape.diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.shape.star { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.shape.hex { clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); }

.answer-status { margin-top: 18px; text-align: center; font-weight: 700; color: var(--muted); }
.answer-status b { color: var(--ok); }

/* ---------- leaderboard ---------- */
.board { display: flex; flex-direction: column; gap: 8px; }
.board-row {
    display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center;
    padding: 11px 14px; border-radius: 13px; background: rgba(255,255,255,.045);
    border: 1px solid var(--line); position: relative; overflow: hidden;
    animation: slideIn .4s ease both;
}
.board-row.me { border-color: var(--cyan); background: rgba(34,211,238,.11); }
.board-row .rank { font-weight: 800; font-size: 16px; text-align: center; color: var(--gold); }
.board-row .name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .sub { font-size: 11px; color: var(--muted); }
.board-row .score { font-family: ui-monospace, monospace; font-weight: 800; color: var(--cyan); direction: ltr; }
.board-row .bar { position: absolute; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .5s; }

/* ---------- podium ---------- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; min-height: 280px; padding-top: 30px; }
.pod {
    width: min(180px, 28vw); text-align: center; padding: 18px 10px 20px; border-radius: 20px 20px 8px 8px;
    background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.02));
    border: 1px solid var(--line); animation: rise .6s ease both;
}
.pod.first { min-height: 240px; background: linear-gradient(180deg, rgba(251,191,36,.28), rgba(251,191,36,.03)); border-color: rgba(251,191,36,.5); }
.pod.second { min-height: 195px; background: linear-gradient(180deg, rgba(203,213,225,.2), transparent); }
.pod.third { min-height: 165px; background: linear-gradient(180deg, rgba(251,146,60,.2), transparent); }
.pod .medal { font-size: 34px; }
.pod .who { font-weight: 800; margin: 8px 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pts { color: var(--cyan); font-family: ui-monospace, monospace; font-weight: 800; direction: ltr; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 16px; opacity: .9; animation: fall linear forwards; }
.confetti i.emoji { width: auto; height: auto; background: none !important; border-radius: 0 !important; line-height: 1; }

.winner-banner {
    position: fixed; z-index: 60; top: 50%; left: 50%;
    width: min(92vw, 720px); padding: 26px 20px 30px; text-align: center;
    border: 1px solid rgba(255,255,255,.35); border-radius: 28px; pointer-events: none;
    background: linear-gradient(145deg, rgba(76,29,149,.96), rgba(8,145,178,.92));
    box-shadow: 0 30px 100px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.25);
    opacity: 0; transform: translate(-50%, -42%) scale(.86);
    animation: winnerIn .55s cubic-bezier(.2,1.4,.4,1) forwards,
               winnerGlow 1.6s ease-in-out .55s infinite alternate,
               winnerOut .6s ease 6.6s forwards;
}
.winner-crown { font-size: clamp(38px, 9vw, 64px); line-height: 1; filter: drop-shadow(0 6px 18px rgba(251,191,36,.6)); }
.winner-name {
    margin-top: 8px; font-weight: 900; line-height: 1.2; font-size: clamp(26px, 7.5vw, 60px);
    letter-spacing: -.5px; background: linear-gradient(90deg, #fff, #fde68a, #a5f3fc, #fff);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.35));
}
.winner-sub { margin-top: 10px; font-size: 14px; font-weight: 700; color: rgba(255,255,255,.85); }

/* ---------- misc ---------- */
.loading-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); margin-left: 5px; animation: blink 1s infinite; }
.pulse-ring { position: relative; display: inline-grid; place-items: center; width: 78px; height: 78px; }
.pulse-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--cyan); animation: ring 1.8s ease-out infinite; }
.pulse-ring span { font-size: 30px; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 8px; background: rgba(255,255,255,.08); font-size: 12px; }
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #171d3d; border: 1px solid var(--line); padding: 12px 22px; border-radius: 14px;
    font-weight: 700; z-index: 50; opacity: 0; pointer-events: none; transition: .25s; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(251,113,133,.5); color: #fecdd3; }
.toast.ok { border-color: rgba(52,211,153,.5); color: #a7f3d0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .hero, .lobby-grid { grid-template-columns: 1fr; }
    .hero-art { min-height: 250px; }
    .hero p { max-width: none; }
    .opt-row { grid-template-columns: 20px 1fr 32px; gap: 8px; }
}

@media (max-width: 820px) {
    .topbar { align-items: flex-start; }
    .nav a { padding: 7px 10px; font-size: 13px; }
    .options { grid-template-columns: 1fr; }
    .avatar-grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
    .avatar-option { font-size: 20px; border-radius: 11px; }
    .card { padding: 20px; }
    .pin { letter-spacing: 8px; }
    .podium { gap: 10px; }
    .pod { width: min(160px, 30vw); padding: 14px 8px 16px; }
    .pod .medal { font-size: 28px; }
    .teacher-item { flex-wrap: wrap; }
    .teacher-actions { flex-direction: row; flex-wrap: wrap; }
    .teacher-actions .btn { flex: 1; }
    .feature-cards { flex-direction: column; }
    .hero-actions .btn { flex: 1; }
}

@media (max-width: 600px) {
    .wrap, .narrow { width: 100%; padding-left: 14px; padding-right: 14px; }
    .wrap { padding-top: 14px; padding-bottom: 48px; }
    .topbar {
        width: 100%; padding: 12px 14px; margin-bottom: 4px;
        flex-direction: column; align-items: stretch; gap: 10px;
    }
    .brand { font-size: 18px; }
    .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 19px; }
    .nav { gap: 6px; }
    .nav a, .nav-link-btn { padding: 7px 11px; font-size: 12.5px; }
    .user-box { font-size: 12px; padding: 4px 0; }
    .card { padding: 16px; border-radius: 18px; }
    .card + .card { margin-top: 12px; }
    .btn-sm { padding: 10px 13px; }
    .score-row { gap: 14px; }
    .icon-btn { width: 36px; height: 36px; }
    h1 { font-size: clamp(26px, 8vw, 34px); letter-spacing: -.5px; }
    h2 { font-size: clamp(19px, 5.5vw, 24px); }
    h3 { font-size: 16px; }
    p { line-height: 1.7; }
    .auth-card { max-width: none; }
    .auth-title { font-size: 26px; }
    .pulse-ring { width: 64px; height: 64px; }
    .pulse-ring span { font-size: 26px; }
    .field { margin-bottom: 13px; }
    input, textarea, select { font-size: 16px; padding: 12px 13px; border-radius: 12px; }
    .pin-input { letter-spacing: 6px; font-size: 24px !important; }
    .code-input { letter-spacing: 4px; }
    textarea { min-height: 78px; }
    .seg { flex-wrap: wrap; }
    .seg label { padding: 9px 6px; font-size: 13px; }
    .q-block { padding: 14px; border-radius: 15px; }
    .opt-row { grid-template-columns: 18px 1fr 36px; gap: 6px; }
    .opt-row input[type="text"] { padding: 10px; font-size: 14px; }
    .option { min-height: 78px; padding: 13px 14px; font-size: 15px; gap: 10px; }
    .shape { width: 28px; height: 28px; }
    .question-text { font-size: clamp(19px, 5.5vw, 26px); line-height: 1.5; margin-bottom: 16px; }
    .question-image { max-height: 180px; margin-bottom: 14px; }
    .pin { font-size: clamp(36px, 13vw, 60px); letter-spacing: 5px; }
    .pin-label { font-size: 13px; }
    .count-big { font-size: 38px; }
    .player-chip { font-size: 12px; padding: 6px 10px; }
    .player-chips { max-height: 180px; }
    .board-row { grid-template-columns: 28px 1fr auto; gap: 8px; padding: 9px 10px; }
    .board-row .name, .board-row .score { font-size: 13px; }
    .podium { flex-wrap: wrap; min-height: 0; gap: 8px; padding-top: 16px; }
    .pod { width: calc(33.333% - 6px); min-width: 96px; padding: 12px 6px 14px; }
    .pod.first { min-height: 180px; }
    .pod.second { min-height: 150px; }
    .pod.third { min-height: 130px; }
    .pod .medal { font-size: 26px; }
    .pod .who { font-size: 12px; }
    .pod .pts { font-size: 13px; }
    .toast { left: 14px; right: 14px; transform: translateY(20px); max-width: none; text-align: center; }
    .toast.show { transform: translateY(0); }
    .winner-banner { padding: 20px 14px 24px; border-radius: 22px; }
    .hero-art { min-height: 210px; }
    .orbit { width: 220px; height: 220px; }
    .orbit:nth-child(2) { width: 160px; height: 160px; }
    .float-card { width: min(260px, 84vw); padding: 16px; }
    .pill-row { gap: 7px; }
    .pill { font-size: 11px; padding: 7px 11px; }
    .quiz-item, .teacher-item { padding: 12px; gap: 10px; }
    .quiz-actions .btn { min-width: calc(50% - 4px); }
    .quiz-icon { width: 38px; height: 38px; font-size: 18px; }
    .quiz-title { font-size: 14px; }
    .quiz-meta { font-size: 11px; }
    .teacher-avatar { width: 36px; height: 36px; font-size: 20px; }
}

@media (max-width: 400px) {
    .user-name { display: none; }
    .nav a, .nav-link-btn { padding: 6px 9px; font-size: 12px; }
    .avatar-grid { gap: 5px; }
    .avatar-option { font-size: 18px; border-radius: 10px; }
    .pod { width: calc(50% - 6px); }
    .option { font-size: 14px; }
    .q-topline { gap: 6px; }
    .badge { font-size: 10px; padding: 3px 8px; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-14px) } }
@keyframes pop { from { opacity: 0; transform: scale(.7) } to { opacity: 1; transform: scale(1) } }
@keyframes slideIn { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: translateY(0) } }
@keyframes rise { from { opacity: 0; transform: translateY(45px) } to { opacity: 1; transform: translateY(0) } }
@keyframes ring { 0% { transform: scale(.8); opacity: 1 } 100% { transform: scale(1.7); opacity: 0 } }
@keyframes blink { 50% { opacity: .2 } }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }
@keyframes winnerIn { to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes winnerGlow { to { box-shadow: 0 30px 120px rgba(139,92,246,.75), inset 0 1px 0 rgba(255,255,255,.35); } }
@keyframes winnerOut { to { opacity: 0; transform: translate(-50%, -62%) scale(.96); } }
