/* 180+ Mini App — brand palette from the logo:
   violet #3F2B9A → deep indigo #1A1040 → azure #065DA7, silver #F0F0F0 */

:root {
  --bg-1: #1a1040;
  --bg-2: #2a1b6b;
  --accent-1: #3f2b9a;
  --accent-2: #065da7;
  --azure: #1e90ff;
  --text: #f0f0f0;
  --text-dim: #b9b3d9;
  --card: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.13);
  --good: #2ecc71;
  --bad: #ff5e6c;
  --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* атрибут hidden має перемагати будь-який display з класів (.btn тощо) */
[hidden] { display: none !important; }

/* стабільний жолоб скролбара: у повноекранному режимі контент не зсувається вправо */
html { scrollbar-gutter: stable; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-1);
  color: var(--text);
  min-height: 100vh;
}
/* градієнт окремим fixed-шаром: background-attachment:fixed глючить на Windows/4K */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 55%, #0c2f63 130%);
}

#zoom-toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200;
  padding: 8px 16px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--card-border); backdrop-filter: blur(10px);
  font-weight: 800; opacity: 0; transition: opacity .2s; pointer-events: none; }
#zoom-toast.show { opacity: 1; }
#zoom-ctl { position: fixed; right: 14px; bottom: 14px; z-index: 95;
  display: flex; align-items: center; gap: 2px; padding: 4px 6px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 999px;
  backdrop-filter: blur(10px); opacity: .55; transition: opacity .15s; }
#zoom-ctl:hover { opacity: 1; }
#zoom-ctl button { background: none; border: none; color: var(--text); font-size: 17px;
  font-weight: 800; width: 28px; height: 28px; cursor: pointer; line-height: 1; }
#zoom-ctl span { font-size: 12px; font-weight: 700; color: var(--text-dim);
  min-width: 40px; text-align: center; cursor: pointer; }

#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 90px; }

/* ---------- loader ---------- */
.loader-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; }
.hex-loader { font-size: 64px; animation: spin 1.6s ease-in-out infinite; color: var(--azure); }
.loader-text { font-size: 28px; font-weight: 800; letter-spacing: 4px; margin-top: 8px; }
@keyframes spin { 50% { transform: rotate(180deg) scale(1.15); } }

/* ---------- generic ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn {
  display: block; width: 100%;
  border: none; border-radius: var(--radius);
  padding: 16px; margin-bottom: 10px;
  font-size: 17px; font-weight: 700; color: #fff;
  background: linear-gradient(100deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 6px 22px rgba(63, 43, 154, 0.45);
  cursor: pointer; transition: transform .08s, opacity .2s;
}
.btn:active { transform: scale(0.97); }
.btn.secondary { background: var(--card); border: 1px solid var(--card-border); box-shadow: none; }
.btn.small { padding: 11px; font-size: 15px; margin-bottom: 8px; }

.title { font-size: 22px; font-weight: 800; margin: 6px 0 14px; }
.subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 14px; }

/* шапка екрана: кнопка-іконка зліва, назва ІДЕАЛЬНО по центру (симетричний грід) */
.topbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  gap: 10px; margin-bottom: 14px; }
.topbar .back { background: var(--card); border: 1px solid var(--card-border); color: var(--text);
  border-radius: 12px; width: 44px; height: 38px; padding: 0; font-size: 17px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; }
