:root {
  color-scheme: light;
  --page: #eef4f1;
  --ink: #1f2528;
  --muted: #5a6970;
  --panel: #fbf8ef;
  --line: #c5d2cf;
  --stage: #d7e5e7;
  --water: #2f8f9d;
  --deck: #5f5144;
  --accent: #d9952e;
  --accent-dark: #6d4710;
  --cargo: #496fba;
  --danger: #c84e4a;
  --safe: #17866f;
  --shadow: 0 18px 40px rgba(31, 37, 40, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    linear-gradient(135deg, rgba(47, 143, 157, 0.16) 0 28%, transparent 28% 100%),
    linear-gradient(315deg, rgba(217, 149, 46, 0.14) 0 24%, transparent 24% 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(109, 71, 16, 0.48);
  border-radius: 8px;
  color: #211709;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  min-height: 44px;
  padding: 0 18px;
  transition: box-shadow 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

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

button:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(47, 143, 157, 0.38);
  outline-offset: 3px;
}

.shell {
  margin: 0 auto;
  padding: 16px 0 22px;
  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.1rem, 5vw, 3.8rem);
  line-height: 1;
  margin: 0;
}

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

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

.objective,
.readout,
.stat {
  background: rgba(251, 248, 239, 0.96);
  border: 1px solid rgba(197, 210, 207, 0.95);
  border-radius: 8px;
}

.objective,
.readout {
  padding: 14px;
}

.objective p,
.readout p {
  color: #323b3f;
  font-size: 0.98rem;
  line-height: 1.42;
  margin: 0;
}

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

.stat {
  min-height: 70px;
  padding: 10px;
}

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

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

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

canvas {
  aspect-ratio: 960 / 620;
  background: #dfe9ea;
  border-radius: 6px;
  display: block;
  max-height: calc(100vh - 162px);
  max-width: 100%;
  min-height: 310px;
  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: 255px;
  }
}

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

  button {
    padding: 0 13px;
  }

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

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