:root {
  --bg: #f4efe6;
  --paper: rgba(255, 250, 242, 0.88);
  --panel: rgba(255, 252, 247, 0.9);
  --ink: #1d241f;
  --muted: #55615a;
  --line: rgba(29, 36, 31, 0.12);
  --wolf: #c44d56;
  --police: #0f7c90;
  --civil: #7a8f47;
  --unknown: #8f8776;
  --accent: #d7823b;
  --shadow: 0 18px 60px rgba(59, 43, 21, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Segoe UI Variable Display", "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(215, 130, 59, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 124, 144, 0.16), transparent 26%),
    linear-gradient(160deg, #f8f3ea 0%, #efe8dd 48%, #ebe3d7 100%);
}

.page-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 20px;
  margin-bottom: 22px;
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: 36px;
  padding: 28px 30px 30px;
}

.eyebrow,
.section-kicker,
.hero-card-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(38px, 6vw, 64px);
  line-height: 0.96;
}

h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.lead {
  margin: 18px 0 0;
  max-width: 64ch;
  color: var(--muted);
  line-height: 1.7;
  font-size: 16px;
}

.lead span {
  color: var(--ink);
  font-weight: 700;
}

.hero-card {
  border-radius: 30px;
  padding: 24px;
  align-self: stretch;
}

.hero-card-title {
  margin-bottom: 12px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.hero-card p,
.section-copy,
.metric-footnote,
.narrative,
.branch-note,
.status-banner {
  color: var(--muted);
  line-height: 1.65;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.section-head,
.toolbar,
.slider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.ghost-button,
select {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
}

.ghost-button {
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

.ghost-button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(15, 124, 144, 0.28);
  outline-offset: 2px;
}

.slider-row {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.56);
}

.slider-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.slider-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.slider-control {
  min-width: 220px;
  text-align: right;
}

.slider-control input {
  width: 100%;
}

.slider-value {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.seat-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 184px;
  padding: 12px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(248, 242, 233, 0.85));
}

.seat-card.is-hard {
  background: linear-gradient(160deg, rgba(255, 247, 233, 0.96), rgba(244, 232, 212, 0.92));
  border-color: rgba(215, 130, 59, 0.35);
}

.seat-card.is-wolf-focus {
  border-color: rgba(196, 77, 86, 0.7);
  background: linear-gradient(160deg, rgba(255, 236, 239, 0.98), rgba(248, 210, 216, 0.96));
  box-shadow: 0 18px 34px rgba(196, 77, 86, 0.16);
}

.seat-card.is-police-focus {
  border-color: rgba(15, 124, 144, 0.62);
  background: linear-gradient(160deg, rgba(236, 250, 255, 0.98), rgba(205, 235, 243, 0.96));
  box-shadow: 0 18px 34px rgba(15, 124, 144, 0.15);
}

.seat-head {
  display: block;
}

.seat-number {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.seat-meta {
  margin-top: 10px;
  min-height: 34px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.guess-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guess-pill,
.guess-note {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
}

.guess-pill {
  color: white;
  font-weight: 700;
}

.guess-pill[data-role="wolf"] { background: var(--wolf); }
.guess-pill[data-role="police"] { background: var(--police); }
.guess-pill[data-role="civil"] { background: var(--civil); }

.guess-note {
  background: rgba(29, 36, 31, 0.06);
  color: var(--muted);
}

.prob-strip {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.prob-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.prob-row.is-primary {
  font-weight: 700;
}

.prob-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 0;
}

.prob-label[data-role="wolf"] { background: var(--wolf); }
.prob-label[data-role="police"] { background: var(--police); }
.prob-label[data-role="civil"] { background: var(--civil); }

.prob-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(29, 36, 31, 0.08);
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  border-radius: 999px;
}

.prob-fill[data-role="wolf"] { background: var(--wolf); }
.prob-fill[data-role="police"] { background: var(--police); }
.prob-fill[data-role="civil"] { background: var(--civil); }

.prob-value {
  min-width: 48px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}

.prob-rank {
  min-width: 30px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
}

.prob-rank.is-top {
  font-weight: 700;
}

.prob-rank.is-top[data-role="wolf"] { color: var(--wolf); }
.prob-rank.is-top[data-role="police"] { color: var(--police); }
.prob-rank.is-top[data-role="civil"] { color: var(--civil); }

.prob-row.is-top {
  background: rgba(29, 36, 31, 0.03);
  border-radius: 12px;
  padding-left: 6px;
  padding-right: 6px;
}

.evidence-stack {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.evidence-field {
  display: block;
}

.evidence-field span {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--muted);
}

.evidence-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.status-banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(215, 130, 59, 0.1);
  border: 1px solid rgba(215, 130, 59, 0.2);
}

.status-banner[data-state="error"] {
  background: rgba(196, 77, 86, 0.12);
  border-color: rgba(196, 77, 86, 0.28);
  color: #8e2f37;
}

.metric-grid,
.analysis-grid,
.branch-grid {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.metric-card,
.insight-card,
.branch-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  padding: 18px;
}

.metric-label,
.insight-title,
.branch-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.metric-value {
  margin-top: 12px;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 700;
  letter-spacing: -0.05em;
}

