:root {
  --bg: #07131f;
  --bg-soft: #102538;
  --panel: rgba(12, 27, 41, 0.92);
  --panel-border: rgba(125, 190, 255, 0.18);
  --text: #e8f3ff;
  --muted: #94acc6;
  --accent: #46d4ff;
  --accent-strong: #00f0a4;
  --danger: #ff6473;
  --warm: #ffd166;
  --shadow: 0 22px 56px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 240, 164, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(70, 212, 255, 0.18), transparent 28%),
    linear-gradient(180deg, #0b1724 0%, #07131f 50%, #050d16 100%);
}

body {
  padding: 24px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(79, 120, 158, 0.28), rgba(22, 39, 56, 0.92));
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(70, 212, 255, 0.45);
}

button.primary {
  background: linear-gradient(180deg, rgba(0, 240, 164, 0.28), rgba(16, 95, 79, 0.95));
  border-color: rgba(0, 240, 164, 0.4);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 14, 22, 0.84);
  color: var(--text);
  padding: 10px 12px;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

textarea {
  min-height: 280px;
  resize: vertical;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 13px;
}

.app-shell {
  max-width: 1760px;
  margin: 0 auto;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(14, 38, 58, 0.96), rgba(7, 19, 31, 0.88)),
    linear-gradient(90deg, rgba(70, 212, 255, 0.08), rgba(0, 240, 164, 0.08));
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-size: 12px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
}

.hero-copy {
  margin: 0;
  max-width: 780px;
  line-height: 1.7;
  color: var(--muted);
}

.keycaps {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.keycaps span {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.22), rgba(255, 209, 102, 0.08));
  border: 1px solid rgba(255, 209, 102, 0.32);
  font-size: 22px;
  font-weight: 700;
  box-shadow: inset 0 -6px 18px rgba(0, 0, 0, 0.24);
}

.layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 320px minmax(980px, 1.25fr) 380px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

.field-note {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 0;
}

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

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

.status-card,
.timeline-panel {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-readout {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.game-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-stage {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  aspect-ratio: 16 / 9;
  min-height: min(78vh, 860px);
  max-height: 860px;
  background: linear-gradient(180deg, rgba(7, 16, 25, 0.98), rgba(3, 8, 14, 1));
}

.game-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 10, 18, 0.14), rgba(3, 10, 18, 0.28)),
    radial-gradient(circle at top, rgba(70, 212, 255, 0.1), transparent 45%);
  pointer-events: none;
  z-index: 1;
}

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

.hud-block {
  padding: 14px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(70, 212, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(70, 212, 255, 0.16);
}

.hud-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.hud-block strong {
  font-size: clamp(20px, 2vw, 28px);
}

#bgVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  opacity: 0.56;
  filter: saturate(1.08) contrast(1.05) brightness(0.82);
  background: #01060c;
}

#bgVideo.is-visible {
  display: block;
}

#gameCanvas {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background: transparent;
}

.editor-head {
  margin-bottom: 14px;
}

.editor-form {
  margin-bottom: 10px;
}

.editor-split {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}

.note-list {
  min-height: 300px;
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 6px;
}

.note-row {
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.note-row.is-selected {
  border-color: rgba(70, 212, 255, 0.48);
  background: rgba(70, 212, 255, 0.12);
}

.note-row-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

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

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

  .game-stage {
    min-height: min(72vh, 760px);
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .hero {
    padding: 18px;
    flex-direction: column;
    align-items: start;
  }

  .inline-grid,
  .hud,
  .editor-split {
    grid-template-columns: 1fr;
  }

  #gameCanvas {
    height: 62vh;
  }

  .game-stage {
    aspect-ratio: auto;
    min-height: 62vh;
  }
}
