/* PLAYFORGE — дизайн-токены */
:root {
  --bg: #0B0D14; --bg2: #111420; --surface: #171A27; --surface2: #202438;
  --accent: #8B5CF6; --accent-ink: #fff; --accent2: #22D3EE;
  --text: #F5F7FF; --text2: #A1A7B8;
  --ok: #34D399; --warn: #FBBF24; --err: #F87171;
  --line: rgba(161, 167, 200, .16); --line2: rgba(161, 167, 200, .28);
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --r-card: 18px; --r-btn: 14px; --r-chip: 999px; --r-sm: 10px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1); --dur: .18s;
  --top: calc(env(safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 62px; --fs: 15px;
}
:root[data-theme="light"] {
  --bg: #F4F5FA; --bg2: #FFFFFF; --surface: #FFFFFF; --surface2: #ECEEF6;
  --text: #14172A; --text2: #5B6178; --line: rgba(40, 48, 90, .12); --line2: rgba(40, 48, 90, .22);
  --shadow: 0 6px 20px rgba(30, 40, 90, .10); --accent2: #0891B2; --ok: #059669; --warn: #B45309; --err: #DC2626;
}
:root[data-big="1"] { --fs: 17px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs)/1.45 var(--font); -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { min-height: 100vh; min-height: 100dvh; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 19px; line-height: 1.25; letter-spacing: -.005em; }
h3 { font-size: 16px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.muted { color: var(--text2); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* shell */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3); padding: calc(var(--top) + 10px) var(--s4) 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .02em; font-size: 17px; }
.logo i { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.logo svg { width: 16px; height: 16px; }
.spacer { flex: 1; }
.iconbtn { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--err); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface2); display: grid; place-items: center; font-weight: 700; overflow: hidden; border: 1px solid var(--line); flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: var(--s4) var(--s4) calc(var(--nav-h) + var(--bottom) + var(--s5)); }
.page { animation: fadein .22s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: color-mix(in srgb, var(--bg2) 94%, transparent); border-top: 1px solid var(--line); padding-bottom: var(--bottom); backdrop-filter: blur(10px); }
.bottomnav a { flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--text2); transition: color var(--dur); }
.bottomnav a svg { width: 22px; height: 22px; }
.bottomnav a.on { color: var(--accent); }
.bottomnav a.on span { font-weight: 700; }
@media (min-width: 900px) {
  .bottomnav { top: 0; bottom: auto; right: auto; width: 92px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding-top: 70px; }
  .bottomnav a { height: 68px; flex: none; }
  .topbar, main { margin-left: 92px; } .topbar { margin-left: 92px; }
  main { padding-bottom: var(--s6); }
}

