/* ЗнайКвест — оформление портала. Спокойная палитра (чернила + фиолетовый бренд +
   тёплый акцент), много воздуха, аккуратная типографика. Имена классов, от которых
   зависят JS-каталог, мастер профиля и кабинет учителя, сохранены. */

:root {
  --ink: #17152b;
  --ink-soft: #393657;
  --muted: #76748f;
  --line: #ece9f4;
  --bg: #ffffff;
  --bg-soft: #f7f6fc;
  --brand: #6c5ce7;
  --brand-d: #4a3fc4;
  --brand-tint: #efecfd;
  --accent: #ff9f43;
  --accent-d: #f2860f;
  --ok: #22c55e; --warn: #f5b32b; --bad: #ef4444;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 14px 40px rgba(31, 22, 84, 0.10);
  --shadow-sm: 0 4px 16px rgba(31, 22, 84, 0.07);
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
.container { width: min(1080px, 90vw); margin: 0 auto; }
.eyebrow { color: var(--brand); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; }
.muted { color: var(--muted); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 800; font-size: 1rem;
  padding: 12px 22px; border-radius: 12px; border: 1.5px solid transparent; cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, background .14s, border-color .14s, color .14s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #3a2300; box-shadow: 0 6px 16px rgba(255, 159, 67, .35); }
.btn-primary:hover { background: var(--accent-d); }
.btn-violet { background: var(--brand); color: #fff; }
.btn-violet:hover { background: var(--brand-d); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost-light { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.28); }
.btn-ghost-light:hover { background: rgba(255,255,255,.16); }
.btn-lg { font-size: 1.06rem; padding: 15px 28px; }
.btn-block { width: 100%; }

/* ---------- Шапка ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; gap: 18px; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 900; font-size: 1.3rem; letter-spacing: -.01em; }
.brand img { width: 34px; height: 34px; }
.brand b { color: var(--brand); }
.nav-links { display: flex; gap: 26px; margin-left: 22px; }
.nav-links a { color: var(--ink-soft); font-weight: 700; font-size: .96rem; }
.nav-links a:hover { color: var(--brand); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lang-switch { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.lang-switch button { border: none; background: none; color: var(--muted); font-weight: 800; padding: 5px 11px; border-radius: 8px; cursor: pointer; font-family: var(--font); font-size: .9rem; }
.lang-switch button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 84px 0 72px; background: radial-gradient(900px 380px at 78% 10%, var(--brand-tint), transparent 70%); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink-soft); padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: .85rem; box-shadow: var(--shadow-sm); }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.5rem); font-weight: 900; line-height: 1.06; letter-spacing: -.02em; margin: 20px 0 16px; }
.hero h1 .hl { color: var(--brand); }
.hero .lead { font-size: 1.16rem; color: var(--muted); max-width: 480px; }
.hero-cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; }
.hero-art .disc { width: min(360px, 82%); aspect-ratio: 1; border-radius: 50%; background: linear-gradient(160deg, var(--brand-tint), #fff); display: grid; place-items: center; box-shadow: var(--shadow); }
.hero-art img { width: 64%; animation: bob 5s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-12px) rotate(1.5deg); } }

/* ---------- Полоса ценности ---------- */
.value { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.value-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; padding: 34px 0; }
.value-item { display: flex; gap: 14px; align-items: flex-start; }
.value-item .vi { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); font-size: 1.2rem; }
.value-item h4 { font-size: 1.02rem; font-weight: 800; margin-bottom: 2px; }
.value-item p { color: var(--muted); font-size: .94rem; line-height: 1.45; }

/* ---------- Секции ---------- */
.section { padding: 76px 0; }
.section-head { max-width: 620px; margin: 0 auto 44px; text-align: center; }
.section-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); font-weight: 900; letter-spacing: -.02em; margin: 8px 0; }
.section-head p { color: var(--muted); font-size: 1.06rem; }

/* как это работает — компактный ряд */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.step { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 22px; }
.step .n { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 900; display: grid; place-items: center; margin-bottom: 14px; }
.step h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: .96rem; }

