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

:root {
  --bg: #06080f;
  --panel: #0c1018;
  --cyan: #3de8ff;
  --magenta: #e056ff;
  --amber: #ffb347;
  --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;
}

.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 {
  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;
}

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

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

.play-intro .intro-parcel {
  display: block;
  width: min(110px, 28vw);
  height: auto;
  margin: 0.35rem auto 0.55rem;
  filter: drop-shadow(0 0 12px rgba(94, 245, 200, 0.35));
}

.play-intro .lead,
.play-intro .sub {
  margin: 0.25rem 0;
  font-size: 0.92rem;
}

.play-intro .intro-tail {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.35rem auto 0.5rem;
  max-width: 300px;
}

.btn-primary:disabled {
  opacity: 0.72;
  cursor: wait;
}

.demo-wrap {
  margin: 0.65rem auto;
  border: 1px solid #243044;
  border-radius: 8px;
  overflow: hidden;
  max-width: 300px;
}

.hud {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.hud span {
  color: var(--muted);
  margin-right: 0.35rem;
}

.hud strong {
  color: var(--cyan);
}

#hud-ev-label {
  font-size: 0.72rem;
}

.now-task {
  margin: 0 0 0.4rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid #3de8ff66;
  background: linear-gradient(90deg, #132030, #101828);
  color: var(--mint);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  box-shadow: 0 0 14px #3de8ff22;
}

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

.feed-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  margin-bottom: 0.25rem;
}

.lbl-yesterday {
  color: var(--cyan);
}

.lbl-today {
  color: var(--magenta);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 390 / 280;
  border: 1px solid #2a3548;
  border-radius: 10px;
  overflow: hidden;
  background: #080a10;
}

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

.wipe-bar {
  margin: 0.45rem 0 0.35rem;
}

.wipe-track {
  position: relative;
  height: 2.25rem;
  margin-top: 0.25rem;
  background: #121824;
  border-radius: 999px;
  border: 1px solid #2f3d54;
}

.wipe-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3.2rem;
  height: 1.6rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  border: 2px solid #fff3;
  box-shadow: 0 0 12px #3de8ff66;
  cursor: grab;
}

.wipe-handle:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.wipe-handle.pulse {
  animation: wipePulse 1.2s ease-in-out 1;
}

@keyframes wipePulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

.evidence-row {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: flex;
  gap: 0.45rem;
  min-height: 72px;
}

.evidence-row li {
  flex: 1;
  min-width: 0;
  background: #0f141e;
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.3rem;
  font-size: 0.65rem;
  text-align: center;
}

.evidence-row li img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  object-position: center;
  border-radius: 4px;
  display: block;
  margin-bottom: 0.2rem;
  background: #1a2438;
}

.evidence-row li.filled {
  border-color: var(--cyan);
  box-shadow: 0 0 10px #3de8ff33;
}

.operator {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.78rem;
  padding: 0.4rem;
  border-radius: 8px;
  background: #0c1018cc;
}

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

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

.inspector {
  font-size: 0.65rem;
  background: #080c14;
  padding: 0.5rem;
  border-radius: 6px;
  overflow: auto;
  max-height: 120px;
}

.dev-only {
  display: none !important;
}

html[data-debug="1"] .dev-only#btn-inspector:not([hidden]) {
  display: inline-flex !important;
}

html[data-debug="1"] .dev-only#inspector:not([hidden]) {
  display: block !important;
}

.finale {
  text-align: center;
  padding: 0.5rem 0;
}

.finale h2 {
  font-size: 1.1rem;
  color: var(--amber);
}

#finale-canvas {
  width: 100%;
  max-width: 390px;
  border-radius: 10px;
  border: 1px solid #2a3548;
}

.summary {
  text-align: center;
  padding: 0.75rem 0;
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.miss-toast {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  background: #1a1424ee;
  border: 1px solid var(--magenta);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  z-index: 50;
}

.miss-toast::before {
  content: "× ";
  color: var(--magenta);
  font-weight: bold;
}

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

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

html[data-promo-shot="1"] .play-intro,
html[data-promo-board="1"] .play-intro,
html[data-promo-verdict="1"] .play-intro,
html[data-promo-summary="1"] .play-intro,
html[data-promo-og="1"] .play-intro {
  display: none !important;
}

html[data-promo-shot="1"] #evidence-board.capture-hide,
html[data-promo-board="1"] #evidence-board.capture-hide {
  display: block !important;
}

html[data-promo-verdict="1"] #verdict-panel.capture-hide {
  display: block !important;
}

html[data-promo-summary="1"] #summary.capture-hide {
  display: block !important;
}

html[data-promo-shot="1"] .shell,
html[data-promo-board="1"] .shell,
html[data-promo-verdict="1"] .shell,
html[data-promo-summary="1"] .shell {
  display: block !important;
}

