@font-face {
  font-family: Pretendard;
  src: url('./fonts/pretendard.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; width: 100%; height: 100%; overflow: hidden; }
body { background: var(--color-bg-canvas); color: var(--color-fg-primary); font-family: var(--font-family); font-size: var(--font-body); font-weight: var(--weight-regular); line-height: var(--line-body); letter-spacing: -.015em; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; letter-spacing: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, .motion-choice input:focus-visible { outline: 2px solid var(--color-stroke-focus); outline-offset: 4px; }
a { color: inherit; text-decoration: none; }
input { min-width: 0; }
input::placeholder { color: var(--color-fg-tertiary); }
[hidden] { display: none !important; }
.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; }
.ui-icon { display: block; width: 20px; height: 20px; flex-shrink: 0; }
body {
  --tabs-floor: calc(var(--safe-bottom) + 20px);
  --tabs-height: 61px;
  --controls-floor: calc(var(--tabs-floor) + var(--tabs-height) + 12px);
}
body[data-keyboard] {
  --tabs-floor: calc(max(var(--safe-bottom), var(--keyboard-inset) + max(0px, var(--safe-before-keyboard, 0px) - var(--safe-bottom))) + 4px);
}

.experience { position: relative; width: 100%; height: 100%; height: 100dvh; isolation: isolate; overflow: hidden; }
.stage { position: absolute; inset: 0; z-index: 0; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
body[data-world=cloud] .stage canvas { -webkit-touch-callout:none; -webkit-user-select:none; user-select:none; }
.cinema-shade { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var(--color-scene-shade); }
body[data-world=square] .cinema-shade { background:linear-gradient(180deg,#292d3826,transparent 24%,transparent 83%,#27302324); }
body[data-world=square][data-time-of-day=day] .cinema-shade { background:linear-gradient(180deg,#33475a12,transparent 27%,transparent 85%,#2b493414); }
body[data-world=square][data-time-of-day=night] .cinema-shade { background:linear-gradient(180deg,#101a342c,transparent 24%,transparent 82%,#111a302f); }
.cinema-shade::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 32%, rgb(9 12 16 / 72%) 64%, rgb(9 12 16 / 80%)); opacity: 0; transition: opacity .65s ease; }
body[data-completed=cloud] .cinema-shade::after { opacity: 1; }

.site-header { position: fixed; top: var(--safe-top); left: 0; right: 0; height: 88px; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-8); z-index: 5; pointer-events: none; }
.wordmark { display:inline-flex; align-items:center; min-height:var(--height-touch); pointer-events:auto; }
.wordmark img { display:block; width:100px; height:auto; filter:drop-shadow(0 2px 3px rgb(5 13 22 / 66%)) drop-shadow(0 3px 10px rgb(5 13 22 / 28%)); }
.header-actions { display: flex; align-items: center; gap: var(--space-3); pointer-events: auto; }
.quiet-button, .about-button { min-height: var(--height-touch); min-width: var(--height-touch); border: 0; border-radius: var(--radius-md); background: transparent; transition: background var(--duration-fast); }
.quiet-button { display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-body-sm); font-weight: var(--weight-medium); padding: var(--space-2) var(--space-3); text-shadow: var(--shadow-text); }
#rest-toggle { border: 1px solid var(--color-stroke-subtle); border-radius: var(--radius-full); padding-inline: var(--space-3); background: var(--color-bg-caption); backdrop-filter: blur(16px); white-space: nowrap; }
.seat-icon { display: inline-flex; }
.rest-place { display: none; }
body[data-world=cloud]:not([data-seated]) #rest-toggle { display: none; }
#portal-door {
  position:absolute; z-index:3; left:0; top:0;
  display:grid; place-items:center; min-height:var(--height-touch);
  padding:0; border:0; border-radius:var(--radius-full); background:transparent;
  color:var(--color-fg-on-glass); font-size:var(--font-label); font-weight:var(--weight-semibold); white-space:nowrap;
  transform:translate(var(--portal-x),var(--portal-y)) translate(-50%,-100%);
}
.portal-label {
  display:inline-flex; align-items:center; gap:8px;
  min-height:30px; padding:3px 12px; line-height:var(--line-label);
  border:1px solid var(--color-stroke-default); border-radius:inherit;
  background:var(--color-bg-caption);
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
}
.portal-label::after {
  content:''; width:6px; height:6px; border:solid currentColor; border-width:1.5px 1.5px 0 0;
  transform:rotate(45deg);
}
#portal-door::after {
  content:''; position:absolute; top:calc(50% + 15px); left:50%;
  height:6px; border-left:1px solid var(--color-bg-caption);
}
@media (hover:hover) {
  #portal-door:hover .portal-label { background:var(--color-bg-floating-hover); }
}
#portal-door:active .portal-label { background:var(--color-bg-floating-pressed); }
#portal-door:focus-visible { outline:none; }
#portal-door:focus-visible .portal-label { outline:2px solid var(--color-stroke-focus); outline-offset:2px; }
#portal-door[hidden], body:has(#cloud-note:not([hidden])) #portal-door { display: none; }
.world-transition.portal-arrival { background: var(--color-portal-glow); }
body[data-seated] :is(.wordmark,.world-panel,#completion) { display: none; }
body[data-lying] :is(.wordmark,.world-panel,#completion,.world-tabs,.cloud-controls) { display:none; }
body[data-lying] #rest-toggle { background:var(--color-bg-caption); }
.camp-sky-caption { position:fixed; z-index:4; left:50%; bottom:calc(var(--tabs-floor) + 18px); transform:translateX(-50%); width:max-content; max-width:calc(100% - 36px); margin:0; padding:9px 17px; border:1px solid var(--color-stroke-subtle); border-radius:var(--radius-full); background:var(--color-bg-caption); color:var(--color-fg-primary); font-size:var(--font-body-sm); line-height:var(--line-body-sm); text-align:center; backdrop-filter:blur(12px); pointer-events:none; }
.camp-sky-caption[hidden] { display:none; }
body[data-world=train][data-seated] #panel-train { display:block; }
body[data-world=train][data-seated] :is(#train-car-nav,#panel-train .entry-guide) { display:none; }
body[data-seated] .header-actions { margin-left: auto; }
body[data-seated] #sound-toggle[aria-pressed=true] .sound-icon { color: var(--color-fg-on-selected); }
body[data-seated] #seat-reset { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background:var(--color-bg-caption); }
body[data-seated] .stage canvas { cursor: grab; }
body[data-seated] .stage canvas:active { cursor: grabbing; }
body[data-train-writing] .stage canvas,body[data-train-writing] .stage canvas:active { cursor:crosshair; }
#seat-view-tip {
  position: absolute;
  z-index: 3;
  top: calc(58px + var(--safe-top));
  left: var(--space-6);
  margin: 0;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--color-bg-caption);
  color: var(--color-fg-primary);
  font-size: var(--font-label);
  line-height: var(--line-label);
  pointer-events: none;
}
body[data-world=cloud] #seat-view-tip { top: calc(140px + var(--safe-top)); }
body[data-seated] .rest-place { display: block; position: absolute; z-index: 2; top: calc(24px + var(--safe-top)); left: var(--space-6); margin: 0; font-size: var(--font-body-sm); font-weight: var(--weight-medium); color: var(--color-fg-primary); text-shadow: var(--shadow-text); pointer-events: none; animation: place-arrival 6s ease both; }
@keyframes place-arrival { 0% { opacity: 0; } 18%,65% { opacity: 1; } 100% { opacity: 0; } }

body[data-world=cloud][data-seated] .rest-place { display: none; }
#lookout { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.lookout-heading { position: absolute; top: calc(16px + var(--safe-top)); left: var(--space-6); display: grid; gap: 8px; color: var(--color-fg-primary); text-shadow: var(--shadow-text); }
.lookout-heading h2 { margin: 0; font-size: var(--font-title-sm); letter-spacing: -.045em; }
#lookout-presence { display: flex; align-items: center; gap: 7px; margin: 5px 0 0; font-size: var(--font-label); font-weight: var(--weight-medium); }
#lookout-presence::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--color-fg-tertiary); }
#lookout-presence[data-status=online]::before { background: var(--color-fg-success); }
.lookout-tools { display: flex; align-items: center; gap: 6px; }
#lookout-bench, #lookout-link,.sky-buttons { background: var(--color-bg-floating); border: 1px solid var(--color-stroke-subtle); color: var(--color-fg-primary); backdrop-filter: blur(14px); border-radius: var(--radius-full); pointer-events: auto; }
#lookout-bench { min-height: 44px; padding: 0 12px; font-size: var(--font-label); }
#lookout-link { display: grid; place-items: center; width: 44px; height: 44px; }
#lookout svg { width: 19px; height: 19px; }
.lookout-actions { position: absolute; bottom: var(--controls-floor); width: 100%; display: grid; justify-items: center; gap: var(--space-3); padding-inline: var(--space-4); text-align: center; }
#sky-message { margin: 0; max-width: 29em; padding: 7px 14px; border-radius: var(--radius-md); background: var(--color-bg-caption); color: var(--color-fg-secondary); font-size: var(--font-body-sm); line-height: 1.6; word-break: keep-all; }
#sky-message:empty { display: none; }
.sky-buttons { display: flex; align-items: center; gap: 3px; padding: 4px; }
.sky-buttons button { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 0 15px; min-height: 44px; border-radius: var(--radius-full); border: 0; background: transparent; color: var(--color-fg-primary); font: inherit; font-size: var(--font-body-sm); font-weight: var(--weight-semibold); }

@media(max-width:420px){
  #sky-message { white-space: pre-line; }
  .lookout-heading { left: 12px; }
  body[data-world=cloud] #seat-view-tip { left: 18px; }
  .header-actions #sound-label { display: none; }
}
.quiet-button[aria-pressed=true] .sound-icon { color: var(--color-bg-accent); }
.header-actions #sound-toggle, .about-button { background: var(--color-bg-caption); backdrop-filter: blur(16px); }
.about-button { font-size: 18px; font-weight: var(--weight-semibold); border: 1px solid var(--color-stroke-subtle); }

.world-tabs {
  border: 1px solid var(--color-glass-rim);
  border-radius: var(--radius-full);
  color: var(--color-fg-on-glass);
  background: var(--color-glass-solid);
  box-shadow: var(--shadow-glass);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .world-tabs {
    background: var(--color-glass-sheen), var(--color-glass);
    -webkit-backdrop-filter: saturate(155%) brightness(.73) blur(9px);
    backdrop-filter: saturate(155%) brightness(.73) blur(9px);
  }
}
.world-tabs {
  --inset: 5px;
  --lens-offset: 0%;
  position: fixed;
  left: 50%;
  bottom: var(--tabs-floor);
  z-index: 6;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(380px, calc(100% - 32px));
  padding: var(--inset);
  pointer-events: auto;
}
body[data-world=laundry] .world-tabs { --lens-offset: 100%; }
body[data-world=train] .world-tabs { --lens-offset: 200%; }
body[data-world=square] .world-tabs { --lens-offset: 300%; }
.world-tabs::before {
  content: '';
  position: absolute;
  inset-block: var(--inset);
  left: var(--inset);
  width: calc((100% - var(--inset) - var(--inset)) / 4);
  border-radius: inherit;
  border: 1px solid var(--color-glass-rim);
  background: var(--color-glass-lens);
  box-shadow: inset 0 1px 2px #F2FAFF5C, inset 0 -2px 3px #BBE1FF2B, 0 1px 3px #050B142E;
  transform: translateX(var(--lens-offset));
  transition: transform .44s cubic-bezier(.2,1.1,.3,1);
  pointer-events: none;
}
.world-tabs button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 49px;
  padding: 4px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: inherit;
  font-size: var(--font-label);
  line-height: 16px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.world-tabs button { text-shadow: 0 1px 3px #07131D8C; }
.world-tabs button[aria-selected=true] { color: var(--color-glass-lens-text); font-weight: var(--weight-bold); }
body:has(#motion-toggle:checked) .world-tabs::before { transition: none; }
.world-tabs button:focus-visible, body[data-seated] .header-actions button:focus-visible { outline: 2px solid var(--color-stroke-focus); outline-offset: -3px; }
@media (hover:hover) {
  .world-tabs button:not([aria-selected=true]):hover, body[data-seated] .header-actions :is(#seat-reset,#rest-toggle,#sound-toggle):enabled:hover,
  #sky-chime:enabled:hover, .note-toggle:enabled:hover { background: var(--color-bg-hover); }
  :is(#rest-toggle,#about-open,#lookout-bench,#lookout-link,#lookout-posture):enabled:hover,
  .header-actions #sound-toggle:enabled:hover { background: var(--color-bg-floating-hover); }
}
.world-tabs button:active, .note-toggle:enabled:active, #sky-chime:enabled:active,
body[data-seated] .header-actions :is(#seat-reset,#rest-toggle,#sound-toggle):enabled:active { background: var(--color-bg-pressed); }
.header-actions #sound-toggle:enabled:active, :is(#rest-toggle,#about-open,#lookout-bench,#lookout-link,#lookout-posture):enabled:active { background: var(--color-bg-floating-pressed); }
@media (prefers-reduced-transparency: reduce) {
  .world-tabs { background: var(--color-glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .world-tabs::before { background: var(--color-bg-selected); }
}
@media (forced-colors: active) {
  .world-tabs { background: Canvas; color: ButtonText; border-color: ButtonText; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .world-tabs::before { display: none; }
  .world-tabs button[aria-selected=true] { border: 2px solid Highlight; color: ButtonText; }
  .world-tabs button:focus-visible, body[data-seated] .header-actions button:focus-visible { outline-color: Highlight; }
}
.tab-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; }

.world-panel { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
#train-car-nav { position: absolute; left: 50%; top: calc(var(--safe-top) + 86px); transform: translateX(-50%); display: inline-flex; align-items: center; border-radius: var(--radius-full); border: 1px solid var(--color-stroke-subtle); background: var(--color-bg-caption); backdrop-filter: blur(16px); color: var(--color-fg-primary); }
#train-car-name { white-space: nowrap; font-size: var(--font-body-sm); font-weight: var(--weight-medium); }
#train-car-nav button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-full); background: transparent; color: inherit; font-size: 24px; line-height: 1; pointer-events: auto; }
#train-car-nav button:disabled { opacity: .27; }
#train-car-nav button:enabled:hover { background: var(--color-bg-hover); }
@media(max-width:760px),(max-height:620px) { #train-car-nav { top: calc(var(--safe-top) + 69px); } }
.entry-guide {
  position:absolute;
  top:calc(86px + var(--safe-top));
  right:max(32px,env(safe-area-inset-right));
  width: min(335px,calc(100% - 32px));
  padding: 15px 18px 9px;
  border: 1px solid var(--color-stroke-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-bg-floating);
  box-shadow: var(--shadow-floating);
  backdrop-filter: blur(16px);
  text-align: left;
  word-break: keep-all;
}
.entry-guide h2 { margin: 0 0 4px; color: var(--color-fg-primary); font-size: 19px; font-weight: var(--weight-semibold); line-height: 1.35; }
@media (min-width:760px) and (max-width:1000px) {
  #panel-train .entry-guide { top:calc(var(--safe-top) + 140px); }
}
.entry-guide p { margin: 0; color: var(--color-fg-secondary); font-size: var(--font-body-sm); line-height: 1.5; }
.entry-actions { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.entry-actions button { min-height: 44px; pointer-events: auto; border: 0; border-radius: var(--radius-full); color: var(--color-fg-primary); font-size: var(--font-body-sm); font-weight: var(--weight-semibold); }
#entry-action { padding: 0 13px; background: var(--color-bg-selected); color: var(--color-fg-on-selected); }
#entry-skip { padding: 0 7px; background: transparent; color: var(--color-fg-secondary); font-weight: var(--weight-medium); }

.completion { position: absolute; left: 50%; top: 54%; width: min(460px,calc(100% - 32px)); transform: translate(-50%,-50%); z-index: 3; pointer-events: none; text-align: center; color: var(--color-fg-primary); text-shadow: var(--shadow-text); animation: settle-in 1.2s ease-out both; }
.completion::before { content: ''; position: absolute; inset: -48px -24px; z-index: -1; background: var(--color-completion-shade); filter: blur(12px); }
.completion h2 { margin: 0 0 var(--space-3); font-size: var(--font-title); line-height: var(--line-title); font-weight: var(--weight-semibold); letter-spacing: -.035em; word-break: keep-all; }
.completion p { margin: 0; font-size: var(--font-body); line-height: var(--line-body); word-break: keep-all; }
.completion h2, .completion p, #sky-message { text-wrap: balance; }
body[data-cloud-release] .cloud-controls, body[data-cloud-release]:not([data-completed]) #panel-cloud .action-dock { visibility: hidden; }
body[data-completed=cloud] .completion { top: 62%; }
body[data-completed=cloud] .completion::before { display: none; }
body[data-completed=cloud] .completion h2 { color:var(--color-glass-lens-text); font-size:var(--font-body-sm); line-height:var(--line-body-sm); letter-spacing:0; }
body[data-completed=cloud] .completion p { font-size:clamp(1.35rem,3.7vw,1.75rem); line-height:1.45; font-weight:var(--weight-semibold); letter-spacing:-.03em; }
body[data-completed=laundry] .completion { top: 61%; }
body[data-completed=train] .completion, body[data-completed=square] .completion { top: 59%; }
@keyframes settle-in { from { opacity: 0; transform: translate(-50%,calc(-50% + 10px)); } to { opacity: 1; transform: translate(-50%,-50%); } }
@media (max-width:760px) { .completion h2 { font-size: 25px; line-height: 35px; } .completion p { font-size: var(--font-body-sm); line-height: var(--line-body-sm); } }
@media (max-height:620px) { .completion { top: 40%; } body[data-completed=cloud] .completion, body[data-completed=laundry] .completion, body[data-completed=train] .completion, body[data-completed=square] .completion { top: 43%; } }

.action-dock { position: absolute; bottom: var(--controls-floor); left: 50%; transform: translateX(-50%); width: min(460px,calc(100% - 40px)); display: flex; align-items: center; flex-direction: column; gap: var(--space-3); text-align: center; }
.dock-heading { order: 0; display: flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 38px; max-width: 100%; border: 1px solid var(--color-stroke-subtle); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); background: var(--color-bg-caption); backdrop-filter: blur(16px); }
.dock-heading p { font-size: var(--font-body-sm); font-weight: var(--weight-medium); line-height: var(--line-body-sm); margin: 0; word-break: keep-all; overflow-wrap: anywhere; color: var(--color-fg-primary); }
.action-dock > input { order: 1; width: min(400px,100%); min-height: 52px; padding: 14px var(--space-4); border: 1px solid var(--color-stroke-default); border-radius: var(--radius-lg); background: var(--color-bg-input); backdrop-filter: blur(20px); color: var(--color-fg-primary); font-size: var(--font-action); line-height: var(--line-action); box-shadow: var(--shadow-floating); }
.action-dock > input:focus { border-color: var(--color-stroke-focus); outline: none; }
.dock-bottom { order: 2; display: inline-flex; align-items: center; justify-content: center; gap: 3px; max-width: 100%; padding: 4px; border-radius: 30px; border: 1px solid var(--color-stroke-subtle); background: var(--color-bg-floating); backdrop-filter: blur(20px); box-shadow: var(--shadow-floating); }
.action-dock { pointer-events: none; }
.action-dock :is(input,.dock-bottom) { pointer-events: auto; }
.dock-bottom button { border-radius: var(--radius-full); box-shadow: none; }
#train-draw-toggle { display:none; }
body[data-world=train][data-seated] #train-draw-toggle { display:inline-flex; }
body[data-world=train][data-seated] #train-note-toggle { order:-2; }
body[data-world=train][data-seated] #train-draw-toggle { order:-1; }
#train-draw-toggle[aria-pressed=true] { background:var(--color-bg-selected); color:var(--color-fg-on-selected); }
#square-actions button { padding-inline: 14px; }
#square-actions { flex-wrap: wrap; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3); min-height: var(--height-button); padding: 14px var(--space-6); border-radius: var(--radius-lg); font-size: var(--font-action); font-weight: var(--weight-semibold); line-height: var(--line-action); white-space: nowrap; transition: transform var(--duration-fast) var(--ease-standard), background var(--duration-fast); }
.primary-button { border: 1px solid transparent; }
.primary-button, #sky-light { background: var(--color-bg-accent); color: var(--color-fg-on-accent); }
@media (hover:hover) {
  .primary-button:enabled:hover, #sky-light:enabled:hover { background: var(--color-bg-accent-hover); }
}
.primary-button:enabled:active, #sky-light:enabled:active { background: var(--color-bg-accent-pressed); transform: scale(.98); }
.secondary-button { border: 0; background: transparent; color: var(--color-fg-secondary); }
.secondary-button:enabled:hover { background: var(--color-bg-hover); }
.secondary-button:enabled:active { background: var(--color-bg-pressed); }
.note-toggle { order: 3; min-height: var(--height-touch); padding: var(--space-2) var(--space-3); background: transparent; border: 0; color: var(--color-fg-secondary); font-size: var(--font-body-sm); font-weight: var(--weight-medium); line-height: var(--line-body-sm); white-space: nowrap; transition: color var(--duration-fast); }
.note-toggle:hover { color: var(--color-fg-primary); }
.note-toggle[aria-expanded=true] { color: var(--color-fg-on-selected); background: var(--color-bg-selected); }
.dock-heading:has(p:empty) { display: none; }
#cloud-goal-hint:not([hidden]) + .dock-heading { display:none; }
.wash-progress { order: 1; height: 4px; width: 180px; background: var(--color-stroke-default); overflow: hidden; border-radius: var(--radius-full); }
.wash-progress span { display: block; height: 100%; width: 0; background: var(--color-bg-accent); transition: width var(--duration-normal) linear; }


.world-tabs button[aria-busy=true] .tab-icon { animation: world-pending 1.1s ease-in-out infinite alternate; }
@keyframes world-pending { to { opacity:.4; } }
@media (prefers-reduced-motion:reduce) { .world-tabs button[aria-busy=true] .tab-icon { animation:none; opacity:.65; } }
.world-transition { position: absolute; inset: 0; z-index: 4; background: var(--color-bg-canvas); opacity: 0; pointer-events: none; }
.world-transition.travelling { animation: arrive 950ms ease-out both; }
@keyframes arrive { 0% { opacity: .88; } 100% { opacity: 0; } }
.toast { position: absolute; bottom: calc(var(--controls-floor) + 70px); left: 50%; transform: translateX(-50%); padding: var(--space-4) var(--space-5); background: var(--color-bg-floating); border: 1px solid var(--color-stroke-subtle); backdrop-filter: blur(20px); color: var(--color-fg-primary); font-size: var(--font-body-sm); line-height: var(--line-body-sm); border-radius: var(--radius-lg); max-width: calc(100% - 40px); text-align: center; z-index: 12; box-shadow: var(--shadow-floating); pointer-events:none; }

dialog { inset: calc(var(--safe-top) + 12px) 0 var(--controls-floor); margin: auto; border: 1px solid var(--color-stroke-subtle); background: var(--color-bg-surface); color: var(--color-fg-primary); padding: var(--space-8); border-radius: var(--radius-xl); max-width: 440px; max-height: calc(100dvh - var(--safe-top) - var(--controls-floor) - 12px); width: calc(100% - 40px); box-shadow: var(--shadow-modal); overscroll-behavior: contain; }
dialog::backdrop { background: var(--color-bg-overlay); backdrop-filter: blur(8px); }
dialog form { position: absolute; right: var(--space-3); top: var(--space-3); }
dialog .dialog-close { border: 0; background: none; color: var(--color-fg-secondary); font-size: 26px; line-height: 32px; width: var(--height-touch); height: var(--height-touch); border-radius: var(--radius-md); }
dialog .dialog-close:hover { background: var(--color-bg-hover); }
dialog .dialog-close:active { background: var(--color-bg-pressed); }
dialog h2 { font-size: var(--font-title-sm); line-height: var(--line-title-sm); font-weight: var(--weight-bold); letter-spacing: -.025em; margin: 0 0 var(--space-5); }
dialog p { font-size: var(--font-body); line-height: var(--line-body); color: var(--color-fg-secondary); word-break: keep-all; }
dialog .dialog-footnote { font-size: var(--font-label); line-height: var(--line-label); margin-top: var(--space-6); color: var(--color-fg-tertiary); }
.motion-choice { display: flex; align-items: center; gap: var(--space-3); min-height: var(--height-touch); font-size: var(--font-body); line-height: var(--line-body); font-weight: var(--weight-medium); margin-top: var(--space-5); cursor: pointer; }
.motion-choice input { accent-color: var(--color-bg-accent); width: 20px; height: 20px; flex-shrink: 0; }

@media (max-width: 760px) {
  .site-header { height: 76px; padding: 0 var(--space-5); }
  .wordmark img { width:88px; }
  .header-actions { gap: var(--space-1); }
  .quiet-button { padding: var(--space-2); font-size: var(--font-label); }
  .action-dock { width: calc(100% - 40px); gap: var(--space-2); }
  .dock-heading p { font-size: var(--font-label); line-height: var(--line-label); }
  .primary-button, .secondary-button { font-size: var(--font-body); padding: 14px var(--space-5); }
  .dock-bottom { gap: 2px; }
  #panel-train .dock-bottom button { padding-inline: var(--space-3); }
  #square-actions button { padding-inline: 9px; font-size: var(--font-body-sm); }
  .note-toggle { font-size: var(--font-label); }
  dialog { padding: var(--space-6); }
}

@media (max-width: 360px) {
  .site-header { padding: 0 var(--space-3); }
  .wordmark img { width:82px; }
  .world-tabs { width: calc(100% - 24px); }
  .action-dock { width: calc(100% - 32px); }
  .primary-button, .secondary-button { padding: 14px var(--space-4); }
}

@media (max-height: 620px) {
  .site-header { height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .world-transition.travelling { opacity: 0; }
}

.control-guide { display: grid; gap: var(--space-3); padding-left: var(--space-5); margin: 0; color: var(--color-fg-secondary); font-size: var(--font-body); line-height: var(--line-body); word-break: keep-all; }
.text-button { min-height: var(--height-touch); padding: var(--space-2) 0; border: 0; background: transparent; color: var(--color-fg-secondary); font-size: var(--font-body-sm); text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--color-fg-primary); }
.text-button:active { color: var(--color-fg-on-selected); }

.cloud-controls { display: none; position: absolute; right: var(--space-8); bottom: calc(132px + var(--safe-bottom)); z-index: 3; }
body:is([data-world=cloud],[data-world=square],[data-world=train]):not([data-seated]) .cloud-controls { display: block; }
body:has(.world-panel:not([hidden]) input:not([hidden])) .cloud-controls { visibility: hidden; }
.cloud-stick { position: relative; display: block; width: 92px; height: 92px; border: 1px solid var(--color-stroke-default); border-radius: var(--radius-full); background: var(--color-bg-caption); backdrop-filter: blur(16px); touch-action: none; cursor: grab; color: var(--color-fg-secondary); box-shadow: var(--shadow-floating); padding: 0; }
.cloud-stick:active { cursor: grabbing; border-color: var(--color-fg-on-selected); }
.cloud-stick svg { display: block; width: 100%; height: 100%; opacity: .6; pointer-events: none; }
.cloud-stick-thumb { position: absolute; width: 30px; height: 30px; left: 50%; top: 50%; border: 0; border-radius: var(--radius-full); background: var(--color-bg-accent); box-shadow: var(--shadow-floating); transform: translate(calc(-50% + var(--stick-x, 0px)),calc(-50% + var(--stick-y, 0px))); pointer-events: none; }
.cloud-stick:active .cloud-stick-thumb { background: var(--color-bg-accent-pressed); }
@media (max-width:760px) { .cloud-controls { right: var(--space-5); bottom: calc(164px + var(--safe-bottom)); } .cloud-stick { width: 84px; height: 84px; } }
@media (max-width:360px) { .cloud-controls { right: var(--space-4); } .cloud-stick { width: 76px; height: 76px; } }
@media (max-height:620px) and (min-width:761px) { .cloud-controls { bottom: calc(108px + var(--safe-bottom)); } }

body[data-lookout-posture=walking] .cloud-controls { display:block; bottom:calc(24px + var(--safe-bottom)); z-index:5; }
body[data-lookout-posture=walking] .cloud-stick { width:72px; height:72px; }
body[data-lookout-posture=walking] .stage canvas { cursor:crosshair; }
body[data-lookout-posture=walking] .stage canvas:active { cursor:grabbing; }
#lookout-posture { background:var(--color-bg-selected); color:var(--color-fg-on-selected); }

#lookout-picker { width:min(420px,calc(100% - 24px)); padding:24px; background:var(--color-bg-surface); color:var(--color-fg-primary); color-scheme:dark; }
#lookout-picker .dialog-close { color:var(--color-fg-secondary); }
#lookout-picker h2 { margin:0 0 6px; }
#lookout-picker p { color:var(--color-fg-secondary); margin:0 0 20px; }
#lookout-picker h3 { margin:20px 0 10px; font-size:15px; }
.bench-map { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.bench-map button, #seat-choices button { min-height:54px; background:var(--color-bg-input); border:1px solid var(--color-stroke-subtle); color:var(--color-fg-secondary); border-radius:13px; padding:8px 4px; }
.bench-map button { display:grid; justify-items:center; align-content:center; gap:7px; font-size:12px; }
.bench-map button:not([aria-pressed=true]):hover, #seat-choices button:enabled:hover { background:var(--color-bg-hover); }
.bench-map button:not([aria-pressed=true]):active, #seat-choices button:enabled:active { background:var(--color-bg-pressed); }
.bench-map button[aria-pressed=true] { background:var(--color-bg-selected); border-color:var(--color-fg-on-selected); color:var(--color-fg-on-selected); }
.bench-dots { display:flex; gap:3px; border-bottom:3px solid var(--color-fg-tertiary); padding:0 2px 3px; }
.bench-dots i { width:7px; height:7px; border:1px solid var(--color-fg-tertiary); border-radius:50%; }
.bench-dots .occupied { background:var(--color-fg-on-selected); }
#seat-choices { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
#seat-choices button { display:grid; justify-items:center; gap:2px; }
#seat-choices span { font-size:12px; }
:is(.action-dock input, .primary-button, .secondary-button, #rest-toggle, #lookout-bench, #sky-light, #sky-chime, #lookout-posture, #seat-choices button):disabled {
  background: var(--color-bg-disabled);
  color: var(--color-fg-disabled);
}
.entry-skip-icon { display:none; }

@media (max-width:759px), (pointer:coarse) and (orientation:landscape) and (max-height:500px) {
  body { --tabs-floor: calc(8px + var(--safe-bottom)); --tabs-height:52px; --controls-floor:calc(var(--tabs-floor) + var(--tabs-height) + 8px); }
  .site-header { height:60px; padding-left:max(12px,env(safe-area-inset-left)); padding-right:max(12px,env(safe-area-inset-right)); }
  .wordmark img { width:78px; }
  .header-actions { gap:3px; }
  .header-actions #sound-label { display:none; }
  .header-actions #sound-toggle { display:grid; place-items:center; }
  #rest-toggle { padding-inline:10px; gap:5px; }
  .world-tabs { --inset:3px; width:min(352px,calc(100% - 24px)); }
  .world-tabs button { min-height:44px; padding:2px; gap:1px; }
  .world-tabs .tab-icon,.world-tabs .ui-icon { width:17px; height:17px; }
  .entry-guide { left:50%; top:calc(var(--safe-top) + 62px); right:auto; transform:translateX(-50%); display:flex; align-items:center; gap:6px; width:max-content; max-width:calc(100% - 24px); padding:0 2px 0 12px; border-radius:16px; }
  .entry-guide p { font-size:var(--font-label); line-height:1.4; }
  .entry-guide h2,.entry-guide #entry-action,.entry-skip-label { display:none; }
  .entry-actions { margin:0; flex:none; }
  #entry-skip { display:grid; place-items:center; width:44px; height:44px; padding:0; }
  .entry-skip-icon { display:inline; font-size:21px; font-weight:var(--weight-regular); }
  #train-car-nav { top:calc(var(--safe-top) + 62px); }
  #panel-train .entry-guide { top:calc(var(--safe-top) + 116px); }
  .action-dock { width:calc(100% - 24px); gap:5px; }
  .dock-bottom,.sky-buttons { padding:2px; gap:1px; }
  body[data-world=train][data-seated] #train-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:min(320px,100%); border-radius:18px; }
  body[data-world=train][data-seated] #train-actions button { min-width:0; white-space:normal; }
  .dock-bottom :is(.primary-button,.secondary-button,.note-toggle), .sky-buttons button { min-height:44px; padding:5px 12px; font-size:var(--font-body-sm); line-height:20px; gap:5px; }
  .dock-heading { min-height:26px; padding:2px 9px; }
  .dock-heading p { font-size:var(--font-label); line-height:1.4; }
  .action-dock:has(input:not([hidden])) .dock-heading { display:none; }
  .action-dock input { min-height:44px; padding-block:9px; font-size:16px; line-height:24px; }
  .lookout-heading { top:calc(var(--safe-top) + 12px); left:max(12px,env(safe-area-inset-left)); gap:8px; }
  .lookout-heading h2 { font-size:var(--font-body); line-height:20px; }
  #lookout-presence { margin-top:1px; line-height:16px; max-width:min(130px,calc(100vw - 206px)); }
  .lookout-actions { padding-inline:8px; gap:5px; }
  body[data-world=cloud] #seat-view-tip { top:calc(114px + var(--safe-top)); left:max(12px,env(safe-area-inset-left)); max-width:calc(100% - 24px); }
  body[data-seated]:not([data-world=cloud]) .rest-place { top:calc(var(--safe-top) + 62px); left:12px; }
  body[data-seated]:not([data-world=cloud]) #seat-view-tip { top:calc(var(--safe-top) + 91px); left:12px; }
  #lookout-picker { padding:20px 16px; }
  .cloud-controls,body[data-lookout-posture=walking] .cloud-controls { right:max(12px,env(safe-area-inset-right)); bottom:calc(var(--controls-floor) + 80px); }
  .cloud-stick,body[data-lookout-posture=walking] .cloud-stick { width:74px; height:74px; }
}
@media (max-width:759px) and (orientation:portrait) {
  #portal-door { transform:translate(var(--portal-x),max(var(--portal-y),calc(var(--safe-top) + 108px))) translate(-50%,-100%); }
  body:has(#panel-cloud .entry-guide:not([hidden])) #portal-door { transform:translate(var(--portal-x),max(var(--portal-y),calc(var(--safe-top) + 167px))) translate(-50%,-100%); }
}
@media (pointer:coarse) and (orientation:landscape) and (max-height:500px) {
  #portal-door {
    transform:translate(clamp(calc(env(safe-area-inset-left) + 54px),calc(var(--portal-x) + 78px),calc(100vw - env(safe-area-inset-right) - 54px)),max(calc(var(--safe-top) + 84px),var(--portal-y))) translate(-50%,-50%);
  }
  #portal-door::after { top:50%; left:-6px; width:6px; height:0; border-left:0; border-top:1px solid var(--color-bg-caption); }
  body { --tabs-floor:max(4px,var(--safe-bottom)); }
  .entry-guide { left:max(12px,env(safe-area-inset-left)); right:auto; transform:none; max-width:36%; }
  #panel-train .entry-guide { top:calc(var(--safe-top) + 62px); }
  #train-car-nav { top:max(8px,var(--safe-top)); }
  .world-tabs { width:min(310px,48%); }
  .action-dock, .lookout-actions { width:min(400px,66%); }
  .lookout-actions { left:50%; transform:translateX(-50%); }
  .lookout-heading { display:flex; gap:12px; align-items:center; }
  body[data-world=cloud] #seat-view-tip { top:calc(var(--safe-top) + 64px); }
  .action-dock:has(input:not([hidden])) { gap:3px; }
}
@media (max-width:360px) {
  .sky-buttons button,.dock-bottom :is(.primary-button,.secondary-button,.note-toggle) { padding-inline:8px; }
  #panel-train .dock-bottom button { padding-inline:8px; }
}
