/* Version 11 · choice-driven immersion without changing assessment meaning */

:root {
  --gold: #815b20;
}

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

.resume-journey {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 28px;
  padding: 18px 21px;
  border: 1px solid color-mix(in srgb, var(--world-line) 36%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--white) 91%, var(--world-light-a));
  box-shadow: 0 12px 34px #173d2f0c;
}

.resume-journey > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

.resume-journey .icon {
  width: 42px;
  height: 42px;
  padding: 8px;
  border-radius: 50%;
  color: var(--teal);
  background: #e4eddb;
}

.resume-journey span,
.resume-journey strong,
.resume-journey small {
  display: block;
}

.resume-journey span {
  color: var(--gold);
  font-size: .72rem;
  font-weight: 750;
}

.resume-journey strong {
  margin: 4px 0;
  font-size: 1rem;
}

.resume-journey small {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.6;
}

.resume-journey .primary {
  min-height: 46px;
  padding: 10px 16px;
  font-size: .85rem;
}

.quick-finder {
  display: grid;
  grid-template-columns: minmax(230px, .7fr) minmax(0, 1.3fr);
  gap: clamp(24px, 5vw, 70px);
  align-items: start;
  margin: 8px 0 34px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid color-mix(in srgb, var(--world-line) 24%, var(--line));
  border-radius: 24px;
  background: color-mix(in srgb, var(--white) 92%, var(--world-light-a));
}

.quick-finder h2 {
  margin: 10px 0 12px;
  font-size: clamp(1.45rem, 2.7vw, 2.2rem);
}

.quick-finder > div:first-child p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

.quick-route-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.quick-route-list button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fffefa;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.quick-route-list button:hover {
  transform: translateY(-2px);
  border-color: var(--world-line);
  background: #f8faf3;
}

.quick-route-list button > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--teal);
  background: color-mix(in srgb, var(--world-light-a) 24%, #eef3e8);
}

.quick-route-list .icon {
  width: 20px;
  height: 20px;
}

.quick-route-list strong {
  font-size: .82rem;
  line-height: 1.55;
}

.quick-route-list b {
  color: var(--gold);
}

.journey-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 23px 0 28px;
  border-block: 1px solid var(--line);
}

.journey-preview > div {
  position: relative;
  padding: 19px 16px 20px;
}

.journey-preview > div + div {
  border-left: 1px solid var(--line);
}

.journey-preview span,
.journey-preview strong,
.journey-preview small {
  display: block;
}

.journey-preview span {
  margin-bottom: 10px;
  color: var(--gold);
  font-size: .7rem;
  font-weight: 800;
}

.journey-preview strong {
  font-size: .88rem;
}

.journey-preview small {
  margin-top: 7px;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.55;
}

.question-column {
  min-width: 0;
}

.chapter-arrival {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 15px;
  align-items: center;
  margin: 0 0 14px;
  padding: 15px 19px;
  border: 1px solid color-mix(in srgb, var(--world-line) 34%, var(--line));
  border-radius: 15px;
  color: var(--ink);
  background: color-mix(in srgb, var(--white) 84%, var(--world-light-a));
  animation: chapter-arrive .42s cubic-bezier(.2, .8, .2, 1) both;
  scroll-margin-top: 16px;
  outline: none;
}

.chapter-arrival:focus-visible {
  outline: 3px solid #ac7437;
  outline-offset: 3px;
}

.chapter-arrival > span {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 68px;
  padding: 8px;
  border-right: 1px solid color-mix(in srgb, var(--world-line) 28%, transparent);
  color: var(--gold);
  font-size: .73rem;
  font-weight: 800;
}

.chapter-arrival > div {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
}

.chapter-arrival .icon {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  color: var(--world-line);
}

.chapter-arrival strong {
  font-size: .96rem;
}

.chapter-arrival p {
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.55;
}

.question-card h1 {
  scroll-margin-top: 18px;
}

