@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-cyrillic.woff2") format("woff2");
  font-weight: 500 900; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-latin.woff2") format("woff2");
  font-weight: 500 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #ffffff;
  --bg-2: #f4f6f8;
  --line: #e3e7eb;
  --edge: #cfd6dc;
  --ink: #1f2a30;
  --ink-2: #5e6b73;
  --ink-3: #6f7b82;
  --track: #e3e7eb;

  --green: #16873a;  --green-edge: #0e6a2c;  --green-soft: #e3f5e7;  --green-ink: #0f6b2d;
  --red: #d93a3a;    --red-edge: #a82626;    --red-soft: #fde8e8;    --red-ink: #a92323;
  --blue: #1a6fd6;   --blue-edge: #1256a8;   --blue-soft: #e6f0fc;   --blue-ink: #1558ab;  --blue-line: #9cc3f2;
  --orange: #e8740c; --orange-edge: #b35705; --orange-soft: #fff0e0; --orange-ink: #a64f00;
  --purple: #7a4cd9; --purple-edge: #5e36b3; --purple-soft: #f0eafd; --purple-ink: #5a31ad;
  --on-accent: #ffffff;

  --r-s: 12px; --r-m: 16px; --r-l: 22px;
  --pad: 16px;
  --tabs-h: 64px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-t: var(--tg-content-safe-area-inset-top, 0px);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  color-scheme: light;
}
:root[data-scheme="dark"] {
  --bg: #111b21;
  --bg-2: #17242b;
  --line: #2b3b44;
  --edge: #0a1317;
  --ink: #eef3f6;
  --ink-2: #a3b2ba;
  --ink-3: #93a3ab;
  --track: #2b3b44;

  --green: #58c86a;  --green-edge: #3a9a4c;  --green-soft: #163424;  --green-ink: #8fe0a0;
  --red: #ff6b6b;    --red-edge: #c24848;    --red-soft: #3a1c1f;    --red-ink: #ffa6a6;
  --blue: #5aa9ff;   --blue-edge: #2f7acc;   --blue-soft: #15304c;   --blue-ink: #9ccbff;  --blue-line: #3d78b8;
  --orange: #ff9f43; --orange-edge: #c47423; --orange-soft: #3a2712; --orange-ink: #ffc07f;
  --purple: #a987ff; --purple-edge: #7b58d6; --purple-soft: #2a2145; --purple-ink: #cbb6ff;
  --on-accent: #0b1418;

  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.4; font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { max-width: 100%; display: block; }
::selection { background: var(--blue-soft); color: var(--ink); }
:focus-visible { outline: 3px solid var(--blue-line); outline-offset: 2px; border-radius: 12px; }
input { caret-color: var(--blue); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.s { width: 18px; height: 18px; stroke-width: 2.6; }
.ic.l { width: 30px; height: 30px; }
.ic.xl { width: 72px; height: 72px; stroke-width: 2; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: var(--tg-viewport-stable-height, 100dvh); position: relative; }
.view { padding: calc(12px + var(--safe-t)) var(--pad) calc(var(--tabs-h) + var(--safe-b) + 28px); }
.view.full { padding-bottom: calc(24px + var(--safe-b)); }
.view.enter { animation: view-in .28s var(--ease-out) backwards; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

h1, h2, h3 { margin: 0; font-weight: 900; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 21px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.25; font-weight: 800; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .meta { color: var(--ink-2); font-size: 14px; font-weight: 700; }

/* ---------------------------------------------------------------- buttons */
.btn {
  --c: var(--green); --e: var(--green-edge); --t: var(--on-accent);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; padding: 12px 18px;
  background: var(--c); color: var(--t);
  border-radius: var(--r-m); box-shadow: 0 4px 0 var(--e);
  font-weight: 900; font-size: 16px; letter-spacing: .03em; text-transform: uppercase;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
  margin-bottom: 4px;
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--e); }
.btn:disabled { --c: var(--line); --e: var(--edge); --t: var(--ink-3); cursor: default; transform: none; }
:root[data-scheme="dark"] .btn:disabled { --e: #0a1317; }
.btn.red { --c: var(--red); --e: var(--red-edge); }
.btn.blue { --c: var(--blue); --e: var(--blue-edge); }
.btn.purple { --c: var(--purple); --e: var(--purple-edge); }
.btn.ghost {
  --t: var(--blue-ink); background: var(--bg); border: 2px solid var(--line);
  box-shadow: 0 4px 0 var(--line);
}
.btn.ghost:active { box-shadow: 0 0 0 var(--line); }
.btn.sm { min-height: 44px; font-size: 14px; padding: 8px 14px; width: auto; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border: 2px solid var(--line); border-radius: 999px; font-weight: 800; font-size: 14px; white-space: nowrap;
}
.chip.flame { color: var(--orange-ink); }
.chip.flame .ic { color: var(--orange); }
.chip.flame.off { color: var(--ink-3); }
.chip.flame.off .ic { color: var(--ink-3); }
.chip.known .ic { color: var(--green); }

/* segmented */
.seg { display: inline-flex; padding: 3px; gap: 3px; border: 2px solid var(--line); border-radius: var(--r-m); background: var(--bg); }
.seg button { min-height: 34px; padding: 0 12px; border-radius: var(--r-s); font-weight: 900; font-size: 14px; color: var(--ink-2); letter-spacing: .02em; }
.seg button[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue-ink); box-shadow: inset 0 0 0 2px var(--blue-line); }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; }

/* ---------------------------------------------------------------- home */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.topbar .right { display: flex; gap: 8px; }

.hero {
  margin-top: 18px; padding: 18px; border: 2px solid var(--line); border-radius: var(--r-l);
  box-shadow: 0 4px 0 var(--line);
}
.hero-top { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.hero-top h1 { font-size: 28px; }
.hero-top p { color: var(--ink-2); font-weight: 700; margin-top: 2px; }
.hero-top p.hero-err { color: var(--red-ink); margin-top: 0; }

.ring {
  --p: 0; --w: 0; --size: 72px; --thick: 8px;
  width: var(--size); height: var(--size); border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--red) 0 calc((var(--p) + var(--w)) * 1%), var(--track) 0);
  display: grid; place-items: center;
}
.ring::before { content: ""; position: absolute; inset: var(--thick); border-radius: 50%; background: var(--bg); }
.ring > * { position: relative; }
.ring .val { font-weight: 900; font-size: 20px; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left;
  padding: 12px 10px; border: 2px solid var(--line); border-radius: var(--r-m); box-shadow: 0 4px 0 var(--line);
  transition: transform .08s ease, box-shadow .08s ease; min-height: 108px; min-width: 0;
}
.mode:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.mode .tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.mode b { font-weight: 900; font-size: 14px; line-height: 1.15; }
.mode small { color: var(--ink-2); font-weight: 700; font-size: 12px; white-space: nowrap; }
.t-red { background: var(--red-soft); color: var(--red); }
.t-blue { background: var(--blue-soft); color: var(--blue); }
.t-purple { background: var(--purple-soft); color: var(--purple); }
.t-green { background: var(--green-soft); color: var(--green); }
.t-orange { background: var(--orange-soft); color: var(--orange); }

.tickets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px 8px; }
.tk { display: grid; justify-items: center; gap: 4px; padding: 2px 0; border-radius: var(--r-m); }
.tk .ring { --size: 58px; --thick: 6px; }
.tk .ring .val { font-size: 17px; }
.tk .ring.done { background: var(--green); }
.tk .ring.done::before { background: var(--green); }
.tk .ring.done .val { color: var(--on-accent); }
.tk .ring.cur { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--blue-line); }
.tk small { font-size: 12px; font-weight: 800; color: var(--ink-3); min-height: 16px; }
.tk small.err { color: var(--red-ink); }
.tk:active .ring { transform: scale(.94); }
.tk .ring { transition: transform .1s ease; }

