:root {
  color-scheme: dark;
  --ink-950: #050b10;
  --ink-900: #081018;
  --ink-850: #0b151d;
  --ink-800: #0f1b24;
  --ink-700: #172936;
  --line: #29404f;
  --line-soft: rgba(120, 155, 170, 0.18);
  --paper: #edf2ef;
  --paper-soft: #c8d3d4;
  --muted: #8fa3aa;
  --gold: #e7c77a;
  --gold-soft: rgba(231, 199, 122, 0.15);
  --red: #df6652;
  --red-soft: rgba(223, 102, 82, 0.16);
  --cyan: #5cc7bd;
  --cyan-soft: rgba(92, 199, 189, 0.14);
  --blue: #78aee8;
  --radius: 6px;
  --serif: "Noto Serif JP", "Noto Serif SC", "Yu Mincho", "Songti SC", Georgia, serif;
  --sans: Inter, "Noto Sans JP", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--ink-950);
  background-size: 48px 48px;
  color: var(--paper);
  font: 400 1rem/1.72 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }

button:focus-visible,
a:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.ambient span {
  position: absolute;
  width: 38rem;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .08;
}

.ambient span:nth-child(1) { background: var(--red); top: -25rem; left: -14rem; }
.ambient span:nth-child(2) { background: var(--cyan); top: 15%; right: -28rem; }
.ambient span:nth-child(3) { background: var(--gold); bottom: -30rem; left: 25%; }

.site-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-size: .86rem;
  font-weight: 680;
  letter-spacing: .14em;
}

.brand b { color: var(--gold); }

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
  font-size: .92rem;
  line-height: 1;
}

.language-switch {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 16, 24, .75);
}

.language-switch button {
  min-width: 54px;
  min-height: 34px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: color .18s, background .18s;
}

.language-switch button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink-950);
}

#app {
  flex: 1;
  width: 100%;
}

.screen {
  min-height: calc(100vh - 150px);
  padding: clamp(34px, 7vh, 76px) 0;
  animation: reveal .42s ease both;
}

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

.home-screen {
  display: grid;
  grid-template-columns: minmax(260px, .78fr) minmax(0, 1.22fr);
  gap: clamp(36px, 6vw, 88px);
  align-items: center;
}

.triad-seal {
  position: relative;
  width: min(100%, 410px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.triad-seal::before,
.triad-seal::after {
  content: "";
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.triad-seal::before { inset: 1%; }
.triad-seal::after { inset: 15%; border-color: rgba(231,199,122,.28); }

.orbit {
  position: absolute;
  inset: 6%;
  animation: turn 45s linear infinite;
}

.orbit::before,
.orbit::after,
.triad-dot {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  box-shadow: 0 0 24px currentColor;
}

.orbit::before { color: var(--red); background: currentColor; top: 0; left: calc(50% - 7px); }
.orbit::after { color: var(--cyan); background: currentColor; bottom: 20%; left: 3%; }
.triad-dot { color: var(--gold); background: currentColor; bottom: 22%; right: 9%; }

@keyframes turn { to { transform: rotate(360deg); } }

.seal-lines {
  position: absolute;
  width: 72%;
  height: 64%;
  overflow: visible;
}

.seal-center {
  position: relative;
  z-index: 1;
  width: 48%;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px solid rgba(231,199,122,.4);
  border-radius: 50%;
  background: rgba(8,16,24,.82);
  box-shadow: 0 25px 80px #0008, inset 0 0 50px rgba(231,199,122,.04);
}

.seal-center strong {
  font: 500 clamp(3.5rem, 8vw, 6rem)/.95 var(--serif);
  color: var(--gold);
}

.seal-center span {
  margin-top: 10px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .22em;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .2em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

.home-copy h1 {
  max-width: 720px;
  margin-bottom: 20px;
  font: 500 clamp(3rem, 6.8vw, 6.1rem)/1.03 var(--serif);
  letter-spacing: -.035em;
}

.lead {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--paper-soft);
  font-size: clamp(1rem, 1.5vw, 1.12rem);
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 520px;
  gap: 12px;
  margin-top: 32px;
}

.mode-card {
  position: relative;
  min-height: 170px;
  padding: 22px 23px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(23,41,54,.92), rgba(10,20,28,.88));
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.mode-card::after {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  right: -58px;
  bottom: -70px;
  border: 1px solid var(--accent, var(--gold));
  border-radius: 50%;
  opacity: .25;
  transition: transform .3s ease;
}

.mode-card:hover,
.mode-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent, var(--gold));
  background: linear-gradient(145deg, rgba(29,51,64,.98), rgba(11,22,30,.92));
}

.mode-card:hover::after { transform: scale(1.18); }
.mode-card:nth-child(1) { --accent: var(--cyan); }

.room-number {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .16em;
}

.mode-card strong {
  display: block;
  margin: 15px 0 7px;
  font: 600 1.36rem/1.25 var(--serif);
}

.mode-card .mode-desc { color: var(--paper-soft); font-size: .9rem; }
.mode-card .mode-arrow { position: absolute; right: 20px; top: 20px; color: var(--accent); font-size: 1.15rem; }

.principle-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: .82rem;
}

