@font-face {
  font-family: "Qingke";
  src: url("/fonts/zcool-qingke-huangyou.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: dark;
  --ink: #f4f0dc;
  --ink-dim: #bdd1c3;
  --night: #081d20;
  --deep: #0d2a2d;
  --pine: #173f3a;
  --moss: #5f8656;
  --grass: #92b96d;
  --water: #23626e;
  --water-light: #4d98a0;
  --wood: #9a6338;
  --wood-dark: #5f3d2b;
  --stone: #81908a;
  --stone-dark: #44544f;
  --paper: #e9d8a7;
  --paper-ink: #3b3426;
  --amber: #f7c95b;
  --amber-deep: #c98430;
  --copper: #c97849;
  --danger: #d36e55;
  --success: #a4d27a;
  --focus: #ffe087;
  --shadow: rgba(2, 10, 10, 0.44);
  --safe-top: max(12px, env(safe-area-inset-top));
  --safe-right: max(14px, env(safe-area-inset-right));
  --safe-bottom: max(12px, env(safe-area-inset-bottom));
  --safe-left: max(14px, env(safe-area-inset-left));
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 4px;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(.65);
  opacity: .5;
}

::selection {
  background: var(--amber);
  color: var(--night);
}

#world-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #204f58 0%, #2f7774 45%, #b5c58a 100%);
}

#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  min-height: 100dvh;
}

.screen {
  position: relative;
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.screen::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(5, 22, 23, .24), transparent 44%, rgba(5, 22, 23, .18));
  content: "";
  pointer-events: none;
}

.display {
  margin: 0;
  font-family: "Qingke", "PingFang SC", sans-serif;
  font-weight: 400;
  letter-spacing: .015em;
}

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

.topbar {
  display: flex;
  z-index: 5;
  align-items: center;
  min-height: 60px;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  flex: none;
  filter: drop-shadow(0 8px 10px rgba(2, 10, 10, .35));
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
}

.brand-mark::before {
  inset: 7px 5px 5px;
  background: var(--amber);
  clip-path: polygon(50% 0, 100% 25%, 100% 72%, 50% 100%, 0 72%, 0 25%);
}

.brand-mark::after {
  top: 12px;
  left: 14px;
  width: 14px;
  height: 20px;
  background: var(--pine);
  clip-path: polygon(48% 0, 100% 52%, 63% 52%, 63% 100%, 0 43%, 36% 43%);
}

.brand-name {
  font-family: "Qingke", "PingFang SC", sans-serif;
  font-size: clamp(24px, 2.5vw, 36px);
  line-height: .95;
  text-shadow: 0 3px 14px rgba(5, 22, 23, .5);
}

.brand-sub {
  margin-top: 4px;
  color: #d4e0cd;
  font-size: 12px;
  letter-spacing: .08em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.world-button,
.icon-button,
.quiet-button {
  min-height: 48px;
  border: 0;
  cursor: pointer;
}

.icon-button {
  display: inline-grid;
  width: 50px;
  border: 2px solid rgba(232, 221, 179, .38);
  background: rgba(10, 38, 38, .76);
  box-shadow: 0 8px 22px var(--shadow), inset 0 1px rgba(255, 255, 255, .13);
  place-items: center;
}

.icon-button svg,
.tool-art svg,
.route-glyph svg,
.inline-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 2.2;
}

.parent-entry {
  display: flex;
  align-items: center;
  min-height: 50px;
  gap: 9px;
  border: 2px solid rgba(232, 221, 179, .38);
  background: rgba(10, 38, 38, .76);
  box-shadow: 0 8px 22px var(--shadow), inset 0 1px rgba(255, 255, 255, .13);
  padding: 0 16px;
  color: #e7eddb;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.parent-entry .hold-dot {
  width: 9px;
  height: 9px;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(247, 201, 91, .16);
}

.home-main {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 430px);
  align-items: end;
  gap: clamp(22px, 4vw, 58px);
  padding: clamp(20px, 3vh, 34px) clamp(6px, 2vw, 24px) 22px;
}

.world-story {
  display: flex;
  align-self: stretch;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  padding-bottom: 88px;
  pointer-events: none;
}

