@import url("https://fonts.googleapis.com/css2?family=Satisfy&display=swap");

:root {
  --bg: #081824;
  --bg-soft: #102739;
  --panel: rgba(10, 29, 44, 0.86);
  --panel-strong: #14344b;
  --line: rgba(185, 226, 245, 0.16);
  --text: #eff9ff;
  --muted: #b6d7e6;
  --accent: #ffd166;
  --accent-2: #7ae0d6;
  --danger: #ff8a80;
  --success: #8ee59b;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(122, 224, 214, 0.12), transparent 28%),
    radial-gradient(circle at right 20%, rgba(255, 209, 102, 0.16), transparent 24%),
    linear-gradient(180deg, #0a1f2e 0%, #07141e 100%);
}

body[data-view="intro"] {
  background: #07141e;
}

body[data-view="story"] {
  background: #07141e;
}

body[data-view="map"] {
  background:
    radial-gradient(circle at top left, rgba(129, 181, 223, 0.26) 0%, rgba(129, 181, 223, 0.08) 28%, transparent 48%),
    linear-gradient(180deg, #edf5fb 0%, #dcebf5 45%, #f4f8fb 100%);
}

body[data-view="map"] .panel,
body[data-view="map"] .world-card {
  background: linear-gradient(180deg, rgba(251, 252, 254, 0.95) 0%, rgba(239, 246, 252, 0.92) 100%);
  border-color: rgba(123, 162, 194, 0.24);
  box-shadow:
    0 18px 42px rgba(33, 70, 102, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
}

body[data-view="map"] .panel h2,
body[data-view="map"] .world-card h3,
body[data-view="map"] .eyebrow,
body[data-view="map"] .badge,
body[data-view="map"] .status-label,
body[data-view="map"] .status-value {
  color: #1f4f7b;
}

body[data-view="map"] .panel p,
body[data-view="map"] .world-card p,
body[data-view="map"] .small-note {
  color: #4f7391;
}

body[data-view="map"] .digit-pill {
  background: rgba(41, 104, 156, 0.09);
  color: #1f4f7b;
}

body[data-view="map"] .digit-pill.empty {
  color: rgba(31, 79, 123, 0.28);
}

body[data-view="map"] .digit-input {
  border: 1px solid rgba(123, 162, 194, 0.22);
  outline: none;
  font: inherit;
  cursor: text;
}

body[data-view="map"] .digit-input:focus {
  border-color: rgba(31, 79, 123, 0.42);
  box-shadow: 0 0 0 4px rgba(129, 181, 223, 0.18);
}

body[data-view="map"] .badge {
  background: rgba(41, 104, 156, 0.1);
}

body[data-view="map"] .badge.success {
  background: rgba(142, 229, 155, 0.2);
}

body[data-view="map"] .badge.locked {
  background: rgba(255, 138, 128, 0.18);
}

body[data-view="map"] .map-actions {
  margin-top: 1.35rem;
}

body[data-view="map"] .map-chest-button {
  background:
    linear-gradient(180deg, #5d97c8 0%, #2d618f 100%);
  border-color: #234b6d;
  color: #f8fbff;
  box-shadow:
    0 18px 28px rgba(18, 42, 63, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

body[data-view="map"] .map-chest-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 20px 30px rgba(18, 42, 63, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

body[data-view="map"] .map-chest-button:disabled {
  background:
    linear-gradient(180deg, rgba(93, 151, 200, 0.38) 0%, rgba(45, 97, 143, 0.38) 100%);
  border-color: rgba(35, 75, 109, 0.28);
  color: rgba(248, 251, 255, 0.7);
}

body[data-view="map"] .map-photo-panel {
  padding: 1.35rem;
}

body[data-view="map"] .map-photo-placeholder {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(228, 239, 249, 0.88);
}

body[data-view="map"] .map-photo-image {
  width: 100%;
  height: 100%;
  min-height: 240px;
  display: block;
  object-fit: cover;
  object-position: center center;
}

body[data-view="map"] .map-reset-section {
  padding-top: 0.2rem;
}

body[data-view="map"] .map-reset-actions {
  justify-content: center;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(12px);
}

body::before {
  width: 280px;
  height: 280px;
  top: 4rem;
  right: 6vw;
  background: rgba(122, 224, 214, 0.08);
}

body::after {
  width: 360px;
  height: 360px;
  bottom: 2rem;
  left: -4rem;
  background: rgba(255, 209, 102, 0.08);
}

.page-shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
  max-width: 100%;
  overflow-x: clip;
}

body[data-view="intro"]::before,
body[data-view="intro"]::after,
body[data-view="story"]::before,
body[data-view="story"]::after {
  display: none;
}

body[data-view="intro"] .page-shell {
  width: 100%;
  margin: 0;
  padding: 0;
}

body[data-view="story"] .page-shell {
  width: 100%;
  margin: 0;
  padding: 0;
}

body[data-view="intro"] .app {
  gap: 0;
}

body[data-view="story"] .app {
  gap: 0;
}

.eyebrow {
  margin: 0 0 0.5rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.78rem;
}

.intro-cover-title,
.panel h2,
.world-card h3,
.question-card h3,
.result-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app {
  display: grid;
  gap: 1.4rem;
}

.panel,
.world-card,
.question-card,
.result-card,
.status-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel,
.result-card {
  padding: 1.6rem;
}

.world-layout {
  display: grid;
  gap: 1.2rem;
}

.intro-cover {
  position: relative;
  display: block;
  width: 100%;
  min-height: min(78vh, 900px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 34px;
  background: #0b1d2a;
  box-shadow: var(--shadow);
}

body[data-view="intro"] .intro-cover {
  min-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

.intro-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 12, 18, 0.02) 0%, rgba(4, 12, 18, 0.11) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0) 100%);
}

.intro-cover-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.intro-cover-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.95rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  padding-bottom: calc(clamp(1.5rem, 4vw, 3rem) + 5.8rem + env(safe-area-inset-bottom, 0px));
  text-align: center;
}

.intro-logo-image {
  display: block;
  width: min(64vw, 430px);
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.24));
}

.intro-cover-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}

