/* Layout: two working panels (ввод цветов | камера), под ними полоса решения с пошаговым плеером. Кубик — чёрный пластик с наклейками. */
:root {
  --bg: #edf0f3;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #5a6673;
  --line: #d3d9e0;
  --plastic: #15181c;
  --accent: #0a7a57;
  --accent-ink: #ffffff;
  --warn: #b4232f;
  --warn-bg: #fbe9ea;
  --ok-bg: #e3f3ec;
  --empty: #3a4049;

  --st-W: #f3f5f7;
  --st-Y: #ffd400;
  --st-G: #00a253;
  --st-B: #0b4fc4;
  --st-R: #cf1f36;
  --st-O: #ff6a13;

  --f-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101317; --surface: #191d23; --ink: #e8ecf0; --muted: #98a3af; --line: #2c333c;
    --plastic: #050607; --accent: #2fc28c; --accent-ink: #06261a; --warn: #ff7a85; --warn-bg: #3a1a1e; --ok-bg: #12301f; --empty: #2a3038;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101317; --surface: #191d23; --ink: #e8ecf0; --muted: #98a3af; --line: #2c333c;
  --plastic: #050607; --accent: #2fc28c; --accent-ink: #06261a; --warn: #ff7a85; --warn-bg: #3a1a1e; --ok-bg: #12301f; --empty: #2a3038;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 48px;
}
.wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 22px; }
header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(26px, 4.4vw, 40px); line-height: 1.05; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 .dot { display: inline-grid; grid-template-columns: repeat(3, 0.26em); gap: 0.04em; vertical-align: 0.06em; margin-right: 0.25em; padding: 0.05em; background: var(--plastic); border-radius: 0.08em; }
h1 .dot i { display: block; width: 0.26em; height: 0.26em; border-radius: 0.03em; }
.lede { margin: 6px 0 0; color: var(--muted); max-width: 60ch; }
h2 { font-family: var(--f-display); font-weight: 500; font-size: 18px; margin: 0; letter-spacing: 0.005em; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }

.panels { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 860px) { .panels { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }

/* Net */
.net {
  --s: clamp(22px, 6.4vw, 38px);
  display: grid; grid-template-columns: repeat(12, var(--s)); grid-template-rows: repeat(9, var(--s));
  gap: 3px; justify-content: center; user-select: none; -webkit-user-select: none;
}
.face-bg { background: var(--plastic); border-radius: 7px; margin: -4px; z-index: 0; cursor: pointer; border: 2px solid transparent; }
.face-bg.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.st { z-index: 1; border: 0; border-radius: 4px; padding: 0; cursor: pointer; background: var(--empty); position: relative; }
.st:focus-visible, button:focus-visible, .chip:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.st.center { cursor: default; }
.st.center::after { content: attr(data-face); position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px var(--f-mono); color: rgba(0,0,0,.55); }
.st.center[data-c="B"]::after, .st.center[data-c="G"]::after, .st.center[data-c="R"]::after { color: rgba(255,255,255,.75); }
.st[data-c="W"] { background: var(--st-W); } .st[data-c="Y"] { background: var(--st-Y); } .st[data-c="G"] { background: var(--st-G); }
.st[data-c="B"] { background: var(--st-B); } .st[data-c="R"] { background: var(--st-R); } .st[data-c="O"] { background: var(--st-O); }

.palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 40px; height: 40px; border-radius: 8px; border: 3px solid var(--plastic); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

button.btn, label.btn, a.btn {
  text-decoration: none;
  font: 600 14px var(--f-body); border-radius: 9px; padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: 6px;
}
button.btn:hover, label.btn:hover, a.btn:hover { border-color: var(--muted); }
button.btn.primary, label.btn.primary, a.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.hint { color: var(--muted); font-size: 13.5px; margin: 0; }
.hold { background: var(--bg); border-radius: var(--r); padding: 10px 12px; font-size: 14px; display: flex; gap: 10px; align-items: start; }
.hold b { font-family: var(--f-mono); }

/* Scanner */
.face-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.face-tab { font: 600 13px var(--f-body); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 11px 5px 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.face-tab .sw { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--plastic); }
.face-tab[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.face-tab .done { color: var(--accent); font-weight: 700; }
.stage { position: relative; background: var(--plastic); border-radius: var(--r); overflow: hidden; aspect-ratio: 4 / 3; max-width: 100%; display: grid; place-items: center; }
.stage canvas { width: 100%; height: 100%; object-fit: contain; touch-action: none; display: block; }
.stage .empty-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #c7ced6; padding: 20px; font-size: 14px; pointer-events: none; }
.size-row { display: flex; align-items: center; gap: 10px; }
.size-row input { flex: 1; min-width: 0; accent-color: var(--accent); }
.msg { border-radius: 9px; padding: 9px 12px; font-size: 14px; margin: 0; }
.msg.err { background: var(--warn-bg); color: var(--warn); }
.msg.ok { background: var(--ok-bg); color: var(--ink); }
.msg:empty { display: none; }

/* Solution */
.solve-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.status { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ready::before { background: var(--accent); }
.player { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 24px; align-items: center; }
@media (max-width: 640px) { .player { grid-template-columns: minmax(0, 1fr); } .iso-box { max-width: 240px; margin: 0 auto; } }
.iso-box svg { width: 100%; height: auto; display: block; }
.move-big { font: 700 clamp(44px, 9vw, 72px)/1 var(--f-mono); letter-spacing: -0.02em; }
.step-no { font-variant-numeric: tabular-nums; }
.move-desc { font-size: 16.5px; max-width: 46ch; margin: 6px 0 0; }
.move-desc strong { font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 700 14px var(--f-mono); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 7px; padding: 5px 0; min-width: 44px; text-align: center; cursor: pointer; font-variant-numeric: tabular-nums; }
.chip.done { color: var(--muted); background: var(--bg); text-decoration: line-through; text-decoration-color: var(--muted); }
.chip.now { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px 18px; font-size: 13.5px; color: var(--muted); }
.legend b { font-family: var(--f-mono); color: var(--ink); }
.done-banner { font-family: var(--f-display); font-size: 22px; }
.note { font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .chip, .st, .swatch { transition: background-color .12s, color .12s; } }

/* ---------- Site chrome ---------- */
.topnav { max-width: 1120px; margin: 0 auto 6px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand .dot { display: inline-grid; grid-template-columns: repeat(3, 5px); gap: 1px; padding: 2px; background: var(--plastic); border-radius: 3px; }
.brand .dot i { width: 5px; height: 5px; border-radius: 1px; display: block; }
.topnav nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topnav nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.topnav nav a:hover { color: var(--ink); background: var(--surface); }
.topnav nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
a { color: var(--accent); }
footer.site { max-width: 1120px; margin: 8px auto 0; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; color: var(--muted); font-size: 13px; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 14px; }
footer.site a { color: var(--muted); }

/* ---------- Money blocks (hidden until js/config.js is filled) ---------- */
.ad-slot { min-height: 90px; border-radius: 12px; overflow: hidden; }
.support { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: center; }
@media (max-width: 640px) { .support { grid-template-columns: minmax(0, 1fr); } }
.shop { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.shop a { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--bg); }
.shop a:hover { border-color: var(--muted); }
.shop .price { color: var(--muted); font-size: 13px; }
.adnote { font-size: 11.5px; color: var(--muted); }

/* ---------- Article / FAQ ---------- */
.prose { max-width: 70ch; display: grid; gap: 12px; }
.prose h2 { margin-top: 12px; }
.prose h3 { font-family: var(--f-display); font-weight: 500; font-size: 16px; margin: 8px 0 0; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose li + li { margin-top: 4px; }
.alg { font: 700 15px var(--f-mono); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: inline-block; letter-spacing: .02em; overflow-wrap: anywhere; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.toc a { display: inline-block; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: 13.5px; color: var(--ink); background: var(--surface); }
.stepcard { display: grid; gap: 10px; }
.stepcard .num { font-family: var(--f-mono); font-weight: 700; color: var(--accent); }
details.faq { border-top: 1px solid var(--line); padding: 12px 0; }
details.faq:last-of-type { border-bottom: 1px solid var(--line); }
details.faq summary { cursor: pointer; font-weight: 600; font-size: 15.5px; }
details.faq p { margin: 8px 0 0; color: var(--ink); max-width: 70ch; }

/* ---------- Timer ---------- */
.timer-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 860px) { .timer-grid { grid-template-columns: minmax(0, 1fr); } }
.scramble { font: 700 clamp(16px, 2.6vw, 21px)/1.55 var(--f-mono); word-spacing: .2em; overflow-wrap: anywhere; }
.clock { font: 700 clamp(64px, 15vw, 132px)/1 var(--f-mono); font-variant-numeric: tabular-nums; text-align: center; padding: 28px 0; border-radius: 14px; background: var(--bg); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.clock.hold { color: var(--warn); }
.clock.armed { color: var(--accent); }
.clock.running { color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.stat b { font: 700 22px var(--f-mono); font-variant-numeric: tabular-nums; }
.times { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 320px; overflow: auto; }
.times li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; padding: 4px 6px; border-radius: 6px; }
.times li:nth-child(odd) { background: var(--bg); }
.times .t { font: 700 15px var(--f-mono); }
.times .i { color: var(--muted); font-size: 12px; }
.times button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 6px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--ok-bg); color: var(--ink); }
.mini-net { display: grid; grid-template-columns: repeat(12, 12px); grid-template-rows: repeat(9, 12px); gap: 1px; }
.mini-net i { border-radius: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); font: 600 13.5px var(--f-body); padding: 7px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