.og-promo {
  display: none;
}

html[data-promo-og="1"] body {
  margin: 0;
  background: #050810;
  overflow: hidden;
}

html[data-promo-og="1"] .shell {
  display: none !important;
}

html[data-promo-og="1"] .og-promo {
  display: block;
  width: 1200px;
  height: 630px;
}

.play-steps {
  list-style: none;
  margin: 0.5rem auto 0.75rem;
  padding: 0;
  max-width: 320px;
  text-align: left;
  font-size: 0.82rem;
}

.play-steps li {
  margin: 0.35rem 0;
  padding: 0.35rem 0.5rem;
  background: #0f141e;
  border-radius: 6px;
  border-left: 3px solid var(--cyan);
}

.cam-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.cam-actions button {
  flex: 1;
  min-height: 44px;
}

.cam-actions .cam-next.is-ready {
  border-color: var(--mint);
  color: var(--mint);
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 0 16px #5ef5c833;
}

.investigate {
  position: fixed;
  inset: 0;
  background: #050810dd;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 80;
  padding: 0.75rem;
}

.investigate[hidden] {
  display: none !important;
}

.investigate-card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, #141c2a, #0c1018);
  border: 1px solid #3de8ff55;
  border-radius: 14px 14px 10px 10px;
  padding: 0.85rem 0.9rem 1rem;
  box-shadow: 0 -8px 32px #0009;
}

.investigate-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  color: var(--mint);
}

.investigate-card p {
  margin: 0.25rem 0;
  font-size: 0.82rem;
}

.investigate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.investigate-actions button {
  min-height: 44px;
  font-size: 0.78rem;
}

.btn-adopt {
  border-color: var(--mint) !important;
  color: var(--mint) !important;
}

.evidence-board,
.verdict-panel {
  padding: 0.65rem 0;
}

.evidence-board h2,
.verdict-panel h2 {
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
  color: var(--cyan);
}

.detective-wall {
  position: relative;
  margin: 0.65rem 0 0.85rem;
  padding: 0.5rem 0.35rem;
  border-radius: 12px;
  background:
    linear-gradient(165deg, #121824 0%, #0a0e16 100%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 18px,
      rgba(61, 232, 255, 0.03) 18px,
      rgba(61, 232, 255, 0.03) 19px
    );
  border: 1px solid #3de8ff44;
  box-shadow: inset 0 0 24px #0008;
}

.board-chain {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
}

.board-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 2rem;
  margin: 0.15rem 0;
}

.board-connector::before {
  content: "";
  width: 2px;
  flex: 1;
  min-height: 0.5rem;
  background: linear-gradient(180deg, var(--cyan), var(--mint));
  box-shadow: 0 0 10px #3de8ff88;
}

.board-connector::after {
  content: "▾";
  color: var(--mint);
  font-size: 0.7rem;
  line-height: 1;
  text-shadow: 0 0 8px #5ef5c8;
}

.board-pin {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem;
  align-items: start;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid #3de8ff55;
  background: linear-gradient(145deg, #151e2c, #0d121c);
  box-shadow: 0 0 16px #3de8ff22;
  font-size: 0.74rem;
  min-height: 44px;
}

.board-pin img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #2f3d54;
}

.board-pin-meta {
  min-width: 0;
}

.board-pin-cam {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--cyan);
  letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
}

.board-pin-cam::before {
  content: "◎";
  color: var(--mint);
  font-size: 0.55rem;
}

.board-pin-place {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  margin-bottom: 0.15rem;
}

.board-pin-title {
  font-weight: 700;
  font-size: 0.8rem;
  margin: 0 0 0.2rem;
  line-height: 1.3;
  word-break: break-word;
}

.board-pin-fact {
  margin: 0;
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.35;
}

.board-pin-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.3rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  border: 1px solid var(--mint);
  color: var(--mint);
  background: #5ef5c814;
}

.board-pin-tag::before {
  content: "★";
  font-size: 0.55rem;
}

.board-pin-tag.is-noise {
  border-color: var(--muted);
  color: var(--muted);
  background: #8b9bb514;
}

.board-pin-tag.is-noise::before {
  content: "○";
}

.inv-thumb-wrap {
  margin: 0.35rem 0 0.5rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #3de8ff55;
  background: #0a1018;
  max-width: 200px;
}

.inv-thumb-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.inv-split {
  margin: 0;
}

.inv-split div {
  margin: 0.4rem 0;
}