.intro-access-layout {
  align-items: center;
  flex-wrap: nowrap;
}

.intro-access-block,
.intro-password-panel {
  width: min(100%, 300px);
}

.intro-access-block {
  display: flex;
  justify-content: center;
}

.intro-cover-actions .primary-button,
.intro-cover-actions .secondary-button {
  min-width: 220px;
  padding: 1rem 1.45rem;
  border: 2px solid rgba(86, 47, 20, 0.7);
  color: #4a2915;
  backdrop-filter: blur(6px);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 248, 229, 0.55);
}

.intro-cover-actions .primary-button {
  background: linear-gradient(180deg, #f2ddb0 0%, #d0aa67 100%);
}

.intro-cover-actions .primary-button:hover,
.intro-cover-actions .secondary-button:hover {
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 248, 229, 0.6);
}

.intro-cover-actions .secondary-button {
  background: linear-gradient(180deg, #e6c88f 0%, #b17a47 100%);
  color: #fff5dc;
  border-color: rgba(86, 47, 20, 0.82);
}

.intro-cover-actions .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.66;
  filter: saturate(0.72);
}

.intro-password-panel {
  display: grid;
  gap: 0.55rem;
  padding: 0.9rem 0.95rem 0.85rem;
  border: 1px solid rgba(255, 239, 202, 0.38);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(9, 28, 41, 0.56) 0%, rgba(8, 20, 31, 0.44) 100%);
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.16);
}

.intro-legal-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 5.8rem;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: linear-gradient(180deg, rgba(11, 29, 42, 0.96) 0%, rgba(7, 19, 28, 0.98) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.18);
}

.intro-legal-links,
.intro-legal-copy {
  margin: 0;
}

.intro-legal-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.96rem;
}

.intro-legal-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.96);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
}

.intro-legal-link:hover {
  color: #f2ddb0;
}

.intro-legal-copy {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
}

.intro-password-input {
  width: 100%;
  padding: 0.95rem 1.05rem;
  border: 2px solid rgba(239, 218, 170, 0.42);
  border-radius: 18px;
  background: rgba(250, 247, 238, 0.94);
  color: #3e2516;
  font: inherit;
  text-transform: uppercase;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.intro-password-input::placeholder {
  color: rgba(74, 41, 21, 0.56);
  text-transform: none;
}

.intro-password-message {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  color: rgba(255, 245, 220, 0.94);
  text-align: center;
  text-shadow: 0 1px 8px rgba(5, 14, 20, 0.38);
}

.intro-password-error {
  margin: 0.45rem 0 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 148, 148, 0.6);
  border-radius: 10px;
  background: rgba(126, 17, 17, 0.5);
  color: #ffe6e6;
  font-size: 0.84rem;
  line-height: 1.35;
  text-align: center;
}

.intro-password-input:focus {
  border-color: rgba(248, 233, 185, 0.82);
  box-shadow:
    0 0 0 4px rgba(248, 233, 185, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.intro-notice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(4, 14, 22, 0.58);
  backdrop-filter: blur(8px);
}

.intro-notice {
  width: min(100%, 560px);
  padding: 1.8rem;
  border: 1px solid rgba(248, 231, 187, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(15, 37, 54, 0.98) 0%, rgba(10, 25, 37, 0.98) 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.intro-notice p {
  margin: 0 0 1rem;
}

.intro-notice-layout {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1.2rem;
  align-items: center;
}

.intro-book-image {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.28);
  transform: rotate(-7deg);
}

.intro-notice .button-row {
  margin-top: 1.2rem;
}

.intro-notice .primary-button {
  background: linear-gradient(180deg, #f2ddb0 0%, #d0aa67 100%);
  color: #4a2915;
}

.intro-notice .ghost-button {
  color: #fff5dc;
  border-color: rgba(248, 231, 187, 0.28);
}

.legal-modal {
  width: min(100%, 720px);
  max-height: min(82vh, 860px);
  display: flex;
  flex-direction: column;
}

.legal-modal-title {
  margin: 0 0 1rem;
  color: #fff5dc;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.legal-modal-content {
  overflow-y: auto;
  padding-right: 0.4rem;
}

.legal-modal-content h3 {
  margin: 1rem 0 0.45rem;
  color: #f2ddb0;
  font-size: 1.02rem;
  letter-spacing: 0.03em;
}

.legal-modal-content h3:first-child {
  margin-top: 0;
}

.legal-modal-content p,
.legal-modal-content ul {
  margin: 0 0 0.8rem;
  color: rgba(255, 245, 220, 0.96);
  line-height: 1.6;
}

.legal-modal-content ul {
  padding-left: 1.2rem;
}

.legal-modal-copy {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(248, 231, 187, 0.22);
  color: rgba(255, 245, 220, 0.82);
  font-size: 0.95rem;
}

.story-stage {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(129, 181, 223, 0.26) 0%, rgba(129, 181, 223, 0.06) 28%, transparent 48%),
    linear-gradient(180deg, #edf5fb 0%, #dcebf5 45%, #f4f8fb 100%);
}

.story-overlay {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.2rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
}

.story-overlay-split {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.12) 100%);
}

.story-progress {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
}

.story-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 0 0 1px rgba(9, 44, 72, 0.12);
}

