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

:root {
  --bg: #04050a;
  --panel: #0a0e16;
  --cyan: #2ee8ff;
  --violet: #b56dff;
  --gold: #ffd76a;
  --mint: #6dffcf;
  --text: #e8f2ff;
  --muted: #8fa2be;
  --danger: #ff5c52;
  --v: 20261121-g5;
}

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

body {
  background:
    radial-gradient(ellipse 110% 70% at 50% -5%, rgba(46, 232, 255, 0.08), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 30%, rgba(181, 109, 255, 0.07), transparent 45%),
    var(--bg);
}

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

html[data-promo-shot="1"] body {
  min-height: 100svh;
  background-color: #14202e;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(46, 232, 255, 0.04) 0,
      rgba(46, 232, 255, 0.04) 1px,
      transparent 1px,
      transparent 22px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 215, 120, 0.03) 0,
      rgba(255, 215, 120, 0.03) 1px,
      transparent 1px,
      transparent 18px
    ),
    linear-gradient(180deg, #06080f 0%, #14202e 38%, #243448 68%, #355070 100%);
}

html[data-promo-shot="1"] .shell {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.24rem;
  padding-top: 0.35rem;
  padding-bottom: calc(0.3rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #1a2838 0%, #355070 100%);
}

html[data-promo-shot="1"] .console {
  flex: 0 0 auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  padding-bottom: 0.15rem;
}

html[data-promo-shot="1"] .hud {
  gap: 0.22rem;
  font-size: 0.58rem;
}

html[data-promo-shot="1"] .hud-bonus span {
  font-size: 0.5rem;
}

html[data-promo-shot="1"] .objective-strip {
  padding: 0.2rem 0.42rem;
  font-size: 0.65rem;
  gap: 0.35rem;
}

html[data-promo-shot="1"] .obj-bonus {
  font-size: 0.54rem;
}

html[data-promo-shot="1"] .hud strong {
  font-size: 0.88rem;
}

html[data-promo-shot="1"] .brake-button {
  min-height: 2.65rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.92rem;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(181, 109, 255, 0.2) 0,
    rgba(181, 109, 255, 0.2) 7px,
    rgba(46, 232, 255, 0.16) 7px,
    rgba(46, 232, 255, 0.16) 14px
  );
}

html[data-promo-shot="1"] .operator {
  display: none;
}

html[data-promo-shot="1"] .console #shot-status {
  margin-top: 0.12rem;
}

.promo-floor,
.shot-fill {
  display: none;
}

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

html[data-promo-shot="1"] #shot-status {
  display: block !important;
  padding: 0.45rem 0.5rem;
  background: #2a3e58;
  border-top: 1px solid rgba(46, 232, 255, 0.3);
}

.shot-route-bars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.shot-route-bars span {
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.shot-route-bars strong {
  display: block;
  color: var(--mint);
  font-size: 0.78rem;
  margin-top: 0.08rem;
}

.shot-route-bars em {
  display: block;
  margin-top: 0.2rem;
  height: 5px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--gold));
  font-style: normal;
  box-shadow: 0 0 8px rgba(46, 232, 255, 0.45);
}

html[data-promo-shot="1"] .shot-status::after {
  content: "";
  display: block;
  margin-top: 0.55rem;
  height: 52px;
  border-radius: 8px;
  border: 1px solid rgba(46, 232, 255, 0.22);
  background-color: #1a2838;
  background-image:
    repeating-linear-gradient(
      90deg,
      #243448 0,
      #243448 18px,
      rgba(255, 215, 120, 0.65) 18px,
      rgba(255, 215, 120, 0.65) 20px,
      #2a3e58 20px,
      #2a3e58 36px,
      rgba(46, 232, 255, 0.55) 36px,
      rgba(46, 232, 255, 0.55) 38px
    ),
    repeating-linear-gradient(
      0deg,
      #182434 0,
      #182434 10px,
      #1e3048 10px,
      #1e3048 16px
    );
}

.shot-status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.shot-status-grid strong {
  display: block;
  color: var(--cyan);
  font-size: 1rem;
  margin-top: 0.1rem;
}

html[data-promo-shot="1"] .promo-floor {
  display: none !important;
  margin-top: 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(46, 232, 255, 0.22);
  background-color: #14202e;
  background-image:
    linear-gradient(180deg, rgba(46, 232, 255, 0.12) 0%, rgba(109, 255, 207, 0.18) 100%),
    repeating-linear-gradient(
      90deg,
      #1a2838 0,
      #1a2838 12px,
      #ffd76a 12px,
      #ffd76a 14px,
      #243448 14px,
      #243448 36px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 18px,
      rgba(46, 232, 255, 0.15) 18px,
      rgba(46, 232, 255, 0.15) 20px
    );
  box-shadow:
    inset 0 16px 48px rgba(46, 232, 255, 0.08),
    0 0 24px rgba(109, 255, 207, 0.12);
}

