:root {
  color-scheme: light;
  --page: #edf1e9;
  --ink: #20252b;
  --muted: #5d6870;
  --panel: #fffdf6;
  --line: #c8d0c4;
  --stage: #d9e4df;
  --grid: #f8f3e7;
  --accent: #e8b33e;
  --accent-dark: #77540d;
  --teal: #087f8c;
  --coral: #d95d39;
  --violet: #5653a6;
  --shadow: 0 18px 42px rgba(32, 37, 43, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(120deg, rgba(8, 127, 140, 0.12) 0 26%, transparent 26% 100%),
    linear-gradient(300deg, rgba(217, 93, 57, 0.12) 0 22%, transparent 22% 100%),
    var(--page);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  background: var(--accent);
  border: 1px solid rgba(119, 84, 13, 0.42);
  border-radius: 8px;
  color: #211a08;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  min-height: 44px;
  padding: 0 18px;
  transition: box-shadow 120ms ease, transform 120ms ease;
}

button:hover {
  box-shadow: 0 10px 20px rgba(32, 37, 43, 0.14);
  transform: translateY(-1px);
}

button:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(8, 127, 140, 0.34);
  outline-offset: 3px;
}

.shell {
  margin: 0 auto;
  padding: 18px 0 24px;
  width: min(1190px, calc(100vw - 28px));
}

.topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.eyebrow,
.label {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.2rem, 5.5vw, 4.05rem);
  line-height: 0.96;
  margin: 0;
}

.layout {
  align-items: stretch;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.objective,
.readout {
  background: rgba(255, 253, 246, 0.95);
  border: 1px solid rgba(200, 208, 196, 0.94);
  border-radius: 8px;
  padding: 14px;
}

.objective p,
.readout p {
  color: #343b42;
  font-size: 0.98rem;
  line-height: 1.44;
  margin: 0;
}

.stat-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat {
  background: rgba(255, 253, 246, 0.89);
  border: 1px solid rgba(200, 208, 196, 0.94);
  border-radius: 8px;
  min-height: 72px;
  padding: 10px;
}

.stat > span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 850;
}

.stat strong {
  display: block;
  font-size: 1.16rem;
  line-height: 1.14;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.stage {
  align-items: center;
  background: var(--stage);
  border: 1px solid rgba(93, 104, 112, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
}

canvas {
  aspect-ratio: 960 / 640;
  background: var(--grid);
  border-radius: 6px;
  display: block;
  max-height: calc(100vh - 168px);
  max-width: 100%;
  min-height: 320px;
  touch-action: none;
  width: 100%;
}

@media (max-width: 880px) {
  .shell {
    padding-top: 12px;
    width: min(100vw - 18px, 720px);
  }

  .topbar {
    align-items: flex-start;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .stage {
    padding: 7px;
  }

  canvas {
    max-height: none;
    min-height: 260px;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 10px;
  }

  button {
    padding: 0 13px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .stat {
    min-height: 58px;
  }
}
