:root {
  --bg: #f3ede3;
  --ink: #1f1c1a;
  --muted: #6f665d;
  --card: rgba(255, 251, 245, 0.9);
  --line: rgba(53, 40, 31, 0.12);
  --accent: #7a2230;
  --accent-soft: #a94957;
  --gold: #c49b56;
  --teal: #1d5c63;
  --safe: #246b46;
  --warn: #9a5b11;
  --danger: #8f2a2a;
  --shadow: 0 18px 48px rgba(55, 28, 15, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(196, 155, 86, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(29, 92, 99, 0.12), transparent 24%),
    linear-gradient(180deg, #f7f2e8 0%, #efe5d6 100%);
  font-family:
    "Avenir Next", "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
}

body {
  padding: 32px 20px 40px;
}

.splash-page {
  min-height: 100vh;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.78) 0%, rgba(239, 229, 214, 0.96) 58%),
    linear-gradient(132deg, #f7f2e8 0%, #ede0cd 45%, #e2d4c0 100%);
}

.splash-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 12px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid rgba(53, 40, 31, 0.11);
  background: rgba(247, 242, 232, 0.84);
  backdrop-filter: blur(16px);
}

.splash-brand,
.splash-links {
  display: inline-flex;
  align-items: center;
}

.splash-brand {
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.splash-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(122, 34, 48, 0.22);
  border-radius: 8px;
  background: #5a1e1e;
  color: #fffaf2;
  font-family:
    "Iowan Old Style", "Palatino", "Hiragino Mincho ProN", serif;
  font-size: 0.82rem;
}

.splash-links {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.splash-links a,
.splash-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(80, 55, 42, 0.2);
  border-radius: 8px;
  padding: 9px 13px;
  background: rgba(255, 251, 245, 0.68);
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
}

.splash-links a:hover,
.splash-links a:focus,
.splash-button:hover,
.splash-button:focus {
  border-color: rgba(122, 34, 48, 0.42);
  outline: 3px solid rgba(196, 155, 86, 0.23);
  outline-offset: 2px;
}

.splash-nav-cta,
.splash-button-primary {
  border-color: rgba(122, 34, 48, 0.18);
  background: linear-gradient(135deg, var(--accent) 0%, #4e1321 100%);
  color: #fffaf2;
  box-shadow: 0 14px 30px rgba(90, 30, 30, 0.15);
}

.splash-shell {
  width: min(1240px, calc(100vw - 36px));
  margin: 0 auto;
  padding: clamp(24px, 4vw, 42px) 0 52px;
}

.splash-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(340px, 0.9fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  min-height: clamp(480px, 66svh, 620px);
}

.splash-copy {
  display: grid;
  gap: 22px;
}

.splash-copy h1 {
  max-width: 720px;
  font-size: 7.2rem;
  line-height: 0.88;
}

.splash-lede {
  max-width: 610px;
  margin: 0;
  color: #3f342e;
  font-size: 1.45rem;
  font-weight: 560;
  line-height: 1.34;
}

.splash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.splash-button {
  min-height: 46px;
  padding: 11px 16px;
}

.dossier-visual {
  min-width: 0;
}

.dossier-table {
  position: relative;
  min-height: min(560px, 58vw);
  border: 1px solid rgba(53, 40, 31, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(145deg, #33261d 0%, #5a3d2b 48%, #2d211a 100%);
  box-shadow: 0 30px 70px rgba(55, 28, 15, 0.22);
  overflow: hidden;
}

.dossier-table::before {
  position: absolute;
  inset: 28px;
  content: "";
  border: 1px solid rgba(255, 250, 242, 0.14);
  border-radius: 8px;
  pointer-events: none;
}

.dossier-page,
.dossier-slip,
.dossier-stamp {
  position: absolute;
  box-shadow: 0 20px 44px rgba(21, 14, 9, 0.24);
}

.dossier-page {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(72, 50, 34, 0.22);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(122, 34, 48, 0.07) 1px, transparent 1px) 0 0 / 22px 22px,
    #fffaf2;
  color: #1f1c1a;
}

.dossier-page-main {
  top: 64px;
  left: 54px;
  width: min(370px, calc(100% - 120px));
  min-height: 320px;
  padding: 24px;
  transform: rotate(-3deg);
}

.dossier-page-side {
  right: 44px;
  bottom: 54px;
  width: min(270px, calc(100% - 120px));
  min-height: 160px;
  padding: 22px;
  transform: rotate(5deg);
}

.dossier-page-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.dossier-page-head strong {
  color: var(--accent);
  text-align: right;
}

.dossier-rule {
  height: 74px;
  border: 1px solid rgba(122, 34, 48, 0.18);
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 0 26%, rgba(122, 34, 48, 0.12) 26% 27%, transparent 27% 60%, rgba(29, 92, 99, 0.14) 60% 61%, transparent 61%),
    linear-gradient(180deg, rgba(29, 92, 99, 0.1), rgba(196, 155, 86, 0.12));
}

.dossier-lines {
  display: grid;
  gap: 10px;
}

.dossier-lines span {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: rgba(80, 55, 42, 0.13);
}

.dossier-lines span:nth-child(2) {
  width: 84%;
}

.dossier-lines span:nth-child(3) {
  width: 58%;
}

.dossier-verdicts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
}

