/* StudiKitEZ — black & white, premium restraint.
   Solid colors only. No gradients, no popups, no clutter.
   Mobile-first, WCAG 2.1 AA targets. */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --ink: #09090b;
  --muted: #71717a;
  --line: #e4e4e7;
  --primary: #09090b;
  --primary-dark: #000000;
  --primary-ink: #ffffff;
  --primary-soft: #f4f4f5;
  --brown: #52525b;
  --brown-dark: #27272a;
  --danger: #b3261e;
  --danger-soft: #fbeae8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 16px 40px -28px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #101014;
    --surface-2: #17171c;
    --ink: #fafafa;
    --muted: #a1a1aa;
    --line: #26262b;
    --primary: #fafafa;
    --primary-dark: #ffffff;
    --primary-ink: #09090b;
    --primary-soft: #1c1c21;
    --brown: #a1a1aa;
    --brown-dark: #e4e4e7;
    --danger: #ff9d97;
    --danger-soft: #3a1d1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 18px 44px -28px rgba(0, 0, 0, 0.8);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  animation: pagein 0.35s ease-out both;
}
@keyframes pagein { from { opacity: 0; } to { opacity: 1; } }
img { max-width: 100%; display: block; animation: imgin 0.5s ease-out both; }
@keyframes imgin { from { opacity: 0; } to { opacity: 1; } }
a { color: var(--ink); text-underline-offset: 3px; }
.nav-links a, .mobile-menu a, .brand, .btn, .crumbs a, .tg-widget a { text-decoration: none; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 0.7rem 1rem; border-radius: 0 0 10px 0; z-index: 100; font-weight: 700; }
.skip-link:focus { left: 0; }