.shell {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 0.55rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 100svh;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

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

.brand {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

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

.ghost-button,
.btn-primary {
  border-radius: 10px;
  border: 1px solid rgba(109, 255, 207, 0.35);
  background: rgba(12, 18, 28, 0.85);
  color: var(--text);
  font-size: 0.82rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(46, 232, 255, 0.22), rgba(181, 109, 255, 0.2));
  border-color: rgba(46, 232, 255, 0.55);
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
  width: 100%;
}

.play-intro h1 {
  font-size: 1.35rem;
  margin: 0.2rem 0 0.5rem;
}

.play-intro h1 span {
  display: block;
  font-size: 1.05rem;
  color: var(--cyan);
  font-weight: 500;
}

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

.rule-list {
  margin: 0.6rem 0 1rem;
  padding: 0.65rem 0.75rem;
  list-style: none;
  font-size: 0.88rem;
  line-height: 1.5;
  border-radius: 12px;
  background: rgba(10, 14, 22, 0.92);
  border: 1px solid rgba(46, 232, 255, 0.14);
}

.rule-list li {
  margin: 0.35rem 0;
}

.rule-list strong {
  color: var(--text);
}

.rule-card--goal {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.6rem;
  margin: 0 0 0.45rem !important;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 215, 106, 0.14), rgba(46, 232, 255, 0.08));
  border: 1px solid rgba(255, 215, 106, 0.42);
  box-shadow: 0 0 18px rgba(255, 215, 106, 0.08);
}

.rule-card--goal strong {
  color: var(--gold);
  font-size: 0.92rem;
  line-height: 1.45;
}

.exit-glyph {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin-top: 0.05rem;
  border-radius: 6px;
  border: 2px solid var(--gold);
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(46, 232, 255, 0.55), transparent 70%),
    rgba(18, 10, 24, 0.9);
  box-shadow: inset 0 0 10px rgba(255, 215, 106, 0.35);
  position: relative;
}

.exit-glyph::after {
  content: "EXIT";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.42rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
  font-family: Trebuchet MS, sans-serif;
}

.objective-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  padding: 0.32rem 0.55rem;
  border-radius: 8px;
  background: rgba(8, 12, 20, 0.88);
  border: 1px solid rgba(255, 215, 106, 0.28);
  font-size: 0.78rem;
  line-height: 1.25;
}

.obj-goal {
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.obj-label {
  display: inline-block;
  margin-right: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 215, 106, 0.16);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--gold);
  font-family: Trebuchet MS, sans-serif;
}

.obj-signal {
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-family: Trebuchet MS, sans-serif;
  color: var(--cyan);
  border: 1px solid rgba(46, 232, 255, 0.35);
  border-radius: 5px;
  padding: 0.08rem 0.38rem;
  background: rgba(46, 232, 255, 0.08);
}

.obj-signal[data-state="track"] {
  color: #ffd76a;
  border-color: rgba(255, 215, 106, 0.45);
  background: rgba(255, 215, 106, 0.1);
}

.obj-bonus {
  flex-shrink: 0;
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  font-size: 0.62rem;
  color: var(--muted);
}

.hud-bonus span {
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.02em;
}

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

.canvas-wrap {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(46, 232, 255, 0.25);
  box-shadow: 0 0 40px rgba(46, 232, 255, 0.08), inset 0 0 30px rgba(0, 0, 0, 0.5);
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 366 / 480;
  background: #05070f;
  touch-action: none;
}

html[data-promo-shot="1"] #game-canvas {
  aspect-ratio: auto;
  height: 458px;
}

.console {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.brake-button {
  width: 100%;
  min-height: 3.1rem;
  border-radius: 14px;
  border: 2px solid rgba(181, 109, 255, 0.55);
  background: linear-gradient(180deg, rgba(181, 109, 255, 0.18), rgba(46, 232, 255, 0.1));
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  touch-action: none;
}

.brake-button[aria-pressed="true"] {
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(46, 232, 255, 0.35), rgba(181, 109, 255, 0.25));
  box-shadow: 0 0 24px rgba(46, 232, 255, 0.35);
}

.brake-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.operator {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(8, 12, 20, 0.9);
  border: 1px solid rgba(109, 255, 207, 0.2);
  font-size: 0.82rem;
}

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

.op-msg {
  margin: 0.15rem 0 0;
}

.fail-banner {
  margin: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: rgba(255, 92, 82, 0.15);
  border: 1px solid rgba(255, 92, 82, 0.45);
  color: #ffb4ad;
  font-size: 0.88rem;
}

.summary .sum-rank {
  font-size: 2rem;
  color: var(--gold);
  margin: 0.25rem 0;
}

#sum-stats {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

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

.actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.route-maps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.route-maps canvas {
  width: 100%;
  border-radius: 6px;
  border: 1px solid rgba(46, 232, 255, 0.2);
}

@media (max-width: 380px) {
  .hud {
    font-size: 0.55rem;
    gap: 0.18rem;
  }
  .hud strong {
    font-size: 0.78rem;
  }
  .hud-bonus span {
    font-size: 0.5rem;
  }
  .objective-strip {
    font-size: 0.72rem;
    padding: 0.28rem 0.45rem;
  }
  .obj-bonus {
    font-size: 0.56rem;
  }
}