.dossier-verdicts span {
  min-height: 42px;
  border: 2px solid currentColor;
  border-radius: 6px;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 900;
}

.dossier-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dossier-page-side strong {
  color: var(--teal);
  font-size: 2.4rem;
  line-height: 0.9;
}

.dossier-page-side small {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.dossier-slip {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px solid rgba(90, 30, 30, 0.18);
  border-radius: 6px;
  padding: 14px;
  background: #f3dca4;
  color: #5a3712;
  font-size: 0.88rem;
  font-weight: 850;
}

.dossier-slip-one {
  top: 54px;
  right: 54px;
  width: 158px;
  transform: rotate(7deg);
}

.dossier-slip-two {
  right: 198px;
  bottom: 42px;
  width: 168px;
  transform: rotate(-7deg);
}

.dossier-stamp {
  left: 92px;
  bottom: 76px;
  display: grid;
  min-width: 210px;
  min-height: 78px;
  place-items: center;
  border: 4px solid rgba(122, 34, 48, 0.78);
  border-radius: 6px;
  color: rgba(122, 34, 48, 0.78);
  font-size: 1.28rem;
  font-weight: 900;
  transform: rotate(-11deg);
}

.splash-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(360px, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
  border-top: 1px solid rgba(53, 40, 31, 0.14);
  padding-top: 22px;
}

.splash-intro h2 {
  max-width: 560px;
  font-size: 3rem;
  line-height: 1;
}

.splash-intro p {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.5;
}

.splash-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.splash-steps li {
  display: grid;
  gap: 8px;
  min-height: 148px;
  border: 1px solid rgba(80, 55, 42, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 251, 245, 0.72);
  box-shadow: 0 12px 30px rgba(55, 28, 15, 0.08);
}

.splash-steps strong {
  color: var(--accent);
  font-family:
    "Iowan Old Style", "Palatino", "Hiragino Mincho ProN", serif;
  font-size: 1.35rem;
  line-height: 1;
}

.splash-steps span {
  color: var(--muted);
  line-height: 1.35;
}

.shell {
  max-width: 1380px;
  margin: 0 auto;
}

.masthead,
.setup,
.overview-card,
.panel,
.score-card,
.memo-panel,
.mini-card,
.evidence-card,
.assist-card,
.xray-card,
.challenge-card {
  backdrop-filter: blur(10px);
}

.masthead,
.setup,
.overview-card,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.masthead {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  padding: 28px 30px;
  margin-bottom: 20px;
}

.eyebrow,
.phase-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--accent-soft);
  font-weight: 700;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family:
    "Iowan Old Style", "Palatino", "Hiragino Mincho ProN", serif;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.6rem, 5vw, 4.4rem);
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

h3 {
  font-size: 1.2rem;
}

p,
li,
textarea,
input,
select,
button {
  font: inherit;
}

.tagline,
.masthead-note p,
.overview-strap,
.overview-body {
  max-width: 64ch;
  line-height: 1.55;
}