.accent-card {
  background: linear-gradient(165deg, rgba(215, 130, 59, 0.14), rgba(255, 252, 247, 0.9));
}

.analysis-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.insight-card.wide {
  grid-column: 1 / -1;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pill {
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}

.pill {
  background: rgba(29, 36, 31, 0.06);
}

.swing-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.swing-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px 12px;
}

.swing-seat {
  font-weight: 700;
}

.swing-detail {
  color: var(--muted);
  text-align: right;
}

@media (max-width: 1100px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .seat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    background: #f2ece2;
  }

  .page-shell {
    width: 100%;
    padding:
      max(10px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .hero {
    display: block;
    margin-bottom: 8px;
  }

  .hero-copy {
    padding: 8px 4px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .hero-card,
  .eyebrow,
  .lead,
  .section-copy,
  .section-kicker {
    display: none;
  }

  h1 {
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: 0;
  }

  h2 {
    font-size: 21px;
    letter-spacing: 0;
  }

  .layout {
    gap: 10px;
  }

  .panel {
    padding: 12px;
    border-radius: 14px;
    backdrop-filter: none;
    box-shadow: 0 4px 8px rgba(59, 43, 21, 0.08);
  }

  .section-head {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .toolbar {
    width: 100%;
    align-items: stretch;
    flex-direction: row;
    gap: 8px;
  }

  .ghost-button {
    min-height: 44px;
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    touch-action: manipulation;
  }

  .slider-row {
    align-items: stretch;
    flex-direction: column;
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  .seat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .seat-card {
    min-width: 0;
    min-height: 0;
    padding: 10px;
    border-radius: 12px;
    box-shadow: none;
  }

  .seat-card.is-wolf-focus {
    box-shadow: 0 3px 7px rgba(196, 77, 86, 0.2);
  }

  .seat-card.is-police-focus {
    box-shadow: 0 3px 7px rgba(15, 124, 144, 0.2);
  }

  .seat-number {
    font-size: 18px;
    letter-spacing: 0;
  }

  .evidence-stack {
    margin-top: 8px;
  }

  .evidence-field span,
  .seat-meta,
  .guess-note {
    display: none;
  }

  .evidence-field select {
    min-height: 44px;
    padding: 8px 28px 8px 10px;
    border-radius: 8px;
    font-size: 16px;
    touch-action: manipulation;
  }

  .guess-strip {
    display: block;
    margin-top: 8px;
  }

  .guess-pill {
    padding: 5px 8px;
    font-size: 12px;
  }

  .prob-strip {
    width: 100%;
    gap: 3px;
    margin-top: 6px;
  }

  .prob-row {
    display: grid;
    grid-template-columns: 22px minmax(18px, 1fr) auto auto;
    gap: 4px;
    margin: 0;
    padding: 4px 0;
  }

  .prob-row.is-top {
    padding-left: 4px;
    padding-right: 4px;
    border-radius: 7px;
  }

  .prob-label {
    font-size: 10px;
    padding: 3px 0;
  }

  .prob-track {
    height: 6px;
  }

  .prob-value {
    min-width: 35px;
    font-size: 10px;
  }

  .prob-rank {
    min-width: 20px;
    font-size: 10px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .status-banner {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
  }

  .slider-control {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    text-align: right;
  }

  .slider-control input {
    min-height: 44px;
  }

  .slider-value {
    margin-top: 0;
    font-size: 18px;
  }

  .metric-card,
  .insight-card {
    padding: 12px;
    border-radius: 12px;
  }

  .metric-label,
  .insight-title {
    font-size: 12px;
    letter-spacing: 0;
  }

  .metric-value {
    margin-top: 8px;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: 0;
    overflow-wrap: anywhere;
  }

  .metric-footnote,
  .narrative {
    font-size: 13px;
    line-height: 1.5;
  }

  .pill-row {
    gap: 7px;
    margin-top: 10px;
  }

  .pill {
    padding: 8px 10px;
    font-size: 13px;
  }

  .swing-row {
    flex-direction: column;
    border-radius: 10px;
  }

  .swing-detail {
    text-align: left;
  }
}

@media (max-width: 340px) {
  .panel {
    padding: 10px;
  }

  .seat-grid {
    gap: 6px;
  }

  .seat-card {
    padding: 8px;
  }

  .prob-row {
    grid-template-columns: 22px minmax(0, 1fr) auto;
  }

  .prob-track {
    display: none;
  }

  .prob-value {
    min-width: 0;
    text-align: left;
  }
}

@media (max-height: 500px) and (max-width: 950px) {
  .page-shell {
    width: 100%;
    padding:
      max(8px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .hero {
    display: block;
    margin-bottom: 6px;
  }

  .hero-copy {
    padding: 4px 2px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .hero-card,
  .eyebrow,
  .lead,
  .section-copy,
  .section-kicker {
    display: none;
  }

  h1 {
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: 0;
  }

  .panel {
    padding: 12px;
    border-radius: 14px;
    backdrop-filter: none;
  }

  .seat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

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

@media (hover: hover) and (pointer: fine) {
  .ghost-button:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.95);
  }
}

@media (pointer: coarse) {
  .ghost-button,
  select {
    min-height: 44px;
  }
}

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