.world-story-copy {
  width: min(600px, 94%);
  margin-left: clamp(0px, 4vw, 60px);
  text-shadow: 0 3px 18px rgba(5, 21, 22, .7);
}

.world-story h1 {
  max-width: 10ch;
  font-size: clamp(48px, 6.4vw, 76px);
  line-height: .88;
}

.world-story p {
  max-width: 32ch;
  margin: 18px 0 0;
  color: #e3ead5;
  font-size: clamp(15px, 1.5vw, 20px);
  font-weight: 650;
  line-height: 1.65;
}

.world-story .story-emphasis {
  color: var(--focus);
}

.mission-board {
  position: relative;
  align-self: center;
  width: 100%;
  max-height: calc(100dvh - 112px);
  overflow: auto;
  border: 4px solid var(--wood-dark);
  background: linear-gradient(135deg, rgba(239, 220, 166, .98), rgba(217, 192, 128, .98));
  box-shadow: 0 20px 46px rgba(3, 17, 18, .42), inset 0 0 0 4px rgba(255, 248, 215, .3);
  color: var(--paper-ink);
  padding: clamp(22px, 3vh, 34px);
}

.mission-board::before,
.mission-board::after {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #79513a;
  box-shadow: inset 3px 3px rgba(255, 255, 255, .14), inset -3px -3px rgba(0, 0, 0, .26);
  content: "";
}

.mission-board::before {
  top: 10px;
  left: 10px;
}

.mission-board::after {
  right: 10px;
  bottom: 10px;
}

.mission-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  color: #574933;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .08em;
}

.mission-board h2 {
  margin: 0 0 9px;
  font-size: clamp(31px, 3.8vw, 48px);
  line-height: 1;
}

.mission-intro {
  margin: 0 0 18px;
  color: #5a4b35;
  font-size: 14px;
  line-height: 1.5;
}

.route-list {
  position: relative;
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-list::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 19px;
  width: 2px;
  background: rgba(79, 66, 43, .25);
  content: "";
}

.route-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  min-height: 48px;
  gap: 10px;
}

.route-glyph {
  display: grid;
  z-index: 1;
  width: 40px;
  height: 40px;
  background: #f2e7c3;
  box-shadow: inset 0 0 0 2px rgba(77, 60, 35, .16);
  color: #5a6848;
  place-items: center;
}

.route-glyph svg {
  width: 21px;
  height: 21px;
}

.route-label {
  font-size: 14px;
  font-weight: 760;
}

.route-time {
  color: #584a35;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.start-button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 70px;
  margin-top: 20px;
  overflow: hidden;
  border: 3px solid #553e24;
  background: var(--amber);
  box-shadow: inset 0 -7px rgba(151, 91, 30, .35), inset 0 4px rgba(255, 245, 181, .6), 0 8px 0 #6d4729, 0 16px 22px rgba(78, 52, 27, .25);
  color: #3b2d1f;
  cursor: pointer;
  font-family: "Qingke", "PingFang SC", sans-serif;
  font-size: clamp(25px, 2.9vw, 36px);
  place-items: center;
  transition: transform .18s var(--ease-out), filter .18s;
}

.start-button::after {
  position: absolute;
  inset: -30% auto -30% -35%;
  width: 24%;
  background: rgba(255, 255, 255, .25);
  content: "";
  transform: skewX(-18deg);
  animation: button-glint 4.8s ease-in-out infinite;
}

.start-button:active {
  box-shadow: inset 0 -3px rgba(151, 91, 30, .35), inset 0 4px rgba(255, 245, 181, .5), 0 3px 0 #6d4729;
  transform: translateY(5px);
}

@keyframes button-glint {
  0%, 70% { transform: translateX(0) skewX(-18deg); }
  88%, 100% { transform: translateX(620%) skewX(-18deg); }
}

.camp-meter {
  position: absolute;
  bottom: var(--safe-bottom);
  left: var(--safe-left);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(560px, calc(100vw - 480px));
  border: 2px solid rgba(237, 222, 169, .28);
  background: rgba(7, 29, 31, .82);
  box-shadow: 0 12px 28px rgba(0, 10, 11, .32);
  padding: 10px 14px;
}