.topbar .grow { font-weight: 800; font-size: 17px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- home ---------- */
.hero { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
/* web-only header actions (fullscreen / logout) — clean icon buttons */
.hero-btn { flex: 0 0 auto; width: 40px; height: 40px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0;
  background: var(--card); border: 1px solid var(--card-border); color: var(--text-dim);
  border-radius: 12px; cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease; }
.hero-btn:hover { color: var(--text); border-color: var(--accent-2); background: rgba(255,255,255,.04); }
.hero-btn:active { transform: scale(.9); }
.hero-btn svg { display: block; }
.hero .hex { width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 17px; }
.hex-logo { width: 56px; height: 56px; border-radius: 16px; display: block;
  box-shadow: 0 6px 20px rgba(63, 43, 154, .5); }
.hex-loader-img { width: 84px; height: 84px; border-radius: 22px;
  animation: pulse 1.4s ease-in-out infinite; box-shadow: 0 10px 36px rgba(6, 93, 167, .5); }
@keyframes pulse { 50% { transform: scale(1.09); } }
.hero h1 { font-size: 20px; }
.hero p { color: var(--text-dim); font-size: 13px; }

.subjects { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.subject-chip { padding: 11px 17px; border-radius: 999px; font-size: 15px; font-weight: 700;
  background: var(--card); border: 1px solid var(--card-border); color: var(--text-dim); cursor: pointer;
  transition: background .22s ease, color .22s ease, border-color .22s ease, transform .12s ease; }
.subject-chip:active { transform: scale(.94); }
.subject-chip.active { background: linear-gradient(100deg, var(--accent-1), var(--accent-2));
  color: #fff; border-color: transparent; }
/* сесія, яку користувач уже проходив */
.subject-chip.done { background: linear-gradient(100deg, #1d7a4f, #2eaf6e);
  color: #eafff3; border-color: transparent; }
.subject-chip.done.active { background: linear-gradient(100deg, #23995f, #36d184);
  box-shadow: 0 0 0 2px rgba(54, 209, 132, .45); }

.mode-card { position: relative; overflow: hidden; cursor: pointer; }
.mode-card h3 { font-size: 18px; margin-bottom: 4px; }
.mode-card p { color: var(--text-dim); font-size: 13px; }
.mode-card .emoji { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 34px; opacity: .85; }

/* головне меню: три режими одним рядком */
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row3 .card { margin-bottom: 0; text-align: center; padding: 14px 6px; }
.row3 .m-emoji { font-size: 26px; margin-bottom: 4px; }
.row3 h3 { font-size: 15px; margin-bottom: 2px; }
.row3 p { font-size: 11px; color: var(--text-dim); }
@media (max-width: 359px) { .row3 p { display: none; } }

/* ---------- list buttons ---------- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid3 .btn { margin-bottom: 0; padding: 14px 8px; }

/* ---------- player ---------- */
.progress-wrap { height: 7px; border-radius: 999px; background: rgba(255,255,255,.12); margin-bottom: 10px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-1), var(--azure)); transition: width .25s; }
.player-meta { display: flex; justify-content: space-between; align-items: center;
  color: var(--text-dim); font-size: 14px; margin-bottom: 10px; min-height: 28px; }
.player-meta b { color: var(--text); }
.meta-right { display: inline-flex; align-items: center; gap: 6px; }
#live-timer { font-variant-numeric: tabular-nums; min-width: 38px; display: inline-block; }

/* ---------- чернетка ---------- */
.scratch-wrap { margin: 0 0 10px; border: 1px dashed var(--card-border);
  border-radius: 14px; background: rgba(255,255,255,.04); overflow: hidden; }
/* довге затискання на канвасі не викликає виділення/копіювання */
.scratch-wrap, .scratch-full, #scratch, #scratch-full-cv {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.scratch-head { display: flex; justify-content: space-between; align-items: center;
  padding: 4px 12px 0; font-size: 13px; color: var(--text-dim); }
.scratch-head .link-btn { padding: 4px 0; }
.scr-btn { width: 32px; height: 30px; border-radius: 10px; cursor: pointer;
  background: linear-gradient(100deg, var(--accent-1), var(--accent-2));
  border: 1px solid rgba(255,255,255,.25); color: #fff;
  font-size: 19px; font-weight: 800; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.scr-btn.scr-danger { background: rgba(255, 94, 108, .25); border-color: rgba(255, 94, 108, .5); font-size: 15px; }
.scr-btn svg { display: block; }
.scr-btn.active { background: #fff; color: var(--accent-1); border-color: #fff; }
/* канвас виключений із зум-контексту UI — малюється завжди 1:1 */
.scratch-wrap, .scratch-full { zoom: var(--inv-zoom, 1); }
#scratch { display: block; width: 100%; height: 220px; touch-action: none; cursor: crosshair; }
.scratch-full { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 80%); }
.scratch-full .scratch-head { padding: calc(10px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)) 14px 6px; font-size: 15px; }
.scratch-full .link-btn { font-size: 18px; padding: 4px 8px; }
.scratch-full .hint-x { font-size: 22px; }
#scratch-full-cv { flex: 1; width: 100%; touch-action: none; cursor: crosshair; }

.q-images img { width: 100%; border-radius: 14px; margin-bottom: 10px; background: #fff; display: block; }

.answers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 10px 0; }
.answers.cols-4 { grid-template-columns: repeat(4, 1fr); }
.answers.cols-6 { grid-template-columns: repeat(6, 1fr); }
.answers.cols-7 { grid-template-columns: repeat(7, 1fr); }
.answers.cols-8 { grid-template-columns: repeat(8, 1fr); }
.ans-btn { padding: 14px 0; border-radius: 14px; border: 1px solid var(--card-border);
  background: var(--card); color: var(--text); font-size: 17px; font-weight: 700; cursor: pointer; }
.ans-btn.selected { background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); border-color: transparent; }
.ans-btn.dim { opacity: .45; }

/* відповідності: пусті ячейки 1..N + літери (тап або перетягування) */
.match-slots { display: flex; gap: 8px; margin: 10px 0; }
.m-slot { flex: 1; min-height: 52px; border: 1.5px dashed var(--card-border); border-radius: 13px;
  background: rgba(255,255,255,.04); display: flex; align-items: center; justify-content: center;
  gap: 7px; cursor: pointer; transition: border-color .12s, background .12s; }
.m-slot .m-num { color: var(--text-dim); font-weight: 800; font-size: 14px; }
.m-slot .m-val { font-size: 19px; font-weight: 800; min-width: 14px; }
.m-slot.filled { border-style: solid; background: rgba(63,43,154,.4); border-color: rgba(255,255,255,.25); }
.m-slot.hot, .m-slot.drop { border-color: var(--azure); box-shadow: 0 0 0 1.5px var(--azure);
  background: rgba(30,144,255,.12); }
.m-letter { touch-action: none; }
.m-letter.dragging { opacity: .4; }
.drag-ghost { position: fixed; z-index: 300; pointer-events: none;
  transform: translate(-50%, -120%); width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); color: #fff;
  font-size: 22px; font-weight: 800; box-shadow: 0 10px 28px rgba(0,0,0,.45); }
.match-hint { color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }

.short-input { width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--card-border);
  background: rgba(0,0,0,.25); color: var(--text); font-size: 17px; margin: 10px 0; outline: none; }
.short-input:focus { border-color: var(--azure); }

.player-nav { display: flex; gap: 8px; margin: 10px 0; }
.player-nav .btn { margin-bottom: 0; }
.player-nav .nav-cnt { flex: 1.4; }
.player-nav .nav-arr { flex: 1; }

.nav-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 12px 0; }
.nav-cell { padding: 12px 0; text-align: center; border-radius: 12px; font-weight: 700; cursor: pointer;
  background: var(--card); border: 1px solid var(--card-border); }
.nav-cell.answered { background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); border-color: transparent; }
.nav-cell.current { outline: 2px solid var(--azure); }

