:root {
  color-scheme: dark;
  --bg-deep: #081521;
  --bg-harbor: #0d2d35;
  --panel: #102733;
  --panel-strong: #173c45;
  --text: #f5f1dc;
  --muted: #a9c2bd;
  --amber: #ffb14a;
  --ember: #ff6f3c;
  --mint: #71f2c9;
  --coral: #ff6978;
  --line: rgba(245, 241, 220, 0.16);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 177, 74, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 18%, rgba(113, 242, 201, 0.12), transparent 30rem),
    linear-gradient(135deg, var(--bg-deep), #102431 48%, #14202a);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

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

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  color: #fff4c9;
  font-size: 1rem;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.restart-button {
  min-height: 44px;
  border: 1px solid rgba(255, 177, 74, 0.54);
  border-radius: 8px;
  padding: 0 18px;
  background: #ffb14a;
  color: #231405;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(255, 111, 60, 0.2);
  cursor: pointer;
}

.restart-button:hover,
.restart-button:focus-visible {
  background: #ffd07d;
}

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

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-harbor);
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b2a33;
  touch-action: none;
}

.status-panel {
  position: absolute;
  inset: auto 18px 18px 18px;
  display: none;
  border: 1px solid rgba(255, 244, 201, 0.24);
  border-radius: 8px;
  padding: 16px;
  background: rgba(8, 21, 33, 0.9);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
}

.status-panel.is-visible {
  display: block;
}

.status-panel strong {
  display: block;
  margin-bottom: 4px;
  color: #fff4c9;
  font-size: 1.2rem;
}

.status-panel p {
  margin-bottom: 0;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(16, 39, 51, 0.88);
  box-shadow: var(--shadow);
}

.objective,
.prompt,
.controls {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.objective p,
.prompt p,
.controls p {
  margin-bottom: 0;
}

.controls p + p {
  margin-top: 8px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(245, 241, 220, 0.1);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.stat-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat strong {
  color: #fff4c9;
  font-size: 1.18rem;
}

.meter {
  overflow: hidden;
  height: 14px;
  border: 1px solid rgba(245, 241, 220, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--amber), var(--coral));
  transition: width 160ms linear;
}

.controls {
  border-bottom: 0;
  padding-bottom: 0;
}

.controls strong {
  color: #fff4c9;
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 20px, 760px);
    padding: 14px 0;
  }

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

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

  .side-panel {
    order: -1;
  }
}

@media (max-width: 560px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .restart-button {
    width: 100%;
  }
}