.camp-meter strong {
  font-size: 13px;
  white-space: nowrap;
}

.block-track {
  display: flex;
  gap: 5px;
}

.build-block {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(24, 44, 35, .65);
  background: rgba(255, 255, 255, .12);
  box-shadow: inset -3px -3px rgba(0, 0, 0, .18), inset 3px 3px rgba(255, 255, 255, .12);
}

.build-block.done {
  background: var(--amber);
}

.camp-caption {
  color: #bfd3c4;
  font-size: 12px;
}

/* Session */
.session-screen {
  background: linear-gradient(180deg, rgba(5, 24, 26, .12), rgba(5, 24, 26, .56));
}

.session-header {
  display: grid;
  z-index: 6;
  grid-template-columns: auto minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  border-bottom: 2px solid rgba(223, 215, 174, .26);
  background: rgba(8, 34, 35, .82);
  box-shadow: 0 12px 28px rgba(2, 12, 12, .2);
  margin: calc(var(--safe-top) * -1) calc(var(--safe-right) * -1) 0 calc(var(--safe-left) * -1);
  padding: var(--safe-top) var(--safe-right) 10px var(--safe-left);
  backdrop-filter: blur(8px);
}

.phase-title {
  min-width: 0;
}

.phase-title strong {
  display: block;
  overflow: hidden;
  font-family: "Qingke", "PingFang SC", sans-serif;
  font-size: clamp(20px, 2vw, 29px);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-title span {
  color: var(--ink-dim);
  font-size: 12px;
}

.phase-track {
  display: flex;
  align-items: center;
  gap: 6px;
}

.phase-track i {
  width: clamp(24px, 3.5vw, 54px);
  height: 8px;
  background: rgba(255, 255, 255, .13);
}

.phase-track i.done {
  background: var(--success);
}

.phase-track i.current {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(247, 201, 91, .14);
}

.timer-display {
  min-width: 84px;
  color: #eaf2e3;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: center;
}

.session-main {
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2.5vh, 28px) 0 96px;
}

.challenge-shell {
  display: flex;
  width: min(100%, 1040px);
  height: 100%;
  max-height: 650px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2vh, 24px);
}

.instruction-sign {
  position: relative;
  max-width: min(760px, 90vw);
  border: 3px solid #4c3828;
  background: linear-gradient(180deg, #aa7546, #825432);
  box-shadow: inset 0 0 0 3px rgba(255, 225, 171, .13), 0 10px 24px rgba(2, 13, 13, .34);
  padding: 13px 26px;
  color: #fff1d3;
  font-size: clamp(18px, 2vw, 25px);
  font-weight: 760;
  line-height: 1.4;
  text-align: center;
  text-shadow: 0 2px rgba(66, 39, 22, .65);
}

.instruction-sign::before,
.instruction-sign::after {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #33261f;
  content: "";
  transform: translateY(-50%);
}

.instruction-sign::before { left: 9px; }
.instruction-sign::after { right: 9px; }

.challenge-stage {
  display: flex;
  width: min(920px, 94vw);
  min-height: 340px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  border: 4px solid #283f39;
  background: linear-gradient(160deg, rgba(39, 79, 70, .97), rgba(20, 52, 50, .98));
  box-shadow: inset 0 0 0 4px rgba(164, 197, 147, .1), 0 24px 46px rgba(2, 11, 12, .34);
  padding: clamp(18px, 3vw, 34px);
}

.choice-row {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: clamp(14px, 3vw, 34px);
}

.choice-or {
  display: grid;
  align-self: center;
  width: 56px;
  height: 56px;
  background: var(--amber);
  box-shadow: inset -5px -5px rgba(123, 72, 27, .26), inset 4px 4px rgba(255, 248, 198, .42);
  color: #3b2b20;
  font-family: "Qingke", "PingFang SC", sans-serif;
  font-size: 28px;
  place-items: center;
  transform: rotate(45deg);
}

.choice-or span {
  transform: rotate(-45deg);
}

.choice-tile {
  position: relative;
  display: grid;
  min-height: 220px;
  overflow: hidden;
  border: 4px solid #28352e;
  background: linear-gradient(145deg, #d8c989, #a8a96e);
  box-shadow: inset -9px -9px rgba(68, 78, 56, .22), inset 7px 7px rgba(255, 255, 222, .28), 0 10px 0 rgba(8, 31, 28, .5);
  color: #273b32;
  cursor: pointer;
  place-items: center;
  transition: transform .18s var(--ease-out), filter .18s;
}

.choice-tile:hover,
.answer-tile:hover {
  filter: brightness(1.08);
}

.choice-tile:active,
.answer-tile:active {
  transform: translateY(4px) scale(.99);
}

.choice-tile[aria-pressed="true"] {
  outline: 5px solid var(--focus);
  outline-offset: 4px;
}

.choice-tile.wrong,
.answer-tile.wrong {
  animation: gentle-nudge .42s var(--ease-out);
  background: #b87d63;
}

.choice-tile.correct,
.answer-tile.correct {
  background: #a9ce75;
  box-shadow: inset -9px -9px rgba(56, 91, 47, .22), inset 7px 7px rgba(255, 255, 222, .3), 0 10px 0 rgba(8, 31, 28, .5), 0 0 0 6px rgba(247, 224, 135, .2);
}

@keyframes gentle-nudge {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-10px); }
  70% { transform: translateX(10px); }
}