.tagline {
  margin-top: 12px;
  font-size: 1.1rem;
}

.setup {
  padding: 18px 22px;
  margin-bottom: 20px;
}

.setup-grid,
.panel-header,
.split-fields,
.score-grid,
.memo-grid,
.reveal-grid,
.two-column,
.mini-grid {
  display: grid;
  gap: 16px;
}

.setup-grid {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.field,
.field-block {
  display: grid;
  gap: 8px;
}

.field span,
.field-block span {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(80, 55, 42, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  padding: 12px 14px;
  color: var(--ink);
}

textarea {
  min-height: 116px;
  resize: vertical;
}

.action-button,
.verdict-button,
.condition-chip,
.challenge-card {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #4e1321 100%);
  color: #fffaf2;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.action-button:hover,
.verdict-button:hover,
.condition-chip:hover,
.challenge-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(90, 30, 30, 0.16);
}

.action-button:disabled,
.verdict-button:disabled,
.condition-chip:disabled,
.challenge-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.action-button-secondary {
  background: linear-gradient(135deg, #4b665b 0%, #213b33 100%);
}

.action-button-compact {
  padding: 9px 12px;
  font-size: 0.92rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 360px) 1fr;
  gap: 20px;
  align-items: start;
}

.overview-card,
.panel {
  padding: 22px;
}

.phase-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.phase-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(122, 34, 48, 0.08);
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: capitalize;
}

.phase-pill.is-active {
  background: rgba(122, 34, 48, 0.18);
  color: var(--accent);
  font-weight: 700;
}

.score-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 18px;
}

.score-card,
.mini-card,
.evidence-card,
.assist-card,
.memo-panel,
.xray-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(80, 55, 42, 0.12);
  border-radius: 18px;
  padding: 16px;
}

.score-card h3 {
  font-size: 2rem;
  margin-top: 8px;
}

.muted,
.sync-error,
.prompt-copy,
.assist-takeaway {
  color: var(--muted);
}

.mini-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 18px;
}

.panel-header {
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-bottom: 18px;
}

.budget-pills,
.choice-row,
.condition-list,
.challenge-list,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.budget-pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(196, 155, 86, 0.16);
  color: #6c4816;
  font-weight: 700;
}

.briefing-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(122, 34, 48, 0.06), rgba(29, 92, 99, 0.05));
  border: 1px solid rgba(80, 55, 42, 0.12);
}

.bullet-list {
  margin: 14px 0 0;
  padding-left: 18px;
  line-height: 1.5;
}

.two-column,
.memo-grid,
.reveal-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.evidence-card.is-open,
.assist-card.is-open,
.challenge-card.is-selected,
.condition-chip.is-selected,
.verdict-button.is-active {
  border-color: rgba(122, 34, 48, 0.28);
  box-shadow: inset 0 0 0 1px rgba(122, 34, 48, 0.12);
}

.condition-chip {
  background: rgba(122, 34, 48, 0.08);
  color: var(--accent);
  border-color: rgba(122, 34, 48, 0.12);
}

.condition-chip.is-selected,
.verdict-button.is-active,
.challenge-card.is-selected {
  background: linear-gradient(135deg, var(--teal) 0%, #133d42 100%);
  color: #f6f3eb;
}

.verdict-button {
  background: rgba(122, 34, 48, 0.08);
  color: var(--accent);
  border-color: rgba(122, 34, 48, 0.14);
}

.memo-panel,
.xray-card,
.challenge-card {
  line-height: 1.5;
}

.challenge-card {
  text-align: left;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  border-color: rgba(80, 55, 42, 0.12);
}

.challenge-box {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(80, 55, 42, 0.12);
}

.metric-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.metric-row {
  display: grid;
  grid-template-columns: 110px 1fr 52px;
  gap: 12px;
  align-items: center;
}

.metric-label,
.metric-value {
  font-size: 0.94rem;
  font-weight: 600;
}

.metric-bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(122, 34, 48, 0.08);
  overflow: hidden;
}

.metric-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold) 0%, var(--accent) 100%);
}