/* ---------- results ---------- */
.score-hero { text-align: center; padding: 26px 16px; }
.score-hero .nmt { font-size: 56px; font-weight: 900;
  background: linear-gradient(100deg, #9d8cff, var(--azure));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.score-hero .sub { color: var(--text-dim); margin-top: 4px; }
.dots { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 14px; }
.dot { width: 13px; height: 13px; border-radius: 50%; }
.dot.g { background: var(--good); } .dot.b { background: var(--bad); } .dot.n { background: rgba(255,255,255,.2); }

.review-item { border-left: 4px solid var(--bad); }
.review-item.ok { border-left-color: var(--good); }
.review-item .rev-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.review-item .rev-answers { font-size: 14px; color: var(--text-dim); margin-bottom: 6px; }
.review-item .rev-answers b { color: var(--text); }
.review-item img { width: 100%; border-radius: 12px; margin-top: 8px; background: #fff; }
.expl { white-space: pre-wrap; font-size: 14px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 12px; margin-top: 8px; }
/* Rendered LaTeX-Markdown explanation (apka). KaTeX needs normal white-space. */
.expl .md { white-space: normal; line-height: 1.5; }
.expl .md p { margin: 0 0 8px; }
.expl .md p:last-child, .expl .md ol:last-child, .expl .md ul:last-child { margin-bottom: 0; }
.expl .md ol, .expl .md ul { margin: 0 0 8px; padding-left: 22px; }
.expl .md li { margin: 4px 0; }
.expl .md strong { color: #fff; }
.expl .md code { background: rgba(255,255,255,.1); border-radius: 5px; padding: 1px 5px; font-size: 13px; }
/* Block formulas: let wide ones scroll instead of overflowing the card. */
.expl .md .katex-display { margin: 8px 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.expl .md .katex { font-size: 1.05em; }
.link-btn { background: none; border: none; color: var(--azure); font-size: 14px; font-weight: 700; cursor: pointer; padding: 6px 0; }

.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }
/* pure-opacity fade (no vertical "pull") for the themes list */
@keyframes qfade { from { opacity: 0; } }

/* ---------- cascading picker ---------- */
.picker { padding-bottom: 8px; }
.lvl-label { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-dim); margin: 10px 2px 8px; }
/* всі варіанти видно одразу — переносимо рядками, без горизонтального скролу */
.lvl-row { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; }
.subject-chip.wide { padding: 9px 18px; }
/* pencil button to change the 4th subject — same font size as the chips */
.subject-chip.chip-edit { padding: 9px 12px; opacity: .9; }
.subject-chip.chip-add { border-style: dashed; color: var(--text-dim); }
/* Subject picker: ALWAYS two rows on phone — 3 mandatory on row 1,
   (4th subject + ✏️) on row 2. Chips share a uniform size. */
#row-subj { display: flex; flex-wrap: wrap; gap: 6px; }
/* chips sized to their text (not stretched) — keeps gaps tight */
#row-subj .subject-chip { flex: 0 0 auto; }
/* forced line break after the 2nd subject → row1=[math,hist], row2=[mova,4th,✏️] */
.lvl-break { flex-basis: 100%; width: 100%; height: 0; margin: 0; padding: 0; }
/* desktop / wide: single row, sized to content (no forced break) */
@media (min-width: 680px) {
  #row-subj .subject-chip { flex: 0 0 auto; }
  .lvl-break { display: none; }
}
/* web (browser, any width): force the whole subject picker onto ONE row,
   horizontally scrollable if it overflows — no wrapping, no forced break */
body.web #row-subj { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
body.web #row-subj::-webkit-scrollbar { display: none; }
body.web .lvl-break { display: none; }
.lvl-hint { color: var(--text-dim); font-size: 14px; padding: 6px 2px; }
.lvl-anim:not([hidden]) { animation: slideIn .34s cubic-bezier(.22,.61,.36,1); }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } }
.picker .btn { margin-top: 10px; margin-bottom: 6px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.row2 .card { margin-bottom: 0; min-width: 0; }
.row2 .mode-card h3 { font-size: 16px; }
.row2 .mode-card p { font-size: 12px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100;
  background: rgba(31, 22, 70, .8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; animation: fade .2s ease; }
/* хедер Telegram у фулскріні перекриває верх — кнопки опускаємо нижче safe area */
.lb-close { position: absolute;
  top: calc(14px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  right: 14px; z-index: 101;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3);
  background: rgba(63, 43, 154, .85); color: #fff; font-size: 20px; font-weight: 700;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.lb-stage { flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none;
  padding-top: calc(8px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
.lb-stage img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff;
  transition: transform .06s linear; transform-origin: center; user-select: none; }
.q-images img, .review-item img { cursor: zoom-in; }
/* скарга — окремо, праворуч, не лізе в очі */
.rev-report { display: block; margin-left: auto; text-align: right;
  color: var(--text-dim); font-size: 12.5px; opacity: .75; padding: 2px 0; }
.rev-report:active { opacity: 1; }
.gear { background: none; border: none; font-size: 16px; cursor: pointer;
  padding: 0 0 0 6px; vertical-align: middle; opacity: .85; }
.topbar .gear { justify-self: end; font-size: 18px; }
.lb-arr { position: absolute; top: 50%; transform: translateY(-50%); z-index: 101;
  width: 46px; height: 64px; border-radius: 14px; border: 1px solid rgba(255,255,255,.3);
  background: rgba(63, 43, 154, .85); color: #fff;
  font-size: 30px; line-height: 1; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-arr:active { background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); }
.lb-count { position: absolute;
  top: calc(22px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  left: 50%; transform: translateX(-50%); z-index: 101;
  padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.3);
  background: rgba(63, 43, 154, .85); color: #fff;
  font-size: 14px; font-weight: 700; }

/* ---------- random verdict ---------- */
.verdict-ok { border-left: 4px solid var(--good); }
.verdict-bad { border-left: 4px solid var(--bad); }

/* ---------- stats ---------- */
.stat-big { text-align: center; padding: 18px 8px; }
.stat-big .num { font-size: 34px; font-weight: 900;
  background: linear-gradient(100deg, #9d8cff, var(--azure));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-big .cap { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.stat-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 2px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,.07);
  overflow-wrap: anywhere; }
.stat-row:last-child { border-bottom: none; }
.stat-row.dim { color: var(--text-dim); }
.stat-row span:first-child { flex-shrink: 0; max-width: 55%; }
.stat-row span:last-child { text-align: right; white-space: nowrap; }
.stat-big { min-width: 0; }
.stat-big .num { font-size: clamp(22px, 8vw, 34px); overflow: hidden; text-overflow: ellipsis; }

/* ---------- admin analytics dashboard ---------- */
.an-toggle { display: flex; gap: 8px; margin: 4px 0 12px; }
.an-win { flex: 1; padding: 9px 0; border-radius: 12px; border: 1px solid rgba(255,255,255,.12);
  background: var(--card); color: var(--text-dim); font-weight: 700; font-size: 14px; cursor: pointer; }
.an-win.active { background: var(--accent, #6c5ce7); color: #fff; border-color: transparent; }
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.an-kpi { background: var(--card); border-radius: 16px; padding: 14px 12px; text-align: center;
  min-width: 0; }
.an-kpi-v { font-size: clamp(22px, 7vw, 30px); font-weight: 800; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; }
.an-kpi-l { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.an-kpi-s { font-size: 11px; color: var(--text-dim); opacity: .8; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-fun-row { margin: 10px 0; }
.an-fun-h { display: flex; justify-content: space-between; gap: 8px; font-size: 13px;
  font-weight: 600; margin-bottom: 5px; }
.an-fun-h .dim { color: var(--text-dim); font-weight: 400; font-size: 12px; white-space: nowrap; }
.an-fun-bars { display: flex; flex-direction: column; gap: 4px; }
.an-bar { height: 22px; border-radius: 6px; display: flex; align-items: center; min-width: 28px;
  transition: width .3s ease; }
.an-bar span { font-size: 11px; font-weight: 700; color: #fff; padding: 0 7px; white-space: nowrap; }
.an-bar.started { background: #3a86ff; }
.an-bar.finished { background: #2eaf6e; }
.an-bar.abandoned { background: #e74c3c; }
.an-sep { height: 1px; background: rgba(255,255,255,.1); margin: 12px 0; }
.an-q { cursor: pointer; }
.an-friction .stat-row span:last-child { font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); }

/* ---------- admin ---------- */
.admin-q { display: flex; align-items: center; gap: 10px; padding: 10px 2px;
  border-bottom: 1px solid rgba(255,255,255,.07); cursor: pointer; }
.admin-q:last-child { border-bottom: none; }
.admin-q .qn { font-weight: 800; min-width: 34px; }
.admin-q .qmeta { flex: 1; font-size: 13px; color: var(--text-dim); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.admin-q .qmeta b { color: var(--text); }
.field-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-dim); margin: 12px 2px 6px; }
.field { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--card-border);
  background: rgba(0,0,0,.25); color: var(--text); font-size: 15px; outline: none; font-family: inherit; }
textarea.field { min-height: 110px; resize: vertical; }
.btn.danger { background: linear-gradient(100deg, #8e2436, #c0392b); box-shadow: 0 6px 22px rgba(192,57,43,.35); }
.sess-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.sess-actions .btn { margin-bottom: 0; }

/* ---------- партіал-мітки, match single-level, calc ---------- */
.dot.y { background: #f1c40f; }
.review-item.part { border-left-color: #f1c40f; }
select.field { appearance: none; -webkit-appearance: none; }
.score-hero .nmt .of { font-size: 26px; color: var(--text-dim); -webkit-text-fill-color: var(--text-dim); }

/* ---------- swipe anim + hint ---------- */
.slide-l { animation: slideL .22s ease; }
.slide-r { animation: slideR .22s ease; }
@keyframes slideL { from { opacity: .4; transform: translateX(60px); } }
@keyframes slideR { from { opacity: .4; transform: translateX(-60px); } }
.swipe-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(100deg, rgba(63,43,154,.45), rgba(6,93,167,.45));
  border: 1px solid var(--card-border); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.hint-x { background: none; border: none; color: var(--text-dim); font-size: 16px; cursor: pointer; padding: 2px 6px; }

/* ---------- fullscreen safe area (Telegram Bot API 8+) ---------- */
#app {
  padding-top: calc(16px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
}
body { touch-action: pan-y; }
/* свайп вниз не оновлює/не тягне сторінку (браузерний pull-to-refresh) */
html, body { overscroll-behavior-y: none; }

/* ---------- довідкові матеріали ---------- */
.mats-overlay { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  max-height: 46vh; overflow-y: auto;
  background: rgba(16, 10, 48, .97); backdrop-filter: blur(14px);
  border-top: 1px solid var(--card-border); border-radius: 20px 20px 0 0;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0,0,0,.5); animation: sheetUp .22s ease; }
@keyframes sheetUp { from { transform: translateY(40%); opacity: .5; } }
.mats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mat-thumb { width: 100%; aspect-ratio: 3/4; object-fit: cover; object-position: top;
  border-radius: 10px; background: #fff; cursor: zoom-in; }
.sheet-bg { position: fixed; inset: 0; z-index: -1; }
.mats-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
/* рядок налаштування з повзунком */
.set-row { display: flex; justify-content: space-between; align-items: center;
  padding: 5px 2px; font-size: 14px; font-weight: 600; }
.set-row .switch { width: 42px; height: 24px; }
.set-row .switch .knob { width: 18px; height: 18px; }
.set-row .switch.on .knob { left: 21px; }
.switch { width: 48px; height: 28px; border-radius: 999px; position: relative;
  background: rgba(255,255,255,.14); border: 1px solid var(--card-border);
  cursor: pointer; transition: background .15s; padding: 0; flex-shrink: 0; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); border-color: transparent; }
.switch.on .knob { left: 23px; }
/* компактна шторка на ПК — праворуч унизу, не на всю ширину */
@media (min-width: 900px) {
  .sheet-compact { left: auto; right: 24px; bottom: 24px; width: 360px;
    border-radius: 20px; border: 1px solid var(--card-border); }
}
.mats-head .hint-x { font-size: 22px; }
.mats-body img { width: 100%; border-radius: 12px; margin-bottom: 10px; background: #fff; cursor: zoom-in; }
.mode-card.centered { text-align: center; }
.spec-match { display: block; width: 100%; text-align: left; padding: 10px 12px; margin-top: 6px;
  border-radius: 12px; border: 1px solid var(--card-border); background: var(--card);
  color: var(--text); font-size: 14px; cursor: pointer; }
.spec-match:active { background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); }

/* ---------- stats (1:1 з ботом) ---------- */
.stat-subj { margin-bottom: 12px; }
.stat-subj .dim2 { color: var(--text-dim); font-size: 14px; margin-top: 2px; }
.fb-area { width: 100%; resize: vertical; min-height: 120px; font-family: inherit; }

/* ---------- confirm (Enter/Esc) ---------- */
.confirm-ov { position: fixed; inset: 0; z-index: 120; background: rgba(8,4,28,.6);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  animation: fade .15s ease; }
.confirm-box { background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--card-border); border-radius: 18px; padding: 18px;
  width: min(92vw, 380px); box-shadow: 0 16px 50px rgba(0,0,0,.5); }
.confirm-box p { font-weight: 700; margin-bottom: 14px; }
.confirm-row { display: flex; gap: 8px; }
.confirm-row .btn { margin-bottom: 0; flex: 1; }
.confirm-hint { color: var(--text-dim); font-size: 12px; margin-top: 10px; text-align: center; }

/* ---------- web version (desktop) ---------- */
@media (min-width: 900px) {
  #app { max-width: 760px; }
  .q-images img { max-height: 72vh; object-fit: contain; }
  .nav-grid { grid-template-columns: repeat(10, 1fr); }
}
/* ПК: завдання зліва, чернетка справа (⚙️ дозволяє поміняти місцями).
   Без чернетки — звичайна центрована колонка. */
@media (min-width: 1100px) {
  #app:has(.play-wrap.has-cv) { max-width: 1240px; }
  .play-wrap.has-cv { display: grid; grid-template-columns: minmax(0, 600px) minmax(0, 1fr);
    gap: 18px; align-items: start; }
  .play-wrap.has-cv.swap { grid-template-columns: minmax(0, 1fr) minmax(0, 600px); }
  .play-wrap.has-cv.swap .play-col { order: 2; }
  .play-wrap.has-cv .scratch-wrap { position: sticky; top: 12px; margin: 0; }
}
#tg-login iframe { border-radius: 14px; }

/* ---------- адмін: керування фото завдання ---------- */
.adm-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.adm-img { position: relative; }
.adm-img img { height: 90px; border-radius: 8px; background: #fff; display: block; cursor: zoom-in; }
.adm-img-x { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px;
  border-radius: 50%; border: 1px solid var(--card-border); background: var(--bad);
  color: #fff; font-size: 13px; cursor: pointer; line-height: 1; }
.paste-zone { border: 1.5px dashed var(--card-border); border-radius: 12px;
  padding: 14px; text-align: center; color: var(--text-dim); font-size: 14px;
  cursor: text; outline: none; }
.paste-zone:focus { border-color: var(--azure); color: var(--text); }

/* минулі спроби */
.attempt-row { cursor: pointer; }
.attempt-row.noreview { opacity: .55; cursor: default; }

/* ---------------- режим «За темами» ---------------- */
.seg-toggle { display: flex; gap: 6px; margin: 12px 0 4px; background: var(--card);
  border: 1px solid var(--card-border); border-radius: 999px; padding: 4px; }
.seg-toggle button { flex: 1; padding: 9px 6px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-dim); font-size: 14px; font-weight: 700; cursor: pointer; }
.seg-toggle button.active { background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); color: #fff; }

/* ---------------- калькулятор: куди я проходжу ---------------- */
.bd-mini { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
  margin-top: 8px; font-size: 11px; color: var(--text-dim); }
.bd-mini b { color: var(--text); font-weight: 700; }
.rec-box { margin-top: 14px; }
.rec-title { font-size: 15px; font-weight: 800; margin: 18px 2px 4px; }
.rec-title .sub { font-size: 11px; font-weight: 500; color: var(--text-dim); }
.rec-kse { display: block; text-decoration: none; color: var(--text); margin-top: 8px;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--card); }
.rec-kse:active { transform: scale(0.99); }
.rec-kse.ok { border-color: rgba(46,204,113,.55); background: rgba(46,204,113,.10); }
.rec-kse-head { font-size: 15px; font-weight: 800; letter-spacing: .3px; }
.rec-kse-mark { font-size: 15px; }
.rec-kse-specs { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
/* KSE grants list (priority-ordered, strict per-subject) */
.rec-kse-box { display: block; margin-top: 8px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--card); }
.rec-kse-box.none { text-decoration: none; color: var(--text); }
.rec-kse-box.none .rec-kse-title { margin-bottom: 0; }
.rec-kse-title { font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.rec-grant { border-top: 1px solid var(--card-border); }
.rec-grant:first-of-type { border-top: none; }
.rec-grant-head { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 9px 0; cursor: pointer; }
.rec-grant-head:active { opacity: .7; }
.rec-grant-top { font-size: 14px; font-weight: 700; }
.rec-grant-name {}
.rec-grant.ok .rec-grant-name { color: #2ecc71; }
.rec-grant-chev { flex-shrink: 0; width: 28px; height: 28px; display: flex;
  align-items: center; justify-content: center; border-radius: 50%;
  font-size: 18px; font-weight: 800; line-height: 1; color: #4aa3ff;
  background: rgba(74,163,255,.16); border: 1px solid rgba(74,163,255,.35);
  transition: transform .18s; }
.rec-grant-head.open .rec-grant-chev { transform: rotate(180deg);
  color: #fff; background: #4aa3ff; }
.rec-grant-body { padding: 0 0 9px; }
.rec-grant-link { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--accent, #4aa3ff); text-decoration: underline; }
.rec-grant-progs { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.rec-grant-reason { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.rec-grant-cond { font-size: 11px; color: var(--text-dim); margin-top: 3px; font-style: italic; }
.rec-grant-benefits { margin: 4px 0 0; padding-left: 18px; font-size: 12px; color: var(--text-dim); }
.rec-grant-benefits li { margin: 1px 0; }
.rec-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.rec-card { display: block; text-decoration: none; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--card-border); background: var(--card); color: var(--text); }
.rec-card:active { transform: scale(0.99); }
.rec-card.near { border-color: rgba(241,196,15,.5); }
.rec-uni { font-size: 14px; font-weight: 700; }
.rec-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.rec-gap { font-size: 12px; font-weight: 700; color: #e0a800; margin-top: 3px; }
.rec-score { font-size: 12px; margin-top: 4px; }

.theme-group { margin: 14px 2px 6px; font-size: 13px; font-weight: 700; letter-spacing: .4px;
  color: var(--text-dim); text-transform: uppercase; }
.theme-row { position: relative; width: 100%; display: block; overflow: hidden; text-align: left;
  margin-bottom: 8px; padding: 0; border: 1px solid var(--card-border); border-radius: 14px;
  background: var(--card); color: var(--text); cursor: pointer; }
.theme-row:active { transform: scale(0.99); }
.theme-fill { position: absolute; inset: 0 auto 0 0; height: 100%;
  background: linear-gradient(90deg, rgba(46,204,113,.38), rgba(46,204,113,.20));
  border-right: 2px solid rgba(46,204,113,.65); transition: width .3s; z-index: 0; }
.theme-row-in { position: relative; z-index: 1; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; padding: 14px 14px; }
.theme-name { font-size: 15px; font-weight: 600; }
.theme-count { font-size: 13px; font-weight: 700; color: var(--text-dim); white-space: nowrap; }

.theme-sheet .th-label { margin: 12px 2px 6px; font-size: 13px; font-weight: 700; color: var(--text-dim); }
.theme-sheet .th-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-sheet .th-opts button { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--card-border);
  background: var(--card); color: var(--text-dim); font-size: 14px; font-weight: 700; cursor: pointer; }
.theme-sheet .th-opts button.active {
  background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); color: #fff; border-color: transparent; }

/* результати теми: неправильні завдання */
.nav-cell.wrong { border-color: var(--bad); color: var(--bad); }

/* ================= Наголоси ================= */
.nah-card.mode-card .m-emoji, .nah-card .m-emoji { }
.nah-intro p { margin: 0 0 8px; font-size: 14px; }
.nah-overall { font-size: 13px; color: var(--text-dim); }
.nah-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.nah-pack { border: 1px solid var(--card-border); background: var(--card); border-radius: 12px;
  padding: 12px 6px; text-align: center; cursor: pointer; transition: transform .1s; }
.nah-pack:active { transform: scale(.96); }
.nah-pack.part { border-color: rgba(255,193,7,.5); }
.nah-pack.done { border-color: rgba(46,204,113,.6); background: rgba(46,204,113,.12); }
.nah-pack-lab { font-size: 16px; font-weight: 800; }
.nah-pack-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.nah-pack.done .nah-pack-sub::after { content: " ✓"; color: #2ecc71; }
.nah-top { grid-template-columns: 44px 1fr auto; }
.nah-left { font-size: 12px; color: var(--text-dim); font-weight: 700; text-align: right; white-space: nowrap; }
/* full-screen color feedback while dragging */
.nah-tint { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: transparent; }
/* екран гри зафіксований на весь viewport — сторінка НЕ рухається вбік */
.nah-game { position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column;
  overflow: hidden; touch-action: none;
  padding: calc(12px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)) 14px calc(14px + env(safe-area-inset-bottom)); }
/* deck of cards (Tinder-style) */
.nah-deck { position: relative; flex: 1; min-height: 0; margin: 4px 0; }
.nah-corners { position: absolute; left: 16px; right: 16px; bottom: 4px; top: auto; z-index: 30;
  display: flex; justify-content: space-between; align-items: center; transition: opacity .6s ease; }
.nah-cor { font-size: 14px; font-weight: 800; }
.nah-cor.no { color: #ff6b6b; }
.nah-cor.yes { color: #2ecc71; }
/* картка менша за колоду й центрована (видно верхнє/нижнє меню) */
.nah-card { position: absolute; left: 50%; top: 45%; width: min(90%, 400px); height: min(66%, 410px);
  background: linear-gradient(180deg, #2e2168, #241a52);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 24px; padding: 18px; text-align: center; box-shadow: 0 14px 40px rgba(0,0,0,.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  will-change: transform; touch-action: none; }
.nah-card.behind { pointer-events: none; }
.nah-card.hint-yes { border-color: rgba(46,204,113,.9); box-shadow: 0 10px 34px rgba(46,204,113,.3); }
.nah-card.hint-no { border-color: rgba(231,76,60,.9); box-shadow: 0 10px 34px rgba(231,76,60,.3); }
.nah-word { font-weight: 800; letter-spacing: .5px; line-height: 1.2; max-width: 100%; word-break: break-word; }
.nah-vow { color: #4aa3ff; }
.nah-note { font-size: 14px; color: var(--text-dim); margin-top: 10px; }
.nah-q { font-size: 13px; color: var(--text-dim); margin-top: 18px; }
.nah-swipe-hint { text-align: center; color: var(--text-dim); font-weight: 700; font-size: 14px; margin-top: 14px; }
/* кнопки ПК — нижче, внахлест на нижню частину карток */
/* кнопки ПК — окремо під картками (без нахлесту) */
.nah-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.nah-btn { padding: 16px 0; border-radius: 16px; border: 2px solid; background: var(--card); font-size: 17px; font-weight: 800; cursor: pointer; }
.nah-btn.no { color: #e74c3c; border-color: rgba(231,76,60,.55); }
.nah-btn.yes { color: #2ecc71; border-color: rgba(46,204,113,.55); }
.nah-btn:active { transform: scale(.97); }
.nah-done { text-align: center; }
.nah-done-emoji { font-size: 52px; }
.nah-entry { display: flex; align-items: center; justify-content: center; gap: 8px; }
.nah-entry-sub { font-size: 12px; font-weight: 600; opacity: .8; }
.theme-row.nah-theme { background: linear-gradient(100deg, rgba(63,43,154,.55), rgba(6,93,167,.45)); border: 1px solid rgba(74,163,255,.45); }
.theme-row.nah-theme .theme-name { font-weight: 800; }

/* флеш-сигнал на весь екран + банер правильного наголосу */
/* плавне ОДНЕ підсвічування фону: поступово загоряється і поступово згасає (~2с, без блимання) */
@keyframes nahFlashOk {
  0% { background: rgba(0,214,107,0); } 32% { background: rgba(0,214,107,.55); }
  100% { background: rgba(0,214,107,0); } }
@keyframes nahFlashBad {
  0% { background: rgba(255,38,38,0); } 32% { background: rgba(255,38,38,.6); }
  100% { background: rgba(255,38,38,0); } }
.nah-vow-bad { color: #ff3b3b; }
.nah-vow-good { color: #18e07a; }
.nah-card.corrected { border-color: rgba(255,255,255,.3); }
.nah-tint.flash-ok { animation: nahFlashOk 2s ease-in-out; }
.nah-tint.flash-bad { animation: nahFlashBad 2s ease-in-out; }
.nah-correct { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 40;
  background: rgba(231,76,60,.95); color: #fff; padding: 10px 16px; border-radius: 14px;
  font-size: 18px; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.nah-correct .nah-vow { color: #fff8b0; }

/* плавна поява нової картки */
.nah-card.enter { opacity: 0 !important; transform: translate(-50%, calc(-50% + 46px)) scale(.82) !important; }
/* налаштування анімації */
.nah-set-lab { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }
.nah-anim-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nah-anim-seg button { padding: 10px 4px; border-radius: 12px; border: 1px solid var(--card-border);
  background: rgba(255,255,255,.05); color: var(--text-dim); font-size: 13px; font-weight: 700; cursor: pointer; }
.nah-anim-seg button.active { background: linear-gradient(100deg, var(--accent-1), var(--accent-2)); color: #fff; border-color: transparent; }
/* зелений блок із правильним наголосом (по тапу — знищення) */
.nah-correct-block { position: absolute; left: 8px; right: 8px; top: 56%; bottom: auto; z-index: 45; cursor: pointer;
  background: linear-gradient(180deg, #1f9d57, #16864a); border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px; padding: 16px 14px; text-align: center; box-shadow: 0 12px 36px rgba(22,134,74,.5);
  opacity: 0; transform: translateY(20px); transition: opacity .22s ease, transform .22s ease; }
.nah-correct-block.in { opacity: 1; transform: translateY(0); }
.nah-correct-block:active { transform: scale(.98); }
.nah-cb-lab { font-size: 13px; font-weight: 700; color: #d9ffe9; }
.nah-cb-word { font-size: 30px; font-weight: 800; margin: 6px 0; color: #fff; }
.nah-cb-word .nah-vow { color: #fff3a0; }
.nah-cb-tap { font-size: 12px; color: #cfeede; }
/* шредер */
.nah-shred { position: absolute; z-index: 35; pointer-events: none; }
.nah-strip { position: absolute; top: 0; bottom: 0; overflow: hidden; border-radius: 0; }

/* налаштування анімації — ⚙️ всередині гри */
.nah-top-right { display: flex; align-items: center; gap: 8px; }
.nah-gear { background: var(--card); border: 1px solid var(--card-border); color: var(--text);
  border-radius: 10px; width: 36px; height: 34px; font-size: 16px; cursor: pointer; }
.nah-set-pop { position: absolute; right: 0; top: 46px; z-index: 50; width: min(320px, 92%);
  background: #2a1f5e; border: 1px solid rgba(255,255,255,.2); border-radius: 16px; padding: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.5); }

/* ============================================================
   Публічний лендинг (web, логаут) — .lp
   #app має max-width:560px; лендинг розривається на повну ширину
   через від'ємні поля, щоб виглядати як справжній сайт.
   ============================================================ */
.lp {
  margin: -16px calc(-50vw + 50%) -90px;   /* вирвати з падінгів/центрування #app */
  width: 100vw;
  text-align: center;
  overflow-x: hidden;
}
.lp section,
.lp .lp-head,
.lp .lp-foot { padding-left: 20px; padding-right: 20px; }
.lp h2, .lp h3, .lp p { margin: 0; }

/* контейнер для вмісту секцій — обмежує ширину на десктопі */
.lp-hero, .lp-stats, .lp-sec, .lp-band, .lp .lp-foot > * { max-width: 860px; margin-left: auto; margin-right: auto; }

/* ---- header ---- */
.lp-head {
  display: flex; align-items: center; gap: 14px;
  max-width: 1040px; margin: 0 auto;
  padding-top: 14px; padding-bottom: 14px;
}
.lp-brand { display: flex; align-items: center; gap: 9px; font-weight: 900; font-size: 19px; letter-spacing: 1px; }
.lp-logo { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; box-shadow: 0 3px 12px rgba(0,0,0,.4); }
.lp-nav { display: flex; gap: 22px; margin-left: auto; }
.lp-nav a { color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 600; transition: color .15s; }
.lp-nav a:hover { color: var(--text); }
.lp-login-btn { width: auto; margin: 0; padding: 9px 20px; font-size: 14px; }
.lp-head .lp-nav + .lp-login-btn { margin-left: 0; }

/* ---- hero ---- */
.lp-hero { padding-top: 48px; padding-bottom: 40px; }
.lp-badge {
  display: inline-block; padding: 7px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--card-border);
  font-size: 13px; font-weight: 700; color: var(--text-dim); margin-bottom: 22px;
  backdrop-filter: blur(8px);
}
.lp-h1 { font-size: clamp(30px, 7vw, 54px); font-weight: 900; line-height: 1.08; letter-spacing: -.5px; }
.lp-grad {
  background: linear-gradient(100deg, var(--azure), #7aa9ff 60%, #c4b5ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.lp-sub { max-width: 620px; margin: 20px auto 0; color: var(--text-dim); font-size: clamp(15px, 2.4vw, 19px); line-height: 1.5; }
.lp-cta-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 30px; }
.lp-cta { width: auto; margin: 0; padding: 15px 30px; font-size: 16px; }
.lp-cta-note { margin-top: 14px; color: var(--text-dim); font-size: 13px; }

/* ---- stats band ---- */
.lp-stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px;
  padding-top: 8px; padding-bottom: 40px;
}
.lp-stat {
  flex: 1 1 150px; max-width: 220px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 18px 14px; backdrop-filter: blur(10px);
}
.lp-stat b { display: block; font-size: 26px; font-weight: 900; color: var(--azure); }
.lp-stat span { font-size: 13px; color: var(--text-dim); }

/* ---- generic section ---- */
.lp-sec { padding-top: 46px; padding-bottom: 46px; }
.lp-h2 { font-size: clamp(24px, 5vw, 36px); font-weight: 900; letter-spacing: -.3px; }
.lp-lead { max-width: 560px; margin: 12px auto 0; color: var(--text-dim); font-size: 16px; line-height: 1.5; }

/* ---- feature grid ---- */
.lp-grid {
  display: grid; gap: 14px; margin-top: 30px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  text-align: left;
}
.lp-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 20px; backdrop-filter: blur(10px); transition: transform .15s, border-color .15s;
}
.lp-card:hover { transform: translateY(-3px); border-color: rgba(122,169,255,.45); }
.lp-ic { font-size: 30px; margin-bottom: 10px; }
.lp-card h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.lp-card p { color: var(--text-dim); font-size: 14px; line-height: 1.5; }

/* ---- subjects ---- */
.lp-subjects {
  display: grid; gap: 10px; margin-top: 28px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.lp-subj {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 14px;
  padding: 13px 15px; font-weight: 700; font-size: 14px;
}
.lp-subj-ic { font-size: 20px; }

/* ---- steps ---- */
.lp-steps {
  display: grid; gap: 16px; margin-top: 30px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.lp-step {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 24px 20px; backdrop-filter: blur(10px);
}
.lp-step-n {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 6px 18px rgba(6,93,167,.4);
}
.lp-step h3 { font-size: 18px; font-weight: 800; margin-bottom: 7px; }
.lp-step p { color: var(--text-dim); font-size: 14px; line-height: 1.5; }

/* ---- CTA band ---- */
.lp-band {
  margin-top: 14px; margin-bottom: 14px;
  padding: 48px 24px; border-radius: 24px;
  background: linear-gradient(135deg, rgba(63,43,154,.55), rgba(6,93,167,.5));
  border: 1px solid var(--card-border); backdrop-filter: blur(10px);
}
.lp-band .lp-cta { margin-top: 24px; }

/* ---- FAQ ---- */
.lp-faq { max-width: 640px; margin: 28px auto 0; text-align: left; }
.lp-faq-i {
  background: var(--card); border: 1px solid var(--card-border); border-radius: 14px;
  padding: 4px 16px; margin-bottom: 10px;
}
.lp-faq-i summary {
  cursor: pointer; padding: 14px 0; font-weight: 700; font-size: 15px;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.lp-faq-i summary::-webkit-details-marker { display: none; }
.lp-faq-i summary::after { content: "+"; font-size: 22px; font-weight: 400; color: var(--text-dim); transition: transform .2s; }
.lp-faq-i[open] summary::after { transform: rotate(45deg); }
.lp-faq-i p { color: var(--text-dim); font-size: 14px; line-height: 1.55; padding: 0 0 14px; }

/* ---- footer ---- */
.lp-foot {
  margin-top: 20px; padding-top: 40px; padding-bottom: 48px;
  border-top: 1px solid var(--card-border);
}
.lp-foot .lp-brand { justify-content: center; margin: 0 auto; }
.lp-foot-about { max-width: 480px; margin: 16px auto 0; color: var(--text-dim); font-size: 14px; line-height: 1.55; }
.lp-foot-links { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-top: 20px; }
.lp-foot-links a { color: var(--azure); text-decoration: none; font-weight: 700; font-size: 14px; }
.lp-foot-links a:hover { text-decoration: underline; }
.lp-foot-login {
  background: none; border: none; color: var(--text-dim); font-weight: 700; font-size: 14px;
  cursor: pointer; padding: 0; font-family: inherit;
}
.lp-foot-login:hover { color: var(--text); }
.lp-foot-copy { margin-top: 24px; color: var(--text-dim); font-size: 12px; opacity: .8; }

/* ---- mobile ---- */
@media (max-width: 640px) {
  .lp-nav { display: none; }
  .lp-hero { padding-top: 34px; }
  .lp-cta-row .lp-cta { flex: 1 1 100%; }
}

/* ===================== login screen (web) ===================== */
.login {
  max-width: 420px;
  margin: 0 auto;
  padding: 30px 18px 28px;
  min-height: 84vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.login-brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.login-logo {
  width: 76px; height: 76px; border-radius: 22px; object-fit: cover;
  box-shadow: 0 12px 34px rgba(6, 93, 167, .45);
}
.login-wordmark {
  font-size: 26px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(100deg, #8fb6ff, #d7c4ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-h1 { font-size: 23px; font-weight: 800; margin: 4px 0 8px; }
.login-sub {
  color: var(--text-dim); font-size: 14px; line-height: 1.5;
  margin: 0 0 22px; max-width: 340px;
}
.login-methods { width: 100%; display: flex; flex-direction: column;
  align-items: center; gap: 12px; }
.login-tg { min-height: 46px; display: flex; align-items: center;
  justify-content: center; width: 100%; border-radius: 14px; }
.login-tg.li-current { box-shadow: 0 0 0 2px var(--azure, #4aa3ff); border-radius: 16px; }
.login-btn {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px 16px; border-radius: 14px; cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--text);
  background: var(--card); border: 1px solid var(--card-border);
  text-decoration: none; transition: border-color .15s, background .15s, transform .05s;
}
.login-btn:active { transform: scale(.985); }
.login-google { background: #fff; color: #1f1f1f; border-color: #fff; }
.login-google:hover { background: #f3f3f3; }
.login-guest { background: var(--card); }
.login-guest:hover { border-color: var(--accent-2); }
.li-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-left: 4px; border-radius: 50%;
  background: linear-gradient(135deg, #16c172, #0a9d5b); color: #fff;
  font-size: 12px; font-weight: 800;
}
.login-or {
  width: 100%; display: flex; align-items: center; gap: 12px;
  color: var(--text-dim); font-size: 12px; margin: 18px 0 16px;
}
.login-or::before, .login-or::after {
  content: ""; flex: 1; height: 1px; background: var(--card-border);
}
.login-warn {
  color: #ffd27a; font-size: 12.5px; line-height: 1.45;
  margin: 10px 4px 0; max-width: 340px;
}
.login-bot {
  margin-top: auto; padding-top: 26px;
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-dim); font-size: 13px; text-decoration: none;
}
.login-bot:hover { color: var(--text); }
.login-bot b { color: var(--azure, #6cb0ff); font-weight: 700; }
.login-bot-ic { font-size: 15px; }

/* ===================== guest reminder banner (home) ===================== */
.guest-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px; padding: 11px 12px;
  border-radius: 14px;
  background: linear-gradient(100deg, rgba(255, 174, 66, .16), rgba(255, 174, 66, .07));
  border: 1px solid rgba(255, 174, 66, .35);
}
.guest-banner-ic { font-size: 18px; flex: 0 0 auto; }
.guest-banner-txt { flex: 1; font-size: 13px; line-height: 1.35; color: var(--text); }
.guest-banner-cta {
  flex: 0 0 auto; border: none; cursor: pointer;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: #1a1040; background: linear-gradient(100deg, #ffce7a, #ffb347);
}
.guest-banner-x {
  flex: 0 0 auto; border: none; background: none; cursor: pointer;
  color: var(--text-dim); font-size: 15px; line-height: 1; padding: 4px;
}
.guest-banner-x:hover { color: var(--text); }
