/* Echo Chambers - styles. Dark theme, high contrast, no external fonts or assets. */
:root {
  --bg: #0e1124;
  --panel: #181d3a;
  --panel-2: #212850;
  --line: #3a4375;
  --text: #eef1ff;
  --muted: #b4bbe0;
  --accent-a: #2dd4bf;   /* Chamber A: teal   (circle shape) */
  --accent-b: #fbbf24;   /* Chamber B: amber  (diamond shape) */
  --focus: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 700px at 50% -10%, #1b2150 0%, var(--bg) 60%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(16px, 1.1vw + 12px, 19px);
  line-height: 1.45;
  min-height: 100vh;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(10px, 2.2vw, 24px);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: clamp(8px, 1.6vw, 18px);
}

.title {
  margin: 0;
  font-size: clamp(1.4rem, 2.6vw + 0.6rem, 2.2rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.level-nav { display: flex; gap: 8px; }

.level-btn {
  position: relative;
  min-width: 46px;
  height: 46px;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.level-btn[aria-current="step"] { border-color: var(--text); background: var(--panel-2); }
.level-btn.done::after { content: "\2713"; margin-left: 6px; color: var(--accent-a); font-weight: 800; }
.level-btn:disabled { cursor: not-allowed; opacity: 0.55; border-style: dashed; }
.level-btn.locked::after { content: "locked"; margin-left: 6px; font-size: 0.7em; font-weight: 600; color: var(--muted); }

.intro { text-align: center; margin-bottom: clamp(8px, 1.6vw, 16px); }
.level-name { margin: 0 0 4px; font-size: clamp(1.15rem, 1.4vw + 0.8rem, 1.6rem); }
.level-hint { margin: 0; color: var(--muted); }

.boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 3vw, 36px);
  align-items: start;
}

.board { margin: 0; min-width: 0; }

.board-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
}

.badge {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  color: #10131f;
  font-weight: 800;
  font-size: 0.9em;
}
.badge-a { background: var(--accent-a); border-radius: 50%; }
.badge-b { background: var(--accent-b); border-radius: 4px; transform: rotate(45deg); }
.badge-b { width: 1.4em; height: 1.4em; }
.badge-b::first-line { transform: none; }

.canvas-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

canvas { display: block; width: 100%; height: 100%; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 28px;
  margin: clamp(12px, 2vw, 22px) 0 8px;
}

.counter { display: flex; align-items: baseline; gap: 10px; }
.counter-label { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8em; }
.counter-value { font-size: 2rem; font-weight: 800; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
.counter-best { color: var(--muted); font-size: 0.85em; }

.buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.btn {
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-a); color: #08201c; border-color: var(--accent-a); }
.btn-primary:hover:not(:disabled) { border-color: #fff; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  margin: 0 2px;
  padding: 0 6px;
  font: inherit;
  font-size: 0.8em;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: #0b0e1d;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
}
.btn-primary kbd { color: #08201c; background: rgba(255,255,255,0.45); border-color: rgba(0,0,0,0.3); }

.status {
  min-height: 1.5em;
  margin: 6px 0 14px;
  text-align: center;
  color: var(--text);
}

.howto {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 16px;
  color: var(--muted);
  background: rgba(24, 29, 58, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.howto p { margin: 4px 0; }
.howto strong { color: var(--text); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 8, 20, 0.72);
  z-index: 10;
}
.overlay[hidden] { display: none; }

.dialog {
  width: min(92vw, 460px);
  padding: 24px;
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--text);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}
.dialog-title { margin: 0 0 8px; font-size: 1.7rem; }
.dialog-text { margin: 0 0 18px; color: var(--muted); }
.dialog-buttons { display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 520px) {
  .counter-value { font-size: 1.6rem; }
  .btn { padding: 8px 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  .level-btn, .btn { transition: border-color 120ms ease; }
}