/* каталог игр */
.catalog-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 24px; }
.catalog-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 900; letter-spacing: -.02em; }
.profile-chip { display: inline-flex; align-items: center; gap: 11px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 9px 14px; box-shadow: var(--shadow-sm); }
.profile-chip .pc-flag { font-size: 1.5rem; }
.profile-chip .pc-text { line-height: 1.25; font-size: .92rem; }
.profile-chip .pc-text b { display: block; }
.profile-chip .pc-text span { color: var(--muted); font-size: .84rem; }
.profile-chip .pc-edit { color: var(--brand); font-weight: 800; cursor: pointer; white-space: nowrap; }
.games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.game-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .16s ease, box-shadow .16s ease; display: flex; flex-direction: column; }
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.game-thumb { aspect-ratio: 16/10; position: relative; display: grid; place-items: center; color: #fff; font-size: 2.6rem; }
.game-thumb .tag { position: absolute; top: 11px; left: 11px; background: rgba(0,0,0,.32); backdrop-filter: blur(4px); color: #fff; font-weight: 700; font-size: .74rem; padding: 4px 10px; border-radius: 999px; }
.game-thumb .stars { position: absolute; top: 11px; right: 12px; color: #ffd479; font-size: .9rem; }
.game-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.game-body h3 { font-size: 1.18rem; font-weight: 900; }
.game-body p { color: var(--muted); font-size: .92rem; flex: 1; }
.game-meta { display: flex; gap: 7px; flex-wrap: wrap; }
.pill { background: var(--brand-tint); color: var(--brand); font-weight: 700; font-size: .76rem; padding: 3px 11px; border-radius: 999px; }
.game-card.soon { opacity: .72; }
.game-card.soon .game-thumb { filter: saturate(.5); }

/* учителям */
.teach { background: var(--bg-soft); border-top: 1px solid var(--line); }
.teach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.teach-grid h2 { font-size: clamp(1.7rem, 3.2vw, 2.2rem); font-weight: 900; letter-spacing: -.02em; margin: 8px 0 12px; }
.teach-grid .lead { color: var(--muted); font-size: 1.06rem; }
.teach-list { list-style: none; margin: 18px 0 24px; display: flex; flex-direction: column; gap: 10px; }
.teach-list li { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.teach-list li::before { content: ""; flex: none; width: 18px; height: 18px; border-radius: 6px; background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); }

/* footer */
.footer { background: var(--ink); color: rgba(255,255,255,.65); padding: 44px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr; gap: 28px; }
.footer .brand { color: #fff; font-size: 1.2rem; margin-bottom: 10px; }
.footer p { font-size: .92rem; max-width: 280px; }
.footer h4 { color: #fff; font-size: .95rem; margin-bottom: 12px; }
.footer a { display: block; padding: 4px 0; color: rgba(255,255,255,.65); font-size: .92rem; }
.footer a:hover { color: #fff; }
.footer .copyright { border-top: 1px solid rgba(255,255,255,.12); margin-top: 30px; padding-top: 18px; text-align: center; font-size: .85rem; color: rgba(255,255,255,.5); }

/* ---------- Карточки данных (используются и в кабинете) ---------- */
.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.progress { width: 100%; border-collapse: collapse; }
table.progress th, table.progress td { padding: 13px 16px; text-align: left; }
table.progress thead th { background: var(--bg-soft); color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
table.progress tbody tr { border-top: 1px solid var(--line); }
table.progress tbody tr:hover { background: var(--bg-soft); }
table.progress .num { font-variant-numeric: tabular-nums; font-weight: 800; }
.acc-bar { display: flex; align-items: center; gap: 9px; }
.acc-bar .track { width: 84px; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.acc-bar .fill { height: 100%; border-radius: 999px; }
.topic-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.topic-chip { font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--brand-tint); color: var(--brand); }

/* ---------- Модалки (мастер профиля, вход по коду) ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(23,21,43,.55); backdrop-filter: blur(5px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 18px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg); width: min(600px, 96vw); max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 70px rgba(23,21,43,.35); }
.modal-head { padding: 20px 24px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); }
.modal-head img { width: 40px; }
.modal-head h3 { font-size: 1.18rem; font-weight: 900; }
.modal-head p { color: var(--muted); font-size: .88rem; }
.modal-head .x { margin-left: auto; background: var(--bg-soft); border: none; color: var(--ink-soft); width: 34px; height: 34px; border-radius: 10px; font-size: 1.1rem; cursor: pointer; }
.modal-head .x:hover { background: var(--line); }
.steps-bar { display: flex; gap: 6px; padding: 16px 24px 0; }
.steps-bar .sd { flex: 1; height: 5px; border-radius: 999px; background: var(--line); transition: background .2s; }
.steps-bar .sd.active { background: var(--brand); }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-body h4 { font-size: 1.16rem; font-weight: 800; margin-bottom: 4px; }
.modal-body .hint { color: var(--muted); margin-bottom: 18px; font-size: .95rem; }
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.opt-grid.cols3 { grid-template-columns: repeat(3, 1fr); }
.opt { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; font-size: .98rem; transition: border-color .14s, background .14s, transform .1s; text-align: left; }
.opt:hover { border-color: var(--brand); transform: translateY(-1px); }
.opt.selected { border-color: var(--brand); background: var(--brand-tint); }
.opt .flag { font-size: 1.4rem; }
.opt .check { margin-left: auto; color: var(--brand); font-weight: 900; opacity: 0; }
.opt.selected .check { opacity: 1; }
.subject-group { margin-bottom: 16px; }
.subject-group .sg-title { font-weight: 900; color: var(--brand); margin-bottom: 9px; font-size: .92rem; text-transform: uppercase; letter-spacing: .05em; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.modal-foot .spacer { flex: 1; }
.btn-text { background: none; border: none; color: var(--muted); font-weight: 800; cursor: pointer; font-family: var(--font); font-size: .98rem; }
.btn-text:hover { color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: .9rem; }
.field input, .field select { padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 11px; font-family: var(--font); font-size: 1rem; background: #fff; color: var(--ink); transition: border-color .14s; }
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); }
.form-err { color: var(--bad); font-weight: 700; font-size: .9rem; min-height: 1.1em; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); z-index: 200; transition: transform .3s; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- Кабинет учителя (dashboard.html) ---------- */
.dash-bg { min-height: 100vh; background: var(--bg-soft); }
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 30px 16px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); width: min(430px, 96vw); overflow: hidden; }
.auth-card .ac-head { padding: 26px; text-align: center; border-bottom: 1px solid var(--line); }
.auth-card .ac-head img { width: 56px; margin: 0 auto 8px; }
.auth-card .ac-head h2 { font-size: 1.4rem; font-weight: 900; }
.auth-card .ac-head p { color: var(--muted); font-size: .94rem; }
.auth-tabs { display: flex; }
.auth-tabs button { flex: 1; border: none; background: none; padding: 15px; font-family: var(--font); font-weight: 800; font-size: 1rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.auth-tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.auth-form { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }

.dash-top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.dash-user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.dash-user .uname { font-weight: 800; }
.dash-main { padding: 34px 0 60px; }
.dash-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-head h1 { font-size: 1.7rem; font-weight: 900; letter-spacing: -.02em; }
.dash-head .spacer { flex: 1; }
.class-tabs { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 22px; }
.class-tab { background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 16px; cursor: pointer; font-weight: 800; transition: all .14s; }
.class-tab:hover { border-color: var(--brand); }
.class-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.class-tab .cnt { opacity: .7; font-weight: 700; margin-left: 6px; }
.joincode-box { display: inline-flex; align-items: center; gap: 14px; background: #fff; border: 1.5px dashed var(--accent); border-radius: 14px; padding: 12px 18px; }
.joincode-box .code { font-size: 1.6rem; font-weight: 900; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.joincode-box .lbl { color: var(--accent-d); font-weight: 800; font-size: .76rem; text-transform: uppercase; }
.joincode-box button { background: var(--accent); border: none; border-radius: 9px; padding: 7px 13px; font-weight: 800; cursor: pointer; font-family: var(--font); }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.kpi .k { font-size: 1.9rem; font-weight: 900; color: var(--brand); }
.kpi .t { color: var(--muted); font-weight: 700; font-size: .92rem; }
.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-state img { width: 76px; margin: 0 auto 14px; opacity: .9; }
.empty-state h3 { color: var(--ink); font-size: 1.2rem; margin-bottom: 6px; }

/* ---------- Адаптив ---------- */
@media (max-width: 880px) {
  .hero-grid, .teach-grid { grid-template-columns: 1fr; text-align: center; }
  .hero .lead { margin: 0 auto; } .hero-cta { justify-content: center; }
  .hero-art { order: -1; }
  .value-grid { grid-template-columns: 1fr; gap: 18px; }
  .value-item { text-align: left; }
  .steps, .games { grid-template-columns: 1fr; }
  .teach-list { text-align: left; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open { display: flex; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: #fff; border-bottom: 1px solid var(--line); padding: 16px 6vw; gap: 14px; }
  table.progress thead { display: none; }
  table.progress, table.progress tbody, table.progress tr, table.progress td { display: block; width: 100%; }
  table.progress tr { padding: 8px 0; }
  table.progress td { padding: 5px 16px; }
  table.progress td::before { content: attr(data-l); display: inline-block; width: 96px; color: var(--muted); font-weight: 700; }
}
@media (max-width: 520px) {
  .opt-grid, .opt-grid.cols3 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}
