:root {
  color-scheme: light;
  --paper: #f7efd9;
  --surface: #fff8e7;
  --ink: #252a2c;
  --muted: #6b6c60;
  --line: #d8cbb0;
  --green: #45695c;
  --green-soft: #e8ead8;
  --ochre: #a57238;
  --amber: #f8e3b3;
  --red: #a14932;
  --yellow: #f2be58;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #b2692c; outline-offset: 4px; }
button, a { touch-action: manipulation; }
svg { display: block; }
h1, h2, p { margin: 0; }
::selection { background: #f4ce80; }
.game { max-width: 460px; margin: auto; min-height: 100svh; background: var(--paper); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.header { display: flex; align-items: center; gap: 10px; padding: 17px 18px 13px; }
h1 { font-size: 24px; font-weight: 850; letter-spacing: -1px; margin-right: auto; line-height: 1.2; }
h1 span { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 10px; }
.icon-button { border: 0; background: transparent; min-width: 44px; height: 44px; display: grid; place-items: center; font-size: 26px; border-radius: 50%; }
.header > .icon-button { margin-right: -10px; }
.icon-button:hover { background: var(--amber); }
.cash-chip { display: flex; align-items: center; gap: 8px; border: 2px solid #b8a987; border-radius: 24px; background: var(--surface); min-height: 42px; padding: 5px 13px 5px 7px; }
.cash-chip > span { display: grid; place-items: center; width: 26px; height: 26px; background: var(--yellow); border: 1.8px solid var(--ink); border-radius: 50%; font-size: 15px; font-weight: 700; box-shadow: inset 2px 0 0 #ffdb8e; }
.cash-chip strong { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.street { position: relative; margin: 0 10px; border: 2.5px solid var(--ink); border-radius: 22px 24px 20px 23px; overflow: hidden; isolation: isolate; box-shadow: 0 4px 0 #b7ad91; background: #b9d3d3; }
.scene-stage { position: relative; aspect-ratio: 390 / 470; }
#scene-art { padding-bottom: 18px; background: #d7c7a7; }
.street[data-time="night"] #scene-art { background: #737e8c; }
.scenery { width: 100%; height: 100%; display: block; }
.scene-location { position: absolute; top: 16px; left: 16px; z-index: 1; font-size: 14px; font-weight: 800; letter-spacing: 1px; color: #34494b; }
.scene-location span { font-size: 10px; font-weight: 600; letter-spacing: 0; display: block; margin-top: 3px; opacity: .75; }
.street[data-time="night"] .scene-location { color: #f4dfb1; }
.speech { position: absolute; z-index: 1; left: 34%; top: 11%; width: 61%; min-height: 52px; padding: 12px 14px; text-align: left; border: 2.5px solid var(--ink); background: #fff7de; border-radius: 17px 19px 17px 4px; color: var(--ink); font-size: 14px; font-weight: 750; line-height: 1.5; box-shadow: 2px 3px 0 #252a2c22; transform: rotate(-2deg); }
.speech::after { content: ''; position: absolute; left: 15px; bottom: -9px; width: 12px; height: 14px; background: #fff7de; border-bottom: 2.5px solid var(--ink); border-right: 2.5px solid var(--ink); transform: skewY(-35deg); }
.speech.warning, .speech.warning::after { background: #ffe9b4; }
.courier { position: absolute; left: 20%; top: 30%; width: 38%; aspect-ratio: 1 / 2; }
.sprite { width: 100%; height: 100%; background-repeat: no-repeat; background-size: 300% 100%; }
.courier-body { background-image: url('assets/courier-states.png'); background-position: 0 0; transform-origin: 50% 94%; animation: breathe 4s ease-in-out infinite; }
.courier[data-mood="tired"] .courier-body { background-position: 50% 0; animation-duration: 5s; }
.courier[data-mood="exhausted"] .courier-body { background-position: 100% 0; animation-duration: 6s; }
.sigh { position: absolute; left: 83%; top: 30%; white-space: nowrap; font-size: 11px; font-weight: 750; color: #fff8e8; text-shadow: 1px 1px 0 #252a2c; animation: sigh 5s ease-in-out infinite; }
.courier[data-mood="exhausted"] .sigh { top: 46%; left: 88%; }
.scooter { position: absolute; left: 54%; top: 53%; width: 46%; aspect-ratio: 1; }
.bike-frame { background-image: url('assets/scooter-states.png'); background-position: 0 0; }
.scooter[data-condition="worn"] .bike-frame { background-position: 50% 0; }
.scooter[data-condition="broken"] .bike-frame { background-position: 100% 0; }
.rental .bike-frame { filter: hue-rotate(52deg) saturate(.8); }
.cargo-upgrade { position: absolute; width: 56%; height: auto; top: -5%; left: 0; }
.rental-tag { position: absolute; top: 48%; left: 21%; transform: rotate(8deg); background: #e4eff1; border: 1px solid var(--ink); padding: 1px 3px; font-size: 9px; font-weight: 800; }
.repair-mark { position: absolute; top: 18%; right: 0; width: 22px; height: 22px; display: grid; place-items: center; background: var(--yellow); border: 2px solid var(--ink); border-radius: 50%; font-weight: 900; transform: rotate(10deg); }
.street[data-time="night"] .courier-body { filter: brightness(.91) saturate(.9); }
.street[data-time="night"] .bike-frame { filter: brightness(.82) saturate(.85); }
.street[data-time="night"] .rental .bike-frame { filter: hue-rotate(52deg) brightness(.82) saturate(.75); }
.scene-target { position: absolute; z-index: 2; border: 0; border-radius: 14px; background: transparent; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 9px; }
.scene-target > span { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; border: 2px solid var(--ink); border-radius: 13px 12px 11px 14px; background: #fff5da; padding: 6px 10px; font-size: 12px; line-height: 1.3; font-weight: 750; box-shadow: 0 3px 0 #252a2c45; white-space: nowrap; transition: transform .15s, background .15s; }
.scene-target > span svg { width: 18px; height: 18px; flex-shrink: 0; }
.scene-target > .target-with-stat { flex-direction: column; gap: 3px; }
.target-title { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.target-stat { font-size: 11px; line-height: 1.3; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.target-stat strong { color: var(--ink); font-weight: 800; }
.target-stat.low, .target-stat.low strong { color: var(--red); }
.scene-target:hover > span, .scene-target:focus-visible > span { background: #ffe4a2; transform: translateY(-2px); }
.scene-target:active > span { transform: translateY(2px); box-shadow: none; }
.scene-target:disabled { opacity: .55; }
.scene-target.suggested > span { background: var(--yellow); }
.parcel-target { left: 0; top: 63%; width: 23%; height: 37%; }
.courier-target { left: 23%; top: 31%; width: 32%; height: 69%; }
.bike-target { left: 55%; top: 52%; width: 45%; height: 48%; }
.scene-reward { position: absolute; left: 27%; top: 41%; pointer-events: none; font-size: 19px; font-weight: 850; color: var(--ink); opacity: 0; background: #ffda7d; border: 2px solid var(--ink); border-radius: 12px; padding: 7px 13px; box-shadow: 2px 3px 0 #252a2c30; white-space: nowrap; z-index: 3; }
.action-spark { opacity: 0; }
.street[data-action] .scene-reward { animation: reward 1.4s ease-out; }
.street[data-action="delivery"] .courier, .street[data-action="delivery"] .scooter { animation: out-and-back 1.2s ease-in-out; }
.street[data-action="rest"] .courier-body { animation: relief .9s ease-in-out; }
.street[data-action="repair"] .scooter { animation: tinker .6s ease-in-out; }
.street[data-action="sorting"] .parcel-stack, .street[data-action="rent"] .scooter { animation: parcel-hop .7s ease-in-out; }
.street[data-action="upgrade"] .action-spark, .street[data-action="repair"] .action-spark, .street[data-action="rest"] .action-spark { animation: sparkle 1.2s ease-in-out; }
@keyframes breathe { 50% { transform: scaleY(.992) rotate(-.35deg); } }
@keyframes sigh { 0%, 65%, 100% { opacity: 0; translate: 0 0; } 20%, 45% { opacity: 1; translate: 3px -5px; } }
@keyframes out-and-back { 0%,100% { translate: 0 0; } 28% { translate: 175px -2px; opacity: 0; } 45% { translate: -180px 0; opacity: 0; } 75% { translate: 0 0; opacity: 1; } }
@keyframes reward { 0% { opacity: 0; translate: 0 12px; } 15%,70% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 -12px; } }
@keyframes relief { 50% { translate: 0 -5px; } }
@keyframes tinker { 20%,60% { translate: -3px 0; } 40%,80% { translate: 3px 0; } }
@keyframes parcel-hop { 40% { translate: 0 -9px; } 70% { translate: 0 2px; } }
@keyframes sparkle { 20%,65% { opacity: 1; } 0%,100% { opacity: 0; } }
.dispatch { padding: 21px 16px 0; }
.section-heading { margin-bottom: 12px; }
h2 { font-size: 17px; font-weight: 800; letter-spacing: .2px; }
.orders { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.order { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 12px 5px 10px; min-height: 158px; background: var(--surface); border: 2px solid var(--ink); border-radius: 15px 17px 14px 16px; box-shadow: 0 4px 0 #b9b098; text-align: center; transition: translate .15s, background .15s; }
.order:not(:disabled):hover { translate: 0 -3px; background: #fff1cd; }
.order:active { translate: 0 3px; box-shadow: none; }
.order.selected { background: #ffe5a6; box-shadow: 0 4px 0 var(--ink); }
.order.selected::before { content: '✓'; position: absolute; right: 6px; top: 4px; color: var(--ink); font-size: 14px; font-weight: 800; }
.order-icon { color: var(--ink); margin-bottom: 6px; }
.order-icon svg { width: 37px; height: 37px; }
.order-title { font-size: 15px; font-weight: 800; white-space: nowrap; }
.order-cost { font-size: 11px; color: var(--muted); margin: 4px 0 7px; }
.order-cost.warning { color: var(--red); }
.order-price { display: block; min-width: 74%; padding-top: 6px; border-top: 1px solid var(--line); font-size: 27px; font-weight: 850; line-height: 1.1; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.order-price small { font-size: 13px; font-weight: 650; margin-right: 2px; }
.order:disabled { opacity: .48; box-shadow: 0 2px 0 #b9b098; }
.order-detail { margin-top: 16px; padding: 15px; background: var(--surface); border: 2px solid var(--ink); border-radius: 12px; animation: reveal .16s ease-out; }
.order-preview { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.order-preview strong { font-weight: 700; color: var(--ink); }
.order-detail .primary-button { margin-top: 12px; }
.order-detail details { font-size: 12px; color: var(--muted); margin-top: 5px; }
.order-detail summary { cursor: pointer; min-height: 44px; align-content: center; }
.order-detail details p { line-height: 1.7; padding-bottom: 4px; }
.order-detail .receipt-note { margin-top: 10px; }
.bill-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: calc(100% - 32px); margin: 22px 16px 0; padding: 10px 0; min-height: 44px; background: none; border: 0; border-top: 1.5px dashed #bfb194; font-size: 11px; color: var(--muted); text-align: left; }
.bill-card strong { font-weight: 750; margin-right: 5px; }
.bill-card.warning { color: var(--red); }
.feedback { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: 14px; padding: 0 3px; min-height: 44px; border: 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 600; animation: reveal .25s ease-out; }
.feedback[hidden] { display: none; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.sheet { width: min(100%,460px); max-width: 460px; max-height: 88dvh; position: fixed; inset: auto 0 0; margin: 0 auto; padding: 0; border: 2px solid var(--ink); border-bottom: 0; border-radius: 23px 23px 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -6px 0 #252a2c22; overscroll-behavior: contain; }
.sheet::backdrop { background: #1a263570; backdrop-filter: blur(3px); }
.sheet-inner { padding: 10px 23px calc(22px + env(safe-area-inset-bottom)); }
.handle { height: 4px; width: 32px; border-radius: 4px; background: #c6b897; margin: 0 auto 10px; }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.sheet-heading h2 { font-size: 22px; line-height: 1.3; font-weight: 800; letter-spacing: -.5px; }
.sheet-heading .icon-button { margin-right: -9px; font-size: 26px; }
.sheet-kicker { font-size: 11px; color: var(--muted); letter-spacing: 1px; margin: 10px 0 9px; }
.sheet-copy { font-size: 13px; color: #62645b; line-height: 1.7; margin-bottom: 17px; }
.sheet-copy:last-child { margin-bottom: 0; }
.big-number { font-size: 46px; letter-spacing: -2px; line-height: 1.25; font-weight: 800; margin: 12px 0 18px; font-variant-numeric: tabular-nums; }
.big-number small { font-size: 22px; font-weight: 500; letter-spacing: 0; margin-right: 6px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-row > span:first-child { color: var(--muted); }
.detail-row > strong { font-size: 13px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.receipt-note { margin: 15px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--green-soft); color: #506047; font-size: 12px; line-height: 1.7; }
.receipt-note.warning { background: var(--amber); color: #80552f; }
.primary-button { border: 2px solid var(--ink); border-radius: 12px; min-height: 49px; width: 100%; padding: 12px 16px; margin-top: 20px; background: var(--yellow); color: var(--ink); box-shadow: 0 3px 0 var(--ink); font-size: 14px; font-weight: 800; }
.primary-button:active { transform: translateY(3px); box-shadow: none; }
.primary-button:disabled { background: #d6cfb8; color: #78776c; border-color: #a49b84; box-shadow: none; }
.secondary-button { width: 100%; border: 1.5px solid var(--ink); border-radius: 11px; background: none; min-height: 46px; font-size: 13px; margin-top: 9px; padding: 10px; }
.secondary-button:hover { background: var(--amber); }
.text-button { width: 100%; border: 0; background: none; min-height: 44px; font-size: 12px; color: var(--muted); margin-top: 5px; }
.service-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.service-row strong { display: block; font-size: 14px; font-weight: 700; }
.service-row p { font-size: 11px; line-height: 1.6; color: var(--muted); margin-top: 5px; }
.service-row button { border: 1.5px solid var(--ink); border-radius: 9px; white-space: nowrap; padding: 9px 12px; min-height: 44px; background: var(--amber); font-size: 12px; font-weight: 700; min-width: 77px; }
.service-row button:disabled { opacity: .45; }
.history-list { list-style: none; padding: 0; margin: 4px 0 0; }
.history-list li { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.6; color: #62645b; }
.ending-stamp { width: 55px; height: 55px; border: 3px solid var(--green); border-radius: 7px; display: grid; place-items: center; color: var(--green); font-size: 29px; font-weight: 800; transform: rotate(-8deg); margin: 20px 0; }
.ending-stamp.failed { border-color: var(--red); color: var(--red); }
.error-message { color: var(--red); font-size: 12px; margin: 12px 0; line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 700px) {
  body { background: #d6d0bf; }
  .game { box-shadow: 0 0 0 1px #252a2c18, 0 15px 70px #252a2c18; }
  .sheet { bottom: 24px; border-radius: 22px; border-bottom: 2px solid var(--ink); }
  .sheet-inner { padding-bottom: 24px; }
}
@media (max-width: 360px) {
  .header { padding: 12px 13px 10px; gap: 6px; }
  h1 { font-size: 21px; } h1 span { font-size: 12px; margin-left: 7px; }
  .cash-chip { padding-right: 10px; gap: 6px; } .cash-chip strong { font-size: 18px; }
  .street { margin: 0 8px; }
  .scene-location { top: 12px; left: 12px; font-size: 12px; }
  .speech { font-size: 12px; padding: 10px 11px; min-height: 46px; }
  .scene-target > span { font-size: 11px; padding: 5px 7px; gap: 3px; min-height: 34px; }
  .scene-target > span svg { width: 15px; height: 15px; }
  .target-title { gap: 3px; }
  .target-stat { font-size: 10px; }
  .dispatch { padding: 18px 12px 0; } .orders { gap: 7px; }
  .order { min-height: 150px; } .order-title { font-size: 13px; } .order-price { font-size: 25px; }
  .sheet-inner { padding-left: 20px; padding-right: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .street[data-action] .scene-reward { opacity: 1; }
}

/* The apprentice's work card: one compact reminder, details on demand. */
.chapter-card { display: block; width: calc(100% - 32px); margin: 0 16px 14px; padding: 11px 13px; border: 1.5px solid #b9ab88; border-left: 5px solid var(--yellow); border-radius: 5px 11px 9px 4px; background: var(--surface); text-align: left; }
.chapter-kicker { display: block; color: var(--muted); font-size: 10px; letter-spacing: .8px; margin-bottom: 4px; }
.chapter-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chapter-title > strong { font-size: 15px; font-weight: 800; }
.chapter-title > b { font-size: 11px; background: #eee3c6; border-radius: 5px; padding: 3px 6px; white-space: nowrap; }
.chapter-next { display: block; color: #74664a; font-size: 11px; line-height: 1.5; margin-top: 5px; }
.chapter-card:hover { border-color: var(--ink); }
.story-card { display: flex; align-items: center; gap: 10px; width: calc(100% - 32px); margin: 18px 16px 0; padding: 12px 10px; border: 2px solid var(--ink); border-radius: 11px 13px 10px 12px; box-shadow: 0 3px 0 #b9b098; background: #ffe5a7; text-align: left; }
.story-card[hidden] { display: none; }
.story-tag { writing-mode: vertical-rl; font-size: 10px; letter-spacing: 2px; color: #80552f; }
.story-card > span:nth-child(2) { flex: 1; }
.story-card strong { display: block; font-size: 13px; line-height: 1.5; }
.story-card small { display: block; font-size: 10px; line-height: 1.5; color: #74664a; margin-top: 3px; }
.story-card > b { font-size: 22px; }
.story-copy { font-size: 14px; line-height: 1.85; color: #4f514b; }
.story-copy p { margin-bottom: 13px; }
.intro-targets { background: var(--amber); border-left: 3px solid var(--ochre); padding: 12px 14px; margin: 15px 0; display: grid; gap: 7px; font-size: 12px; }
.intro-targets strong { margin-bottom: 3px; }
.intro-targets span::before { content: '○'; margin-right: 8px; color: var(--ochre); }
.story-choices { display: grid; gap: 12px; margin-top: 18px; padding-bottom: 4px; }
.story-choice { width: 100%; text-align: left; border: 2px solid var(--ink); border-radius: 11px; padding: 12px 13px; background: var(--surface); box-shadow: 0 3px 0 #b9b098; }
.story-choice:first-child { background: #ffdf93; }
.story-choice strong { display: flex; align-items: center; justify-content: space-between; gap: 9px; font-size: 14px; line-height: 1.5; }
.story-choice small { display: block; font-size: 11px; color: #6b614e; line-height: 1.65; margin-top: 5px; }
.story-choice em { display: block; color: var(--red); font-size: 11px; font-style: normal; margin-top: 5px; }
.story-choice:disabled { opacity: .5; box-shadow: none; }
.story-choice:not(:disabled):active { translate: 0 3px; box-shadow: none; }
.goal-list { padding: 0; margin: 12px 0; list-style: none; }
.goal-list li { display: flex; align-items: flex-start; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.goal-list li > div { flex: 1; min-width: 0; }
.goal-check { color: #9b8765; font-size: 19px; line-height: 1.3; }
.goal-list .ready .goal-check { color: var(--green); font-weight: 800; }
.goal-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.goal-heading strong { font-size: 14px; }
.goal-heading b { color: #80552f; font-size: 12px; font-variant-numeric: tabular-nums; }
.ready .goal-heading b { color: var(--green); }
.goal-list p { color: var(--muted); font-size: 11px; line-height: 1.65; margin-top: 6px; }
.goal-list progress { display: block; width: 100%; height: 5px; margin-top: 9px; border: 0; border-radius: 3px; appearance: none; background: #e5dbc3; overflow: hidden; }
.goal-list progress::-webkit-progress-bar { background: #e5dbc3; }
.goal-list progress::-webkit-progress-value { background: #d49d49; border-radius: 3px; }
.goal-list progress::-moz-progress-bar { background: #d49d49; }
.goal-list .ready progress::-webkit-progress-value { background: var(--green); }
.sheet-section-title { font-size: 12px; margin: 22px 0 10px; color: var(--muted); }
.badge-list { display: grid; gap: 7px; }
.badge-list > div { border: 1px dashed #c5b898; padding: 9px 11px; border-radius: 7px; }
.badge-list strong { display: block; color: var(--muted); font-size: 12px; }
.badge-list small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.badge-list .earned { background: var(--green-soft); border-style: solid; }
.badge-list .earned strong { color: var(--green); }
.journal-list { padding: 0; margin: 0; list-style: none; }
.journal-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.journal-list small { display: block; font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.journal-list strong { font-size: 14px; }
.journal-list p { font-size: 12px; line-height: 1.8; color: #62645b; margin-top: 7px; }
.next-chapter { display: grid; gap: 7px; background: var(--green-soft); border-radius: 10px; padding: 15px; margin-top: 18px; }
.next-chapter small { font-size: 10px; color: var(--green); letter-spacing: 1px; }
.next-chapter strong { font-size: 20px; }
.next-chapter span { font-size: 12px; color: var(--muted); }
.feedback span:first-child { text-align: left; line-height: 1.65; }
@media (max-width:360px) { .chapter-card, .story-card { width: calc(100% - 24px); margin-left: 12px; margin-right: 12px; } .chapter-title > strong { font-size: 14px; } }