/* list rows */
.rows { display: grid; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px; border: 2px solid var(--line); border-radius: var(--r-m);
}
button.row { box-shadow: 0 4px 0 var(--line); transition: transform .08s ease, box-shadow .08s ease; margin-bottom: 4px; }
button.row:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.row .body { flex: 1; min-width: 0; }
.row .body b { display: block; font-weight: 800; }
.row .body small { color: var(--ink-2); font-weight: 700; font-size: 14px; }
.row .chev { color: var(--ink-3); }
.bar { display: block; height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; margin-top: 8px; }
.bar i { --v: 0%; display: block; height: 100%; width: 100%; background: var(--green); clip-path: inset(0 calc(100% - var(--v)) 0 0 round 99px); transition: clip-path .6s var(--ease-out); }

/* ---------------------------------------------------------------- quiz */
.qhead { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-3); flex: none; }
.icon-btn:active { background: var(--bg-2); }
.progress { flex: 1; height: 16px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress i {
  --v: 0%; display: block; height: 100%; width: 100%; background: var(--green);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.12), inset 0 4px 0 rgba(255,255,255,.25);
  clip-path: inset(0 calc(100% - var(--v)) 0 0 round 99px);
  transition: clip-path .45s var(--ease-out);
}
.progress.purple i { background: var(--purple); }
.progress.orange i { background: var(--orange); }
.qcount { font-weight: 900; color: var(--ink-2); min-width: 44px; text-align: right; }
.timer { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; color: var(--purple-ink); background: var(--purple-soft); padding: 6px 10px; border-radius: 999px; }
.timer.low { color: var(--red-ink); background: var(--red-soft); }
.qfoot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; color: var(--ink-2); font-weight: 800; font-size: 14px; }
.qfoot .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); }
.qfoot .extra { color: var(--orange-ink); }
.qfoot .err { color: var(--red-ink); }
.draft { margin-top: 8px; font-size: 12px; font-weight: 800; opacity: .75; }
.review .draft { color: var(--ink-3); opacity: 1; margin-top: 4px; }

