/* ============================================================
   MOUCHA CONSOLE — moderní tmavá konzole.
   Tvary (zamčeno): karty 14, viewporty 12, tlačítka 9, pruhy 4.
   Jeden akcent: limetková. Neutrály: studená zinková rodina.
   Bez serifů, bez stínových efektů, bez textur.
   ============================================================ */
:root {
  --s1: 5px; --s2: 8px; --s3: 13px; --s4: 21px; --s5: 34px;
  --bg: #0b0d11;
  --panel: #12151c;
  --panel2: #1a1f29;
  --inset: #07080c;
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.15);
  --text: #eef1f6;
  --dim: #9aa3b2;
  --faint: #626b7a;
  --acc: #a3e635;
  --acc-ink: #1c2607;
  --acc-dim: rgba(163, 230, 53, 0.13);
  --red: #f87171;
  --green: #34d399;
  --blue: #60a5fa;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14.5px/1.6 var(--font); }
::selection { background: var(--acc); color: var(--acc-ink); }
a { color: var(--acc); }
code { font-family: var(--mono); font-size: 0.86em; background: var(--panel2);
  border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--acc); color: var(--acc-ink);
  font-weight: 700; font-size: 13px; padding: var(--s2) var(--s3); z-index: 60; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; top: 0; }
kbd { font-family: var(--mono); font-size: 11px; color: var(--dim); background: var(--panel2);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }

/* ---------- kostra: jedna obrazovka, stránka nescrolluje ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; height: 100dvh; overflow: hidden; }
.maincol { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* ---------- boční lišta ---------- */
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  background: #0e1117; border-right: 1px solid var(--line); padding: 18px 12px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--acc); color: var(--acc-ink);
  font-weight: 800; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.logo.lg { width: 44px; height: 44px; font-size: 25px; border-radius: 13px; }
.brand-tx strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand-tx small { display: block; font-size: 11px; color: var(--faint); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 11px; width: 100%;
  background: none; border: 0; border-radius: 9px; color: var(--dim);
  font-size: 14px; font-weight: 600; padding: 9px 10px; cursor: pointer; text-align: left;
  transition: background-color 0.14s, color 0.14s; }
.nav button svg { width: 18px; height: 18px; flex: none; }
.nav button span { flex: 1; }
.nav button kbd { opacity: 0; transition: opacity 0.14s; }
.nav button:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav button:hover kbd { opacity: 1; }
.nav button.active { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.nav button.active svg { color: var(--acc); }
.nav button.active kbd { opacity: 1; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.netstat { display: flex; align-items: center; gap: 8px; margin: 0 0 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text); }
.netstat i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pl 1.8s infinite; }
@keyframes pl { 50% { opacity: 0.3; } }
.tiny { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--faint); }