.number-value {
  position: absolute;
  right: 15px;
  bottom: 10px;
  font-family: "Qingke", sans-serif;
  font-size: 44px;
  opacity: .84;
}

.block-pile {
  display: flex;
  min-height: 130px;
  align-items: end;
  justify-content: center;
  gap: 6px;
  padding: 12px;
}

.pile-column {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}

.voxel {
  width: 34px;
  height: 31px;
  border: 2px solid #35544b;
  background: #79a867;
  box-shadow: inset -6px -6px rgba(39, 76, 58, .22), inset 5px 5px rgba(219, 235, 175, .25);
}

.choice-tile.hinted .voxel {
  animation: block-count 1s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes block-count {
  0%, 100% { filter: none; transform: translateY(0); }
  45% { filter: brightness(1.55); transform: translateY(-8px); }
}

.feedback-line {
  min-height: 34px;
  color: #e5ead4;
  font-size: clamp(17px, 1.8vw, 23px);
  font-weight: 720;
  text-align: center;
}

.feedback-line[data-tone="try"] { color: #ffe4aa; }
.feedback-line[data-tone="good"] { color: #d8efae; }

.pattern-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 15px);
  width: 100%;
  min-height: 140px;
}

.pattern-block,
.answer-block {
  position: relative;
  display: grid;
  width: clamp(58px, 7.5vw, 90px);
  height: clamp(58px, 7.5vw, 90px);
  border: 3px solid #263b36;
  box-shadow: inset -8px -8px rgba(19, 43, 37, .22), inset 7px 7px rgba(255, 255, 255, .18);
  place-items: center;
}

.pattern-block.missing {
  border: 4px dashed #f4df9e;
  background: rgba(246, 231, 178, .12) !important;
  box-shadow: none;
  color: #f4df9e;
  font-family: "Qingke", sans-serif;
  font-size: 38px;
}

.shape-circle { border-radius: 50%; }
.shape-diamond { transform: rotate(45deg) scale(.78); }
.shape-diamond > span { transform: rotate(-45deg); }
.shape-stripe::after {
  position: absolute;
  inset: 12% 42%;
  background: rgba(255, 255, 255, .55);
  content: "";
}

.token-mark {
  position: absolute;
  z-index: 2;
  display: block;
  background: rgba(25, 42, 35, .82);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25);
  pointer-events: none;
}

.mark-0 .token-mark {
  width: 42%;
  height: 8%;
}

.mark-1 .token-mark {
  width: 18%;
  height: 18%;
  border-radius: 50%;
}

.mark-2 .token-mark {
  width: 40%;
  height: 7%;
  box-shadow: 0 12px 0 rgba(25, 42, 35, .82);
  transform: translateY(-6px);
}