/* кнопки, чипы */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 var(--s4); border-radius: var(--r-btn); border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font-weight: 650; transition: transform var(--dur) var(--ease), background var(--dur), opacity var(--dur); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn.sec { background: var(--surface2); color: var(--text); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line2); }
.btn.danger { background: var(--err); color: #1b0b0b; }
.btn.ok { background: var(--ok); color: #04261a; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.off { opacity: .45; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-chip); background: var(--surface); border: 1px solid var(--line); color: var(--text2); font-size: 13.5px; white-space: nowrap; transition: all var(--dur); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar, .row::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface2); color: var(--text2); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.err { background: color-mix(in srgb, var(--err) 18%, transparent); color: var(--err); }
.badge.acc { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #b79cff; }
:root[data-theme="light"] .badge.acc { color: #6d3fd8; }
.badge.cyan { background: color-mix(in srgb, var(--accent2) 18%, transparent); color: var(--accent2); }

/* секции */
.section { margin-top: var(--s5); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: var(--s3); }
.sec-head a, .link { color: var(--accent2); font-size: 14px; font-weight: 600; background: none; border: 0; padding: 0; }
.row { display: flex; gap: var(--s3); overflow-x: auto; scroll-snap-type: x proximity; margin: 0 calc(var(--s4) * -1); padding: 2px var(--s4) 8px; scrollbar-width: none; }
.row > * { scroll-snap-align: start; flex: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.hstack { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s4); }
.card.flat { box-shadow: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s4) 0; }

/* обложки */
.cover { position: relative; overflow: hidden; border-radius: 14px; aspect-ratio: 16/10; background: radial-gradient(120% 90% at 20% 0%, hsl(var(--h) 85% 62% / .55), transparent 62%), linear-gradient(150deg, hsl(var(--h) 55% 30%), hsl(calc(var(--h) + 45) 60% 13%)); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.cover img.ld { opacity: 1; }
.cover b { position: absolute; right: 10px; bottom: -14px; font-size: 76px; line-height: 1; font-weight: 800; color: rgba(255,255,255,.14); user-select: none; }
.gcard { width: 188px; display: flex; flex-direction: column; gap: 8px; text-align: left; background: none; border: 0; padding: 0; color: inherit; }
.grid .gcard { width: auto; }
.gcard .t { font-weight: 650; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.gcard .meta { display: flex; gap: 8px; align-items: center; color: var(--text2); font-size: 12.5px; flex-wrap: wrap; }
.gcard .cover { transition: transform var(--dur) var(--ease); }
.gcard:active .cover { transform: scale(.98); }
.demo-tag { position: absolute; top: 8px; left: 8px; z-index: 2; }
.play-fab { position: absolute; right: 8px; bottom: 8px; z-index: 2; width: 36px; height: 36px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow); }
.play-fab svg { width: 16px; height: 16px; }
.stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.stars svg { width: 14px; height: 14px; fill: var(--surface2); }
.stars svg.f { fill: var(--warn); }
.rate-input { display: flex; gap: 6px; }
.rate-input button { background: none; border: 0; padding: 4px; }
.rate-input svg { width: 34px; height: 34px; fill: var(--surface2); transition: transform var(--dur) var(--ease), fill var(--dur); }
.rate-input svg.f { fill: var(--warn); } .rate-input button:active svg { transform: scale(1.2); }

/* баннер */
.banner { position: relative; border-radius: 22px; overflow: hidden; min-height: 340px; display: flex; align-items: flex-end; border: 1px solid var(--line); }
.banner .cover { position: absolute; inset: 0; border-radius: 0; aspect-ratio: auto; }
.banner .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,13,20,0) 20%, rgba(11,13,20,.86) 78%, rgba(11,13,20,.96)); }
.banner .in { position: relative; z-index: 2; padding: var(--s5) var(--s4) var(--s4); width: 100%; display: flex; flex-direction: column; gap: 10px; color: #F5F7FF; }
.banner h1 { font-size: 28px; } .banner .muted { color: #c8cde0; }
.banner .acts { display: flex; gap: 10px; margin-top: 4px; }
.banner .acts .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
@media (min-width: 700px) { .banner { min-height: 380px; } .banner .in { padding: 32px; max-width: 640px; } }

/* прогресс и графики */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text2); }
.bar i { flex: 1; height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
.bar i u { display: block; height: 100%; background: var(--warn); border-radius: 4px; }
.chart { width: 100%; height: 150px; display: block; }
.chart .gl { stroke: var(--line); } .chart text { fill: var(--text2); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* метрики и таблицы */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
@media (min-width: 700px) { .metrics { grid-template-columns: repeat(4, 1fr); } }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.metric .v { font-size: 24px; font-weight: 750; letter-spacing: -.01em; margin-top: 2px; }
.metric .l { font-size: 12.5px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.metric .h { font-size: 12px; color: var(--text2); margin-top: 2px; }
.help { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line2); background: none; color: var(--text2); font-size: 10px; padding: 0; line-height: 1; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 600; color: var(--text2); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.item { display: flex; align-items: center; gap: var(--s3); padding: 12px var(--s4); border-bottom: 1px solid var(--line); text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; color: inherit; }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .grow .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .thumb { width: 56px; border-radius: 10px; flex: none; }
.item.unread { background: color-mix(in srgb, var(--accent) 9%, transparent); }

/* вкладки, формы */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 calc(var(--s4) * -1) var(--s4); padding: 0 var(--s4); }
.tabs a, .tabs button { padding: 10px 12px; color: var(--text2); font-weight: 600; font-size: 14px; border: 0; background: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs .on { color: var(--text); border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 13px; color: var(--text2); font-weight: 600; }
input, textarea, select { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: 12px; padding: 11px 12px; font: inherit; font-size: 16px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); border-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--text2); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text2); }
.search input { padding-left: 38px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch input { width: 46px; height: 28px; appearance: none; background: var(--surface2); border-radius: 14px; position: relative; border: 1px solid var(--line2); padding: 0; cursor: pointer; transition: background var(--dur); flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform var(--dur) var(--ease); }
.switch input:checked { background: var(--accent); border-color: var(--accent); } .switch input:checked::after { transform: translateX(18px); }
.steps { display: flex; gap: 6px; margin-bottom: var(--s4); }
.steps button { flex: 1; height: 6px; border: 0; padding: 0; border-radius: 3px; background: var(--surface2); } .steps .on { background: var(--accent); } .steps .done { background: var(--ok); }
.dropzone { border: 1.5px dashed var(--line2); border-radius: 16px; padding: var(--s5) var(--s4); text-align: center; color: var(--text2); background: var(--bg2); }
.progress { height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; } .progress i { display: block; height: 100%; background: var(--accent2); transition: width .2s; }
.shots { display: flex; gap: 8px; overflow-x: auto; } .shots .sh { position: relative; flex: none; width: 110px; } .shots img { width: 110px; height: 180px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.shots .sh button { position: absolute; top: 4px; right: 4px; }
.shots.big img { width: 150px; height: 260px; }

/* состояния */
.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--text2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { width: 40px; height: 40px; opacity: .6; } .empty h3 { color: var(--text); }
.skel { background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sh 1.3s linear infinite; border-radius: 14px; }
@keyframes sh { to { background-position: -200% 0; } }
.notice { padding: 12px 14px; border-radius: 14px; font-size: 14px; border: 1px solid var(--line); background: var(--surface2); }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.notice.err { border-color: color-mix(in srgb, var(--err) 50%, transparent); background: color-mix(in srgb, var(--err) 10%, transparent); }
.notice.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--bottom) + 12px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 var(--s4); }
.toast { background: var(--surface2); border: 1px solid var(--line2); border-radius: 14px; padding: 11px 16px; box-shadow: var(--shadow); max-width: 480px; font-size: 14px; animation: fadein .2s var(--ease); display: flex; gap: 8px; align-items: center; }
.toast.err { border-color: var(--err); } .toast.ok { border-color: var(--ok); }
.modal-bg { position: fixed; inset: 0; z-index: 90; background: rgba(5, 6, 12, .6); display: flex; align-items: flex-end; justify-content: center; animation: fadeonly .15s; }
@keyframes fadeonly { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line2); border-radius: 22px 22px 0 0; padding: var(--s5) var(--s4) calc(var(--s4) + var(--bottom)); animation: up .22s var(--ease); box-shadow: var(--shadow); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: 22px; } }

