:root {
  color-scheme: dark;
  --background: #0c1723;
  --panel: #13222f;
  --text: #e0e9ef;
  --muted: #9fb1bf;
  --accent: #65d7b4;
  --button: #1d3445;
  --button-hover: #27465c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font: 16px/1.5 system-ui, "Noto Sans KR", "Malgun Gothic", sans-serif;
}

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

[hidden] { display: none !important; }

.panel { padding: 8px 0; }

h1 { margin: 0 0 8px; font-size: 32px; font-weight: 600; }
#screen.title h1 { font-size: 64px; }

p { margin: 0 0 12px; color: var(--muted); white-space: pre-line; }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }

button {
  min-width: 140px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid #2c4a5e;
  border-radius: 6px;
  background: var(--button);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--button-hover); }
button:disabled { opacity: 0.45; cursor: default; }
button.armed { border-color: #b4edff; color: #b4edff; }

#status { margin: 0 0 8px; color: var(--text); }
#hud { margin: 0 0 8px; color: var(--text); font-size: 20px; font-weight: 600; }
#canvas-host { position: relative; width: 100%; }
#canvas-host canvas { display: block; border-radius: 6px; }
/* The editor's canvas takes touches and the right button for itself. */
#canvas-host.editing canvas { touch-action: none; cursor: crosshair; }
/* A drop game's canvas takes touches to aim and drop, and sits in the middle. */
#canvas-host.dropping canvas { touch-action: none; margin: 0 auto; image-rendering: pixelated; }
#hud .hud-value { display: inline-flex; align-items: center; gap: 6px; margin-right: 18px; }
#hud .hud-value img { height: 28px; image-rendering: pixelated; }
#palette button, #settings button { min-width: 0; }
#stage-name {
  width: min(100%, 420px);
  min-height: 40px;
  margin: 0 0 8px;
  padding: 6px 10px;
  border: 1px solid #2c4a5e;
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}
/* The stage list: a row per stage, its name first. */
#buttons.stages { flex-direction: column; align-items: stretch; }
#buttons .stage-row, #buttons .stage-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#buttons .stage-row button:first-child { flex: 1 1 240px; text-align: left; }
#settings .setting { display: flex; align-items: center; gap: 8px; }
#outcome {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 12, 0.55);
  color: var(--text);
  text-align: center;
}
#outcome .ending { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 22px;
  background: rgba(45, 33, 80, 0.94); border: 4px solid #0d0820; box-shadow: 0 0 0 3px #6b5b95, 8px 8px 0 3px #0d0820; }
#outcome .ending strong { font-size: 40px; }
#outcome .ending .totals { font-size: 26px; font-weight: 700; color: #ffd43b; }
#outcome .ending dl { display: grid; grid-template-columns: auto auto; gap: 4px 14px; margin: 0; font-size: 17px; text-align: left; }
#outcome .ending dt { color: var(--muted); }
#outcome .ending dd { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 600; }
#outcome .ending dd img { height: 26px; image-rendering: pixelated; }
#outcome .ending .hint { font-size: 15px; color: var(--muted); }

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 8, 12, 0.85);
}
.overlay .panel { max-width: 640px; width: 100%; padding: 24px; border-radius: 8px; background: var(--panel); }

/* The license link sits under the page while loading and on the title screen. */
#site-notices { max-width: 1200px; margin: 0 auto; padding: 0 16px 24px; font-size: 14px; }
#site-notices a { color: var(--muted); }