.qimg { margin-top: 16px; border-radius: var(--r-m); overflow: hidden; border: 2px solid var(--line); background: var(--bg-2); aspect-ratio: 16 / 7; }
.qimg img { width: 100%; height: 100%; object-fit: contain; }
.qtext { margin-top: 14px; font-size: 20px; line-height: 1.35; font-weight: 800; text-wrap: pretty; }

.answers { display: grid; gap: 10px; margin-top: 18px; }
.ans {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 13px 14px; border: 2px solid var(--line); border-radius: var(--r-m);
  box-shadow: 0 4px 0 var(--line); margin-bottom: 4px;
  font-weight: 700; line-height: 1.35;
  transition: transform .08s ease, box-shadow .12s ease, background-color .15s ease, border-color .15s ease, opacity .2s ease;
}
.ans:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.ans .n {
  width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--line); flex: none;
  display: grid; place-items: center; font-weight: 900; font-size: 14px; color: var(--ink-2);
}
.ans .t { padding-top: 3px; flex: 1; }
.ans.sel { border-color: var(--blue-line); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue-line); color: var(--blue-ink); }
.ans.sel .n { border-color: var(--blue-line); color: var(--blue-ink); }
.ans.ok { border-color: var(--green); background: var(--green-soft); box-shadow: 0 4px 0 var(--green); color: var(--green-ink); }
.ans.ok .n { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.ans.bad { border-color: var(--red); background: var(--red-soft); box-shadow: 0 4px 0 var(--red); color: var(--red-ink); }
.ans.bad .n { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.ans.dim { opacity: .55; }
.ans:disabled { cursor: default; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 14px var(--pad) calc(14px + var(--safe-b));
  background: var(--bg); border-top: 2px solid var(--line);
}
.dock-in { max-width: 528px; margin: 0 auto; }
.dock .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.dock .pair .btn { width: 100%; }
.dock .pair.one { grid-template-columns: 1fr; }
.quiz-space { height: 120px; }

/* feedback — the authored moment */
.fb {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 18px var(--pad) calc(16px + var(--safe-b));
  transform: translateY(100%); transition: transform .38s var(--ease-out);
  max-height: 72vh; overflow-y: auto;
}
.fb.show { transform: translateY(0); }
.fb.ok { background: var(--green-soft); color: var(--green-ink); }
.fb.bad { background: var(--red-soft); color: var(--red-ink); }
.fb-in { max-width: 528px; margin: 0 auto; }
.fb-title { display: flex; align-items: center; gap: 12px; }
.fb-title .badge { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); flex: none; }
.fb.ok .badge { color: var(--green); }
.fb.bad .badge { color: var(--red); }
.fb-title h2 { font-size: 21px; }
.fb-right { margin-top: 10px; font-weight: 800; }
.fb-tip { margin-top: 10px; font-weight: 600; line-height: 1.45; color: var(--ink); opacity: .92; }
.fb-tip.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.linkish { color: inherit; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; margin-top: 6px; min-height: 32px; }
.refs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.ref {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px;
  border-radius: 999px; background: var(--bg); color: var(--blue-ink); font-weight: 900; font-size: 14px;
  border: 2px solid var(--blue-line);
}
.ref:active { transform: scale(.97); }

/* ---------------------------------------------------------------- result */
.result { text-align: center; padding-top: 28px; }
.result .ring { --size: 168px; --thick: 16px; margin: 0 auto; }
.result .ring .val { font-size: 40px; line-height: 1; }
.result .ring .val small { display: block; font-size: 14px; color: var(--ink-2); font-weight: 800; margin-top: 4px; }
.medal {
  width: 156px; height: 156px; margin: 6px auto 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--orange); color: var(--on-accent); box-shadow: 0 8px 0 var(--orange-edge);
  animation: medal-in .7s var(--ease-out) both;
}
@keyframes medal-in { from { transform: scale(.55) rotate(-12deg); opacity: 0; } }
.result.win h1 { color: var(--orange-ink); }
.result h1 { margin-top: 22px; }
.result > p { margin-top: 8px; color: var(--ink-2); font-weight: 700; }
.verdict { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 8px 14px; border-radius: 999px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; font-size: 14px; }
.verdict.ok { background: var(--green-soft); color: var(--green-ink); }
.verdict.bad { background: var(--red-soft); color: var(--red-ink); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.tile-stat { border-radius: var(--r-m); padding: 12px 8px 14px; text-align: center; }
.tile-stat span { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; }
.tile-stat b { display: block; font-size: 28px; font-weight: 900; margin-top: 4px; }
.tile-stat.ok { background: var(--green-soft); color: var(--green-ink); }
.tile-stat.bad { background: var(--red-soft); color: var(--red-ink); }
.tile-stat.time { background: var(--blue-soft); color: var(--blue-ink); }
.tile-stat.zero { background: var(--bg-2); color: var(--ink-2); }
.stack { display: grid; gap: 12px; }

.review { text-align: left; }
.review .item { padding: 16px 0; border-bottom: 2px solid var(--line); }
.review .item:last-child { border-bottom: 0; }
.review .q { font-weight: 800; margin: 6px 0 10px; }
.review .line { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; margin-top: 6px; }
.review .line.ok { color: var(--green-ink); }
.review .line.bad { color: var(--red-ink); }
.review .tipx { color: var(--ink-2); margin-top: 8px; font-weight: 600; }
.review img { border-radius: 12px; border: 2px solid var(--line); margin-top: 8px; }

/* confetti on a perfect run */
.burst { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.burst i { position: absolute; top: 34%; left: 50%; width: 10px; height: 14px; border-radius: 4px; opacity: 0; animation: burst 1.1s var(--ease-out) forwards; }
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}

/* ---------------------------------------------------------------- exam tab */
.exam-hero { padding: 20px; border-radius: var(--r-l); background: var(--purple-soft); color: var(--purple-ink); margin-top: 18px; }
.exam-hero h1 { color: var(--ink); }
.exam-hero .rules { display: grid; gap: 12px; margin: 18px 0 22px; }
.exam-hero .rule { display: flex; gap: 12px; align-items: center; font-weight: 800; color: var(--ink); }
.exam-hero .rule .tile { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--bg); color: var(--purple); flex: none; }

