:root {
  --ink: #352a24;
  --muted: #76634f;
  --paper: #fff9e9;
  --border: #d9bf8b;
  --accent: #a7461c;
  --gold: #f7b749;
  --hp: #cf504b;
  --mp: #3a87ad;
  --exp: #e6ae36;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --radius: 12px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #eee7d8;
  color: var(--ink);
  font:
    14px/1.5 'Malgun Gothic',
    system-ui,
    sans-serif;
  word-break: keep-all;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--paper);
  border-radius: 8px;
  min-height: 44px;
  padding: var(--s2) var(--s4);
  transition:
    filter 0.15s,
    transform 0.15s;
}
button:hover {
  filter: brightness(0.95);
}
button:active {
  transform: translateY(1px);
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
.shell {
  max-width: 1440px;
  margin: auto;
  padding: 0 var(--s8);
}
.header {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}
.brand {
  display: flex;
  gap: var(--s3);
  align-items: center;
  color: var(--accent);
  text-decoration: none;
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 1px;
}
.brand svg {
  width: 40px;
  height: 40px;
}
.brand b {
  font-weight: 400;
  color: var(--ink);
}
.brand small {
  font:
    11px 'Malgun Gothic',
    sans-serif;
  display: block;
  letter-spacing: 3px;
  color: var(--muted);
  margin-top: var(--s1);
}
.header-actions {
  display: flex;
  gap: var(--s2);
  align-items: center;
}
.header-actions button {
  font-size: 12px;
  background: transparent;
}
.offline {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-right: var(--s4);
}
kbd {
  font: 11px/1.4 monospace;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px;
  background: var(--paper);
  box-shadow: 0 2px 0 #d9bf8b55;
  white-space: nowrap;
}
.stage {
  position: relative;
  aspect-ratio: 16/9;
  border: 1px solid #adab83;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: #c2dfd9;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}
.paper {
  background: #fff9e9f2;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 4px 20px #54392918,
    inset 0 1px #fff;
}
.location {
  position: absolute;
  left: var(--s6);
  top: var(--s6);
  width: 224px;
  padding: var(--s4);
  pointer-events: none;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  font-weight: 700;
  display: block;
}
.location strong {
  font-size: 20px;
  display: block;
  margin: var(--s1) 0;
}
.location-sub {
  font-size: 11px;
  color: var(--muted);
}
.location-sub i,
.leaf-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #76934b;
  border-radius: 50%;
  margin-right: 6px;
}
.minimap {
  height: 36px;
  position: relative;
  border-bottom: 3px solid #ca9968;
  margin: var(--s2) 0 var(--s4);
}
.minimap:before {
  content: '';
  position: absolute;
  left: 24%;
  right: 20%;
  bottom: 8px;
  border-top: 3px solid #a2b176;
  transform: skewY(-6deg);
}
.minimap span {
  position: absolute;
  bottom: 0;
  width: 6px;
  height: 8px;
  background: var(--accent);
  left: 5%;
}
.minimap b {
  position: absolute;
  top: 38px;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.minimap b:last-child {
  right: 0;
}
.quest {
  position: absolute;
  right: var(--s6);
  top: var(--s6);
  width: 264px;
  padding: var(--s4);
  pointer-events: none;
}
.quest h2 {
  font-size: 16px;
  margin: var(--s2) 0;
}
.quest p {
  font-size: 12px;
  color: var(--muted);
  margin: var(--s2) 0 var(--s4);
}
.quest-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--s2);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}
.quest-bottom span:first-child {
  font-weight: bold;
  color: var(--accent);
}
.toast {
  position: absolute;
  top: 196px;
  left: 50%;
  transform: translateX(-50%);
  background: #352a24e8;
  color: var(--paper);
  padding: var(--s3) var(--s5);
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  max-width: 90%;
  text-align: center;
  transition: opacity 0.2s;
}
.toast.visible {
  opacity: 1;
}
.interact {
  position: absolute;
  bottom: 21%;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--s2) var(--s4);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 2px 12px #352a2420;
}
.welcome {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #f8e9b724;
  backdrop-filter: blur(2px);
}
.welcome[hidden] {
  display: none;
}
.intro {
  padding: 32px 48px;
  text-align: center;
  width: min(460px, 90%);
  box-shadow: 0 12px 64px #54392930;
}
.intro h1 {
  font-size: 48px;
  line-height: 1.2;
  margin: 16px 0 4px;
  letter-spacing: -3px;
}
.intro h1 span {
  color: var(--accent);
}
.english-title {
  font:
    italic 24px Georgia,
    serif;
  color: var(--accent);
  margin: 0;
}
.intro-copy {
  color: var(--muted);
  line-height: 1.9;
  margin: 24px 0;
}
.primary {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
  font-weight: bold;
}
.intro .primary {
  width: 100%;
  font-size: 16px;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
}
.save-note {
  font-size: 11px;
  color: var(--muted);
  margin: 12px 0 24px;
}
.intro-keys {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
}
.hud {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 20px 24px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 12px 12px;
}
.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}
.avatar {
  background: #f1d39b;
  border: 3px double #b98350;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-weight: bold;
  color: var(--accent);
  font-size: 12px;
}
.identity strong {
  display: block;
  font-size: 14px;
  margin-top: 4px;
}
.identity strong > span {
  color: var(--accent);
  margin-right: 8px;
}
.identity small {
  font-size: 11px;
  color: var(--muted);
}
.stats {
  flex: 1;
  min-width: 0;
}
.stat-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.stats label {
  font-size: 11px;
  font-weight: bold;
  color: var(--muted);
}
.meter {
  height: 20px;
  flex: 1;
  position: relative;
}
.meter progress {
  width: 100%;
  height: 20px;
}
.meter span {
  position: absolute;
  inset: 0;
  text-align: center;
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  text-shadow: 0 1px 2px #352a24;
}
.exp-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
progress {
  appearance: none;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  background: #e7dcc6;
}
progress::-webkit-progress-bar {
  background: #e7dcc6;
}
progress::-webkit-progress-value {
  background: var(--hp);
}
progress::-moz-progress-bar {
  background: var(--hp);
}
.mana progress::-webkit-progress-value {
  background: var(--mp);
}
.mana progress::-moz-progress-bar {
  background: var(--mp);
}
#xp {
  height: 6px;
  flex: 1;
}
#xp::-webkit-progress-value {
  background: var(--exp);
}
#xp::-moz-progress-bar {
  background: var(--exp);
}
#xp-text {
  font-size: 11px;
  color: var(--muted);
}
.hotbar {
  display: flex;
  gap: 8px;
}
.hotbar button {
  position: relative;
  width: 84px;
  padding: 8px;
  padding-top: 20px;
  text-align: center;
  background: #f4ecdc;
  min-height: 64px;
}
.hotbar kbd {
  position: absolute;
  top: -5px;
  left: 8px;
}
.hotbar strong {
  display: block;
  font-size: 12px;
}
.hotbar small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  font-size: 11px;
  color: var(--muted);
}
footer b {
  margin: 0 8px;
}
dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 460px;
  width: calc(100% - 32px);
  max-height: 90dvh;
  box-shadow: 0 20px 80px #352a2433;
}
dialog::backdrop {
  background: #352a2455;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 24px;
  margin: 12px 0 20px;
}
dialog p {
  color: var(--muted);
  line-height: 1.8;
}
.close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: transparent;
  font-size: 24px;
  padding: 0;
  width: 44px;
}
#modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.help-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
}
.touch-controls {
  display: none;
}
@media (max-width: 1000px) {
  .shell {
    padding: 0 16px;
  }
  .offline {
    display: none;
  }
  .hud {
    flex-wrap: wrap;
    gap: 16px;
  }
  .stats {
    min-width: 240px;
  }
  .hotbar {
    width: 100%;
    justify-content: flex-end;
  }
  .hotbar button {
    width: 100px;
  }
  .stage {
    min-height: 540px;
    aspect-ratio: auto;
  }
  .touch-controls {
    display: flex;
    gap: 8px;
    padding-top: 12px;
  }
  .touch-controls button {
    flex: 1;
    touch-action: none;
    user-select: none;
  }
  .intro {
    padding: 24px;
  }
}
@media (max-width: 600px) {
  .shell {
    padding: 0 8px;
  }
  .header {
    height: 80px;
    gap: 8px;
  }
  .brand {
    font-size: 14px;
    letter-spacing: 0;
  }
  .brand svg {
    width: 28px;
  }
  .brand small {
    letter-spacing: 1px;
  }
  .header-actions {
    gap: 4px;
  }
  .header-actions button {
    padding: 8px;
    font-size: 11px;
  }
  .header-actions kbd {
    display: none;
  }
  .stage {
    height: 560px;
    min-height: 0;
  }
  .location {
    left: 8px;
    top: 8px;
    width: 152px;
    padding: 12px;
  }
  .location strong {
    font-size: 14px;
  }
  .location .eyebrow {
    font-size: 9px;
    letter-spacing: 0.5px;
  }
  .location-sub {
    font-size: 9px;
  }
  .minimap {
    display: none;
  }
  .quest {
    right: 8px;
    top: 8px;
    width: 168px;
    padding: 12px;
  }
  .quest .eyebrow {
    font-size: 9px;
    letter-spacing: 0.5px;
  }
  .quest h2 {
    font-size: 14px;
    margin: 4px 0;
  }
  .quest p {
    font-size: 11px;
    margin: 4px 0 8px;
  }
  .quest-bottom {
    font-size: 9px;
    gap: 4px;
  }
  .quest-bottom span:last-child {
    max-width: 105px;
    text-align: right;
  }
  .intro h1 {
    font-size: 32px;
    letter-spacing: -2px;
  }
  .intro .eyebrow {
    font-size: 9px;
  }
  .intro-keys {
    gap: 8px;
  }
  .intro {
    padding: 24px;
    margin-top: 80px;
  }
  .hud {
    padding: 16px;
  }
  .identity {
    min-width: 100%;
  }
  .stats {
    min-width: 100%;
  }
  .hotbar {
    justify-content: stretch;
  }
  .hotbar button {
    flex: 1;
    width: auto;
  }
  .touch-controls {
    gap: 4px;
  }
  .touch-controls button {
    padding: 8px 0;
    font-size: 12px;
  }
  footer {
    flex-wrap: wrap;
    font-size: 11px;
  }
  .toast {
    top: 150px;
    font-size: 12px;
  }
  .interact {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
/* Chapter 02: shared paper controls and equipment states. */
.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.offline {
  font-size: 9px;
  letter-spacing: 1px;
}
.brand {
  flex-shrink: 0;
}
.wide {
  max-width: 720px;
}
.job-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.job-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  background: #f4ecdc;
  white-space: normal;
}
.job-card[aria-pressed='true'] {
  border: 2px solid var(--accent);
  padding: 19px;
  background: var(--paper);
}
.job-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f1d39b;
  color: var(--accent);
}
.job-art svg {
  width: 40px;
  height: 40px;
}
.archer .job-art {
  background: #dce6c5;
  color: #42653c;
}
.mage .job-art {
  background: #d4e9e8;
  color: #356b8c;
}
.job-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.job-details strong {
  font-size: 20px;
}
.job-details > span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.job-details small {
  font-size: 11px;
  color: var(--accent);
}
.job-pick {
  font-size: 12px;
  font-weight: bold;
  color: var(--accent);
}
.equipped-summary {
  padding: 16px 20px;
  background: #f4ecdc;
  border-left: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.equipped-summary strong {
  font-size: 20px;
}
.equipped-summary > span:not(.eyebrow) {
  font-size: 14px;
}
.equipped-summary small {
  font-size: 12px;
  color: var(--muted);
}
.inventory-list {
  max-height: 360px;
  overflow: auto;
  overscroll-behavior: contain;
}
.inventory-hint {
  font-size: 12px;
}
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.item-row > div {
  min-width: 0;
}
.item-row strong {
  display: block;
  font-size: 14px;
}
.item-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}
.item-row button {
  flex-shrink: 0;
  font-size: 12px;
}
.item-row button:disabled {
  opacity: 1;
  background: #eee7d8;
  color: var(--muted);
}
.avatar[data-job='archer'] {
  background: #dce6c5;
  color: #42653c;
  border-color: #76934b;
}
.avatar[data-job='mage'] {
  background: #d4e9e8;
  color: #356b8c;
  border-color: #3a87ad;
}
.hotbar button,
.touch-controls button {
  touch-action: none;
  user-select: none;
}
.toast {
  width: max-content;
  max-width: 88%;
}
.welcome .intro-copy {
  font-size: 14px;
}
.header-actions button {
  min-width: 44px;
}
@media (max-width: 1000px) {
  body {
    padding-bottom: 80px;
  }
  .touch-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    background: var(--paper);
    border-top: 1px solid var(--border);
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 24px #352a2415;
  }
  .touch-controls button {
    min-height: 48px;
  }
  .header {
    height: auto;
    min-height: 88px;
    padding: 12px 0;
  }
  .header-actions {
    max-width: 400px;
  }
  .intro {
    margin-top: 48px;
  }
}
@media (max-width: 600px) {
  .header {
    align-items: center;
    gap: 12px;
  }
  .header-actions {
    max-width: 184px;
    gap: 4px;
  }
  .header-actions button {
    font-size: 11px;
    padding: 8px;
    flex: 1;
  }
  .header-actions #sound {
    min-width: 64px;
  }
  .stage {
    height: clamp(400px, 62dvh, 560px);
  }
  .job-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .job-card,
  .job-card[aria-pressed='true'] {
    flex-direction: row;
    align-items: center;
    padding: 12px;
    gap: 12px;
  }
  .job-art {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
  }
  .job-art svg {
    width: 32px;
    height: 32px;
  }
  .job-details {
    gap: 4px;
  }
  .job-details strong {
    font-size: 16px;
  }
  .job-details > span {
    font-size: 12px;
  }
  .job-details small {
    font-size: 11px;
  }
  .job-pick {
    font-size: 11px;
    flex-shrink: 0;
  }
  .wide {
    padding: 24px;
  }
  .equipped-summary strong {
    font-size: 16px;
  }
  .item-row button {
    padding: 8px;
  }
  .inventory-list {
    max-height: 40dvh;
  }
  .touch-controls {
    padding-left: 8px;
    padding-right: 8px;
    gap: 4px;
  }
  .touch-controls button {
    font-size: 12px;
  }
  .intro {
    padding: 24px 16px;
    margin-top: 48px;
  }
  .intro-copy {
    margin: 16px 0;
  }
  .save-note {
    margin-bottom: 16px;
  }
  .intro h1 {
    font-size: 32px;
  }
  .toast {
    top: 150px;
  }
  .location {
    width: 146px;
  }
  .quest {
    width: 168px;
  }
  .header .brand {
    font-size: 12px;
  }
  .brand svg {
    width: 24px;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  .header {
    min-height: 60px;
    padding: 4px 0;
  }
  .header-actions {
    max-width: none;
  }
  .stage {
    height: calc(100dvh - 136px);
    min-height: 230px;
  }
  .location,
  .quest {
    top: 8px;
    padding: 8px 12px;
  }
  .location {
    left: 8px;
    width: 190px;
  }
  .quest {
    right: 8px;
    width: 230px;
  }
  .minimap,
  .location-sub {
    display: none;
  }
  .quest p {
    margin: 4px 0;
  }
  .quest-bottom {
    padding-top: 4px;
  }
  .location strong {
    font-size: 16px;
  }
  .intro {
    padding: 16px;
    margin: 0;
    width: 420px;
  }
  .intro .eyebrow,
  .intro-copy,
  .save-note,
  .intro-keys {
    display: none;
  }
  .intro h1 {
    font-size: 24px;
    margin: 0;
  }
  .english-title {
    font-size: 16px;
    margin-bottom: 8px;
  }
  .intro .primary {
    padding: 8px 16px;
    min-height: 44px;
  }
  .touch-controls {
    padding: 8px 16px;
  }
  .toast {
    top: 108px;
    padding: 8px 12px;
    font-size: 12px;
  }
  .hud {
    padding: 12px;
  }
  .interact {
    bottom: 19%;
  }
}
.mobile-stats {
  display: none;
}
@media (max-width: 1000px) {
  body {
    padding-bottom: 112px;
  }
  .touch-controls {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
  }
  .mobile-stats {
    grid-column: 1/-1;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    line-height: 20px;
    font-weight: bold;
    color: var(--muted);
  }
  #mobile-hp {
    color: var(--accent);
  }
  #mobile-mp {
    color: #356b8c;
  }
}
@media (max-width: 600px) {
  .touch-controls {
    gap: 4px;
  }
  .header-actions #sound {
    white-space: nowrap;
    min-width: 80px;
  }
  .mobile-stats {
    margin-bottom: 4px;
  }
  .touch-controls button {
    min-width: 0;
    padding: 8px 0;
    font-size: 11px;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  .stage {
    height: calc(100dvh - 164px);
    min-height: 200px;
  }
  .touch-controls {
    padding: 4px 16px 8px;
  }
  .touch-controls button {
    min-height: 44px;
  }
  .mobile-stats {
    line-height: 16px;
  }
}
/* Expedition and equipment showcase */
.expedition-start {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  font-weight: bold;
  background: #f1d39b;
}
.expedition-start span {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.stage-ribbon {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 248px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  pointer-events: none;
}
.stage-ribbon[hidden] {
  display: none;
}
.stage-ribbon strong {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent);
}
.stage-ribbon > span {
  font-size: 11px;
  color: var(--muted);
}
.stage-ribbon progress {
  grid-column: 1/-1;
  width: 100%;
  height: 4px;
}
.stage-ribbon small {
  grid-column: 1/-1;
  font-size: 11px;
  color: var(--muted);
}
.stage-ribbon progress::-webkit-progress-value {
  background: var(--exp);
}
.stage-track {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 24px 0;
}
.stage-track li {
  height: 36px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font: 12px monospace;
}
.stage-track li.boss {
  border-color: var(--accent);
  font-weight: bold;
  background: #f1d39b55;
}
.stage-track li.done {
  background: #dce6c5;
  border-color: #76934b;
  color: #42653c;
}
.stage-track li.current {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.run-rules {
  padding: 16px;
  background: #f4ecdc;
}
.run-rules strong {
  font-size: 14px;
}
.run-rules p {
  font-size: 12px;
  margin-bottom: 0;
}
.reward-kicker {
  font-size: 11px;
  color: var(--accent);
  font-weight: bold;
  letter-spacing: 2px;
}
.reward-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.reward-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  background: #f4ecdc;
  min-width: 0;
}
.reward-card:hover {
  border-color: var(--accent);
  background: var(--paper);
}
.reward-symbol {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: #f1d39b;
}
.reward-symbol svg {
  width: 32px;
  height: 32px;
}
.reward-card strong {
  font-size: 16px;
}
.reward-card > span:not(.reward-symbol) {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
}
.reward-card small {
  font-size: 11px;
  color: var(--accent);
  font-weight: bold;
}
.equipment-showcase {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f4ecdc;
  border-radius: 8px;
  padding: 8px 16px;
}
.equipment-showcase canvas {
  width: 160px;
  height: 200px;
  flex-shrink: 0;
}
.equipment-showcase .equipped-summary {
  padding: 12px 16px;
  background: transparent;
  flex: 1;
}
.stage:has(.stage-ribbon:not([hidden])) .toast {
  top: 180px;
}
@media (max-width: 1000px) {
  .stage-ribbon {
    top: 184px;
  }
  .stage:has(.stage-ribbon:not([hidden])) .toast {
    top: 280px;
  }
  .header-actions {
    max-width: 460px;
  }
}
@media (max-width: 600px) {
  .header-actions {
    max-width: 200px;
  }
  .header-actions #sound {
    min-width: 72px;
    font-size: 10px;
  }
  .stage-ribbon {
    top: 152px;
    padding: 8px 12px;
    width: 248px;
  }
  .stage:has(.stage-ribbon:not([hidden])) .toast {
    top: 240px;
  }
  .stage-track {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin: 16px 0;
  }
  .stage-track li {
    height: 32px;
  }
  .reward-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .reward-card {
    display: grid;
    grid-template-columns: 40px 1fr;
    padding: 12px;
    gap: 4px 12px;
  }
  .reward-symbol {
    grid-row: 1/4;
    width: 40px;
    height: 40px;
  }
  .reward-symbol svg {
    width: 28px;
    height: 28px;
  }
  .reward-card strong {
    font-size: 14px;
  }
  .reward-card > span:not(.reward-symbol) {
    font-size: 12px;
  }
  .reward-card small {
    font-size: 11px;
  }
  .equipment-showcase {
    padding: 4px;
    gap: 0;
  }
  .equipment-showcase canvas {
    width: 112px;
    height: 140px;
  }
  .equipment-showcase .equipped-summary {
    padding: 8px;
    font-size: 12px;
  }
  .equipment-showcase .equipped-summary strong {
    font-size: 14px;
  }
  .equipment-showcase .equipped-summary small {
    font-size: 11px;
  }
  .intro .expedition-start {
    font-size: 12px;
  }
  .intro .expedition-start span {
    font-size: 10px;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  .header-actions {
    max-width: none;
  }
  .stage-ribbon {
    top: 8px;
    width: 220px;
    padding: 8px;
    left: 47%;
  }
  .stage:has(.stage-ribbon:not([hidden])) .toast {
    top: 112px;
  }
  .expedition-start {
    min-height: 36px;
    margin-top: 4px;
  }
  .intro .primary {
    min-height: 36px;
  }
  .equipment-showcase canvas {
    width: 112px;
    height: 140px;
  }
}
/* v4 decisions share the paper/card primitive. */
.decision-intro {
  margin: 0 0 var(--s6);
  color: var(--muted);
  line-height: 1.8;
}
.reward-card:disabled small {
  color: var(--muted);
}
.menu-tabs {
  display: flex;
  gap: var(--s2);
  margin-bottom: var(--s4);
}
.menu-tabs [aria-pressed='true'] {
  background: var(--accent);
  color: var(--paper);
}
.record-row {
  overflow-wrap: anywhere;
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--border);
}
.record-row p {
  font-size: 12px;
  margin: var(--s2) 0 0;
}
.settings-list {
  display: grid;
  gap: var(--s3);
}
.setting-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 48px;
}
.setting-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
select {
  font: inherit;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--s2);
  min-height: 44px;
  max-width: 100%;
}
.save-transfer {
  border-top: 1px solid var(--border);
  margin-top: var(--s6);
  padding-top: var(--s6);
}
.save-transfer p {
  font-size: 12px;
}
.file-label {
  display: block;
  margin-top: var(--s4);
}
.file-label input {
  display: block;
  width: 100%;
  margin-top: var(--s2);
  font: inherit;
}
.bag-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) 0;
  font-size: 12px;
}
.item-actions {
  display: flex;
  gap: var(--s1);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.item-row > div:first-child {
  flex: 1;
}
.item-row .item-actions {
  flex: 0 0 auto;
  max-width: 220px;
}
.stage-track {
  gap: var(--s1);
  margin: var(--s4) 0;
}
.stage-track li {
  height: 28px;
}
.stage-ribbon {
  width: 280px;
}
.stage-ribbon small {
  line-height: 1.6;
}
.stage-ribbon > span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-motion='reduced'] * {
  transition: none !important;
}
.touch-controls [data-action='dodge'] {
  background: #d4e9e8;
  border-color: var(--mp);
}
@media (max-width: 1000px) {
  .touch-controls {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  .mobile-stats {
    gap: var(--s2);
  }
  .stage-ribbon {
    top: 156px;
  }
  .stage:has(.stage-ribbon:not([hidden])) .toast {
    top: 244px;
  }
}
@media (max-width: 600px) {
  body {
    padding-bottom: 160px;
  }
  .touch-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .mobile-stats {
    font-size: 9px;
    gap: var(--s1);
  }
  .touch-controls button {
    min-height: 44px;
    font-size: 12px;
  }
  .stage-track {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
  .stage-track li {
    font-size: 9px;
    height: 24px;
  }
  .item-row {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--s2);
  }
  .item-row .item-actions {
    max-width: none;
    width: 100%;
    justify-content: flex-start;
  }
  .item-actions button {
    flex: 1;
  }
  .stage-ribbon {
    top: 136px;
    width: calc(100% - 16px);
  }
  .location {
    width: calc(44% - 12px);
    padding: 8px;
  }
  .quest {
    width: calc(56% - 12px);
    padding: 8px;
  }
  .location strong {
    font-size: 12px;
  }
  .quest h2 {
    font-size: 12px;
  }
  .quest p {
    font-size: 11px;
  }
  .stage:has(.stage-ribbon:not([hidden])) .toast {
    top: 224px;
  }
  .header-actions {
    max-width: 200px;
  }
  .wide {
    padding: 24px 16px;
  }
  .reward-card {
    grid-template-columns: 1fr;
  }
  .reward-card > span,
  .reward-card > small {
    grid-column: 1;
  }
  .intro {
    margin-top: 88px;
  }
  .intro-copy {
    font-size: 12px !important;
  }
  .intro-keys {
    display: none;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  body {
    padding-bottom: 88px;
  }
  .touch-controls {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  .stage {
    height: calc(100dvh - 150px);
  }
  .stage-ribbon {
    top: 8px;
    left: 50%;
    width: 28%;
    padding: 8px;
  }
  .stage-ribbon > span {
    display: none;
  }
  .location {
    width: 27%;
  }
  .quest {
    width: 27%;
  }
  .quest p,
  .quest-bottom,
  .location-sub {
    display: none;
  }
  .stage:has(.stage-ribbon:not([hidden])) .toast {
    top: 92px;
  }
  .intro {
    margin: 0;
  }
  .mobile-stats {
    font-size: 11px;
  }
}