.mark-3 .token-mark {
  width: 40%;
  height: 8%;
}

.mark-3 .token-mark::after {
  position: absolute;
  inset: 0;
  background: inherit;
  content: "";
  transform: rotate(90deg);
}

.answer-row {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 3vw, 30px);
}

.answer-tile {
  display: grid;
  width: clamp(104px, 14vw, 150px);
  min-height: 116px;
  border: 3px solid #273b34;
  background: #c8bb7d;
  box-shadow: inset -7px -7px rgba(66, 71, 50, .22), inset 6px 6px rgba(255, 255, 220, .28), 0 8px 0 rgba(8, 31, 28, .45);
  cursor: pointer;
  place-items: center;
  transition: transform .18s var(--ease-out), filter .18s;
}

.answer-tile .answer-block {
  width: 70px;
  height: 70px;
}

.answer-tile.removed {
  opacity: .18;
  pointer-events: none;
}

.inventory-strip {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  min-height: 82px;
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  pointer-events: none;
}

.inventory-strip::before {
  position: absolute;
  inset: 22px 0 0;
  z-index: -1;
  border-top: 2px solid rgba(222, 214, 175, .2);
  background: linear-gradient(180deg, rgba(7, 30, 31, .68), rgba(7, 25, 27, .96));
  content: "";
}

.tool-preview {
  display: flex;
  grid-column: 2;
  gap: 8px;
}

.mini-tool {
  display: grid;
  width: 60px;
  height: 60px;
  border: 3px solid #2e372e;
  background: #9c9064;
  box-shadow: inset -6px -6px rgba(31, 42, 33, .25), inset 5px 5px rgba(255, 255, 228, .24);
  color: #2b4438;
  place-items: center;
}

.mini-tool svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

.parent-signal {
  align-self: end;
  justify-self: end;
  min-height: 52px;
  border: 2px solid rgba(228, 219, 178, .36);
  background: rgba(9, 36, 36, .9);
  box-shadow: 0 8px 20px rgba(2, 12, 12, .35);
  padding: 0 17px;
  color: #d6e1d4;
  cursor: pointer;
  font-size: 13px;
  font-weight: 720;
  pointer-events: auto;
}

.tool-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: end;
  justify-content: center;
  background: rgba(3, 15, 17, .7);
  backdrop-filter: blur(9px);
  animation: fade-in .24s ease-out;
}

