:root {
  color-scheme: light;
  --page: #eef0e8;
  --ink: #1e2430;
  --muted: #5f6872;
  --panel: #fffdf6;
  --line: #c8cec5;
  --stage: #d7ddd4;
  --accent: #f0c84d;
  --accent-dark: #7c5b08;
  --teal: #1c9e99;
  --rose: #c95362;
  --violet: #6868ad;
  --shadow: 0 18px 42px rgba(30, 36, 48, 0.17);
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    linear-gradient(125deg, rgba(28, 158, 153, 0.13) 0 28%, transparent 28% 100%),
    linear-gradient(305deg, rgba(201, 83, 98, 0.11) 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(124, 91, 8, 0.42);
  border-radius: 8px;
  color: #211b08;
  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(30, 36, 48, 0.15);
  transform: translateY(-1px);
}

button:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(28, 158, 153, 0.36);
  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.15rem);
  line-height: 0.96;
  margin: 0;
}

.layout {
  align-items: stretch;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 330px) 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, 206, 197, 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.88);
  border: 1px solid rgba(200, 206, 197, 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.24rem;
  line-height: 1.14;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.stage {
  align-items: center;
  background: var(--stage);
  border: 1px solid rgba(95, 104, 114, 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: #fbf8ed;
  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;
  }

  .panel {
    order: 2;
  }

  .stage {
    order: 1;
    padding: 7px;
  }

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

@media (max-width: 520px) {
  .topbar {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

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