/* плеер */
.player { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; flex-direction: column; }
.player .bar2 { display: flex; align-items: center; gap: 10px; padding: calc(var(--top) + 8px) 12px 8px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.player iframe { flex: 1; width: 100%; border: 0; background: #000; }
.player .ov { position: absolute; inset: 0; top: calc(var(--top) + 56px); display: grid; place-items: center; background: var(--bg); text-align: center; padding: var(--s5); }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface2); border-top-color: var(--accent); animation: rot .8s linear infinite; margin: 0 auto 12px; }
@keyframes rot { to { transform: rotate(360deg); } }

.dev-login { max-width: 420px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 10px; padding: var(--s4); }
.review { display: flex; flex-direction: column; gap: 6px; padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.reply { margin-top: 6px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface2); border-radius: 0 12px 12px 0; font-size: 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 14px; } .kv dt { color: var(--text2); } .kv dd { margin: 0; }
.genre-tile { flex: none; width: 128px; height: 72px; border-radius: 16px; padding: 10px 12px; display: flex; align-items: flex-end; font-weight: 700; text-align: left; border: 1px solid var(--line); color: #fff; background: linear-gradient(150deg, hsl(var(--h) 55% 34%), hsl(calc(var(--h) + 40) 60% 17%)); }
.genre-tile small { display: block; font-weight: 500; opacity: .8; font-size: 11px; }
.text-pre { white-space: pre-wrap; word-wrap: break-word; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
.cw { position: relative; }
.cover.hero { border-radius: 20px; aspect-ratio: 16/9; }
.gcard .cover { width: 100%; }
.btn[data-on="1"] svg { color: var(--err); }
.item { cursor: pointer; font: inherit; }
a.item { color: inherit; }
.iconbtn .dot[hidden] { display: none; }
.row { scroll-padding: 0 var(--s4); }
details.card summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "▾"; color: var(--text2); transition: transform var(--dur); }
details.card[open] summary::after { transform: rotate(180deg); }
details.card[open] summary { margin-bottom: 12px; }
.bigdrop { padding: var(--s6) var(--s4); }
.demo-tag { background: rgba(11, 13, 20, .72) !important; color: #fff !important; }