/* ---------- shell ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .wrap { padding: 0 1.5rem; } }
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 1rem; min-height: 3.75rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.brand-mark { width: 2rem; height: 2rem; border-radius: 10px; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 800; }
.nav-links { display: none; gap: 0.25rem; }
.nav-links a { padding: 0.55rem 0.8rem; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 0.92rem; transition: background 0.15s, color 0.15s; }
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a.on { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 10px 10px 0 0; }
@media (min-width: 860px) { .nav-links { display: flex; } .menu-btn { display: none; } }
.mobile-menu { display: none; border-top: 1px solid var(--line); background: var(--surface); padding: 0.75rem 1rem 1rem; animation: rise 0.25s both; }
.mobile-menu.open { display: block; }
.mobile-menu a { display: block; padding: 0.7rem 0.8rem; border-radius: 10px; color: var(--ink); font-weight: 600; }
.mobile-menu a:hover { background: var(--surface-2); }
.page { padding: 1.5rem 0 4rem; min-height: 70vh; }
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.1rem); letter-spacing: -0.03em; font-weight: 800; }
.page-head p { margin: 0.35rem 0 0; color: var(--muted); }
.kicker { display: inline-block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brown); border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0.2rem 0.65rem; margin-bottom: 0.6rem; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 44px; font-weight: 700; font-size: 0.95rem; border-radius: 12px; padding: 0.65rem 1.15rem; border: 1px solid transparent; cursor: pointer; transition: transform 0.12s, background 0.15s, border-color 0.15s, box-shadow 0.2s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.5); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-sm { min-height: 38px; padding: 0.4rem 0.8rem; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.input, .search input, select.input, textarea.input {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); border-radius: 12px; padding: 0.7rem 0.9rem; font-size: 1rem; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .search input:focus, textarea.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--surface-2); }
.input::placeholder { color: var(--muted); opacity: 0.8; }
.search { display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.55rem 0.9rem; transition: border-color 0.15s; }
.search:focus-within { border-color: var(--ink); }
.search input { border: 0; background: none; padding: 0; box-shadow: none; }
label.field { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0.9rem 0 0.35rem; }

/* ---------- cards & grids ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.panel h2, .panel h3 { margin: 0 0 0.35rem; letter-spacing: -0.01em; }
.panel .sub { margin: 0; color: var(--muted); font-size: 0.88rem; }
.bento { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.span-12 { grid-column: span 1; } .span-8, .span-6, .span-4, .span-3 { grid-column: span 1; }
@media (min-width: 860px) {
  .bento { grid-template-columns: repeat(12, 1fr); }
  .span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; }
  .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
}
.cards { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, box-shadow 0.25s; }
.bcard:hover { transform: translateY(-4px); border-color: var(--muted); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 24px 48px -24px rgba(0, 0, 0, 0.4); }
.bcard .thumb { aspect-ratio: 16/9; background: var(--surface-2); overflow: hidden; position: relative; }
.bcard .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); filter: saturate(0.92); }
.bcard:hover .thumb img { transform: scale(1.05); }
.bcard .body { padding: 0.95rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.bcard h3 { margin: 0; font-size: 0.95rem; line-height: 1.45; letter-spacing: -0.005em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.badge-free { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; color: var(--primary-ink); background: var(--primary); border-radius: 5px; padding: 0.15rem 0.45rem; }
.badge-new { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; color: var(--ink); border: 1px solid var(--muted); border-radius: 5px; padding: 0.12rem 0.4rem; }
.stat-num { font-family: var(--mono); font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }
.stat-label { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ink); border-radius: 999px; transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; overflow-x: auto; padding-bottom: 0.25rem; }
.heat span { width: 11px; height: 11px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); }
.heat span[data-l="1"] { background: #e4e4e7; border-color: transparent; }
.heat span[data-l="2"] { background: #a1a1aa; border-color: transparent; }
.heat span[data-l="3"] { background: #52525b; border-color: transparent; }
.heat span[data-l="4"] { background: #09090b; border-color: transparent; }
@media (prefers-color-scheme: dark) {
  .heat span[data-l="1"] { background: #27272a; } .heat span[data-l="2"] { background: #52525b; }
  .heat span[data-l="3"] { background: #a1a1aa; } .heat span[data-l="4"] { background: #fafafa; }
}

/* ---------- player / pdf ---------- */
.stage { background: #000; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; position: relative; }
.stage video, .stage iframe { width: 100%; height: 100%; border: 0; background: #000; }
.stage .spin-veil { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); transition: opacity 0.3s; }
.stage .spin-veil.hide { opacity: 0; pointer-events: none; }
.stage .spin-veil .spinner { border-color: rgba(255, 255, 255, 0.25); border-top-color: #fff; margin: 0; }
.ctl { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 0.65rem 0.85rem; }
.seek { position: relative; flex: 1 1 100%; height: 22px; display: flex; align-items: center; cursor: pointer; order: -1; }
.seek .track { position: relative; width: 100%; height: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: visible; }
.seek .buf { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--muted); opacity: 0.45; border-radius: 999px; }
.seek .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); border-radius: 999px; }
.seek .knob { position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); transform: translate(-50%, -50%); left: 0; transition: transform 0.12s; }
.seek:hover .knob { transform: translate(-50%, -50%) scale(1.25); }
input[type="range"].vol { width: 84px; accent-color: var(--ink); cursor: pointer; }
@media (max-width: 480px) { input[type="range"].vol { display: none; } }
.iconbtn { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; border-radius: 10px; background: transparent; border: 1px solid transparent; color: var(--ink); font-size: 1.05rem; transition: background 0.15s, transform 0.1s; }
.iconbtn:hover { background: var(--surface-2); border-color: var(--line); }
.iconbtn:active { transform: scale(0.92); }
.qpill { font-family: var(--mono); font-size: 0.72rem; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 0.35rem 0.7rem; min-height: 36px; transition: all 0.15s; }
.qpill.on { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 700; }
.qpill:hover:not(.on) { color: var(--ink); border-color: var(--muted); }
.pdf-stage { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); max-height: 70vh; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.pdf-stage canvas.pdf-page { background: #fff; border-radius: 6px; max-width: 100%; height: auto; box-shadow: var(--shadow); animation: imgin 0.4s both; }
.pdf-stage canvas.draw-layer { background: transparent; box-shadow: none; animation: none; }
.seg { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 0.85rem; padding: 0.55rem 1rem; border-radius: 9px; min-height: 44px; transition: all 0.15s; }
.seg button.on { background: var(--ink); color: var(--bg); }
.timer-digits { font-family: var(--mono); font-size: clamp(3rem, 10vw, 4.5rem); font-weight: 600; letter-spacing: -0.04em; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); display: inline-block; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.feed-item { border-top: 1px solid var(--line); padding: 0.75rem 0; animation: rise 0.35s both; }
.feed-item:first-child { border-top: 0; padding-top: 0; }
.avatar-stack { display: flex; }
.avatar-stack span { width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: var(--bg); border: 2px solid var(--surface); display: grid; place-items: center; font-weight: 800; margin-left: -0.5rem; animation: pop 0.35s cubic-bezier(0.16, 1, 0.3, 1) both; }
.avatar-stack span:first-child { margin-left: 0; }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.anim-rise { animation: rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: var(--d, 0s); }
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; min-height: 0.9rem; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: rgba(128, 128, 128, 0.22); animation: skslide 1.3s infinite; }
@keyframes skslide { to { transform: translateX(100%); } }
.spinner { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body, img, .anim-rise, .live-dot, .skel::after, .spinner, .feed-item, .avatar-stack span { animation: none; }
  .bcard:hover, .btn-primary:hover { transform: none; }
}