.choice-feedback {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  border-left: 3px solid transparent;
  border-radius: 7px;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.choice-feedback[data-kind='branch'] {
  border-color: var(--world-line);
  color: #315e53;
  background: color-mix(in srgb, var(--world-light-a) 18%, #f5f7ef);
}

.choice-feedback[data-kind='clue'] {
  border-color: #a17b35;
  color: #695327;
  background: #f6f0df;
}

.choice-feedback[data-kind='unknown'] {
  border-color: #86918a;
  color: var(--muted);
  background: #f0f2ee;
}

.keyboard-hint {
  margin: 10px 0 0;
  color: #7b877f;
  font-size: .68rem;
  text-align: right;
}

body[data-answer-tone='leaf'] { --answer-halo: #8db58e; }
body[data-answer-tone='gold'] { --answer-halo: #d2b05e; }
body[data-answer-tone='sky'] { --answer-halo: #78afb3; }
body[data-answer-tone='rose'] { --answer-halo: #d79c8d; }

body[data-answer-tone] .glow-b {
  background: radial-gradient(circle, color-mix(in srgb, var(--answer-halo) 43%, transparent) 0, transparent 69%);
}

.result-gate {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr);
  gap: clamp(28px, 6vw, 76px);
  align-items: center;
  min-height: min(680px, calc(100vh - 220px));
  padding: clamp(32px, 6vw, 72px);
  border: 1px solid #d0c18e;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 30%, color-mix(in srgb, var(--world-light-a) 31%, transparent), transparent 34%),
    linear-gradient(135deg, #123b36, #1b5148 58%, #294f45);
  color: #f8f3e5;
  box-shadow: 0 30px 80px #102f2538;
}

.result-gate::before,
.result-gate::after {
  content: '';
  position: absolute;
  z-index: -1;
  border: 1px solid #dec77d38;
  border-radius: 50%;
}

.result-gate::before {
  width: 530px;
  height: 530px;
  left: -190px;
  top: -190px;
  animation: gate-orbit 28s linear infinite;
}

.result-gate::after {
  width: 350px;
  height: 350px;
  right: -120px;
  bottom: -170px;
  border-style: dashed;
  animation: gate-orbit 38s linear infinite reverse;
}

.result-gate > .eyebrow {
  position: absolute;
  top: 28px;
  left: clamp(32px, 6vw, 72px);
  color: #e8d79b;
}

.result-silhouette {
  position: relative;
  width: min(100%, 380px);
  justify-self: center;
}

.result-silhouette::after {
  content: '?';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f1dc988c;
  font-family: Georgia, serif;
  font-size: clamp(4rem, 11vw, 8rem);
  font-style: italic;
  text-shadow: 0 0 35px #f0db8580;
  animation: question-breathe 2.6s ease-in-out infinite;
}

.result-silhouette .character-crop {
  width: 100%;
  filter: brightness(.08) sepia(.25);
  opacity: .55;
  mask-image: linear-gradient(to bottom, #000 62%, transparent 100%);
}

.result-gate > div:nth-of-type(2) > small {
  display: block;
  margin-bottom: 13px;
  color: #d6c98e;
  font-size: .75rem;
  font-weight: 700;
}

.result-gate h1 {
  margin: 0 0 20px;
  font-size: clamp(2.2rem, 5vw, 4.1rem);
  line-height: 1.2;
}

.result-gate h1 em {
  color: #ead485;
  font-style: normal;
}

.result-gate p {
  max-width: 640px;
  color: #dce7df;
  font-size: .96rem;
}

.result-gate-actions {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 18px;
}

.result-gate .primary {
  border-color: #f3dfa3;
  color: #173f39;
  background: #f1dda0;
  box-shadow: 0 5px 0 #aa873c;
}

.result-gate .text-button {
  color: #d9e6dc;
}

.result-resonance {
  display: grid;
  grid-template-columns: minmax(230px, .8fr) minmax(0, 1.2fr);
  gap: 28px 44px;
  align-items: center;
  margin: 28px 0;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid #c8d5c5;
  border-radius: 22px;
  background: linear-gradient(135deg, #f8f8ef, #edf3e8);
}

.result-resonance h2 {
  margin: 10px 0 12px;
  font-size: clamp(1.45rem, 2.8vw, 2rem);
}

.result-resonance > div:first-child p {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
}

.resonance-options {
  display: grid;
  gap: 9px;
}

.resonance-options button {
  position: relative;
  min-height: 52px;
  padding: 12px 44px 12px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #fffefa;
  text-align: left;
  font-weight: 650;
}

.resonance-options button::after {
  content: '○';
  position: absolute;
  right: 16px;
  color: #789083;
}

.resonance-options button[aria-pressed='true'] {
  border-color: var(--teal);
  color: var(--teal);
  background: #e4eee2;
  box-shadow: inset 0 0 0 1px var(--teal);
}

.resonance-options button[aria-pressed='true']::after {
  content: '✓';
}

.resonance-response {
  grid-column: 1 / -1;
  min-height: 72px;
  padding: 17px 19px;
  border-left: 4px solid var(--world-line);
  border-radius: 9px;
  background: #fffef9;
}

.resonance-response p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

.resonance-response strong {
  color: var(--ink);
}

.resonance-response a,
.resonance-response button {
  display: inline-flex;
  margin: 11px 18px 0 0;
  color: var(--teal);
  font-size: .82rem;
  font-weight: 700;
}

.share-status {
  min-height: 20px;
  margin: -14px 0 18px;
  color: var(--muted);
  font-size: .78rem;
}

.result-dock {
  display: none;
}

body.application-focus .result-dock {
  opacity: 0;
  transform: translateY(130%);
  pointer-events: none;
}

.dialog-close {
  position: sticky;
  z-index: 2;
  top: -32px;
  display: flex;
  justify-content: flex-end;
  margin: -22px -20px 4px;
  padding: 8px 20px;
  background: linear-gradient(#fffef9 72%, transparent);
}

.dialog-close .text-button {
  min-width: 54px;
  min-height: 44px;
}

/* Each test keeps the same calm visual system but has a recognisable landscape. */
.world-atmosphere::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .22;
  transition: opacity .5s ease;
}

body[data-world='unconscious'] .world-atmosphere::before {
  background:
    linear-gradient(122deg, transparent 0 14%, #1f4b4030 14.3% 15%, transparent 15.3% 100%),
    radial-gradient(ellipse at 50% 100%, transparent 0 36%, #355e5326 36.5% 37%, transparent 37.5%);
}

body[data-world='learning'] .world-atmosphere::before {
  background-image: linear-gradient(#3b808418 1px, transparent 1px), linear-gradient(90deg, #3b808418 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, transparent, #000 25%, transparent 88%);
}

body[data-world='senior'] .world-atmosphere::before {
  background-image: radial-gradient(ellipse at center, transparent 0 56%, #7c8e5824 57% 59%, transparent 60%);
  background-size: 120px 76px;
  transform: rotate(-7deg) scale(1.12);
}

body[data-world='personality'] .world-atmosphere::before {
  background: repeating-linear-gradient(68deg, transparent 0 88px, #607b5118 89px 91px, transparent 92px 146px);
  mask-image: radial-gradient(circle at 50% 45%, #000, transparent 73%);
}

body[data-world='emotion'] .world-atmosphere::before {
  background: repeating-radial-gradient(ellipse at 50% 110%, transparent 0 62px, #527e831d 64px 66px, transparent 68px 118px);
}

body[data-world='child'] .world-atmosphere::before {
  background-image: radial-gradient(circle, #668d7424 0 4px, transparent 5px);
  background-size: 66px 66px;
  mask-image: linear-gradient(135deg, transparent, #000 30%, transparent 82%);
}

body[data-world='relationship'] .world-atmosphere::before {
  background:
    linear-gradient(14deg, transparent 0 46%, #76678220 46.4% 47%, transparent 47.4%),
    linear-gradient(-14deg, transparent 0 46%, #c2816d1d 46.4% 47%, transparent 47.4%);
}

.character-result-copy > * {
  animation: result-copy-rise .45s ease-out both;
}

.character-result-copy > :nth-child(2) { animation-delay: .05s; }
.character-result-copy > :nth-child(3) { animation-delay: .1s; }
.character-result-copy > :nth-child(4) { animation-delay: .16s; }
.character-result-copy > :nth-child(5) { animation-delay: .21s; }

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

@keyframes gate-orbit {
  to { transform: rotate(360deg); }
}

@keyframes question-breathe {
  0%, 100% { opacity: .48; transform: scale(.96); }
  50% { opacity: .92; transform: scale(1.03); }
}

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

@media (max-width: 900px) {
  .quick-finder,
  .result-resonance {
    grid-template-columns: 1fr;
  }

  .result-gate {
    grid-template-columns: minmax(180px, .62fr) minmax(0, 1.38fr);
  }
}

@media (max-width: 760px) {
  .header-controls button,
  footer .text-button,
  summary {
    min-height: 44px;
  }

  .resume-journey,
  .resume-journey > div,
  .result-gate-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .resume-journey {
    padding: 17px;
  }

  .resume-journey > div:first-child {
    flex-direction: row;
    align-items: center;
  }

  .quick-finder {
    gap: 19px;
    padding: 23px 18px;
    border-radius: 18px;
  }

  .quick-route-list {
    grid-template-columns: 1fr;
  }

  .quick-route-list button {
    min-height: 64px;
  }

  .journey-preview {
    grid-template-columns: 1fr;
  }

  .journey-preview > div {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 15px 4px;
  }

  .journey-preview > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .journey-preview span {
    grid-row: 1 / 3;
  }

  .journey-preview small {
    margin-top: 4px;
    font-size: .76rem;
  }

  .world-beacon {
    display: none;
  }

  .compact-route {
    padding: 12px 14px;
    border-radius: 13px;
  }

  .compact-route .route-heading {
    margin-bottom: 9px;
  }

  .compact-route ol {
    margin: 10px 0 1px;
  }

  .compact-route li {
    gap: 4px;
    font-size: .64rem;
  }

  .compact-route li i {
    width: 8px;
    height: 8px;
  }

  .chapter-arrival {
    grid-template-columns: 54px 1fr;
    padding: 12px 13px;
  }

  .chapter-arrival > span {
    min-width: 0;
  }

  .chapter-arrival p {
    font-size: .72rem;
  }

  .question-card {
    backdrop-filter: none;
  }

  .question-card .actions {
    min-height: 56px;
  }

  body[data-screen='question'] {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .question-card #next {
    position: fixed;
    z-index: 18;
    right: 16px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 16px;
    width: auto;
    max-width: none;
    border-color: color-mix(in srgb, var(--world-line) 70%, var(--teal));
    box-shadow: 0 7px 0 #123b33, 0 15px 35px #0d2c2450;
    transition: transform .2s ease, opacity .2s ease, background .18s ease;
  }

  .question-card #next:disabled {
    opacity: 0;
    transform: translateY(130%);
    pointer-events: none;
  }

  .keyboard-hint {
    display: none;
  }

  .result-gate {
    grid-template-columns: 1fr;
    gap: 18px;
    min-height: calc(100vh - 150px);
    padding: 62px 22px 28px;
    border-radius: 22px;
    text-align: center;
  }

  .result-gate > .eyebrow {
    top: 23px;
    left: 22px;
    right: 22px;
  }

  .result-silhouette {
    width: min(62vw, 260px);
  }

  .result-gate h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .result-gate p {
    font-size: .9rem;
  }

  .result-gate-actions {
    grid-column: 1;
    gap: 7px;
  }

  .result-resonance {
    gap: 20px;
    padding: 23px 18px;
    border-radius: 17px;
  }

  .resonance-response {
    grid-column: auto;
  }

  body[data-screen='result'] {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .result-dock {
    position: fixed;
    z-index: 19;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 64px;
    overflow: hidden;
    border: 1px solid #63847b;
    border-radius: 15px;
    background: #123f38;
    box-shadow: 0 15px 38px #0c282152;
    transition: opacity .18s ease, transform .18s ease;
  }

  .result-dock button,
  .result-dock a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 9px 12px;
    border: 0;
    color: #fffced;
    background: transparent;
    text-decoration: none;
  }

  .result-dock button {
    align-items: center;
    border-right: 1px solid #6d8d82;
  }

  .result-dock a {
    align-items: flex-start;
  }

  .result-dock small {
    color: #d8dba9;
    font-size: .64rem;
  }

  .result-dock strong {
    margin-top: 2px;
    font-size: .85rem;
    line-height: 1.4;
  }

  .world-atmosphere::before {
    opacity: .14;
  }

  .glow-b,
  .orbit-b,
  .atmosphere-stars i:nth-child(n+5) {
    display: none;
  }

  .atmosphere-glow {
    filter: blur(24px);
    will-change: auto;
  }

  body[data-chapter='dungeon'] {
    background-attachment: scroll;
  }
}

@media (max-width: 390px) {
  .chapter-arrival {
    grid-template-columns: 1fr;
  }

  .chapter-arrival > span {
    justify-content: start;
    border-right: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--world-line) 24%, transparent);
  }

  .result-dock {
    grid-template-columns: 62px minmax(0, 1fr);
  }
}

.calm-mode .chapter-arrival,
.calm-mode .result-gate::before,
.calm-mode .result-gate::after,
.calm-mode .result-silhouette::after,
.calm-mode .character-result-copy > * {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .chapter-arrival,
  .result-gate::before,
  .result-gate::after,
  .result-silhouette::after,
  .character-result-copy > * {
    animation: none !important;
  }

  .question-card #next {
    transition: none !important;
  }
}