.workspace {
  width: min(960px, 100%);
  margin: 0 auto;
}

.workspace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.workspace-title h1 {
  margin: 2px 0 0;
  font: 500 clamp(2.2rem, 5vw, 4.4rem)/1.08 var(--serif);
  letter-spacing: -.03em;
}

.ghost-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8,16,24,.65);
  color: var(--paper-soft);
  font-size: .84rem;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}

.ghost-button:hover { color: var(--gold); border-color: var(--gold); }

.lab-panel {
  position: relative;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(17,31,41,.96), rgba(7,15,22,.94));
  box-shadow: 0 30px 90px rgba(0,0,0,.28);
}

.panel-topline {
  position: absolute;
  inset: -1px auto auto -1px;
  width: 34%;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

.panel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.progress-track {
  width: min(260px, 46vw);
  height: 3px;
  overflow: hidden;
  background: var(--line);
  border-radius: 99px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width .35s ease;
}

.nini-line {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
  align-items: start;
  margin-bottom: 28px;
}

.nini-token {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05em;
}

.nini-line p {
  margin: 0;
  color: var(--paper-soft);
  font-family: var(--serif);
}

.scenario-place {
  margin-bottom: 8px;
  color: var(--gold);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.scenario-question {
  max-width: 900px;
  margin-bottom: 18px;
  font: 500 clamp(1.3rem, 2.3vw, 1.9rem)/1.55 var(--serif);
}

.choice-prompt {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: .9rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.choice-button {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12,24,32,.78);
  text-align: left;
  cursor: pointer;
  transition: transform .18s, border-color .18s, background .18s;
}

.choice-button:hover,
.choice-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(24,40,50,.96);
}

.choice-index {
  display: block;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .16em;
}

.choice-button strong { font-weight: 560; line-height: 1.55; }

.intro-card {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 40px;
  align-items: center;
}

.intro-card h2 {
  margin-bottom: 16px;
  font: 500 clamp(2rem, 4.5vw, 3.8rem)/1.12 var(--serif);
}

.intro-card p { color: var(--paper-soft); }

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  margin-top: 12px;
  padding: 11px 22px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink-950);
  font-weight: 750;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, background .18s;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(231,199,122,.16);
  background: #f2d991;
}

.three-words {
  position: relative;
  min-height: 270px;
  display: grid;
  place-items: center;
}

.three-words::before {
  content: "";
  width: 210px;
  height: 185px;
  border: 1px solid rgba(231,199,122,.34);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.three-words span {
  position: absolute;
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink-900);
  text-align: center;
  font-family: var(--serif);
}

.three-words span:nth-child(1) { top: 15px; color: var(--red); }
.three-words span:nth-child(2) { bottom: 18px; left: 8%; color: var(--cyan); }
.three-words span:nth-child(3) { bottom: 18px; right: 8%; color: var(--gold); }

.result-layout {
  display: grid;
  grid-template-columns: minmax(250px,.76fr) minmax(0,1.24fr);
  gap: clamp(26px, 5vw, 60px);
  align-items: center;
}

.radar-wrap { position: relative; }
.radar-chart { width: 100%; height: auto; overflow: visible; }
.radar-chart .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-chart .axis { stroke: rgba(143,163,170,.28); stroke-width: 1; }
.radar-chart .shape { fill: rgba(92,199,189,.2); stroke: var(--cyan); stroke-width: 2; transition: points .4s; }
.radar-chart .dot { fill: var(--gold); }
.radar-label { fill: var(--paper-soft); font: 600 13px var(--sans); text-anchor: middle; }
.radar-value { fill: var(--gold); font: 700 12px var(--sans); text-anchor: middle; }