/* ---------- toast / widget / ads ---------- */
#toast-root { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.6rem; align-items: center; }
@media (min-width: 640px) { #toast-root { left: auto; right: 1.25rem; width: 20rem; align-items: stretch; } }
.toast { width: 100%; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 0.8rem 1rem; font-size: 0.88rem; box-shadow: var(--shadow); animation: rise 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
.toast b { display: block; } .toast p { margin: 0.15rem 0 0; opacity: 0.75; font-size: 0.82rem; }
.tg-widget { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.55rem 0.8rem; font-size: 0.82rem; box-shadow: var(--shadow); animation: rise 0.4s 0.8s both; }
.tg-widget a { color: var(--ink); font-weight: 800; }
.tg-widget button { background: none; border: 0; color: var(--muted); font-size: 1.1rem; min-width: 44px; min-height: 44px; }
.ad-slot { border: 1px dashed var(--line); border-radius: 12px; margin: 1.25rem auto 0; max-width: 100%; text-align: center; padding: 0.4rem; }
.ad-slot .ad-label { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); background: var(--surface); }
.empty h3 { color: var(--ink); margin: 0 0 0.25rem; letter-spacing: -0.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; }
.site-footer .wrap { padding-top: 1.5rem; padding-bottom: 1.5rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }

/* ---------- soul: loader, ring, steps ---------- */
#top-loader { position: fixed; top: 0; left: 0; height: 3px; width: 35%; background: var(--ink); z-index: 300; border-radius: 0 3px 3px 0; transform: translateX(-110%); opacity: 0; pointer-events: none; }
#top-loader.on { opacity: 1; animation: loadslide 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
@keyframes loadslide { to { transform: translateX(310%); } }
.timer-wrap { position: relative; display: inline-grid; place-items: center; margin: 0.5rem auto; }
.timer-wrap svg.ring { position: absolute; inset: -14px; width: calc(100% + 28px); height: calc(100% + 28px); transform: rotate(-90deg); overflow: visible; }
.timer-wrap svg.ring .bg { fill: none; stroke: var(--line); stroke-width: 5; }
.timer-wrap svg.ring .fg { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.9s linear; }

/* Modal (announcements, telegram nag) */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(9, 9, 11, 0.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 1rem; }
.modal-card { max-width: 26rem; width: 100%; padding: 1.6rem; }

/* Chat / messages */
.chat-box { display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto; padding: 0.25rem; }
.chat-row { display: flex; }
.chat-row.mine { justify-content: flex-end; }
.bubble { max-width: 85%; padding: 0.45rem 0.75rem; border-radius: 12px 12px 12px 4px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.88rem; line-height: 1.45; word-break: break-word; }
.chat-row.mine .bubble { background: var(--ink); color: var(--bg); border-color: var(--ink); border-radius: 12px 12px 4px 12px; }
.bubble .who { display: block; font-family: var(--mono); font-size: 0.62rem; opacity: 0.65; margin-bottom: 0.15rem; text-transform: uppercase; letter-spacing: 0.1em; }

/* Feed / list rows (posts, inbox, admin) */
.row-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.row-card + .row-card { margin-top: 0.6rem; }
.row-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.ava { width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; flex: none; }
.ava.admin { background: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--primary); }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 0.15rem 0.6rem; color: var(--muted); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.bad { border-color: var(--danger); color: var(--danger); background: transparent; }
.chip.adm { border-color: var(--primary); color: var(--primary); background: transparent; }
.act-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.7rem; }

/* Admin table */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tbl th { text-align: left; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }

/* Announcement strip on home */
.ann-strip { display: flex; flex-direction: column; gap: 0.6rem; }
.ann-item { display: flex; gap: 0.8rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.ann-item .ico { width: 2rem; height: 2rem; border-radius: 10px; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; font-size: 0.95rem; }

/* Feedback stars */
.stars { display: flex; gap: 0.4rem; }
.star { font-size: 1.9rem; line-height: 1; background: none; border: 0; color: var(--line); cursor: pointer; padding: 0; transition: color 0.15s, transform 0.15s; }
.star:hover, .star.hov { color: var(--muted); transform: scale(1.18); }
.star.on { color: var(--ink); transform: scale(1.18); animation: pop 0.3s cubic-bezier(0.16, 1, 0.3, 1); }

@media (prefers-reduced-motion: reduce) {
  .modal, .modal-card { animation: none !important; }
}
.timer-digits { position: relative; }
#authStep1:not([hidden]), #authStep2:not([hidden]), #authStep3:not([hidden]) { animation: rise 0.32s cubic-bezier(0.16, 1, 0.3, 1) both; }
.hero-mark { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 1.4rem; animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) {
  #top-loader.on, .hero-mark { animation: none; }
  .timer-wrap svg.ring .fg { transition: none; }
}

/* Boot splash: in-flow placeholder (header/footer stay visible, content hidden
   until verification finishes — no full-page takeover). */
#boot-splash { display: none; padding: 12vh 1rem 14vh; }
body.booting #boot-splash { display: block; animation: rise 0.3s ease both; }
body.booting main > *:not(#boot-splash) { display: none !important; }
.splash-card { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }
.splash-mark { display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 22px; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 1.9rem; animation: splashpulse 1.6s ease-in-out infinite; }
@keyframes splashpulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(128,128,128,0.35); } 50% { transform: scale(1.06); box-shadow: 0 0 0 18px rgba(128,128,128,0); } }
/* Reading bear */
.bear { position: relative; width: 5.4rem; height: 5rem; animation: bearbob 2.4s ease-in-out infinite; }
@keyframes bearbob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1deg); } }
.bear .head { position: absolute; left: 50%; top: 0; width: 3.4rem; height: 3rem; transform: translateX(-50%); background: var(--ink); border-radius: 50% 50% 46% 46%; }
.bear .ear { position: absolute; top: -0.3rem; width: 1.05rem; height: 1.05rem; background: var(--ink); border-radius: 50%; }
.bear .ear.l { left: 0.6rem; }
.bear .ear.r { right: 0.6rem; }
.bear .ear::after { content: ""; position: absolute; inset: 0.3rem; background: var(--bg); border-radius: 50%; opacity: 0.55; }
.bear .eye { position: absolute; top: 1.1rem; width: 0.34rem; height: 0.44rem; background: var(--bg); border-radius: 50%; animation: beareye 4.2s infinite; }
.bear .eye.l { left: 1.62rem; }
.bear .eye.r { right: 1.62rem; }
@keyframes beareye { 0%, 91%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.1); } }
.bear .muzzle { position: absolute; left: 50%; top: 1.62rem; transform: translateX(-50%); width: 1.25rem; height: 0.9rem; background: var(--bg); border-radius: 50%; opacity: 0.94; }
.bear .muzzle::after { content: ""; position: absolute; left: 50%; top: 0.3rem; transform: translateX(-50%); width: 0.36rem; height: 0.26rem; background: var(--ink); border-radius: 50%; }
.bear .book { position: absolute; left: 50%; bottom: -0.2rem; transform: translateX(-50%); width: 3.3rem; height: 2.05rem; perspective: 220px; overflow: hidden; border: 2px solid var(--ink); border-radius: 4px 9px 9px 4px; background: var(--surface); }
.bear .book::before { content: ""; position: absolute; left: 50%; top: 3px; bottom: 3px; width: 2px; transform: translateX(-50%); background: var(--ink); opacity: 0.5; }
.bear .page { position: absolute; left: 3px; top: 3px; bottom: 3px; width: calc(50% - 4px); background: var(--bg); border-right: 2px solid var(--ink); border-radius: 2px 0 0 2px; transform-origin: right center; animation: pageflip 2.4s ease-in-out infinite; }
@keyframes pageflip { 0%, 18% { transform: rotateY(0deg); } 58%, 100% { transform: rotateY(-165deg); } }
@media (prefers-reduced-motion: reduce) {
  .bear, .bear .eye, .bear .page { animation: none; }
}
.splash-name { font-weight: 800; letter-spacing: -0.02em; font-size: 1.15rem; }
.splash-bar { width: 11rem; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; position: relative; }
.splash-bar span { position: absolute; inset: 0; width: 40%; border-radius: 999px; background: var(--ink); animation: splashslide 1.1s ease-in-out infinite; }
@keyframes splashslide { 0% { left: -40%; } 100% { left: 100%; } }
.splash-status { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.08em; min-height: 1rem; }
@media (prefers-reduced-motion: reduce) {
  .splash-mark, .splash-bar span { animation: none; }
}