.story-dot.is-active {
  background: #1b7fbb;
  transform: scale(1.18);
}

.story-split {
  width: min(100%, 1260px);
  min-height: calc(100vh - 8rem);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(330px, 440px) minmax(0, 1fr);
  align-items: stretch;
  gap: clamp(1.2rem, 4vw, 3rem);
}

.story-column {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 1.1rem;
  align-content: stretch;
}

.story-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: clamp(320px, 58vh, 560px);
  padding: clamp(1.35rem, 2.2vw, 1.8rem);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.94) 0%, rgba(244, 239, 229, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
}

.story-panel-label {
  margin: 0 0 0.55rem;
  color: #1f4f7b;
  font-family: inherit;
  font-size: clamp(1rem, 1.16vw, 1.12rem);
  font-weight: 500;
  letter-spacing: 0;
}

.story-panel-text {
  margin: 0;
  color: #1f4f7b;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: clamp(1rem, 1.16vw, 1.12rem);
  font-weight: 500;
  line-height: 1.65;
  text-align: justify;
  white-space: pre-line;
}

.story-image-pane {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(360px, 58vh, 720px);
  padding: clamp(0.75rem, 1.8vw, 1.25rem);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.46) 0%, rgba(255, 255, 255, 0.26) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.52),
    0 20px 44px rgba(28, 53, 74, 0.14);
}

.story-side-image {
  width: 100%;
  height: min(74vh, 700px);
  display: block;
  object-fit: contain;
  object-position: center center;
  filter: drop-shadow(0 18px 30px rgba(18, 41, 60, 0.16));
}

.story-controls {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  width: 100%;
  margin: 0;
  padding-bottom: 0;
}

.story-controls .primary-button,
.story-controls .secondary-button {
  min-width: 180px;
}

