:root {
  color-scheme: dark;
  --bg: #070a0e;
  --panel: #0c1018;
  --line: #1c2838;
  --text: #e6eef6;
  --muted: #7f95a8;
  --cyan: #3de8ff;
  --lime: #b8ff52;
  --violet: #c77dff;
  --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% 70% at 50% -10%, #121a28 0%, var(--bg) 58%);
}

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

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

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

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 2px 12px;
  border-bottom: 1px solid var(--line);
}

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

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

.brand strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
}

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

.ghost-button,
.btn-ghost,
.btn-primary,
.btn-text {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #111722;
  color: var(--text);
  padding: 8px 10px;
}

.btn-primary {
  border-color: var(--lime);
  color: #102010;
  background: var(--lime);
}

.hero {
  padding: 12px 2px;
}

.kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.hero h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.hero h1 span {
  display: block;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}

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

.rule-hint {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--lime);
  text-align: center;
}

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

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

.hud span {
  display: block;
  color: var(--muted);
}

.hud strong {
  font-size: 0.95rem;
  color: var(--cyan);
}

.canvas-stack {
  position: relative;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  height: min(58vh, 480px);
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #05080c;
}

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

.minimap {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  opacity: 0.85;
}

.operator-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: #6a7a88;
  letter-spacing: 0.05em;
}

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

.utility {
  text-align: center;
  margin: 6px 0;
}

.graph-inspector {
  margin: 8px 0;
  font-size: 0.8rem;
}

.graph-inspector.open {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
}

.details-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.summary-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--violet);
  border-radius: 6px;
  background: #0e1018;
}

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

.records,
.disclaimer {
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 400px) {
  .hud {
    grid-template-columns: repeat(2, 1fr);
  }
}

html[data-capture="1"] .shell {
  max-width: 390px;
  padding-top: 8px;
}

html[data-capture="1"] .canvas-wrap {
  height: min(72vh, 620px);
}

html[data-promo-shot="1"] .canvas-wrap {
  height: 844px;
  min-height: 844px;
}

html[data-promo-og="1"] body {
  min-height: 630px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