.inv-split dt {
  font-size: 0.68rem;
  color: var(--cyan);
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.inv-split dd {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.verdict-stage {
  position: relative;
  margin: 0.5rem 0 0.65rem;
}

.verdict-evidence-strip {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  min-height: 2.25rem;
  padding-bottom: 0.35rem;
}

.verdict-evidence-strip img {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #3de8ff66;
  box-shadow: 0 0 8px #3de8ff44;
}

.verdict-evidence-strip::after {
  content: "▼";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 2.1rem;
  color: var(--mint);
  font-size: 0.65rem;
  opacity: 0.85;
  text-shadow: 0 0 6px #5ef5c8;
}

.verdict-stage.converge-active .verdict-evidence-strip img {
  box-shadow: 0 0 14px #5ef5c888;
}

.verdict-options {
  display: grid;
  gap: 0.55rem;
  margin: 0.85rem 0 0.35rem;
}

.verdict-card {
  text-align: left;
  padding: 0.65rem 0.75rem 0.7rem;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid #2f3d54;
  background: linear-gradient(135deg, #121a28, #0c1018);
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.55rem;
  align-items: start;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.verdict-card:hover,
.verdict-card:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.verdict-card.is-picked {
  border-color: var(--mint);
  box-shadow: 0 0 20px #5ef5c844, inset 0 0 12px #3de8ff18;
}

.verdict-card.is-picked .hypo-match,
.verdict-card.is-revealed .hypo-match {
  display: inline-flex;
}

.verdict-alignment {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.35rem 0 0.5rem;
  text-align: left;
  line-height: 1.45;
}

.verdict-alignment li {
  margin: 0.2rem 0;
}

.sum-answer {
  font-size: 1rem;
  font-weight: 700;
  color: var(--amber);
  margin: 0.35rem 0 0.5rem;
  line-height: 1.4;
}

.sum-alignment {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: left;
  margin: 0.5rem 0;
  line-height: 1.45;
}

.hypo-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid #3de8ff44;
  background: #0f1824;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.hypo-icon[data-kind="roof-route"]::before {
  content: "↗";
  color: var(--mint);
}

.hypo-icon[data-kind="label-swap"]::before {
  content: "⇄";
  color: var(--amber);
}

.hypo-icon[data-kind="broken-lock"]::before {
  content: "⛨";
  color: var(--magenta);
}

.verdict-card-body strong {
  display: block;
  color: var(--amber);
  margin-bottom: 0.15rem;
  font-size: 0.92rem;
}

.verdict-card-body .hypo-text {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  line-height: 1.35;
}

.verdict-card-body .hypo-match {
  display: none;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--cyan);
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  background: #1a2838;
}

.verdict-card-body .hypo-match::before {
  content: "リンク";
  color: var(--muted);
  font-size: 0.62rem;
}

.verdict-feedback {
  font-size: 0.85rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: #14101cdd;
  border: 1px solid var(--magenta);
  margin: 0.5rem 0;
}

.verdict-feedback::before {
  content: "再検討 · ";
  font-weight: 700;
  color: var(--amber);
}

.rank-badge {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #1a2838;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-weight: 700;
  margin: 0.35rem 0;
}

.rank-shield {
  padding: 0.55rem 1.1rem;
  font-size: 1.05rem;
  border-radius: 12px;
  border-width: 2px;
  box-shadow: 0 0 18px #3de8ff33;
}

.rank-shield::before {
  content: "捜査ランク ";
  font-size: 0.72rem;
  color: var(--muted);
  display: block;
  font-weight: 500;
  margin-bottom: 0.1rem;
}

.sum-route {
  margin: 0.65rem 0;
  padding: 0.55rem 0.4rem;
  border-radius: 10px;
  border: 1px solid #3de8ff44;
  background: #0f141e;
}

.sum-route-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.sum-route-flow img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid #2f3d54;
}

.sum-route-arrow {
  color: var(--mint);
  font-size: 0.75rem;
  padding: 0 0.15rem;
}

.sum-route-conclusion {
  flex: 1 1 100%;
  margin-top: 0.45rem;
  padding: 0.45rem;
  border-radius: 8px;
  background: #1a2838;
  border: 1px solid var(--amber);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--amber);
}

.sum-route-conclusion::before {
  content: "確定結論 · ";
  color: var(--muted);
  font-weight: 500;
  font-size: 0.68rem;
}

.stat-grid {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.stat-grid li {
  background: #0f141e;
  border-radius: 6px;
  padding: 0.45rem 0.4rem;
  text-align: left;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-grid--scores li strong {
  display: block;
  color: var(--cyan);
  font-size: 0.95rem;
  margin-bottom: 0.1rem;
}

.stat-grid--scores li span {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
}

.ghost-button,
.btn-primary {
  min-height: 44px;
}

.evidence-board .btn-primary,
.evidence-board .ghost-button,
.verdict-panel .ghost-button {
  width: 100%;
  max-width: none;
}

@media (max-width: 380px) {
  .board-pin {
    grid-template-columns: 88px 1fr;
  }

  .board-pin img {
    height: 64px;
  }
}

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

  .verdict-card {
    transition: none;
  }
}