.tool-sheet-panel {
  width: min(940px, calc(100vw - 28px));
  border: 4px solid #2f3d36;
  background: linear-gradient(180deg, #d4c58a, #8e8059);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 220, .16), 0 -20px 50px rgba(1, 10, 11, .4);
  color: #26362e;
  padding: clamp(20px, 3vw, 34px);
  transform-origin: bottom;
  animation: tool-rise .36s var(--ease-out);
}

@keyframes tool-rise {
  from { transform: translateY(36px) scale(.97); opacity: .2; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tool-sheet-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.tool-sheet-title h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
}

.tool-sheet-title p {
  max-width: 30ch;
  margin: 0;
  color: #514a36;
  font-size: 14px;
  line-height: 1.5;
}

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

.tool-choice {
  display: grid;
  min-height: 176px;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 14px;
  border: 3px solid #37463c;
  background: #e7d89f;
  box-shadow: inset -7px -7px rgba(73, 71, 48, .16), inset 5px 5px rgba(255, 255, 231, .28), 0 7px 0 #5f563f;
  padding: 18px;
  color: #253c32;
  cursor: pointer;
  text-align: left;
}

.tool-choice:active {
  box-shadow: inset -3px -3px rgba(73, 71, 48, .16), inset 5px 5px rgba(255, 255, 231, .25), 0 3px 0 #5f563f;
  transform: translateY(4px);
}

.tool-art {
  display: grid;
  width: 76px;
  height: 76px;
  background: #38594a;
  box-shadow: inset -7px -7px rgba(5, 27, 21, .22), inset 5px 5px rgba(177, 222, 175, .16);
  color: var(--amber);
  place-items: center;
}

.tool-art svg {
  width: 42px;
  height: 42px;
}

.tool-choice strong {
  display: block;
  font-family: "Qingke", "PingFang SC", sans-serif;
  font-size: clamp(22px, 2.5vw, 31px);
  font-weight: 400;
}

.tool-choice small {
  display: block;
  margin-top: 6px;
  color: #4b4632;
  font-size: 13px;
  line-height: 1.45;
}

.block-flight {
  position: fixed;
  z-index: 50;
  width: 46px;
  height: 46px;
  border: 3px solid #594427;
  background: var(--amber);
  box-shadow: inset -7px -7px rgba(117, 70, 25, .25), inset 6px 6px rgba(255, 247, 182, .38), 0 0 30px rgba(255, 223, 120, .65);
  animation: block-flight 1s var(--ease-out) forwards;
  pointer-events: none;
}

@keyframes block-flight {
  0% { left: 50%; top: 55%; transform: translate(-50%, -50%) scale(.4) rotate(0); }
  45% { left: 50%; top: 28%; transform: translate(-50%, -50%) scale(1.25) rotate(90deg); }
  84% { opacity: 1; box-shadow: inset -7px -7px rgba(117, 70, 25, .25), inset 6px 6px rgba(255, 247, 182, .38), 0 0 46px rgba(255, 230, 133, .9); }
  100% { left: var(--flight-end-x); top: var(--flight-end-y); transform: translate(-50%, -50%) scale(.72) rotate(180deg); opacity: .18; }
}

/* Break, real-world and reflection */
.ritual-stage {
  display: grid;
  width: min(920px, 94vw);
  min-height: 480px;
  grid-template-columns: minmax(250px, .8fr) minmax(320px, 1.2fr);
  align-items: center;
  gap: clamp(22px, 4vw, 54px);
  border: 4px solid #284238;
  background: linear-gradient(140deg, rgba(26, 65, 57, .97), rgba(9, 37, 38, .98));
  box-shadow: inset 0 0 0 4px rgba(186, 212, 165, .08), 0 24px 50px rgba(2, 13, 14, .4);
  padding: clamp(24px, 4vw, 48px);
}

.ritual-visual {
  position: relative;
  display: grid;
  min-height: 260px;
  place-items: center;
}

.campfire {
  position: relative;
  width: 180px;
  height: 210px;
}

.campfire .flame {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 110px;
  height: 150px;
  background: var(--amber);
  box-shadow: 0 0 70px rgba(247, 173, 68, .65);
  clip-path: polygon(50% 0, 73% 29%, 67% 49%, 93% 68%, 74% 100%, 25% 100%, 7% 69%, 34% 46%, 28% 25%);
  transform: translateX(-50%);
  animation: flame-breathe 1.8s ease-in-out infinite;
}

.campfire .flame::after {
  position: absolute;
  inset: 38% 25% 4%;
  background: #fff0a5;
  clip-path: polygon(50% 0, 100% 70%, 74% 100%, 25% 100%, 0 68%);
  content: "";
}

.campfire .log {
  position: absolute;
  bottom: 22px;
  left: 25px;
  width: 130px;
  height: 32px;
  background: var(--wood);
  box-shadow: inset -10px -8px rgba(78, 45, 29, .3), inset 7px 6px rgba(230, 173, 108, .2);
}

.campfire .log.one { transform: rotate(18deg); }
.campfire .log.two { transform: rotate(-18deg); }

@keyframes flame-breathe {
  0%, 100% { transform: translateX(-50%) scale(1); filter: brightness(1); }
  50% { transform: translateX(-50%) scale(.94, 1.05); filter: brightness(1.1); }
}

.ritual-copy h2 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(42px, 6vw, 72px);
  line-height: .94;
}

.ritual-copy p {
  max-width: 36ch;
  margin: 18px 0;
  color: #cfddcb;
  font-size: 17px;
  line-height: 1.65;
}

.countdown {
  color: var(--amber);
  font-family: "Qingke", sans-serif;
  font-size: clamp(48px, 7vw, 86px);
  font-variant-numeric: tabular-nums;
}

.world-button {
  border: 3px solid #4a3827;
  background: var(--amber);
  box-shadow: inset -6px -6px rgba(129, 77, 26, .25), inset 5px 5px rgba(255, 247, 187, .38), 0 7px 0 #6c462b;
  padding: 12px 24px;
  color: #30271f;
  cursor: pointer;
  font-weight: 820;
}

.world-button.secondary {
  border-color: #2a4138;
  background: #9fc277;
  box-shadow: inset -6px -6px rgba(36, 72, 53, .25), inset 5px 5px rgba(231, 246, 190, .23), 0 7px 0 #3c5a43;
}

.real-task-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.real-task {
  min-height: 180px;
  border: 3px solid #4a3827;
  background: #dfcd91;
  box-shadow: inset -7px -7px rgba(76, 60, 38, .17), inset 5px 5px rgba(255, 255, 232, .3), 0 7px 0 #5c4936;
  padding: 18px;
  color: #3d3526;
  cursor: pointer;
  text-align: left;
}

.real-task strong {
  display: block;
  font-family: "Qingke", sans-serif;
  font-size: 28px;
  font-weight: 400;
}

.real-task span {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.real-task.selected {
  outline: 5px solid var(--focus);
  outline-offset: 4px;
}

.reflection-tools {
  display: flex;
  gap: 12px;
  margin: 18px 0 24px;
}

.reflection-tool {
  display: grid;
  width: 92px;
  height: 92px;
  border: 3px solid #33493d;
  background: #bfb174;
  color: #294237;
  place-items: center;
}

.reflection-tool.used {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(247, 201, 91, .16), inset -7px -7px rgba(104, 62, 24, .2);
}

.reflection-tool svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

/* Parent room */
.parent-screen {
  overflow: auto;
  background: #e8dcc0;
  color: #26352f;
}

.parent-screen::after { display: none; }

.parent-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid rgba(54, 64, 55, .2);
  padding: 8px 0 16px;
}

.parent-header h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 52px);
}

