/* ============================================================
   Evolve a Picture — dark, GitHub-ish theme
   ============================================================ */
:root {
  --bg:        #0b0e14;
  --panel:     #10151f;
  --card:      #151b26;
  --card-2:    #1b2332;
  --border:    rgba(255, 255, 255, 0.08);
  --border-2:  rgba(255, 255, 255, 0.14);
  --text:      #e6e9ef;
  --muted:     #9aa4b2;
  --hint:      #6b7482;
  --accent:    #22d3ee;   /* cyan  = best  */
  --accent-2:  #a3a3a3;   /* gray  = mean  */
  --good:      #4ade80;
  --warn:      #fb7185;
  --opt:       #ff4d6d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ------------------------- Stage (two canvases) ------------------------- */
#stage {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
}

#boards {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
}
.board {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.board figcaption {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.board figcaption .sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--hint);
  margin-top: 2px;
}
.board canvas {
  background: #05070c;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border);
  display: block;
}
#stage-note {
  margin: 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--hint);
}

/* ------------------------- Panel ------------------------- */
#panel {
  flex: 0 0 340px;
  width: 340px;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#brand h1 { margin: 0; font-size: 19px; letter-spacing: 0.2px; }
#brand .tag { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.brand-row { display: flex; align-items: center; justify-content: space-between; }
#helpBtn {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 14px; font-weight: 700;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--border-2);
  cursor: pointer;
}
#helpBtn:hover { background: #24304a; }

/* Live status line — turns numbers into a story */
.status {
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  border: 1px solid var(--border-2);
  transition: background 0.25s, border-color 0.25s;
}
.status.explore { background: rgba(59, 130, 246, 0.13); border-color: rgba(96, 165, 250, 0.5); color: #bfdbfe; }
.status.climb   { background: rgba(234, 179, 8, 0.13);  border-color: rgba(250, 204, 21, 0.5); color: #fde68a; }
.status.solved  { background: rgba(34, 197, 94, 0.15);  border-color: rgba(74, 222, 128, 0.55); color: #bbf7d0; }
.status.stuck   { background: rgba(244, 63, 94, 0.14);  border-color: rgba(251, 113, 133, 0.55); color: #fecdd3; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

/* Transport buttons */
.transport { display: flex; gap: 8px; }
.transport button {
  flex: 1;
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s, transform 0.05s;
}
.transport button:hover { background: #24304a; }
.transport button:active { transform: translateY(1px); }
.transport button.primary { background: #0e7490; border-color: #14b8d4; }
.transport button.primary:hover { background: #0891b2; }
.transport button.running { background: #7f1d1d; border-color: #ef4444; }
.transport button.running:hover { background: #991b1b; }

/* Readouts */
.readout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.ro { display: flex; flex-direction: column; gap: 2px; }
.ro-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.ro-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ro-cap { font-size: 10.5px; color: var(--hint); line-height: 1.35; margin-top: 1px; }

#chart {
  width: 100%;
  height: 110px;
  display: block;
  border-radius: 8px;
  background: #0c111b;
  border: 1px solid var(--border);
}
.chart-key { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.chart-key span { display: flex; align-items: center; gap: 6px; }
.line { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.line.best { background: var(--accent); }
.line.mean { background: var(--accent-2); }

/* Match hero (headline number) */
.match-hero { display: flex; flex-direction: column; margin-bottom: 12px; }
.match-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.match-val {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.match-hero .ro-cap { margin-top: 3px; }

/* Target picker */
.target-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.target-btn {
  padding: 9px 6px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.target-btn:hover { background: #24304a; }
.target-btn.active { border-color: var(--accent); background: rgba(34, 211, 238, 0.12); }
.wide-btn {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  cursor: pointer;
}
.wide-btn:hover { background: #24304a; }

.hint { font-size: 11px; color: var(--hint); margin: 6px 0 0; line-height: 1.4; }

/* Controls */
.ctrl { margin-bottom: 14px; }
.ctrl:last-child { margin-bottom: 0; }
.ctrl label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.ctrl .v { color: var(--text); font-weight: 700; float: right; font-variant-numeric: tabular-nums; }
.ctrl.row { display: flex; align-items: center; justify-content: space-between; }
.ctrl.row label { margin: 0; }

select {
  width: 100%;
  padding: 8px 10px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: #263042;
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #06232a;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #06232a;
  cursor: pointer;
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* How it works */
.how summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.how p { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 10px 0 0; }
.how b { color: var(--text); font-weight: 600; }

.foot { font-size: 11px; color: var(--hint); text-align: center; padding: 4px 0 8px; }

/* ------------------------- Intro overlay ------------------------- */
#intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(4px);
}
#intro[hidden] { display: none; }
.intro-card {
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.intro-card h2 { margin: 0 0 12px; font-size: 20px; }
.intro-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--muted); }
.intro-card b { color: var(--text); font-weight: 600; }
.intro-card button {
  margin-top: 6px;
  width: 100%;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: #0e7490;
  border: 1px solid #14b8d4;
  border-radius: 10px;
  cursor: pointer;
}
.intro-card button:hover { background: #0891b2; }

/* ------------------------- Responsive ------------------------- */
@media (max-width: 820px) {
  #app { flex-direction: column; height: auto; overflow: visible; }
  #stage { height: auto; }
  #boards { flex-direction: column; }
  #panel { flex: none; width: 100%; height: auto; border-left: none; border-top: 1px solid var(--border); }
}
