:root {
  color-scheme: dark;
  --bg: #04060a;
  --panel: #0c1018;
  --line: #1e2a3d;
  --text: #e8eef8;
  --muted: #8fa0b8;
  --cyan: #3de8ff;
  --amber: #ffb347;
  --mint: #5dffb2;
  --font: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #111a2e 0%, var(--bg) 55%);
}

a {
  color: var(--cyan);
}

.capture-hide {
  display: none !important;
}

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 12px calc(env(safe-area-inset-bottom) + 16px);
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 4px 14px;
  border-bottom: 1px solid var(--line);
}

.back {
  font-size: 0.82rem;
  text-decoration: none;
}

.brand {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.brand strong {
  display: block;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: 0.04em;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.ghost-button {
  font: inherit;
  font-size: 0.75rem;
  font-family: var(--mono);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
}

.ghost-button[aria-pressed="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
}

.hero {
  padding: 12px 4px 8px;
}

.hero .kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--amber);
  letter-spacing: 0.14em;
}

.hero h1 {
  margin: 4px 0 6px;
  font-size: clamp(1.35rem, 4.5vw, 1.85rem);
  line-height: 1.15;
}

.hero h1 span {
  color: var(--cyan);
}

.catch {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.console {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule-hint {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.9rem;
  border-left: 3px solid var(--cyan);
  background: rgba(61, 232, 255, 0.06);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.hud div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
}

.hud span {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
}

.hud strong {
  font-size: 1rem;
  color: var(--mint);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  min-height: min(62vh, 520px);
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #05080e;
  touch-action: none;
}

#city-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(62vh, 520px);
  cursor: crosshair;
}

.live-msg {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.2em;
}

details.sim-details {
  font-family: var(--mono);
  font-size: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--panel);
}

details.sim-details summary {
  cursor: pointer;
  color: var(--cyan);
  list-style: none;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-top: 8px;
  color: var(--muted);
}

.summary-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(145deg, #0a1220, #070b12);
}

.summary-panel h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--mint);
}

.summary-panel p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-primary,
.btn-ghost {
  font: inherit;
  border-radius: 4px;
  padding: 10px 16px;
  cursor: pointer;
}

.btn-primary {
  border: none;
  background: var(--cyan);
  color: #041018;
  font-weight: 600;
}

.btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.utility-row {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.btn-text {
  font: inherit;
  font-size: 0.78rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}

.disclaimer {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.85;
}

.records {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 8px 0 0;
}

.operator-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: #556;
  letter-spacing: 0.06em;
  pointer-events: none;
}

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

[data-capture="1"] .shell {
  max-width: 440px;
  padding-top: max(env(safe-area-inset-top), 8px);
}

[data-capture="1"] .canvas-wrap {
  min-height: min(70vh, 640px);
  max-height: 74vh;
}

[data-promo-shot="1"] .shell {
  max-width: 390px;
  min-height: 844px;
}

[data-promo-shot="1"] .canvas-wrap,
[data-promo-shot="1"] #city-canvas {
  min-height: 520px;
}

[data-promo-og="1"] body {
  width: 1200px;
  height: 630px;
  overflow: hidden;
}

[data-promo-og="1"] .shell {
  max-width: 1200px;
  padding: 12px 16px;
}

[data-promo-og="1"] .canvas-wrap {
  min-height: 480px;
  max-height: 500px;
}

@media (max-width: 480px) {
  .hud {
    font-size: 0.65rem;
  }
  .hud strong {
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