.parent-header p {
  margin: 4px 0 0;
  color: #4b5a52;
  font-size: 13px;
}

.parent-header .quiet-button {
  margin-left: auto;
}

.quiet-button {
  border: 2px solid #52615a;
  background: transparent;
  padding: 10px 18px;
  color: #2b3d35;
  cursor: pointer;
  font-weight: 750;
}

.parent-content {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  gap: 26px;
  width: min(1180px, 100%);
  margin: 26px auto 0;
  padding-bottom: 30px;
}

.parent-section {
  border-top: 3px solid #425149;
  padding: 18px 2px 24px;
}

.parent-section h2 {
  margin: 0 0 8px;
  font-size: 27px;
}

.parent-section > p {
  margin: 0 0 16px;
  color: #49584f;
  font-size: 14px;
  line-height: 1.55;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border: 2px solid #405148;
  background: #405148;
}

.summary-value {
  background: #f4ead0;
  padding: 18px;
}

.summary-value span {
  display: block;
  color: #4b5951;
  font-size: 12px;
}

.summary-value strong {
  display: block;
  margin-top: 5px;
  font-family: "Qingke", sans-serif;
  font-size: 38px;
  font-weight: 400;
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  border-bottom: 1px solid rgba(64, 81, 72, .22);
  font-size: 14px;
}

.history-row time {
  color: #4b5851;
  font-variant-numeric: tabular-nums;
}

.history-row strong {
  font-weight: 760;
}

.history-row span:last-child {
  color: #40534a;
  font-size: 12px;
}

.empty-history {
  border: 2px dashed rgba(57, 76, 66, .34);
  padding: 24px;
  color: #4b5a52;
  text-align: center;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 58px;
  border-bottom: 1px solid rgba(64, 81, 72, .22);
}

.setting-row span {
  color: #485850;
  font-size: 13px;
}

.switch-button {
  position: relative;
  width: 62px;
  height: 34px;
  flex: none;
  border: 2px solid #415047;
  background: #99a49d;
  cursor: pointer;
}

