.crow-world { z-index: 4; }
.crow-canvas { position: relative; pointer-events: none; transform-origin: 50% 80%; }
.arcade-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin: -8px 0 20px; }
.pocket-button { min-height: 44px; padding: 9px 13px; border: 1px solid var(--line, #b7c1ad); border-radius: 7px; background: transparent; color: inherit; font: inherit; font-size: 14px; cursor: pointer; }
.pocket-button:hover:enabled { background: #87977e18; }
.pocket-button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.pocket-button[aria-pressed="true"] { background: #87977e32; border-color: currentColor; }
.pocket-button:disabled { opacity: .48; cursor: default; }
.pocket-dialog { box-sizing: border-box; width: min(680px, calc(100vw - 28px)); max-height: min(82dvh, 820px); margin: auto; padding: 22px; overflow: auto; overscroll-behavior: contain; border: 1px solid #aeb9a3; border-radius: 14px; background: #f3f1e6; color: #20271f; box-shadow: 8px 10px 0 #20271f20; }
.pocket-dialog::backdrop { background: #20271f65; backdrop-filter: blur(3px); }
.pocket-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.pocket-dialog h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.04em; }
.pocket-dialog h3 { margin: 12px 0; font-size: 17px; font-weight: 600; }
.pocket-dialog p { line-height: 1.5; }
.pocket-fine { color: #56614c; font-size: 13px; }
.passport-pages { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; margin-bottom: 22px; }
.passport-wardrobe { border-left: 1px solid #c7cbb9; padding-left: 22px; }
.passport-wardrobe .pocket-button { display: block; width: 100%; margin-bottom: 8px; text-align: left; }
.passport-stamp { position: relative; margin: 0 0 10px; padding: 11px 12px; border: 1px dashed #b5baa6; border-radius: 3px; font-size: 14px; line-height: 1.3; color: #69735c; }
.passport-stamp span { display: block; margin-top: 4px; font-size: 11px; }
.passport-stamp[data-stamped="true"] { color: #355e51; border: 2px solid #587e6b; transform: rotate(-1deg); }
.passport-stamp[data-stamped="true"]::after { content: ''; position: absolute; top: 13px; right: 13px; width: 9px; height: 5px; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.passport-discovery { font-size: 13px; }
.terminal-window { background: #263229; color: #e7eddd; }
.terminal-window .pocket-fine { color: #b7c5aa; }
.terminal-window .pocket-button { border-color: #6a7d63; }
.terminal-lines { min-height: 160px; max-height: 40dvh; overflow: auto; font: 14px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.terminal-lines p { margin: 8px 0; overflow-wrap: anywhere; }
.terminal-input { color: #c5d799; }
.terminal-command { display: flex; gap: 9px; align-items: center; margin-top: 14px; border-top: 1px solid #53614b; padding-top: 14px; font: 14px ui-monospace, SFMono-Regular, Consolas, monospace; }
.terminal-command input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 8px; border: 1px solid #6a7d63; border-radius: 4px; background: #1c261f; color: #e7eddd; font: inherit; }
.terminal-command input:focus-visible { outline: 2px solid #c5d799; outline-offset: 2px; }
.terminal-command label { white-space: nowrap; }
.night-veil { position: fixed; inset: 0; z-index: 12; pointer-events: none; opacity: 0; background: #101811; }
html[data-theme="dark"] .passport-book { background: #303c31; color: #edf1e7; border-color: #6f7e60; }
html[data-theme="dark"] .passport-book .pocket-fine { color: #b8c3ad; }
html[data-theme="dark"] .passport-stamp { color: #aebda1; border-color: #718064; }
html[data-theme="dark"] .passport-stamp[data-stamped="true"] { color: #d0e2ae; border-color: #a0b982; }
@media (max-width: 520px) {
  .pocket-dialog { padding: 17px; border-radius: 10px; }
  .pocket-dialog h2 { font-size: 21px; }
  .passport-pages { grid-template-columns: 1fr; gap: 12px; }
  .passport-wardrobe { padding-left: 0; padding-top: 8px; border-left: 0; border-top: 1px solid #c7cbb9; }
  .terminal-command { flex-wrap: wrap; }
  .terminal-command input { flex: 1 1 100px; }
  .arcade-tools .pocket-button { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .crow-canvas { transform: none !important; }
  .night-veil { display: none; }
  .pocket-dialog::backdrop { backdrop-filter: none; }
}
@media (forced-colors: active) { .passport-stamp[data-stamped="true"] { border-style: solid; } }
/* The travelling character owns one page-level layer, independent of nested cards. */
.crow-flight-layer { position: fixed; inset: 0; z-index: 40; pointer-events: none; contain: layout style; }
.crow-flight-layer[hidden] { display: none; }
.crow-airborne { position: absolute; top: 0; left: 0; width: 128px; height: 112px; transform-origin: 50% 90%; will-change: transform; }
.crow-airborne .crow-button { position: relative; z-index: 1; margin: 0; }
.crow-airborne .crow-speech { pointer-events: auto; width: min(290px, calc(100vw - 30px)); max-width: 290px; }
.crow-flight-wing { position: absolute; inset: 0; width: 128px; height: 112px; pointer-events: none; image-rendering: pixelated; }
.crow-away::after { content: ''; display: block; width: 128px; height: 112px; flex: 0 0 128px; }
.crow-flight-layer[data-stage="perch"] .crow-airborne::before { content: ''; position: absolute; left: 30px; top: 105px; width: 65px; height: 5px; border-radius: 50%; background: #20271f22; }
@media (prefers-reduced-motion: reduce) { .crow-flight-layer { display: none; } }

.crow-airborne[data-bubble-side="left"] .crow-speech::before { left: auto; right: -7px; transform: rotate(225deg); }
.crow-speech { z-index: 3; }
.crow-airborne .crow-speech { box-sizing: border-box; }
.crow-airborne[data-bubble-side="below"] .crow-speech { transform-origin: var(--bubble-tail-x) -8px; }
.crow-airborne[data-bubble-side="below"] .crow-speech::before { left: var(--bubble-tail-x); top: -7px; right: auto; transform: rotate(135deg); }
@media (max-width: 680px) { .crow-world .crow-speech { left: 118px; width: calc(100% - 118px); } }
.crow-airborne .crow-speech { translate: none; }
.crow-airborne[data-bubble-side="above"] .crow-speech { translate: 0 -100%; transform-origin: var(--bubble-tail-x) calc(100% + 8px); }
.crow-airborne[data-bubble-side="above"] .crow-speech::before { left: var(--bubble-tail-x); top: auto; bottom: -7px; right: auto; transform: rotate(-45deg); }