/* ---------------------------------------------------------------- reference */
.stick { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(8px + var(--safe-t)) 0 10px; margin-top: calc(-12px - var(--safe-t)); }
.hscroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; margin: 10px calc(-1 * var(--pad)) 0; padding-left: var(--pad); padding-right: var(--pad); scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.pill { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); font-weight: 800; font-size: 14px; color: var(--ink-2); }
.pill[aria-pressed="true"] { border-color: var(--blue-line); background: var(--blue-soft); color: var(--blue-ink); }

.signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.sign {
  min-width: 0;
  display: grid; justify-items: center; align-content: start; gap: 6px; padding: 12px 6px 10px;
  border: 2px solid var(--line); border-radius: var(--r-m); box-shadow: 0 4px 0 var(--line); margin-bottom: 4px;
  text-align: center; transition: transform .08s ease, box-shadow .08s ease;
}
.sign:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.sign .pic { width: 64px; height: 64px; display: grid; place-items: center; }
.sign .pic img { max-height: 64px; width: auto; }
.sign b { font-size: 12px; font-weight: 900; color: var(--blue-ink); }
.sign span { font-size: 12px; line-height: 1.25; font-weight: 700; color: var(--ink-2); hyphens: auto; overflow-wrap: anywhere; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
:root[data-scheme="dark"] .sign .pic, :root[data-scheme="dark"] .sheet .signpic { background: #f4f6f8; border-radius: 12px; padding: 4px; }

.search { position: relative; margin-top: 12px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input {
  width: 100%; height: 50px; border-radius: var(--r-m); border: 2px solid var(--line); background: var(--bg-2);
  padding: 0 14px 0 46px; font-weight: 700; outline: none;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--blue-line); background: var(--bg); }

.fine { padding: 14px; border: 2px solid var(--line); border-radius: var(--r-m); }
.fine .art { display: inline-block; font-weight: 900; font-size: 12px; padding: 3px 8px; border-radius: 8px; background: var(--blue-soft); color: var(--blue-ink); }
.fine .art.uk { background: var(--red-soft); color: var(--red-ink); }
.fine p { margin-top: 8px; font-weight: 600; }
.fine .pen { margin-top: 10px; font-weight: 800; color: var(--ink); display: flex; gap: 8px; }
.fine .pen .ic { color: var(--orange); margin-top: 1px; }

.clause { padding: 14px 0; border-bottom: 2px solid var(--line); }
.clause:last-child { border-bottom: 0; }
.clause b { color: var(--blue-ink); font-weight: 900; margin-right: 6px; }
.clause p { display: inline; font-weight: 600; line-height: 1.5; }
.term { padding: 12px 0; border-bottom: 2px solid var(--line); }
.term b { display: block; font-weight: 900; }
.term p { font-weight: 600; color: var(--ink-2); margin-top: 4px; line-height: 1.45; }
mark { background: var(--orange-soft); color: inherit; border-radius: 4px; padding: 0 2px; }

/* ---------------------------------------------------------------- profile */
.me-head { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-ink); display: grid; place-items: center; font-weight: 900; font-size: 28px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px; border: 2px solid var(--line); border-radius: var(--r-m); }
.stat .tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat b { display: block; font-size: 20px; font-weight: 900; line-height: 1.1; }
.stat .txt small { display: block; font-size: 12px; font-weight: 800; color: var(--ink-2); line-height: 1.25; }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 110px; padding: 0 2px; }
.days .d { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; }
.days .d i { display: block; border-radius: 4px; min-height: 4px; }
.days .d i.bad, .legend i.bad { background: var(--red); opacity: .8; }
.days .d i.ok, .legend i.ok { background: var(--green); }
.legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; font-weight: 800; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 4px; }
.days-labels { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; margin-top: 6px; font-size: 12px; color: var(--ink-3); font-weight: 800; text-align: center; }

