:root {
  color-scheme: dark;
  --ink: #f7f5ef;
  --muted: #a8a8b7;
  --panel: rgba(22, 24, 38, .88);
  --line: rgba(255,255,255,.1);
  --pink: #ff5e7d;
  --blue: #6f8cff;
  --yellow: #ffdc56;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: #090a11; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(111,140,255,.18), transparent 32rem),
    radial-gradient(circle at 88% 35%, rgba(255,94,125,.14), transparent 28rem),
    #090a11;
}
.shell { width: min(1220px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 34px; }
.hero { max-width: 800px; margin-bottom: 34px; }
.eyebrow { color: #aebcff; text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 800; }
h1 { margin: 8px 0 12px; font-size: clamp(40px, 7vw, 76px); line-height: .95; letter-spacing: -.055em; }
.hero p { max-width: 690px; margin: 0; color: #c8c8d3; font-size: clamp(17px, 2vw, 21px); line-height: 1.55; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 20px; color: var(--muted); font-size: 14px; }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 16px; height: 16px; }
.legend .square { border-radius: 4px; background: var(--blue); }
.legend .triangle { width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 17px solid var(--yellow); }
.legend .empty { border: 1px dashed #77798a; border-radius: 4px; }
.lab { display: grid; grid-template-columns: minmax(0, 600px) minmax(330px, 1fr); gap: 26px; align-items: start; }
.board-panel, #stats, .lesson { background: var(--panel); border: 1px solid var(--line); box-shadow: 0 25px 70px rgba(0,0,0,.25); backdrop-filter: blur(18px); }
.board-panel { padding: 16px; border-radius: 28px; overflow: hidden; }
.board-label { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 14px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.board-label strong { color: #b7f4cc; }
#canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 18px; background: #11131e; touch-action: none; }
.tip { color: var(--muted); margin: 13px 4px 2px; font-size: 13px; line-height: 1.45; }
#stats { padding: 20px; border-radius: 28px; display: grid; gap: 16px; }
.metric-card, .control-card { border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.025); padding: 15px; }
.metric-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.metric-head strong { color: var(--pink); font-size: 26px; letter-spacing: -.04em; }
#stats_canvas_container { background: url(assets/stats.png) center/100% 100% no-repeat; width: 100%; aspect-ratio: 4/3; position: relative; overflow: hidden; border-radius: 12px; }
#stats_canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#stats_text { position: absolute; opacity: 0; }
.control-copy { display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: baseline; color: var(--muted); font-size: 14px; }
.control-copy strong { color: var(--ink); font-size: 16px; }
.ds { width: 100%; height: 42px; position: relative; overflow: hidden; margin-top: 12px; border-radius: 11px; }
.ds > div { position: absolute; height: 100%; }
.ds > .ds_bg { background-repeat: no-repeat; background-position: center; background-size: 27px; }
.ds > .ds_slider { width: 14px; background: url(assets/ds_slider.png) center/14px 50px no-repeat; cursor: col-resize; z-index: 2; touch-action: none; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button { border: 0; border-radius: 14px; padding: 14px 16px; background: linear-gradient(135deg, #ff5475, #ff8a5b); color: white; font: inherit; font-weight: 800; cursor: pointer; box-shadow: 0 10px 25px rgba(255,84,117,.2); }
button:hover { filter: brightness(1.08); transform: translateY(-1px); }
button:active { transform: translateY(1px); }
button.secondary { background: #292c3d; box-shadow: none; color: #d8d8e2; }
button.running { background: linear-gradient(135deg, #687cff, #9b6fff); }
.lesson { margin-top: 26px; padding: 20px; border-radius: 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lesson div { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.lesson span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: #292c3d; color: #b9c3ff; font-weight: 800; }
.lesson p { margin: 2px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.lesson strong { color: var(--ink); }
footer { padding: 22px 5px 0; color: #6f7080; font-size: 12px; line-height: 1.5; }
@media (max-width: 940px) {
  .shell { width: min(650px, calc(100% - 22px)); padding-top: 34px; }
  .lab { grid-template-columns: 1fr; }
  .lesson { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .shell { width: calc(100% - 14px); }
  .board-panel, #stats { border-radius: 21px; padding: 11px; }
  .actions { grid-template-columns: 1fr; }
}
