:root {
  --bg: #05070f;
  --panel: #0b101c;
  --line: rgba(130, 168, 196, 0.22);
  --text: #e8f2ff;
  --muted: #8fa4bc;
  --cyan: #38e8ff;
  --amber: #ffb347;
  --mint: #5fffc8;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Hiragino Sans", "Yu Gothic UI", "Segoe UI", system-ui, sans-serif;
  overflow-x: hidden;
}

body {
  overscroll-behavior: none;
}

.shell {
  max-width: 430px;
  margin: 0 auto;
  padding: 0 0  env(safe-area-inset-bottom, 0);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 6px;
  flex-wrap: wrap;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
}

.brand {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-align: right;
  line-height: 1.35;
}

.brand strong {
  display: block;
  color: var(--cyan);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(10, 16, 28, 0.85);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
}

.ghost-button[aria-pressed="false"] {
  color: var(--muted);
}

.play-intro {
  padding: 8px 14px 20px;
  text-align: center;
}

.kicker {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin: 0 0 8px;
}

.play-intro h1 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.play-intro h1 span {
  display: block;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 4px;
}

.lead {
  font-size: 1.05rem;
  margin: 0 0 12px;
}

.demo-wrap {
  margin: 0 auto 10px;
  max-width: 320px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #070b14;
}

.course-pick {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 0 12px 12px;
  flex-wrap: wrap;
}

.course-pick button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 16, 28, 0.85);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.course-pick button[aria-pressed="true"] {
  border-color: rgba(56, 232, 255, 0.55);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(56, 232, 255, 0.15);
}

#demo-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: min(100%, 280px);
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, #0e6a88, var(--cyan));
  color: #021018;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.console {
  padding: 0 10px 10px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}

.hud strong {
  display: block;
  font-size: 1rem;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

.sector-strip {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.sector-strip li {
  flex: 1;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.sector-strip li[data-on="1"] {
  border-color: rgba(56, 232, 255, 0.55);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(56, 232, 255, 0.15);
}

.canvas-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #060912;
  line-height: 0;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

#game-canvas:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.steer-pad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.steer-btn {
  min-height: 56px;
  font-size: 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(56, 232, 255, 0.35);
  background: linear-gradient(180deg, rgba(16, 32, 48, 0.95), rgba(8, 14, 24, 0.98));
  color: var(--cyan);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.steer-btn:active,
.steer-btn.is-on {
  background: rgba(56, 232, 255, 0.2);
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(56, 232, 255, 0.25);
}

.operator {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 2px solid rgba(56, 232, 255, 0.35);
  background: rgba(8, 12, 20, 0.65);
  border-radius: 0 8px 8px 0;
}

.op-icon {
  opacity: 0.92;
  flex-shrink: 0;
}

.op-label {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.op-msg {
  margin: 2px 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
}

.summary {
  padding: 16px 14px 24px;
}

.sum-rank {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--amber);
  margin: 0 0 12px;
}

#sum-stats {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

#sum-stats li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.records {
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--muted);
}

html[data-capture="1"] .capture-hide {
  display: none !important;
}

html[data-promo-shot="1"] .capture-hide,
html[data-promo-shot="1"] .masthead {
  display: none !important;
}

html[data-promo-og="1"] body {
  background: #03050a;
}

@media (prefers-reduced-motion: reduce) {
  .steer-btn:active {
    transition: none;
  }
}