.desire-scores {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.desire-score {
  display: grid;
  grid-template-columns: minmax(78px, auto) 1fr 22px;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: .875rem;
}

.desire-score i {
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.desire-score i b {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.desire-score.survival i b { background: var(--red); }
.desire-score.cognition i b { background: var(--cyan); }
.desire-score.relation i b { background: var(--gold); }
.desire-score > strong { color: var(--paper-soft); text-align: right; }

.result-kicker { color: var(--cyan); font-size: .76rem; font-weight: 750; letter-spacing: .16em; }
.result-copy h2 { margin: 9px 0 18px; font: 500 clamp(2rem,4vw,3.5rem)/1.18 var(--serif); }
.result-summary { color: var(--paper-soft); font-size: 1.03rem; }

.result-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 24px 0;
}

.result-box {
  padding: 17px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(8,17,24,.54);
}

.result-box small { display: block; margin-bottom: 6px; color: var(--muted); letter-spacing: .1em; }
.result-box p { margin: 0; color: var(--paper-soft); font-size: .9rem; }
.result-note { color: var(--muted); font-size: .82rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.theory-details {
  width: min(960px,100%);
  margin: 18px auto 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(8,16,24,.5);
}

.theory-details summary {
  padding: 16px 18px;
  color: var(--paper-soft);
  font-weight: 650;
  cursor: pointer;
}

.theory-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 4px 18px 20px;
  color: var(--muted);
  font-size: .86rem;
}

.theory-body h3 { margin-bottom: 7px; color: var(--paper); font: 600 1rem/1.4 var(--serif); }
.theory-body p { margin-bottom: 0; }

.footer {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: .76rem;
}

.footer p { margin: 0; }
.footer a { color: var(--paper-soft); text-decoration-color: var(--line); text-underline-offset: 4px; }
.footer a:hover { color: var(--gold); }

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

@media (max-width: 880px) {
  .home-screen { grid-template-columns: 1fr; gap: 22px; padding-top: 26px; }
  .triad-seal { width: min(60vw, 300px); }
  .home-copy { text-align: center; }
  .home-copy .lead { margin-inline: auto; }
  .mode-grid { margin-inline: auto; text-align: left; }
  .result-layout { grid-template-columns: 1fr; }
  .radar-wrap { width: min(390px, 90%); margin: 0 auto; }
}

@media (max-width: 700px) {
  .site-shell { width: min(100% - 24px, 1180px); }
  .topbar { min-height: 70px; }
  .brand { font-size: .72rem; letter-spacing: .1em; }
  .brand-mark { width: 28px; height: 28px; }
  .language-switch button { min-width: 44px; padding-inline: 8px; }
  .screen { min-height: calc(100vh - 138px); padding: 30px 0 44px; }
  .mode-grid, .choice-grid, .intro-card, .result-pair, .theory-body { grid-template-columns: 1fr; }
  .mode-card { min-height: 146px; }
  .workspace-head { align-items: center; }
  .workspace-title h1 { font-size: 2rem; }
  .workspace-title .eyebrow { margin-bottom: 4px; }
  .lab-panel { padding: 22px 17px; }
  .choice-button { min-height: 92px; }
  .choice-index { margin-bottom: 7px; }
  .three-words { min-height: 230px; order: -1; }
  .footer { padding: 18px 0; flex-direction: column; align-items: flex-start; gap: 4px; }
  .desire-score { grid-template-columns: minmax(78px, auto) 1fr 22px; }
}

@media (max-width: 430px) {
  .brand > span:last-child { max-width: 125px; line-height: 1.25; }
  .language-switch button { min-width: 38px; font-size: .7rem; }
  .language-switch button:first-child { padding-inline: 7px; }
  .home-copy h1 { font-size: 2.7rem; }
  .workspace-head { gap: 10px; }
  .ghost-button { width: 42px; padding: 0; font-size: 0; }
  .ghost-button::before { content: "←"; font-size: 1rem; }
  .panel-meta { align-items: flex-start; flex-direction: column; gap: 8px; }
  .progress-track { width: 100%; }
  .scenario-question { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
