:root {
  color-scheme: light;
  --sky-top: #c8f0ff;
  --sky-bottom: #fff1c4;
  --panel: rgba(14, 53, 64, 0.84);
  --panel-border: rgba(255, 255, 255, 0.18);
  --text: #f5fffe;
  --muted: #cdeced;
  --accent: #ffd166;
  --button: rgba(255, 255, 255, 0.12);
  --button-hover: rgba(255, 255, 255, 0.2);
  --shadow: rgba(7, 31, 39, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.35), transparent 28%),
    radial-gradient(circle at 78% 20%, rgba(255, 209, 102, 0.28), transparent 22%),
    linear-gradient(180deg, var(--sky-top) 0%, #a6e4d0 48%, var(--sky-bottom) 100%);
}

button {
  font: inherit;
  touch-action: manipulation;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.shell {
  width: min(1080px, 100%);
  padding: 26px;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 28px 80px var(--shadow);
  backdrop-filter: blur(12px);
  display: grid;
  gap: 0;
}

.hero {
  display: grid;
  gap: 10px;
}

.eyebrow,
.summary,
.hint,
.hud span {
  margin: 0;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
}

.summary {
  max-width: 58ch;
  line-height: 1.5;
}

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

.hud article {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hud strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
}

.status-row {
  margin: 18px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.status {
  margin: 0;
  font-weight: 700;
}

.actions,
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions {
  justify-content: flex-end;
}

.actions button,
.controls button {
  padding: 11px 16px;
  min-width: 110px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--button);
  color: var(--text);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

.actions button:hover,
.controls button:hover {
  background: var(--button-hover);
  transform: translateY(-1px);
}

.viewport {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  touch-action: manipulation;
  margin-top: 16px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 3;
  background: #d9f8ff;
}

.controls {
  margin-top: 16px;
}

.hint {
  margin-top: 16px;
}

@media (max-width: 900px) {
  .shell {
    padding: 18px;
  }

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

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

  .actions,
  .controls {
    width: 100%;
  }

  .actions button,
  .controls button {
    flex: 1 1 140px;
    min-height: 52px;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 12px;
  }

  .shell {
    padding: 12px;
    border-radius: 22px;
  }

  .hero {
    gap: 6px;
  }

  .eyebrow,
  .summary,
  .hint {
    display: none;
  }

  h1 {
    font-size: 1.95rem;
  }

  .hud {
    margin-top: 10px;
    gap: 8px;
  }

  .hud article {
    padding: 10px 12px;
    border-radius: 14px;
  }

  .hud span {
    font-size: 0.82rem;
  }

  .hud strong {
    margin-top: 4px;
    font-size: 1rem;
  }

  .status-row {
    margin: 10px 0 0;
    gap: 10px;
  }

  .status {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .actions {
    gap: 8px;
  }

  .actions button {
    min-height: 48px;
    padding: 10px 12px;
  }

  .viewport {
    order: 1;
    margin-top: 14px;
    border-radius: 18px;
  }

  canvas {
    aspect-ratio: 16 / 9;
  }

  .controls {
    order: 2;
    margin-top: 12px;
    gap: 8px;
  }

  .hero {
    order: 3;
    margin-top: 12px;
  }

  .hud {
    order: 4;
  }

  .status-row {
    order: 5;
  }

  .actions button,
  .controls button {
    min-width: 0;
    min-height: 56px;
    padding: 12px 14px;
    font-weight: 700;
  }

  .hint strong {
    white-space: nowrap;
  }
}
