:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #10261b;
  color: #f2f7ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(232, 203, 124, 0.16), transparent 30%),
    linear-gradient(180deg, #183e2a 0%, #10261b 46%, #07140f 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid rgba(246, 232, 184, 0.25);
  background: #e0b65f;
  color: #132118;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #f2cc76;
}

.shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}

.game-panel,
.notes {
  border: 1px solid rgba(246, 232, 184, 0.18);
  background: rgba(12, 28, 19, 0.78);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  border-radius: 8px;
}

.game-panel {
  padding: 14px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #c6dc98;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 4vw, 3.1rem);
  line-height: 1;
}

h2 {
  font-size: 1.1rem;
}

.status-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-stack span,
.hud span {
  border: 1px solid rgba(246, 232, 184, 0.18);
  background: rgba(25, 56, 36, 0.72);
  color: #f8efd0;
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.seed-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(4, auto);
  gap: 8px;
  margin-bottom: 12px;
}

.seed-field {
  display: grid;
  gap: 4px;
}

.seed-field span {
  font-size: 0.78rem;
  color: #c6dc98;
  font-weight: 800;
}

.seed-field input {
  min-height: 42px;
  border: 1px solid rgba(246, 232, 184, 0.22);
  border-radius: 6px;
  background: #07140f;
  color: #f2f7ea;
  padding: 0 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.canvas-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #07140f;
  border: 1px solid rgba(246, 232, 184, 0.22);
  border-radius: 8px;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

.game-panel:fullscreen {
  width: 100vw;
  height: 100vh;
  overflow: auto;
  border-radius: 0;
}

.game-panel:fullscreen .canvas-wrap {
  max-height: calc(100vh - 230px);
}

.game-panel:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  overflow: auto;
  border-radius: 0;
}

.game-panel:-webkit-full-screen .canvas-wrap {
  max-height: calc(100vh - 230px);
}

.overlay {
  position: absolute;
  inset: auto 16px 16px;
  display: grid;
  gap: 3px;
  max-width: 360px;
  border: 1px solid rgba(246, 232, 184, 0.24);
  background: rgba(7, 20, 15, 0.78);
  color: #f8efd0;
  border-radius: 8px;
  padding: 12px;
  pointer-events: none;
}

.overlay.hidden {
  display: none;
}

.hud {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.debug-panel {
  margin-top: 12px;
  border: 1px solid rgba(246, 232, 184, 0.18);
  background: rgba(7, 20, 15, 0.62);
  border-radius: 8px;
  padding: 10px;
}

.debug-panel summary {
  cursor: pointer;
  color: #f8efd0;
  font-weight: 900;
}

.debug-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.debug-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0;
}

.debug-grid div {
  border: 1px solid rgba(246, 232, 184, 0.14);
  background: rgba(25, 56, 36, 0.58);
  border-radius: 6px;
  padding: 8px;
  min-width: 0;
}

.debug-grid dt {
  color: #c6dc98;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.debug-grid dd {
  margin: 3px 0 0;
  color: #f8efd0;
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frame-debug {
  margin-top: 12px;
  border-top: 1px solid rgba(246, 232, 184, 0.14);
  padding-top: 10px;
}

.frame-debug-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: #f8efd0;
}

.frame-debug-header span {
  color: #c6dc98;
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
}

.frame-presets,
.frame-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.frame-presets button,
.frame-buttons button {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 0.78rem;
}

.frame-buttons button.active {
  background: #f8efd0;
  color: #07140f;
  border-color: #f8efd0;
}

.touch-controls {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.notes {
  padding: 16px;
  align-self: start;
}

.notes p {
  color: #d9e6c2;
}

.notes ul {
  margin: 0;
  padding-left: 18px;
  color: #d9e6c2;
}

.notes li + li {
  margin-top: 8px;
}

@media (max-width: 940px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .notes {
    order: -1;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 10px;
  }

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

  .seed-row {
    grid-template-columns: 1fr 1fr;
  }

  .seed-field {
    grid-column: 1 / -1;
  }

  .touch-controls {
    display: grid;
  }

  .status-stack {
    justify-content: flex-start;
  }

  .debug-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