/* ---------------------------------------------------------------- tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px max(8px, calc((100% - 560px) / 2)) calc(6px + var(--safe-b));
  background: var(--bg); border-top: 2px solid var(--line);
}
.tab { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--ink-3); font-size: 12px; font-weight: 900; letter-spacing: .02em; border-radius: var(--r-m); min-height: 52px; }
.tab .ic { width: 26px; height: 26px; box-sizing: content-box; padding: 3px 16px; border-radius: var(--r-m); transition: background-color .2s ease; }
.tab[aria-current="page"] { color: var(--blue-ink); }
.tab[aria-current="page"] .ic { color: var(--blue); background: var(--blue-soft); }
.tab[aria-current="page"]::before { content: none; }
.tab:active { background: var(--bg-2); }

/* ---------------------------------------------------------------- sheet */
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 18, .45); z-index: 50; opacity: 0; transition: opacity .25s ease; }
.scrim.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 86vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 0 0 calc(24px + var(--safe-b));
  transform: translateY(100%); transition: transform .34s var(--ease-out);
}
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--bg); border-radius: 24px 24px 0 0; padding: 10px var(--pad) 12px; box-shadow: 0 2px 0 var(--line); }
.sheet-head-in { max-width: 528px; margin: 0 auto; }
.sheet-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-title .icon-btn { margin: -6px -10px 0 0; }
.sheet-h { margin: 24px 0 10px; font-size: 17px; }
.sheet.show { transform: translateY(0); }
.sheet-in { max-width: 528px; margin: 0 auto; padding: 16px var(--pad) 0; }
.grip { width: 44px; height: 5px; border-radius: 999px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin-bottom: 4px; }
.sheet .sub { color: var(--ink-2); font-weight: 800; font-size: 14px; }
.sheet .txt { font-weight: 600; line-height: 1.55; }
.sheet .txt p + p { margin-top: 10px; }
.sheet .signpic { width: 120px; height: 120px; margin: 0 auto 16px; display: grid; place-items: center; }
.sheet .signpic img { max-height: 112px; width: auto; }
.sheet .actions { margin-top: 20px; }

/* ---------------------------------------------------------------- states */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 18px); transform: translateX(-50%);
  z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: var(--r-m);
  font-weight: 800; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.empty { text-align: center; padding: 36px 12px; }
.empty .tile { width: 64px; height: 64px; border-radius: var(--r-l); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-2); font-weight: 700; margin-bottom: 18px; }
.skel { background: var(--bg-2); border-radius: var(--r-m); position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); transform: translateX(-100%); animation: shimmer 1.2s infinite; }
:root[data-scheme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (max-width: 360px) {
  :root { --pad: 12px; }
  .modes { gap: 8px; }
  .mode { padding: 10px; }
  .tickets { gap: 12px 4px; }
  .tk .ring { --size: 52px; }
  .qtext { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