/* ---------- horní lišta ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 12px 26px; }
.crumb { margin: 0; font-size: 13.5px; color: var(--faint); }
.crumb span { margin: 0 6px; color: var(--faint); }
.crumb strong { color: var(--text); font-weight: 700; }
.stats { display: flex; gap: 18px; }
.stat { display: flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11px; color: var(--faint); }
.stat b { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }

/* ---------- obsah ---------- */
main { padding: 18px 26px 14px; max-width: 1400px; width: 100%; margin: 0 auto;
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.stage { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; }
.braincol { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.braincol .card-head { margin-bottom: 8px; }
.brainview { flex: 1; min-height: 0; height: auto; }
.braincol .meta { margin: 8px 0 0; }
.modcol { min-height: 0; min-width: 0; display: flex; }
.module { flex: 1; min-height: 0; min-width: 0; width: 100%; margin: 0; overflow-y: auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 18px 20px; margin: 0 0 14px; }
.card h2 { margin: 0 0 10px; font-size: 15.5px; font-weight: 700; letter-spacing: -0.005em; }
.card h3 { margin: 14px 0 6px; font-size: 12px; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.07em; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.meta { color: var(--dim); font-size: 12.5px; margin: 2px 0 8px; }
.region-title { font-size: 16px; font-weight: 700; margin: 0 0 2px; letter-spacing: -0.005em; }
.hint { color: var(--dim); font-size: 13px; margin: 12px 0 0; max-width: 70ch; }
.hint strong { color: var(--text); }
.role { background: var(--panel2); border-radius: 9px; padding: 9px 12px;
  font-size: 13px; margin: 12px 0 0; color: var(--dim); }
.role::before { content: "V této aplikaci: "; color: var(--text); font-weight: 700; }
.warn { background: rgba(248, 113, 113, 0.09); border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; color: #fca5a5; }

/* ---------- tlačítka ---------- */
.btn { background: var(--acc); color: var(--acc-ink); border: 1px solid transparent; border-radius: 9px;
  font-weight: 700; font-size: 13.5px; padding: 8px 15px; cursor: pointer; white-space: nowrap;
  transition: filter 0.14s, transform 0.06s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line2); font-weight: 600; }
.btn.ghost:hover { border-color: var(--faint); filter: none; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn + .btn { margin-left: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.seg .btn { border: 0; border-radius: 0; margin: 0; background: transparent; color: var(--dim); font-weight: 600; }
.seg .btn + .btn { border-left: 1px solid var(--line2); margin-left: 0; }
.seg .btn.active { background: var(--acc); color: var(--acc-ink); font-weight: 700; }
.opts { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--dim); flex-wrap: wrap; }
.opts label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.opts input[type="checkbox"] { accent-color: var(--acc); }

/* ---------- viewport ---------- */
.viewer { height: 400px; background: var(--inset); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; position: relative; }
.viewer canvas { display: block; }
.fallback-note { position: absolute; bottom: 6px; left: 10px; right: 10px; font-size: 12.5px; color: var(--acc); }
.hz-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px;
  font-size: 12.5px; color: var(--dim); }
.hz-row strong { font-family: var(--mono); font-weight: 600; font-size: 21px; color: var(--text);
  font-variant-numeric: tabular-nums; }

/* ---------- hry ---------- */
.ttt-wrap, .chess-wrap { display: flex; gap: 20px; margin-top: 12px; flex-wrap: wrap; }
.ttt { display: grid; grid-template-columns: repeat(3, 94px); grid-template-rows: repeat(3, 94px); gap: 8px; }
.ttt button { font-size: 46px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer; line-height: 1; padding: 0 0 6px;
  transition: border-color 0.14s, background-color 0.14s; }
.ttt button:hover:empty { border-color: var(--line2); background: #202634; }
.ttt button.x { font-weight: 700; }
.ttt button.o { color: var(--acc); }
.ttt button.win { border-color: var(--acc); border-width: 2px; }
.ttt-side { flex: 1; min-width: 240px; }
.status { font-size: 16px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.005em; }
.think { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--acc); margin: 8px 0; }
.think-bar { flex: 1; height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 3px;
  overflow: hidden; max-width: 240px; }
.think-bar i { display: block; height: 100%; width: 0; background: var(--acc); }
.scores { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.score-row { display: grid; grid-template-columns: 64px 1fr 56px; gap: 8px; align-items: center; padding: 2px 0; }
.score-row .mv { color: var(--dim); }
.score-row .vl { text-align: right; }
.score-row.best .mv, .score-row.best .vl { color: var(--acc); font-weight: 700; }

/* ---------- šachy ---------- */
.chess { display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; max-width: 440px;
  border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.chess button { position: relative; border: 0; font-size: clamp(20px, 4vw, 35px); line-height: 1;
  cursor: pointer; padding: 0; aspect-ratio: 1; transition: filter 0.14s; }
.chess button:hover { filter: brightness(1.07); }
.chess .lt { background: #d9d4c4; } .chess .dk { background: #75828f; }
.chess .w { color: #faf8f2; text-shadow: 0 0 3px #000, 0 0 4px #000; }
.chess .b { color: #161b22; text-shadow: 0 0 3px rgba(217, 212, 196, 0.8); }
.chess button[data-r="7"]::after { content: attr(data-fl); position: absolute; right: 4px; bottom: 2px;
  font-family: var(--mono); font-size: 9px; font-weight: 700; }
.chess button[data-c="0"]::before { content: attr(data-rn); position: absolute; left: 4px; top: 2px;
  font-family: var(--mono); font-size: 9px; font-weight: 700; }
.chess .lt::after, .chess .lt::before { color: rgba(22, 27, 34, 0.55); }
.chess .dk::after, .chess .dk::before { color: rgba(250, 248, 242, 0.8); }
.chess .sel { outline: 3px solid var(--acc); outline-offset: -3px; }
.chess .tgt { outline: 3px solid var(--green); outline-offset: -3px; cursor: pointer; }
.chess .last { outline: 3px solid var(--blue); outline-offset: -3px; }

/* ---------- aréna ---------- */
#arena { width: 100%; height: auto; background: var(--inset); border: 1px solid var(--line);
  border-radius: 12px; cursor: crosshair; display: block; }
.arena-bar { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.speed { margin-left: auto; font-size: 13px; color: var(--dim); display: inline-flex; gap: 8px; align-items: center; }
.speed input { accent-color: var(--acc); }

/* ---------- 3D aréna + přepínače ---------- */
.arena-view { height: clamp(260px, 36vh, 400px); }
.arena-view canvas { display: block; }
.arena-view #arena { border: 0; border-radius: 0; background: transparent; }
.lbl { font-size: 12.5px; color: var(--faint); }
.region-switch { display: grid; grid-template-columns: 42px 1fr 42px; gap: 8px; margin-bottom: 10px; }
.btn.sq { padding: 8px 0; font-size: 17px; line-height: 1; margin-left: 0; }
#regionSelect { background: var(--panel2); color: var(--text); border: 1px solid var(--line2);
  border-radius: 9px; font: 600 13.5px var(--font); padding: 8px 10px; cursor: pointer; min-width: 0; }
.single-track { height: 14px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
.single-fill { height: 100%; width: 0%; }
#singleSpark { width: 100%; height: 55px; background: var(--inset); border: 1px solid var(--line);
  border-radius: 9px; margin-top: 6px; }

/* ---------- textová stránka ---------- */
.prose { max-width: 68ch; }
.prose li { margin-bottom: 8px; }
.steps { padding-left: 20px; }
.steps li::marker { color: var(--acc); font-weight: 700; }
.honest { background: var(--panel2); border-radius: 9px; padding: 2px 14px; margin: 14px 0; }
.honest h3 { color: var(--text); }
.links { list-style: none; padding: 0; }
.links li::before { content: "→ "; color: var(--acc); }

/* ---------- loader ---------- */
#loading { position: fixed; inset: 0; background: var(--bg); z-index: 50;
  display: flex; align-items: center; justify-content: center; }
.loader-box { width: 300px; text-align: center; }
.loader-brand { margin-bottom: 14px; }
.loader-title { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 16px; }
#bootSteps { list-style: none; display: flex; gap: 6px; margin: 0 0 12px; padding: 0; font-size: 0; }
#bootSteps li { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); }
#bootSteps li.active { background: var(--faint); }
#bootSteps li.done { background: var(--acc); }
#loadingMsg { font-family: var(--mono); font-size: 12px; color: var(--dim); margin: 0; }
#loading.failed #loadingMsg { color: var(--red); }

@media (max-width: 1024px) {
  .app { grid-template-columns: 68px 1fr; }
  .side { padding: 14px 10px; align-items: center; }
  .brand-tx, .nav button span, .nav button kbd, .side-foot .tiny { display: none; }
  .brand { padding: 0 0 12px; }
  .nav button { justify-content: center; padding: 10px; }
  .side-foot { border: 0; padding: 12px 0 0; }
  .netstat span { display: none; }
}
@media (max-width: 680px) {
  .app { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .side { position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; height: auto;
    flex-direction: row; border-right: 0; border-top: 1px solid var(--line2);
    background: #0e1117; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav button { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 6px 8px; }
  .nav button svg { width: 20px; height: 20px; }
  .maincol { padding-bottom: 86px; }
  main { padding: 14px 14px 4px; overflow: visible; }
  .stage { grid-template-columns: 1fr; }
  .brainview { height: 320px; flex: none; }
  .module { overflow: visible; }
  .topbar { padding: 10px 14px; }
  .stats { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .netstat i { animation: none; }
}