/* Seek ripple (−10s / +10s) */
.seek-flash { position: absolute; top: 50%; transform: translate(-50%, -50%); z-index: 5; font-family: var(--mono); font-weight: 700; font-size: 1rem; color: #fff; background: rgba(0,0,0,0.65); border: 1px solid rgba(255,255,255,0.35); border-radius: 999px; padding: 0.45rem 0.9rem; pointer-events: none; animation: seekpop 0.7s ease-out both; }
@keyframes seekpop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .seek-flash { animation: none; opacity: 0; } }

/* Fullscreen: the real control bar moves INSIDE the stage; auto-hide on idle */
.stage:fullscreen { border-radius: 0; }
.stage:fullscreen video { max-height: 100vh; }
.stage.in-fs .ctl { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; background: linear-gradient(transparent, rgba(0,0,0,0.8)); border: 0; border-radius: 0; opacity: 1; transition: opacity 0.25s ease; }
.stage.in-fs.idle .ctl { opacity: 0; pointer-events: none; }
.stage.in-fs .ctl .iconbtn, .stage.in-fs .ctl .mono { color: #fff; }
.stage.in-fs .ctl .iconbtn:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); }
.stage.in-fs .vol { accent-color: #fff; }
.stage.in-fs .seek .track { background: rgba(255,255,255,0.25); border-color: transparent; }
.stage.in-fs .seek .fill { background: #fff; }
.stage.in-fs .seek .knob { border-color: #fff; background: #fff; }

/* Card hover lift + press feedback */
.bcard, .row-card, .panel { transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.15s ease; }
.bcard:hover { transform: translateY(-3px); }
.btn:active { transform: scale(0.97); }
.iconbtn { transition: transform 0.12s ease, background 0.15s ease; }
.iconbtn:active { transform: scale(0.9); }

/* PDF draw layer */
.pdf-holder { position: relative; margin: 0 auto 0.75rem; }
.pdf-holder canvas.pdf-page { display: block; }
canvas.draw-layer { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
canvas.draw-layer.drawing { cursor: crosshair; }
.draw-toolbar { position: sticky; top: 0; z-index: 5; }

/* Immersive reader: full-page continuous scroll, sticky bar */
.wrap.wide { max-width: 76rem; }
.pdf-bar { position: sticky; top: 0.6rem; z-index: 20; box-shadow: var(--shadow); }
.pdf-stage.reading { max-height: none; overflow: visible; background: transparent; border: 0; padding: 0.5rem 0 0; gap: 0.9rem; }
.pdf-stage.reading .pdf-holder { width: 100%; max-width: 54rem; }
.pdf-stage.reading canvas.pdf-page { width: 100%; height: auto; }

/* Toast entrance */
.toast { animation: toastin 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Floating AI assistant */
#ai-bubble { position: fixed; right: 1rem; bottom: 4.6rem; z-index: 80; width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; transition: transform 0.15s ease; animation: aibob 3s ease-in-out infinite; overflow: hidden; padding: 0; }
#ai-bubble:hover { transform: scale(1.08); }
.bear.mini { display: block; margin: 0.1rem auto 0; transform: scale(0.52); transform-origin: center 30%; animation: none; }
#ai-bubble:hover .bear.mini { animation: bearbob 2.4s ease-in-out infinite; }
@keyframes aibob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
#ai-panel { position: fixed; right: 1rem; bottom: 8.5rem; z-index: 81; width: min(24rem, calc(100vw - 2rem)); max-height: 62vh; display: none; flex-direction: column; padding: 1rem; }
#ai-panel.open { display: flex; animation: rise 0.25s cubic-bezier(0.16, 1, 0.3, 1) both; }
#ai-thread { overflow-y: auto; display: flex; flex-direction: column; gap: 0.45rem; max-height: 34vh; min-height: 6rem; }
#ai-thread .bubble { font-size: 0.83rem; }
/* Desktop: AI docks as a right sidebar */
@media (min-width: 960px) {
  #ai-panel.open { top: 4.2rem; bottom: 1rem; right: 1rem; max-height: none; }
  #ai-thread { max-height: none; flex: 1; }
}
.ai-typing span { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--muted); animation: aibl 1s infinite; }
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aibl { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  #ai-bubble, #ai-panel.open, .ai-typing span { animation: none; }
}