.story-controls .primary-button {
  background: linear-gradient(180deg, #f2ddb0 0%, #d0aa67 100%);
  border: 2px solid rgba(86, 47, 20, 0.7);
  color: #4a2915;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 248, 229, 0.55);
}

.story-controls .secondary-button {
  background: linear-gradient(180deg, #e6c88f 0%, #b17a47 100%);
  border: 2px solid rgba(86, 47, 20, 0.82);
  color: #fff5dc;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 248, 229, 0.45);
}

.story-controls .primary-button:hover,
.story-controls .secondary-button:hover {
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 248, 229, 0.6);
}

.panel p,
.question-copy,
.status-copy,
.world-card p,
.result-card p {
  color: var(--muted);
  line-height: 1.55;
}

.button-row,
.choice-list,
.map-grid,
.stats-grid,
.digit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.primary-button {
  background: linear-gradient(180deg, #f2ddb0 0%, #d0aa67 100%);
  color: #4a2915;
  border: 2px solid rgba(86, 47, 20, 0.7);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 248, 229, 0.55);
}

.secondary-button {
  background: linear-gradient(180deg, #e6c88f 0%, #b17a47 100%);
  color: #fff5dc;
  border: 2px solid rgba(86, 47, 20, 0.82);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 248, 229, 0.55);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.stats-grid {
  gap: 1rem;
}

.status-card {
  flex: 1 1 210px;
  padding: 1.2rem;
}

.status-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
}

.status-value {
  font-size: 1.55rem;
  font-weight: 700;
}

.map-grid {
  align-items: stretch;
}

.world-card {
  position: relative;
  flex: 1 1 240px;
  min-height: 230px;
  padding: 1.4rem;
  overflow: hidden;
}

.world-card::after {
  content: "";
  position: absolute;
  inset: auto -38px -38px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}

.world-card[data-state="locked"] {
  opacity: 0.6;
}

.world-card[data-state="complete"] {
  border-color: rgba(142, 229, 155, 0.5);
}

.world-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.world-card h3 {
  margin-top: 0.45rem;
}

.world-card-copy {
  text-align: justify;
}

.world-card-featured .world-card-image {
  width: 100%;
  max-width: 168px;
  display: block;
  margin: 0.8rem auto 1rem;
  object-fit: contain;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.badge.success {
  background: rgba(142, 229, 155, 0.18);
  color: var(--success);
}

.badge.locked {
  background: rgba(255, 138, 128, 0.18);
  color: var(--danger);
}

.world-layout {
  grid-template-columns: 320px 1fr;
  align-items: start;
}

body[data-view="world"] {
  background:
    radial-gradient(circle at top left, rgba(129, 181, 223, 0.26) 0%, rgba(129, 181, 223, 0.08) 28%, transparent 48%),
    linear-gradient(180deg, #edf5fb 0%, #dcebf5 45%, #f4f8fb 100%);
}

body[data-view="victory"] {
  background:
    radial-gradient(circle at top left, rgba(129, 181, 223, 0.26) 0%, rgba(129, 181, 223, 0.08) 28%, transparent 48%),
    linear-gradient(180deg, #edf5fb 0%, #dcebf5 45%, #f4f8fb 100%);
}

body[data-view="world"]::before {
  background: rgba(129, 181, 223, 0.08);
}

body[data-view="world"]::after {
  background: rgba(129, 181, 223, 0.06);
}

.world-intro-stage {
  background:
    radial-gradient(circle at top left, rgba(129, 181, 223, 0.26) 0%, rgba(129, 181, 223, 0.06) 28%, transparent 48%),
    linear-gradient(180deg, #edf5fb 0%, #dcebf5 45%, #f4f8fb 100%);
}

.world-intro-split {
  min-height: calc(100vh - 5rem);
}

.world-intro-title {
  margin: 0 0 1rem;
  color: #1f4f7b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 2.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
}

.world-intro-signature {
  margin: 1rem 0 0;
  align-self: flex-end;
  color: #315989;
  font-family: "Satisfy", "Snell Roundhand", "Brush Script MT", "Segoe Script", "Lucida Handwriting", cursive;
  font-size: clamp(1.45rem, 2.1vw, 2.05rem);
  font-weight: 400;
  line-height: 1;
  text-align: right;
}

.world-intro-copy {
  display: grid;
  gap: 0.7rem;
}

.world-intro-panel .story-panel-text {
  text-align: justify;
}

.question-stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background:
    radial-gradient(circle at top left, rgba(129, 181, 223, 0.22) 0%, rgba(129, 181, 223, 0.05) 28%, transparent 48%),
    linear-gradient(180deg, rgba(237, 245, 251, 0.96) 0%, rgba(220, 235, 245, 0.92) 45%, rgba(244, 248, 251, 0.96) 100%);
}

.question-shell {
  width: min(100%, 720px);
  display: grid;
  gap: 1rem;
}

.question-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
}

.question-head-meta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.question-head .eyebrow {
  color: #1f4f7b;
}

.question-zone-label {
  margin: 0;
  font-weight: 700;
}

.question-head-image {
  width: 84px;
  height: 84px;
  display: block;
  object-fit: contain;
}

.question-panel {
  display: block;
  max-width: 640px;
  margin: 0 auto;
  min-height: auto;
  padding: 0.9rem 1.05rem 1rem;
}

.question-top-layout {
  width: min(100%, 860px);
  margin: 0 auto;
}

.question-top-layout.has-help {
  display: grid;
  grid-template-columns: minmax(0, 640px) 180px;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.question-top-layout.has-help .question-panel {
  margin: 0;
  max-width: none;
}

.question-help-card {
  padding: 0.8rem 0.8rem 0.95rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.96) 0%, rgba(244, 239, 229, 0.94) 100%);
  border: 1px solid rgba(200, 170, 116, 0.3);
  box-shadow:
    0 12px 28px rgba(33, 70, 102, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  text-align: center;
}

.question-help-card:hover {
  border-color: rgba(146, 99, 55, 0.46);
  box-shadow:
    0 16px 30px rgba(33, 70, 102, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.question-help-image {
  width: 100%;
  max-width: 120px;
  height: auto;
  display: block;
  margin: 0 auto 0.65rem;
  object-fit: contain;
}

.question-help-title {
  margin: 0 0 0.35rem;
  color: #173f60;
  font-weight: 700;
}

.question-help-text {
  margin: 0;
  color: #214e78;
  line-height: 1.45;
}

.question-help-trigger {
  margin-top: 0.8rem;
  padding: 0.65rem 1rem;
  min-height: 0;
  font-size: 0.96rem;
  line-height: 1.2;
  width: auto;
  min-width: 0;
}

.question-help-modal {
  width: min(100%, 620px);
}

.question-help-modal-title {
  margin: 0 0 1rem;
  color: #fff5dc;
  font-size: 1.2rem;
  font-weight: 700;
}

.question-help-modal-text {
  margin: 0;
  color: #f4ead8;
  line-height: 1.65;
}

.question-lead {
  margin: 0 0 0.55rem;
  color: #173f60;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 1.42vw, 1.22rem);
  font-weight: 700;
  line-height: 1.34;
}

.question-prompt {
  margin: 0;
  color: #173f60;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.08rem);
  font-weight: 500;
  line-height: 1.6;
  text-align: justify;
  white-space: pre-line;
}

.question-count {
  margin: 0 0 0.8rem;
  color: #916337;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
}

.choice-list {
  margin-top: 0;
  flex-direction: column;
  width: min(100%, 640px);
  margin-left: auto;
  margin-right: auto;
}

.choice-button {
  width: 100%;
  text-align: left;
  border-radius: 20px;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.96) 0%, rgba(244, 239, 229, 0.94) 100%);
  color: #173f60;
  border: 1px solid rgba(200, 170, 116, 0.3);
  box-shadow:
    0 12px 28px rgba(33, 70, 102, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.45;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: rgba(146, 99, 55, 0.46);
  box-shadow:
    0 16px 30px rgba(33, 70, 102, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  outline: none;
}

.matching-board {
  width: min(100%, 640px);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.question-story-panel {
  width: min(100%, 760px);
  margin: 0 auto;
}

.question-story-text {
  margin: 0;
  color: #214e78;
  text-align: justify;
}

.question-story-text + .question-story-text {
  margin-top: 0.85rem;
}

.matching-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.matching-columns[data-columns="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.matching-column {
  min-height: 260px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.75rem;
  padding: 0.9rem 0.75rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.96) 0%, rgba(244, 239, 229, 0.94) 100%);
  border: 1px solid rgba(200, 170, 116, 0.3);
  box-shadow:
    0 12px 28px rgba(33, 70, 102, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.matching-column-title {
  margin: 0;
  color: #173f60;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.matching-column-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.matching-placeholder {
  margin-top: auto;
  margin-bottom: auto;
  color: #7f9ab1;
  text-align: center;
  font-size: 0.92rem;
}

.matching-pool {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px dashed rgba(123, 162, 194, 0.35);
}

.matching-pool-title {
  margin: 0 0 0.75rem;
  color: #173f60;
  font-weight: 700;
}

.matching-pool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.swot-board-wrap {
  width: min(100%, 760px);
}

.swot-board {
  position: relative;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 2.75rem 0 0 3.4rem;
}

.swot-top-label,
.swot-side-label {
  position: absolute;
  color: #173f60;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.swot-positive-label {
  top: 0;
  left: calc(3.4rem + 25%);
  transform: translateX(-50%);
}

.swot-negative-label {
  top: 0;
  left: calc(3.4rem + 75%);
  transform: translateX(-50%);
}

.swot-side-label {
  left: 0;
  transform: rotate(-90deg);
  transform-origin: left top;
}

.swot-internal-label {
  top: 46%;
}

.swot-external-label {
  top: 88%;
}

.swot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.swot-cell {
  min-height: 170px;
  padding: 0.85rem;
  border-radius: 20px;
  border: 1px solid rgba(200, 170, 116, 0.24);
  box-shadow:
    0 12px 28px rgba(33, 70, 102, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.swot-cell[data-tone="positive-internal"] {
  background: linear-gradient(180deg, rgba(206, 232, 168, 0.95) 0%, rgba(183, 215, 132, 0.96) 100%);
}

.swot-cell[data-tone="negative-internal"] {
  background: linear-gradient(180deg, rgba(255, 222, 176, 0.95) 0%, rgba(248, 190, 114, 0.96) 100%);
}

.swot-cell[data-tone="positive-external"] {
  background: linear-gradient(180deg, rgba(176, 215, 246, 0.95) 0%, rgba(120, 180, 228, 0.96) 100%);
}

.swot-cell[data-tone="negative-external"] {
  background: linear-gradient(180deg, rgba(251, 188, 188, 0.95) 0%, rgba(233, 132, 132, 0.96) 100%);
}

.swot-cell-body {
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.swot-chip {
  width: 100%;
  min-width: 0;
}

.swot-pool {
  margin-top: 1rem;
}

.matching-chip {
  border: 1px solid rgba(200, 170, 116, 0.28);
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  background: linear-gradient(180deg, #fff7e8 0%, #f4e4bf 100%);
  color: #173f60;
  font: inherit;
  font-size: 0.96rem;
  line-height: 1.3;
  cursor: grab;
  box-shadow: 0 8px 18px rgba(33, 70, 102, 0.1);
}

.matching-chip.in-column {
  width: 100%;
}

.matching-chip:active {
  cursor: grabbing;
}

.matching-chip.is-selected {
  border-color: rgba(31, 79, 123, 0.72);
  box-shadow:
    0 0 0 4px rgba(129, 181, 223, 0.24),
    0 10px 24px rgba(33, 70, 102, 0.16);
  transform: translateY(-1px);
}

.matching-submit-row {
  display: flex;
  justify-content: center;
  padding-top: 0.25rem;
}

.matching-mobile-board,
.ordering-mobile-board {
  width: min(100%, 760px);
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.matching-mobile-help {
  margin: 0;
  color: #214e78;
  font-size: 0.98rem;
  line-height: 1.45;
}

.matching-mobile-list,
.ordering-mobile-list {
  display: grid;
  gap: 0.8rem;
}

.matching-mobile-row,
.ordering-mobile-row {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.96) 0%, rgba(244, 239, 229, 0.94) 100%);
  border: 1px solid rgba(200, 170, 116, 0.3);
  box-shadow:
    0 12px 28px rgba(33, 70, 102, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.matching-mobile-label {
  margin: 0;
  color: #173f60;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
}

.matching-mobile-role-list {
  gap: 1rem;
}

.matching-mobile-role-card {
  gap: 0.7rem;
}

.matching-mobile-role-title {
  font-size: 1rem;
  color: #244b73;
}

.matching-mobile-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.matching-mobile-choice,
.matching-mobile-clear {
  width: 100%;
  border-radius: 16px;
  padding: 0.72rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.25;
}

.matching-mobile-choice {
  background: rgba(255, 255, 255, 0.86);
  color: #173f60;
  border: 1px solid rgba(123, 162, 194, 0.3);
  box-shadow: none;
}

.matching-mobile-choice.is-selected {
  background: linear-gradient(180deg, #f2ddb0 0%, #d0aa67 100%);
  color: #4a2915;
  border: 2px solid rgba(86, 47, 20, 0.7);
}

.matching-mobile-clear {
  background: rgba(49, 89, 137, 0.08);
  color: #315989;
  border: 1px dashed rgba(49, 89, 137, 0.32);
  box-shadow: none;
}

.matching-mobile-select,
.ordering-mobile-select {
  width: 100%;
  padding: 0.78rem 0.92rem;
  border: 1px solid rgba(123, 162, 194, 0.3);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.86);
  color: #173f60;
  font: inherit;
  font-size: 0.98rem;
  line-height: 1.35;
}

.matching-mobile-select:focus,
.ordering-mobile-select:focus {
  outline: 2px solid rgba(31, 79, 123, 0.28);
  outline-offset: 2px;
}

.ordering-mobile-row {
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
}

.ordering-mobile-index {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 14px;
  background: #234775;
  color: #f6fbff;
  font-size: 1rem;
  font-weight: 700;
}

.ordering-mobile-row-a3 .ordering-mobile-index {
  min-height: 48px;
}

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

@media (max-width: 620px) {
  .matching-mobile-choice-grid {
    grid-template-columns: 1fr;
  }
}

.question-actions {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding-top: 0.35rem;
}

.ordering-board {
  width: min(100%, 640px);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.ordering-slots {
  display: grid;
  gap: 0.85rem;
}

.ordering-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.7rem;
  align-items: stretch;
}

.ordering-index {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.96) 0%, rgba(244, 239, 229, 0.94) 100%);
  border: 1px solid rgba(200, 170, 116, 0.3);
  color: #d78856;
  font-size: 1.45rem;
  font-weight: 700;
}

.ordering-slot {
  min-height: 78px;
  display: flex;
  align-items: center;
  padding: 0.7rem 0.8rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px dashed rgba(123, 162, 194, 0.35);
}

.ordering-pool {
  margin-top: 0.15rem;
}

.ordering-chip {
  width: auto;
}

.ordering-board-timeline {
  width: min(100%, 980px);
}

.timeline-slots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.timeline-slots::before {
  content: "";
  position: absolute;
  top: 1.15rem;
  left: 7%;
  right: 7%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(176, 215, 246, 0.9) 0%, rgba(123, 162, 194, 0.9) 100%);
  z-index: 0;
}

.timeline-step {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.7rem;
  justify-items: center;
}

.timeline-marker {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #1f4f7b 0%, #173f60 100%);
  color: #fff7e8;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(33, 70, 102, 0.18);
}

.timeline-slot {
  width: 100%;
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px dashed rgba(123, 162, 194, 0.35);
}

.timeline-chip {
  width: 100%;
  text-align: center;
}

.timeline-pool {
  margin-top: 0.35rem;
}

.a3-board {
  width: min(100%, 760px);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.a3-grid-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  grid-auto-flow: column;
  gap: 0.85rem;
}

.a3-grid-cell {
  display: grid;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(35, 71, 117, 0.35);
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.96) 0%, rgba(244, 239, 229, 0.94) 100%);
  box-shadow:
    0 12px 24px rgba(33, 70, 102, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.a3-grid-index {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.5rem 0.6rem;
  background: #234775;
  color: #f6fbff;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
}

.a3-grid-slot {
  min-height: 58px;
  border-radius: 0;
  border: 0;
  background: transparent;
  justify-content: flex-start;
}

.a3-grid-slot-title {
  border-bottom: 1px solid rgba(200, 170, 116, 0.22);
}

.a3-chip {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.a3-grid-body {
  min-height: 120px;
  background: rgba(255, 255, 255, 0.14);
}

.a3-pool .matching-pool-list {
  justify-content: center;
}

.world-result-card {
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.96) 0%, rgba(244, 239, 229, 0.94) 100%);
  border-color: rgba(200, 170, 116, 0.3);
  box-shadow:
    0 16px 40px rgba(33, 70, 102, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.world-result-image {
  width: min(100%, 220px);
  max-height: 180px;
  display: block;
  margin: 0 auto 1rem;
  object-fit: contain;
}

.world-result-card .eyebrow,
.world-result-card .result-title,
.world-result-card p {
  color: #1f4f7b;
}

.world-result-actions {
  justify-content: center;
}

.world-result-actions .secondary-button {
  background: linear-gradient(180deg, #e6c88f 0%, #b17a47 100%);
  color: #fff5dc;
  border: 2px solid rgba(86, 47, 20, 0.82);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 248, 229, 0.55);
}

.certificate-stage {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  gap: 1.2rem;
}

.certificate-card {
  padding: clamp(1.6rem, 3vw, 2.4rem);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(251, 249, 243, 0.98) 0%, rgba(244, 239, 229, 0.96) 100%);
  border: 1px solid rgba(200, 170, 116, 0.34);
  box-shadow:
    0 20px 40px rgba(33, 70, 102, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  color: #1f4f7b;
}

.certificate-card .eyebrow {
  color: #916337;
  text-align: center;
}

.certificate-title {
  margin: 0;
  color: #1f4f7b;
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
}

.certificate-subtitle {
  margin: 0.45rem 0 1.4rem;
  color: #315989;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.certificate-logo {
  width: min(100%, 240px);
  height: auto;
  display: block;
  margin: 0.65rem auto 1.35rem;
  object-fit: contain;
}

.certificate-recipient-block {
  margin: 0 0 1.35rem;
  display: grid;
  gap: 0.85rem;
}

.certificate-recipient-inputs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.certificate-input {
  width: min(100%, 240px);
  padding: 0.85rem 1rem;
  border: 1px solid rgba(123, 162, 194, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: #1f4f7b;
  font: inherit;
  outline: none;
}

.certificate-input:focus {
  border-color: rgba(31, 79, 123, 0.42);
  box-shadow: 0 0 0 4px rgba(129, 181, 223, 0.18);
}

.certificate-recipient-value {
  position: relative;
  margin: -0.15rem auto 0.35rem;
  min-height: 1.9rem;
  width: min(100%, 420px);
  color: #315989;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 700;
  white-space: nowrap;
}

.certificate-recipient-value.is-empty::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      rgba(145, 99, 55, 0.12) 0%,
      rgba(145, 99, 55, 0.62) 18%,
      rgba(197, 156, 89, 0.96) 50%,
      rgba(145, 99, 55, 0.62) 82%,
      rgba(145, 99, 55, 0.12) 100%
    );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(145, 99, 55, 0.08);
}

.certificate-body {
  display: grid;
  gap: 0.95rem;
  color: #214e78;
}

.certificate-body p {
  margin: 0;
  text-align: center;
  line-height: 1.7;
}

.certificate-print-row {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.certificate-actions {
  justify-content: center;
}

.chest-stage {
  width: min(100%, 860px);
  margin: 0 auto;
  display: grid;
  gap: 1.2rem;
}

.chest-panel {
  width: 100%;
  margin: 0;
}

.chest-panel .eyebrow,
.chest-panel h2,
.chest-panel p {
  color: #1f4f7b;
}

.chest-panel h2 {
  color: #ffffff;
  text-align: center;
}

.chest-visual {
  display: flex;
  justify-content: center;
  margin-bottom: 0.9rem;
}

.chest-image-stack {
  position: relative;
  width: min(100%, 360px);
}

.chest-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.chest-image-closed,
.chest-image-open {
  transition: opacity 520ms ease;
}

.chest-image-open {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.chest-image-stack.is-open .chest-image-open {
  opacity: 1;
}

.chest-image-stack.is-open .chest-image-closed {
  opacity: 0;
}

.chest-code-form {
  display: grid;
  gap: 1rem;
}

.chest-digit-row {
  justify-content: center;
}

.chest-digit-input {
  background: rgba(41, 104, 156, 0.09);
  color: #ffffff;
  border: 1px solid rgba(123, 162, 194, 0.22);
  outline: none;
  font: inherit;
  cursor: text;
}

.chest-digit-input:focus {
  border-color: rgba(31, 79, 123, 0.42);
  box-shadow: 0 0 0 4px rgba(129, 181, 223, 0.18);
}

.chest-actions {
  justify-content: center;
}

.chest-return-row {
  justify-content: flex-start;
}

.chest-panel .result-card.success {
  background: linear-gradient(180deg, rgba(11, 34, 53, 0.96) 0%, rgba(8, 24, 38, 0.96) 100%);
  border-color: rgba(124, 186, 139, 0.45);
}

.chest-panel .result-card.success .result-title,
.chest-panel .result-card.success p {
  color: #ffffff;
}

.digit-pill {
  min-width: 56px;
  padding: 0.7rem 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.digit-entry-row {
  align-items: center;
}

.digit-input {
  width: 56px;
  min-width: 56px;
  padding: 0.7rem 0;
}

.digit-pill.empty {
  color: rgba(239, 249, 255, 0.28);
}

.result-card.success {
  border-color: rgba(142, 229, 155, 0.45);
}

.result-card.fail {
  border-color: rgba(255, 138, 128, 0.45);
}

.result-title {
  margin-bottom: 0.5rem;
}

.code-input {
  width: min(100%, 260px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font: inherit;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.code-input:focus {
  outline: 2px solid rgba(122, 224, 214, 0.45);
  outline-offset: 2px;
}

.small-note {
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  .story-overlay {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .intro-grid,
  .world-layout {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100% - 1rem, 1100px);
    padding-top: 1.25rem;
  }

  .intro-cover {
    min-height: 68vh;
  }

  body[data-view="intro"] .intro-cover {
    min-height: 100vh;
  }

  .intro-cover-actions {
    width: 100%;
    flex-direction: column;
    align-items: center;
  }

  .intro-access-layout {
    align-items: center;
    flex-wrap: wrap;
  }

  .intro-access-block,
  .intro-password-panel {
    width: min(100%, 360px);
  }

  .intro-legal-links {
    font-size: 0.92rem;
  }

  .intro-legal-footer {
    min-height: 5.2rem;
    padding-inline: 0.8rem;
  }

  .intro-legal-copy {
    font-size: 0.82rem;
  }

  .legal-modal {
    max-height: calc(100vh - 2rem);
  }

  .intro-notice-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .intro-book-image {
    width: min(180px, 58vw);
  }

  .story-split {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
    min-height: auto;
    align-items: stretch;
    justify-items: center;
    padding-top: 1rem;
  }

  .story-column {
    order: 1;
    width: 100%;
    max-width: 560px;
    min-width: 0;
    margin: 0 auto;
    grid-template-rows: auto auto;
    gap: 0.8rem;
  }

  .story-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.95rem 1rem 1rem;
    border-radius: 16px;
    min-height: auto;
  }

  .story-panel-text {
    font-size: 1rem;
    line-height: 1.55;
    text-align: justify;
  }

  .story-image-pane {
    order: 2;
    min-height: auto;
    width: 100%;
    max-width: 560px;
    min-width: 0;
    margin: 0 auto;
    padding: 0.75rem;
    border-radius: 20px;
  }

  .story-side-image {
    width: 100%;
    height: auto;
    max-height: 44vh;
    object-fit: contain;
  }

  .map-photo-placeholder,
  .map-photo-image {
    min-height: 190px;
  }

  .map-photo-image {
    max-height: 34vh;
  }

  .question-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .question-top-layout.has-help {
    grid-template-columns: 1fr;
  }

  .question-help-card {
    width: min(100%, 280px);
    margin: 0 auto;
  }

  .question-actions {
    flex-direction: column;
    align-items: center;
  }

  .ordering-board,
  .ordering-board-timeline,
  .a3-board {
    display: flex;
    flex-direction: column;
  }

  .ordering-pool,
  .timeline-pool,
  .a3-pool {
    order: -1;
    margin-top: 0;
    margin-bottom: 0.9rem;
    position: sticky;
    top: 0.5rem;
    z-index: 6;
    background: rgba(235, 244, 252, 0.96);
    box-shadow:
      0 12px 24px rgba(33, 70, 102, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.55);
  }

  .ordering-pool .matching-pool-list,
  .timeline-pool .matching-pool-list,
  .a3-pool .matching-pool-list {
    justify-content: center;
  }

  .ordering-pool .matching-chip,
  .timeline-pool .matching-chip,
  .a3-pool .matching-chip {
    width: 100%;
    text-align: center;
  }

  .timeline-slots {
    grid-template-columns: 1fr 1fr;
  }

  .timeline-slots::before {
    left: 14%;
    right: 14%;
  }

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

  .swot-board {
    padding: 2.2rem 0 0;
  }

  .swot-top-label,
  .swot-side-label {
    position: static;
    transform: none;
    display: inline-block;
    width: 100%;
    text-align: center;
    margin-bottom: 0.35rem;
  }

  .swot-grid {
    margin-top: 0.45rem;
    grid-template-columns: 1fr;
  }

  .a3-grid-board {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }

  .story-controls {
    justify-content: center;
    width: 100%;
    max-width: 560px;
    padding-bottom: 0.5rem;
  }

  .story-controls .primary-button,
  .story-controls .secondary-button {
    min-width: 0;
    flex: 1 1 220px;
  }

  .story-character-wrap {
    margin-top: -0.5rem;
  }

  .story-character {
    width: min(54vw, 180px);
  }

  .story-speech-bubble::after {
    right: 50%;
    transform: translateX(50%);
  }

  .story-scene {
    min-height: 260px;
  }
}

@media (max-width: 620px) {
  .story-overlay {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .story-column {
    width: 100%;
  }

  .story-image-pane {
    width: min(100%, 100%);
    padding: 0.55rem;
  }

  .story-side-image {
    max-height: 36vh;
  }

  .map-photo-placeholder,
  .map-photo-image {
    min-height: 150px;
  }

  .map-photo-image {
    max-height: 28vh;
  }

  .timeline-slots {
    grid-template-columns: 1fr;
  }

  .timeline-slots::before {
    left: 18px;
    right: auto;
    top: 1.15rem;
    bottom: 1.15rem;
    width: 4px;
    height: auto;
  }

  .timeline-step {
    grid-template-columns: 38px 1fr;
    align-items: start;
    justify-items: stretch;
  }

  .story-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .story-controls .primary-button,
  .story-controls .secondary-button {
    width: 100%;
    flex: 1 1 auto;
  }

  .timeline-marker {
    margin-top: 0.1rem;
  }

  .timeline-slot {
    min-height: 92px;
  }

  .ordering-pool,
  .timeline-pool,
  .a3-pool {
    top: 0.35rem;
    padding: 0.85rem;
    border-radius: 18px;
  }

  .ordering-pool .matching-pool-list,
  .timeline-pool .matching-pool-list,
  .a3-pool .matching-pool-list {
    gap: 0.55rem;
  }

  .ordering-pool .matching-chip,
  .timeline-pool .matching-chip,
  .a3-pool .matching-chip {
    padding: 0.62rem 0.72rem;
    font-size: 0.92rem;
    line-height: 1.25;
  }
}

@page {
  size: A4 landscape;
  margin: 10mm;
}

@media print {
  html,
  body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body * {
    visibility: hidden;
  }

  .certificate-stage,
  .certificate-stage *,
  .certificate-card,
  .certificate-card * {
    visibility: visible;
  }

  .certificate-stage {
    width: 100%;
    max-width: none;
    margin: 0;
    gap: 0;
  }

  .certificate-card {
    width: 100%;
    max-width: none;
    min-height: calc(100vh - 20mm);
    margin: 0;
    padding: 12mm 16mm;
    border-radius: 18px;
    border: 1.5px solid rgba(200, 170, 116, 0.62);
    box-shadow: none;
    background:
      radial-gradient(circle at top, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 38%),
      linear-gradient(180deg, rgba(251, 249, 243, 1) 0%, rgba(244, 239, 229, 1) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
  }

  .certificate-card::before {
    content: "";
    position: absolute;
    inset: 6mm;
    border: 1px solid rgba(145, 99, 55, 0.16);
    border-radius: 12px;
    pointer-events: none;
  }

  .certificate-card .eyebrow {
    font-size: 11pt;
    letter-spacing: 0.16em;
    margin-bottom: 3mm;
  }

  .certificate-title {
    font-size: 28pt;
    line-height: 1.08;
    margin-bottom: 2mm;
  }

  .certificate-logo {
    width: 48mm;
    margin: 3mm auto 7mm;
  }

  .certificate-recipient-block {
    gap: 3mm;
    margin: 0 0 6mm;
  }

  .certificate-recipient-value {
    width: min(100%, 120mm);
    min-height: 9mm;
    font-size: 18pt;
    margin: 0 auto 1mm;
  }

  .certificate-body {
    gap: 4mm;
    max-width: 230mm;
    margin: 0 auto;
  }

  .certificate-body p {
    font-size: 13pt;
    line-height: 1.55;
  }

  .certificate-print-row,
  .certificate-actions,
  .certificate-recipient-inputs {
    display: none !important;
  }
}
