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

:root {
  --bg: #06080f;
  --panel: #0c1018;
  --cyan: #3de8ff;
  --lime: #9ff56a;
  --amber: #ffb347;
  --magenta: #e056ff;
  --text: #e8eef8;
  --muted: #8b9bb5;
  --mint: #5ef5c8;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

.shell {
  max-width: 430px;
  margin: 0 auto;
  padding: 0.65rem 0.75rem 1.25rem;
}

.shell.is-playing .masthead {
  display: none;
}

.shell.is-playing {
  padding-top: 0.35rem;
  padding-bottom: 0.65rem;
}

.shell.is-playing .operator {
  margin-top: 0.25rem;
  padding: 0.35rem;
  font-size: 0.72rem;
}

.shell.is-playing .btn-drop {
  padding: 0.65rem;
  margin: 0.2rem 0;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.masthead .back {
  color: var(--mint);
  text-decoration: none;
}

.brand {
  flex: 1;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.brand strong {
  color: var(--cyan);
  margin-right: 0.35rem;
}

.ghost-button,
.btn-primary,
.btn-drop {
  font: inherit;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #2a3548;
}

.ghost-button {
  background: #121824;
  color: var(--text);
  padding: 0.35rem 0.65rem;
}

.btn-primary {
  background: linear-gradient(180deg, #1a2838, #101820);
  border-color: var(--cyan);
  color: var(--cyan);
  padding: 0.65rem 1.2rem;
  width: 100%;
  max-width: 280px;
  font-weight: 700;
}

.play-intro {
  text-align: center;
  padding: 0.25rem 0 0.75rem;
}

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

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

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

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

.sub {
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.demo-wrap {
  margin: 0 auto 0.75rem;
  border: 1px solid #1e2838;
  border-radius: 10px;
  overflow: hidden;
  max-width: 320px;
  background: #080c14;
}

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

.console {
  margin-top: 0.35rem;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.35rem;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  font-size: 0.72rem;
  margin-bottom: 0.4rem;
}

.hud div {
  background: var(--panel);
  border: 1px solid #1c2434;
  border-radius: 6px;
  padding: 0.3rem 0.35rem;
  text-align: center;
}

.hud span {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
}

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

.canvas-wrap {
  border: 1px solid #1e2a3c;
  border-radius: 12px;
  overflow: hidden;
  background: #05070c;
}

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

.rule-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.45rem 0;
}

.btn-drop {
  display: block;
  width: 100%;
  padding: 0.85rem;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, #142030, #0a1018);
  border-color: var(--lime);
  color: var(--lime);
  margin: 0.35rem 0;
}

.btn-drop.pulse {
  animation: dropPulse 0.9s ease-in-out 2;
}

@keyframes dropPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(159, 245, 106, 0);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(159, 245, 106, 0.35);
  }
}

.operator {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px dashed #243044;
  border-radius: 8px;
  font-size: 0.78rem;
}

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

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

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

.help-dialog {
  border: 1px solid #2a3a50;
  background: #0a0e16;
  color: var(--text);
  border-radius: 12px;
  padding: 1rem;
  max-width: 360px;
}

.help-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.summary {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid #243248;
  border-radius: 10px;
  background: var(--panel);
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

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

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

html[data-capture="1"] .shell {
  padding: 0.4rem 0.5rem;
}

html[data-capture="1"] .console {
  margin-top: 0;
}

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

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

html[data-promo-og="1"] #game-canvas {
  max-height: 520px;
}

@media (prefers-reduced-motion: reduce) {
  .btn-drop.pulse {
    animation: none;
  }
}

@media (max-width: 360px) {
  .hud {
    font-size: 0.68rem;
  }
}