.reveal-total {
  margin-top: 16px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
}

.xray-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.xray-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 6px;
}

.rating {
  color: var(--gold);
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.page-footer {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .splash-hero,
  .splash-intro,
  .workspace,
  .masthead,
  .setup-grid,
  .two-column,
  .memo-grid,
  .reveal-grid {
    grid-template-columns: 1fr;
  }

  .splash-hero {
    min-height: 0;
  }

  .splash-copy h1 {
    max-width: 780px;
    font-size: 5.5rem;
  }

  .dossier-table {
    min-height: 500px;
  }

  .splash-intro {
    gap: 20px;
  }
}

@media (max-width: 760px) {
  .splash-nav {
    position: static;
    align-items: flex-start;
  }

  .splash-brand {
    padding-top: 2px;
  }

  .splash-shell {
    width: min(100% - 28px, 680px);
    padding: 28px 0 44px;
  }

  .splash-hero {
    gap: 26px;
  }

  .splash-copy {
    gap: 18px;
  }

  .splash-copy h1 {
    font-size: 4rem;
    line-height: 0.92;
  }

  .splash-lede {
    font-size: 1.14rem;
  }

  .dossier-table {
    min-height: 420px;
  }

  .dossier-page-main {
    top: 42px;
    left: 28px;
    width: calc(100% - 70px);
    min-height: 286px;
    padding: 18px;
  }

  .dossier-page-side {
    right: 24px;
    bottom: 32px;
    width: 210px;
    min-height: 132px;
    padding: 16px;
  }

  .dossier-page-side strong {
    font-size: 1.9rem;
  }

  .dossier-slip-one {
    top: 28px;
    right: 24px;
    width: 128px;
  }

  .dossier-slip-two {
    right: 150px;
    bottom: 28px;
    width: 132px;
  }

  .dossier-stamp {
    left: 44px;
    bottom: 60px;
    min-width: 168px;
    min-height: 62px;
    font-size: 1rem;
  }

  .splash-intro h2 {
    font-size: 2.25rem;
  }

  .splash-steps {
    grid-template-columns: 1fr;
  }

  .splash-steps li {
    min-height: 0;
  }
}

@media (max-width: 480px) {
  .splash-nav {
    flex-wrap: wrap;
    min-height: 0;
  }

  .splash-links {
    justify-content: flex-start;
  }

  .splash-links a {
    min-height: 36px;
    padding: 8px 10px;
  }

  .splash-actions {
    display: flex;
  }

  .splash-copy h1 {
    font-size: 2.9rem;
  }

  .dossier-table {
    min-height: 270px;
  }

  .dossier-page-main {
    top: 28px;
    left: 18px;
    width: calc(100% - 38px);
    min-height: 206px;
    padding: 14px;
  }

  .dossier-page-head {
    font-size: 0.62rem;
  }

  .dossier-rule {
    height: 54px;
  }

  .dossier-lines {
    gap: 7px;
  }

  .dossier-lines span {
    height: 7px;
  }

  .dossier-verdicts {
    gap: 5px;
  }

  .dossier-verdicts span {
    min-height: 34px;
    font-size: 0.64rem;
  }

  .dossier-page-side {
    right: 18px;
    bottom: 20px;
    width: 172px;
    min-height: 104px;
    padding: 12px;
  }

  .dossier-page-side strong {
    font-size: 1.55rem;
  }

  .dossier-page-side small {
    font-size: 0.7rem;
  }

  .dossier-slip-one {
    display: none;
  }

  .dossier-slip-two {
    right: 116px;
    bottom: 16px;
    width: 118px;
    min-height: 54px;
    padding: 10px;
    font-size: 0.72rem;
  }

  .dossier-stamp {
    left: 32px;
    bottom: 62px;
    min-width: 142px;
    min-height: 52px;
    border-width: 3px;
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  body.is-booting .masthead,
  body.is-booting .setup,
  body.is-booting .overview-card,
  body.is-booting .panel,
  body.is-booting .score-card,
  body.is-booting .memo-panel,
  body.is-booting .evidence-card,
  body.is-booting .assist-card {
    animation: rise 420ms ease both;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
