:root {
  --bg: #0d0b16;
  --panel: rgba(24, 20, 40, .78);
  --panel-solid: #171328;
  --line: rgba(173, 150, 255, .16);
  --text: #f3efff;
  --muted: #b7acd8;
  --accent: #8c75ff;
  --accent2: #ff6ec7;
  --good: #70e0a3;
  --warn: #ffd36a;
  --shadow: 0 24px 80px rgba(0,0,0,.45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
.bg {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(140,117,255,.28), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(255,110,199,.18), transparent 55%),
    radial-gradient(500px 300px at 50% 100%, rgba(112,224,163,.12), transparent 60%),
    linear-gradient(180deg, #120f20, #0d0b16 45%, #090813);
}
.bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: radial-gradient(circle at center, black 30%, transparent 75%);
}
.shell { position: relative; width: min(1220px, calc(100% - 32px)); margin: 28px auto 40px; }
.card {
  background: linear-gradient(180deg, rgba(33,27,56,.88), rgba(20,16,36,.84));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.hero { display: flex; gap: 24px; justify-content: space-between; align-items: end; padding: 28px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 8px; color: #cdbfff; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(40px, 7vw, 72px); line-height: .92; letter-spacing: -.04em; }
h1::after { content: " ✦"; color: var(--accent2); font-size: .55em; vertical-align: .35em; }
.lead { margin: 14px 0 0; max-width: 720px; color: var(--muted); font-size: 17px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn {
  appearance: none; border: 1px solid rgba(255,255,255,.12); background: #251e42; color: var(--text);
  padding: 11px 16px; border-radius: 999px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none;
  transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.24); background: #302752; }
.btn:active { transform: translateY(0); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6b5ce7); border-color: transparent; box-shadow: 0 10px 30px rgba(140,117,255,.35); }
.btn.ghost { background: rgba(255,255,255,.03); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.board-card { padding: 20px; }
.status-row { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.status { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.pill { padding: 8px 12px; border-radius: 999px; background: rgba(140,117,255,.14); color: #dcd2ff; font-size: 13px; font-weight: 700; border: 1px solid rgba(140,117,255,.25); white-space: nowrap; }
.board {
  --sq: clamp(40px, 8.5vw, 74px);
  display: grid;
  grid-template-columns: repeat(8, var(--sq));
  grid-template-rows: repeat(8, var(--sq));
  width: calc(var(--sq) * 8);
  height: calc(var(--sq) * 8);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  user-select: none;
}
.sq {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--sq);
  height: var(--sq);
  padding: 0;
  margin: 0;
  border: 0;
  font-size: calc(var(--sq) * 0.72);
  line-height: 1;
  cursor: pointer;
  transition: filter .12s, transform .12s;
}
.sq.light { background: #e8def8; color: #24173d; }
.sq.dark { background: #6b55b7; color: #fff; }
.sq:hover { filter: brightness(1.05); }
.sq.selected { box-shadow: inset 0 0 0 5px rgba(255,211,106,.95); z-index: 1; }
.sq.hint::before { content: ""; position: absolute; width: 28%; aspect-ratio: 1; border-radius: 50%; background: rgba(19,12,38,.22); }
.sq.hint.cap::before { width: 78%; background: transparent; border: 6px solid rgba(19,12,38,.22); }
.sq.dark.hint::before { background: rgba(255,255,255,.24); }
.sq.dark.hint.cap::before { background: transparent; border-color: rgba(255,255,255,.24); }
.sq.boom { animation: boom .45s ease; }
.sq.last { box-shadow: inset 0 0 0 4px rgba(255,110,199,.45); }
.piece { line-height: 1; filter: drop-shadow(0 4px 2px rgba(0,0,0,.22)); transition: transform .12s; }
.sq:hover .piece { transform: translateY(-1px) scale(1.02); }
.white { color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25), 0 0 1px rgba(0,0,0,.45); }
.black { color: #1f1538; text-shadow: 0 1px 0 rgba(255,255,255,.18); }
.sq.dark .black { color: #140e24; }
.coord { position: absolute; font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; opacity: .7; pointer-events: none; }
.coord.r { top: 5px; left: 5px; } .coord.f { bottom: 4px; right: 5px; }
.sq.light .coord { color: #5b4aa3; } .sq.dark .coord { color: #efe8ff; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dot.sel { background: var(--warn); } .dot.hint { background: rgba(255,255,255,.45); } .dot.boom { background: var(--accent2); }
.side { padding: 20px; }
.side h2 { margin: 0 0 12px; font-size: 20px; letter-spacing: -.02em; }
.side h3 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.toggle { display: flex; gap: 10px; align-items: center; padding: 8px 0; color: #ddd5f5; font-size: 14px; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.slider-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.slider-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.slider-row input { width: 100%; accent-color: var(--accent2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { padding: 12px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); text-align: center; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stat .v { font-size: 24px; font-weight: 800; color: #efe8ff; margin-top: 2px; }
.log { height: 220px; overflow: auto; padding: 10px; border-radius: 14px; background: rgba(9,8,19,.55); border: 1px solid rgba(255,255,255,.06); font-size: 13px; }
.log p { margin: 0 0 8px; color: #d9d0f3; }
.log p:last-child { margin-bottom: 0; }
.log .t { color: #8f84b6; font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; margin-right: 6px; }
.log .event { color: #ffd5ef; }
.fine { margin: 14px 0 0; color: #9489b8; font-size: 12px; }
@keyframes boom {
  0% { filter: brightness(1); transform: scale(1); }
  30% { filter: brightness(1.4) saturate(1.3); transform: scale(1.03); }
  100% { filter: brightness(1); transform: scale(1); }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .board { --sq: clamp(34px, 10.5vw, 74px); }
  .side { max-width: calc(var(--sq, 74px) * 8); width: 100%; }
}
@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 1220px); margin-top: 14px; }
  .hero { padding: 20px; align-items: stretch; }
  .hero-actions { justify-content: stretch; }
  .hero-actions .btn { flex: 1; text-align: center; }
  .status { font-size: 20px; }
  .board { --sq: clamp(30px, 10.8vw, 52px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