.switch-button::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: #f5ebcf;
  box-shadow: 0 2px 5px rgba(18, 30, 24, .25);
  content: "";
  transition: transform .2s var(--ease-out);
}

.switch-button[aria-pressed="true"] {
  background: #6f9b5e;
}

.switch-button[aria-pressed="true"]::after {
  transform: translateX(28px);
}

.danger-button {
  min-height: 48px;
  border: 2px solid #9b594a;
  background: transparent;
  padding: 10px 16px;
  color: #934938;
  cursor: pointer;
  font-weight: 760;
}

.parent-note {
  border: 2px solid #9f884d;
  background: #f3e4b8;
  padding: 18px;
  color: #564a30;
  font-size: 14px;
  line-height: 1.65;
}

/* Pause */
.pause-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  background: rgba(4, 18, 19, .78);
  backdrop-filter: blur(10px);
  place-items: center;
}

.pause-panel {
  width: min(620px, calc(100vw - 30px));
  border: 4px solid #4b3a29;
  background: #e0ce94;
  box-shadow: 0 24px 60px rgba(1, 9, 10, .45), inset 0 0 0 4px rgba(255, 255, 224, .2);
  padding: 30px;
  color: #332d23;
}

.pause-panel h2 {
  margin: 0;
  font-size: 42px;
}

.pause-panel p {
  color: #5b513d;
  line-height: 1.6;
}

.pause-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.pause-actions button {
  min-height: 58px;
}

.toast {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 50%;
  z-index: 80;
  max-width: min(620px, 90vw);
  border: 2px solid rgba(239, 224, 170, .38);
  background: rgba(7, 31, 32, .94);
  box-shadow: 0 14px 32px rgba(0, 9, 10, .42);
  padding: 13px 22px;
  color: #f2eedc;
  font-weight: 720;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-in .32s var(--ease-out);
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.noscript-message {
  width: min(520px, calc(100% - 40px));
  margin: 20vh auto;
  border: 3px solid var(--wood-dark);
  background: var(--paper);
  padding: 30px;
  color: var(--paper-ink);
}

@media (max-width: 900px), (orientation: portrait) {
  body { overflow: auto; }
  #app { position: relative; }
  .screen { min-height: 100svh; }
  .home-main {
    grid-template-columns: 1fr;
    align-items: start;
    overflow: auto;
    padding-bottom: 92px;
  }
  .world-story {
    min-height: 38vh;
    padding-bottom: 0;
  }
  .world-story-copy { margin-left: 0; }
  .world-story h1 { font-size: clamp(48px, 13vw, 78px); }
  .mission-board { max-height: none; }
  .camp-meter {
    right: var(--safe-right);
    max-width: none;
  }
  .choice-row { gap: 8px; }
  .choice-or { width: 42px; height: 42px; font-size: 22px; }
  .choice-tile { min-height: 190px; }
  .tool-grid,
  .real-task-grid { grid-template-columns: 1fr; }
  .tool-choice { min-height: 110px; }
  .ritual-stage,
  .parent-content { grid-template-columns: 1fr; }
  .ritual-stage { overflow: auto; }
  .ritual-visual { min-height: 200px; }
}

@media (max-height: 700px) and (orientation: landscape) {
  .topbar { min-height: 50px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-name { font-size: 26px; }
  .brand-sub { display: none; }
  .home-main { padding-top: 8px; padding-bottom: 10px; }
  .world-story { padding-bottom: 68px; }
  .world-story h1 { font-size: clamp(45px, 7vw, 70px); }
  .world-story p { margin-top: 9px; font-size: 14px; }
  .mission-board { padding: 19px 24px; }
  .mission-board h2 { font-size: 33px; margin-top: 8px; }
  .mission-intro { display: none; }
  .route-item { min-height: 42px; }
  .route-glyph { width: 34px; height: 34px; }
  .route-list::before { left: 16px; }
  .start-button { min-height: 58px; margin-top: 12px; }
  .challenge-stage { min-height: 300px; }
  .choice-tile { min-height: 180px; }
  .instruction-sign { padding: 9px 20px; }
  .session-main { padding-top: 8px; }
  .ritual-stage { min-height: 390px; }
}

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

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}
