/*
 * DAYFABLE · Liquid OS
 * A final presentation layer shared by the rendered game and its notebooks.
 * All simulation, action, save, and device selectors remain stable.
 */

/* 01 — Material, typography, and focus */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --os-night: #07191e;
  --os-deep: #092328;
  --os-surface: #123036;
  --os-raised: #193c42;
  --os-card: rgba(25, 59, 65, .72);
  --os-card-hover: rgba(35, 79, 84, .9);
  --os-glass: rgba(10, 33, 39, .86);
  --os-glass-heavy: rgba(12, 36, 42, .96);
  --os-edge: rgba(174, 230, 218, .2);
  --os-glint: rgba(226, 255, 246, .3);
  --os-text: #eaf7f2;
  --os-muted: #acc8c5;
  --os-faint: #8bacaa;
  --os-aqua: #a3f2dc;
  --os-aqua-ink: #06382f;
  --os-aqua-soft: rgba(141, 229, 209, .11);
  --os-gold: #e2c593;
  --os-danger: #ffb6b0;
  --os-danger-soft: #462d32;
  --os-shadow: 0 22px 64px #000e1470, 0 3px 12px #000a1538;
  --os-inner-edge: inset 0 1px 0 var(--os-glint), inset 0 -1px 0 #00151966;
  --os-display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --os-wordmark: "Arial Rounded MT Bold", "Trebuchet MS", ui-sans-serif, system-ui, sans-serif;
  --os-ease: cubic-bezier(.16, 1, .3, 1);
  --ink: var(--os-text);
  --muted: var(--os-muted);
  --paper: var(--os-surface);
  --glass: var(--os-glass);
  --glass-strong: #102f35;
  --line: var(--os-edge);
  --accent: var(--os-aqua);
  --accent-light: var(--os-aqua-soft);
  --mint: #9fe1be;
  --peach: var(--os-gold);
  --violet: #c8bcf1;
  --danger: var(--os-danger);
  --shadow: var(--os-shadow);
  --phone-bg: #0d272e;
  --menu-fill: var(--os-glass-heavy);
  --menu-border: var(--os-edge);
  --menu-shadow: var(--os-shadow);
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --os-night: #dfede8;
  --os-deep: #d8e7e1;
  --os-surface: #f2f8f1;
  --os-raised: #fffef6;
  --os-card: rgba(248, 253, 244, .8);
  --os-card-hover: #e2f2e7;
  --os-glass: rgba(233, 246, 238, .9);
  --os-glass-heavy: rgba(241, 249, 241, .98);
  --os-edge: rgba(42, 85, 73, .2);
  --os-glint: rgba(255, 255, 255, .9);
  --os-text: #1a3b36;
  --os-muted: #486a60;
  --os-faint: #57776c;
  --os-aqua: #226e5a;
  --os-aqua-ink: #f3fff5;
  --os-aqua-soft: rgba(51, 131, 99, .09);
  --os-gold: #805a26;
  --os-danger: #a53639;
  --os-danger-soft: #f8e8e3;
  --os-shadow: 0 22px 64px #173c3626, 0 3px 12px #173c3617;
  --glass-strong: #f0f8ee;
  --phone-bg: #eaf4ec;
  --mint: #407d57;
  --violet: #755d9a;
}

html, body, #game { background-color: var(--os-night); }
body { color: var(--os-text); }
button, input, textarea, select { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:active { transform: scale(.98); }
button:disabled { opacity: .54; cursor: not-allowed; }
:is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--os-aqua);
  outline-offset: 4px;
}
::selection { background: var(--os-aqua); color: var(--os-aqua-ink); }
:is(.aster-sheet-body, #drawer-body, .pause-card, .welcome-card, .loading-status) {
  scrollbar-width: thin;
  scrollbar-color: var(--os-faint) transparent;
}
input, select, textarea {
  color: var(--os-text);
  background: var(--os-card);
  border: 1px solid var(--os-edge);
  border-radius: 12px;
  box-shadow: inset 0 1px 2px #00151d15;
}
input::placeholder, textarea::placeholder { color: var(--os-faint); opacity: 1; }
option { background: var(--os-surface); color: var(--os-text); }

.glass, :root[data-theme="dark"] .glass {
  color: var(--os-text);
  background: linear-gradient(135deg, #c9fff307, transparent 45%), var(--os-glass);
  border: 1px solid var(--os-edge);
  box-shadow: var(--os-inner-edge), var(--os-shadow);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}

/* 02 — The world stays in view */
.world-topbar {
  left: max(24px, env(safe-area-inset-left));
  top: max(22px, env(safe-area-inset-top));
  border-radius: 19px;
  padding: 8px 17px 8px 9px;
  gap: 14px;
  max-width: calc(100% - 295px);
}
.world-topbar .mini-brand > span { color: var(--os-faint); font-size: 7px; letter-spacing: 1.8px; }
.world-topbar .mini-brand strong { color: var(--os-text); font-size: 14px; letter-spacing: .6px; margin-top: 3px; }
.world-topbar .mini-brand .brand-dot { color: var(--os-aqua); font-size: 7px; letter-spacing: 0; }
.world-topbar :is(.wallet, .audience, .icon-button) { color: var(--os-text); }
.world-topbar .wallet { font-size: 13px; font-variant-numeric: tabular-nums; }
.world-topbar .wallet :where(svg,.kinora-image-icon), .world-topbar .audience :where(svg,.kinora-image-icon) { color: var(--os-gold); }
.top-divider, .separator, .world-topbar .top-divider { background: var(--os-edge); }
.icon-button { border-radius: 11px; }
.icon-button:hover, #wall-mode:hover { background: var(--os-aqua-soft); color: var(--os-aqua); }
.world-clock { right: max(24px, env(safe-area-inset-right)); top: max(22px, env(safe-area-inset-top)); border-radius: 19px; padding: 10px 13px 10px 17px; gap: 12px; }
.world-clock strong { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.world-clock small { font-size: 9px; color: var(--os-muted); margin-top: 4px; }
.world-clock > :where(svg,.kinora-image-icon) { color: var(--os-gold); }
.camera-controls { top: auto; right: 24px; bottom: 139px; border-radius: 15px; padding: 6px; }
.camera-controls button { color: var(--os-muted); }
#wall-mode { font-size: 10px; padding: 0 10px; }
.camera-controls #follow-camera[aria-pressed="true"] { color: var(--os-aqua); background: var(--os-aqua-soft); box-shadow: inset 0 0 0 1px var(--os-edge); }
.life-dock { left: 24px; bottom: max(22px, env(safe-area-inset-bottom)); width: 374px; max-width: none; border-radius: 23px; padding: 14px 16px; grid-template-columns: 52px minmax(0, 1fr) 40px; gap: 0 13px; }
.life-dock .avatar { width: 52px; height: 59px; border-radius: 14px; overflow: visible; background: var(--os-raised); box-shadow: 0 0 0 1px var(--os-glint); }
.life-dock .avatar img { border-radius: 14px; }
.avatar > span { background: var(--os-aqua); color: var(--os-aqua-ink); border: 3px solid var(--glass-strong); font-size: 10px; }
.character-summary #player-title { font-size: 7px; letter-spacing: 1.4px; color: var(--os-faint); }
.character-summary strong { font-family: var(--os-display); font-weight: 400; font-size: 21px; letter-spacing: -.45px; color: var(--os-text); margin: 4px 0; }
.mood, :root[data-theme="dark"] .mood { color: var(--mint); font-size: 10px; }
.mood.low { color: var(--os-danger); }
.phone-launch { height: 44px; width: 38px; border-radius: 13px; border: 1px solid var(--os-edge); background: linear-gradient(135deg, #c6fff317, transparent), var(--os-aqua-soft); color: var(--os-aqua); box-shadow: inset 0 1px 0 var(--os-glint); }
.needs-grid { gap: 12px; margin-top: 15px; }
.need { gap: 7px; }
.need :where(svg,.kinora-image-icon) { color: var(--os-muted); width: 14px; height: 14px; }
.need-track { height: 3px; border-radius: 6px; background: var(--os-edge); }
.need-track > span { background: var(--os-aqua); border-radius: 6px; }
.need.low .need-track > span { background: var(--os-gold); }
.need.critical .need-track > span { background: var(--os-danger); }
.need-label { color: var(--os-text); border: 1px solid var(--os-edge); }
.action-dock { left: 416px; bottom: 22px; width: min(310px, calc(100vw - 630px)); transform: none; }
.activity-panel { border-radius: 17px; padding: 13px 16px; max-width: none; }
.activity-copy strong { font-weight: 600; font-size: 12px; }
.activity-copy small { font-size: 10px; line-height: 1.5; color: var(--os-muted); }
.activity-track { margin-top: 11px; height: 2px; background: var(--os-edge); }
.activity-track span { background: var(--os-aqua); }
#action-queue { bottom: 92px; gap: 7px; }
.queue-item { border-radius: 12px; background: var(--os-glass-heavy); border-color: var(--os-edge); color: var(--os-text); padding: 9px 11px; box-shadow: var(--os-inner-edge), 0 5px 20px #000b1830; }
.queue-item.active { border-color: var(--os-aqua); }
.time-dock { right: 24px; bottom: max(22px, env(safe-area-inset-bottom)); padding: 6px; border-radius: 16px; gap: 4px; }
.time-dock button { border-radius: 10px; width: 32px; height: 32px; color: var(--os-muted); }
.time-dock button.active { background: var(--os-aqua); color: var(--os-aqua-ink); box-shadow: 0 0 18px #70e2c31b; }
.controls-hint { right: 26px; bottom: 86px; font-size: 9px; color: #e5f5ef; text-shadow: 0 1px 8px #001b24; }
.story-beacon { right: 24px; top: 99px; border-radius: 16px; border-color: var(--os-edge); padding: 14px 16px; }
.story-beacon small { color: var(--os-muted); }
.aster-caption { left: 107px; top: 110px; color: #f2fff5; }
.aster-caption span { font-size: 8px; letter-spacing: 2px; }
.aster-caption strong { font-size: 34px; text-shadow: 0 3px 24px #001c26; }
.aster-caption p { font-size: 11px; color: #e2f5e8; text-shadow: 0 2px 12px #001c26; }
.toast { border-radius: 16px; padding: 13px 17px; border-color: var(--os-edge); background: var(--os-glass-heavy); color: var(--os-text); box-shadow: var(--os-inner-edge), var(--os-shadow); font-size: 12px; backdrop-filter: blur(18px); }
.toast.bad { color: var(--os-danger); border-color: var(--os-danger); }
#notifications { z-index: 80; }
#hover-label, .speech-bubble, .actor-label .name-tag, .actor-label.player .name-tag { background: var(--os-glass-heavy); color: var(--os-text); border: 1px solid var(--os-edge); box-shadow: 0 4px 20px #00151d30; }
.actor-label.player .name-tag { border-color: var(--os-aqua); }

/* 03 — One calm notebook rail, ten deeply connected views */
.aster-rail {
  left: 24px; top: 99px; bottom: 181px; width: 58px;
  padding: 7px; gap: 5px; border-radius: 20px;
  background: var(--os-glass); border: 1px solid var(--os-edge);
  box-shadow: var(--os-inner-edge), var(--os-shadow);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}
.aster-rail button { width: 42px; height: 42px; min-height: 42px; border-radius: 13px; border: 1px solid transparent; background: transparent; color: var(--os-muted); box-shadow: none; transition: background .18s, color .18s, border-color .18s; }
.aster-rail button:hover { background: var(--os-aqua-soft); color: var(--os-aqua); border-color: var(--os-edge); }
.aster-rail button[aria-pressed="true"] { background: linear-gradient(145deg, #d8fff119, transparent), var(--os-aqua-soft); color: var(--os-aqua); border-color: var(--os-aqua); box-shadow: inset 0 1px 0 var(--os-glint), 0 0 18px #70e2c314; }
.aster-rail :where(svg,.kinora-image-icon) { width: 19px; height: 19px; stroke-width: 1.5; }
.aster-rail button span { border: 1px solid var(--os-edge); background: var(--os-glass-heavy); color: var(--os-text); border-radius: 10px; padding: 9px 12px; }
.aster-sheet {
  left: 96px; top: 99px; bottom: 181px; width: min(456px, calc(100vw - 120px));
  border-radius: 24px; background: var(--os-glass-heavy); border: 1px solid var(--os-edge);
  box-shadow: var(--os-inner-edge), var(--os-shadow);
  backdrop-filter: blur(28px) saturate(1.15);
  -webkit-backdrop-filter: blur(28px) saturate(1.15);
  animation: liquid-sheet-in .3s var(--os-ease);
}
.aster-sheet-head { padding: 25px 27px 22px; border-bottom: 1px solid var(--os-edge); background: linear-gradient(125deg, var(--os-aqua-soft), transparent 70%); flex-shrink: 0; }
.aster-eyebrow { color: var(--os-gold); font-size: 8px; font-weight: 650; line-height: 1.5; letter-spacing: 1.8px; margin-bottom: 8px; }
.aster-sheet-head h2 { font-family: var(--os-display); font-size: 31px; font-weight: 400; letter-spacing: -.9px; line-height: 1.12; color: var(--os-text); padding-right: 25px; }
.aster-close { right: 19px; top: 21px; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: var(--os-aqua-soft); border: 1px solid var(--os-edge); color: var(--os-muted); font-size: 21px; }
.aster-close:hover { color: var(--os-aqua); background: var(--os-card-hover); }
.aster-sheet-body { padding: 22px 25px 28px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.aster-sheet p { color: var(--os-muted); font-size: 12px; line-height: 1.75; }
.aster-sheet h3 { color: var(--os-text); }
.aster-sheet a { color: var(--os-aqua); text-underline-offset: 4px; }
.aster-sheet :is(select, input, textarea) { background: var(--os-card); color: var(--os-text); border: 1px solid var(--os-edge); border-radius: 12px; padding: 12px; font-size: 12px; line-height: 1.5; }
.aster-sheet label { color: var(--os-muted); font-size: 11px; line-height: 1.5; margin-bottom: 7px; }
.aster-section-title { color: var(--os-muted); font-size: 9px; letter-spacing: 1.3px; margin: 24px 0 13px; }
.aster-tabs, .panel-tabs { padding: 4px; gap: 3px; background: var(--os-aqua-soft); border: 1px solid var(--os-edge); border-radius: 12px; }
.aster-tabs button, .panel-tabs button { background: transparent; color: var(--os-muted); border-radius: 8px; font-size: 10px; line-height: 1.5; padding: 8px 5px; }
.aster-tabs button.active, .panel-tabs button.active { background: var(--os-aqua); color: var(--os-aqua-ink); }
.aster-card { border-radius: 15px; background: var(--os-card); border: 1px solid var(--os-edge); padding: 16px; margin: 10px 0; }
.aster-card strong { color: var(--os-text); font-size: 13px; line-height: 1.5; font-weight: 600; }
.aster-card p { font-size: 11px; }
.aster-card small { color: var(--os-faint); font-size: 10px; line-height: 1.6; }
.aster-action { padding: 14px; border-radius: 13px; border: 1px solid var(--os-edge); background: var(--os-card); color: var(--os-text); font-size: 11px; line-height: 1.5; }
.aster-action:hover { background: var(--os-card-hover); border-color: var(--os-aqua); }
.aster-action .step { color: var(--os-aqua); background: var(--os-aqua-soft); width: 28px; height: 28px; border: 1px solid var(--os-edge); }
.aster-action .meta { color: var(--os-faint); font-size: 9px; }
.aster-primary, .primary-button, .hero-button { border: 1px solid #e4fff640; border-radius: 13px; background: var(--os-aqua); color: var(--os-aqua-ink); box-shadow: inset 0 1px 0 #ffffff50, 0 7px 22px #00171a25; font-size: 12px; font-weight: 700; padding: 14px 17px; }
.aster-primary:hover, .primary-button:hover, .hero-button:hover { filter: brightness(1.06); }
.aster-secondary, .secondary-button, .df-small-action { background: var(--os-card); color: var(--os-text); border: 1px solid var(--os-edge); border-radius: 11px; font-size: 11px; line-height: 1.5; padding: 10px 12px; }
.aster-secondary:hover, .secondary-button:hover, .df-small-action:hover { background: var(--os-card-hover); border-color: var(--os-aqua); }
.aster-budgets span, .aster-pill { color: var(--os-muted); background: var(--os-aqua-soft); border: 1px solid var(--os-edge); border-radius: 7px; padding: 7px 9px; font-size: 9px; line-height: 1.4; }
.aster-observation, .aster-plan { color: var(--os-text); background: var(--os-aqua-soft); border-left: 2px solid var(--os-gold); border-radius: 0 12px 12px 0; padding: 14px 16px; font-size: 11px; line-height: 1.7; }
.aster-observation .event { color: var(--os-gold); font-size: 8px; }
.aster-plan span, .aster-plan small { color: var(--os-muted); }
.aster-error { color: var(--os-danger) !important; background: var(--os-danger-soft); border: 1px solid color-mix(in srgb, var(--os-danger) 30%, transparent); border-radius: 12px; padding: 12px 14px; }
.aster-facts { color: var(--os-muted); gap: 8px 12px; font-size: 10px; line-height: 1.5; }
.aster-facts b { color: var(--os-text); }
.aster-memory { border-color: var(--os-edge); padding: 15px 0; }
.aster-memory time { color: var(--os-gold); font-size: 9px; }
.aster-memory p { font-size: 11px; }
.aster-stat { background: var(--os-aqua-soft); border: 1px solid var(--os-edge); border-radius: 12px; padding: 15px 9px; }
.aster-stat strong { color: var(--os-text); font-family: var(--os-display); font-size: 27px; }
.aster-stat span { color: var(--os-muted); font-size: 8px; line-height: 1.5; }
.aster-motion-list button { color: var(--os-text); border-color: var(--os-edge); font-size: 11px; padding: 13px 0; }
.aster-motion-list button small { color: var(--os-faint); font-size: 9px; line-height: 1.5; }
.aster-mini-map { background: var(--os-surface); border: 1px solid var(--os-edge); border-radius: 14px; }
.aster-sheet .status-line, .aster-record-label, .aster-input-hint { color: var(--os-faint); font-size: 10px; line-height: 1.6; }
.aster-sheet pre { color: var(--os-muted); font-size: 10px; line-height: 1.8; background: var(--os-aqua-soft); border-radius: 10px; padding: 12px; }
.aster-scene-receipt { color: var(--os-text); background: var(--os-glass-heavy); border-color: var(--os-edge); border-radius: 18px; padding: 19px 21px; box-shadow: var(--os-inner-edge), var(--os-shadow); }
.aster-scene-receipt small { color: var(--os-gold); }
.aster-scene-receipt strong { font-family: var(--os-display); }
.aster-scene-receipt p { color: var(--os-muted); }
.aster-scene-receipt button { color: var(--os-aqua); border-color: var(--os-edge); background: var(--os-aqua-soft); border-radius: 9px; padding: 9px 12px; }

/* 04 — Homes, belongings, people, and the traces they leave */
.df-feature-card { background: radial-gradient(ellipse at 100% 0, #8cedd515, transparent 70%), var(--os-card); border: 1px solid var(--os-edge); border-radius: 18px; padding: 23px 21px; margin-bottom: 19px; box-shadow: inset 0 1px 0 var(--os-glint); }
.df-feature-card::after { color: color-mix(in srgb, var(--os-aqua) 12%, transparent); font-size: 123px; top: -18px; right: -12px; }
.df-feature-card h3 { color: var(--os-text); font-family: var(--os-display); font-size: 28px; letter-spacing: -.6px; line-height: 1.12; margin: 10px 0 16px; }
.df-feature-card p { color: var(--os-muted); font-size: 11px; line-height: 1.8; }
.df-feature-card.dark { background: radial-gradient(ellipse at top right, #a6e5ca20, transparent 75%), var(--os-deep); color: var(--os-text); border-color: var(--os-edge); }
.df-feature-card.dark h3 { color: var(--os-text); }
.df-feature-card.dark .aster-eyebrow { color: var(--os-gold); }
.df-feature-card.dark p { color: var(--os-muted); }
.df-feature-card.dark::after { color: color-mix(in srgb, var(--os-gold) 13%, transparent); }
.df-metrics { border-color: var(--os-edge); gap: 10px; padding-top: 18px; }
.df-metrics b { font-family: var(--os-display); color: var(--os-text); font-size: 28px; font-variant-numeric: tabular-nums; }
.df-metrics span { color: var(--os-faint); font-size: 8px; letter-spacing: .8px; line-height: 1.5; }
.df-action-cluster { gap: 7px; margin: 13px 0 19px; }
.df-home-card { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; border-color: var(--os-edge); padding-top: 20px; }
:is(.df-home-card, .df-lot, .df-circle, .df-learned-card) h3 { color: var(--os-text); font-family: var(--os-display); font-size: 22px; line-height: 1.18; letter-spacing: -.35px; }
.df-home-card p, .df-lot p, .df-circle p { color: var(--os-muted); font-size: 11px; }
.df-home-drawing { width: 48px; height: 53px; font-size: 37px; border: 1px solid var(--os-edge); border-radius: 14px; color: var(--os-aqua); background: linear-gradient(140deg, var(--os-aqua-soft), transparent), var(--os-card); }
.df-home-card .aster-eyebrow { font-size: 8px; letter-spacing: 1.1px; }
.df-inventory-header { color: var(--os-text); background: radial-gradient(ellipse at 100% 0, #e9cc9740, transparent 75%), var(--os-card); border: 1px solid var(--os-edge); border-radius: 18px; padding: 23px; box-shadow: inset 0 1px 0 var(--os-glint); }
.df-inventory-header span { color: var(--os-gold); font-size: 9px; letter-spacing: 1.5px; }
.df-inventory-header b { color: var(--os-text); font-family: var(--os-display); font-size: 44px; }
.df-inventory-header small { color: var(--os-muted); }
.df-lot { background: var(--os-card); border: 1px solid var(--os-edge); border-radius: 15px; padding: 17px; grid-template-columns: 35px minmax(0, 1fr); }
.df-lot.flagged { background: color-mix(in srgb, var(--os-gold) 9%, var(--os-surface)); border-color: color-mix(in srgb, var(--os-gold) 50%, transparent); }
.df-lot-icon { color: var(--os-gold); background: var(--os-aqua-soft); border: 1px solid var(--os-edge); border-radius: 10px; height: 37px; width: 35px; }
.df-lot h3 { font-size: 20px; }
.df-trace-note { color: var(--os-faint) !important; font-size: 10px !important; }
.df-ledger { border-color: var(--os-edge); color: var(--os-muted); padding: 17px 0; margin-top: 18px; }
.df-ledger summary, .df-learned-card summary { color: var(--os-text); font-size: 11px; line-height: 1.6; padding: 3px 0; }
.df-ledger p { color: var(--os-muted); font-size: 11px; }
.df-circle { border-color: var(--os-edge); padding: 19px 0; gap: 14px; }
.df-circle-mark { border-color: var(--os-surface); border-width: 4px; }
.df-circle small, .df-town-event small { color: var(--os-faint); font-size: 9px; line-height: 1.5; }
.df-map-head h3 { font-family: var(--os-display); color: var(--os-text); font-size: 31px; margin: 7px 0 19px; }
.df-atlas { border: 1px solid var(--os-edge); border-radius: 16px; box-shadow: inset 0 1px 0 var(--os-glint); }
.df-map-legend { color: var(--os-muted); font-size: 9px; line-height: 1.5; margin: 12px 0 18px; flex-wrap: wrap; }
.df-live-skills #df-live-status { background: var(--os-aqua-soft); color: var(--os-muted); border-left: 2px solid var(--os-gold); padding: 13px 15px; border-radius: 0 11px 11px 0; }
.df-learned-card { background: var(--os-card); color: var(--os-text); border-color: var(--os-edge); border-radius: 16px; padding: 19px; }
.df-learned-card details { border-color: var(--os-edge); }
.df-town-event { border-color: var(--os-edge); padding: 15px 0; }

/* 05 — A phone that belongs to this world */
#drawer {
  right: 24px; bottom: 88px; width: 338px; max-height: calc(100dvh - 183px);
  display: flex; flex-direction: column;
  background: var(--phone-bg); color: var(--os-text); border: 5px solid var(--os-deep);
  outline: 1px solid var(--os-glint); border-radius: 38px;
  box-shadow: inset 0 0 0 1px var(--os-edge), 0 25px 85px #000d1a88, 0 2px 4px #dcfff71c;
  animation: liquid-device-in .35s var(--os-ease);
}
.device-top { height: 32px; min-height: 32px; padding: 0 20px; color: var(--os-muted); font-size: 9px; }
.device-camera { top: 5px; width: 82px; height: 20px; border-radius: 20px; background: var(--os-night); border: 1px solid var(--os-edge); }
.device-signal { color: var(--os-muted); }
.drawer-header { padding: 16px 20px 16px; border-bottom: 1px solid var(--os-edge); background: linear-gradient(125deg, var(--os-aqua-soft), transparent); flex-shrink: 0; }
.drawer-header h2 { color: var(--os-text); font-family: var(--os-display); font-weight: 400; font-size: 27px; letter-spacing: -.7px; }
.drawer-header .eyebrow { color: var(--os-gold); font-size: 8px; letter-spacing: 1.5px; }
.drawer-header .icon-button { background: var(--os-aqua-soft); border: 1px solid var(--os-edge); color: var(--os-muted); width: 30px; height: 30px; }
#drawer-body { padding: 18px 19px 22px; min-height: 0; max-height: none; flex: 1; overscroll-behavior: contain; }
.device-home { min-height: 4px; height: 4px; width: 88px; background: var(--os-muted); margin: 7px auto 10px; opacity: .7; }
.phone-wallpaper { border: 1px solid var(--os-edge); border-radius: 22px; padding: 20px; margin-bottom: 22px; background: radial-gradient(ellipse at 92% 0, #acd8c53b, transparent 65%), radial-gradient(ellipse at 0 100%, #7695cc2b, transparent 75%), var(--os-surface); box-shadow: inset 0 1px 0 var(--os-glint); }
.phone-wallpaper h3 { color: var(--os-text); font-family: var(--os-display); font-size: 28px; font-weight: 400; margin-bottom: 8px; }
.phone-wallpaper p { color: var(--os-muted); font-size: 10px; line-height: 1.7; }
.phone-apps { gap: 20px 10px; }
.phone-app { color: var(--os-muted); font-size: 10px; gap: 8px; }
.app-icon { width: 52px; height: 52px; border-radius: 17px; border: 1px solid #e5fff742; background: linear-gradient(140deg, #f3fff12e, #081b241a), var(--app-color, #3f7f77); color: #f4fff9; box-shadow: inset 0 1px 0 #ffffff52, inset 0 -2px 2px #09272e2b, 0 7px 16px #00171e26; }
.app-icon :where(svg,.kinora-image-icon) { width: 23px; height: 23px; }
.phone-dock { border-radius: 19px; background: var(--os-aqua-soft); border: 1px solid var(--os-edge); margin-top: 23px; padding: 11px; }
.phone-dock button { background: var(--os-card); color: var(--os-aqua); border: 1px solid var(--os-edge); border-radius: 12px; }
.phone-back { color: var(--os-aqua); margin: 0 0 15px; font-size: 11px; }
.phone-active, .phone-option, .district-card, .resident-message { background: var(--os-card); border: 1px solid var(--os-edge); border-radius: 15px; padding: 14px; color: var(--os-text); }
.phone-option { margin-bottom: 9px; }
.phone-option strong { color: var(--os-text); font-size: 12px; font-weight: 600; }
.phone-option small, .phone-active small { color: var(--os-muted); font-size: 10px; line-height: 1.6; }
.phone-option:hover { background: var(--os-card-hover); }
.phone-contact { border-color: var(--os-edge); padding: 13px 0; }
.contact-avatar { background: var(--os-aqua-soft); color: var(--os-aqua); border: 1px solid var(--os-edge); border-radius: 13px; }
.phone-contact button { background: var(--os-aqua); color: var(--os-aqua-ink); padding: 9px 11px; border-radius: 11px; }
.device-note, .panel-intro, .inline-note, .muted { color: var(--os-muted); font-size: 11px; line-height: 1.75; }
.panel-section { color: var(--os-gold); font-size: 9px; letter-spacing: 1.25px; }
.stat-row { border-color: var(--os-edge); padding: 17px 0; }
.stat-row strong { font-family: var(--os-display); font-weight: 400; color: var(--os-text); font-size: 26px; }
.stat-row small { color: var(--os-faint); font-size: 8px; }
.settings-row { color: var(--os-text); border-color: var(--os-edge); padding: 15px 0; font-size: 12px; line-height: 1.5; }
.settings-row select { background: var(--os-card); color: var(--os-text); padding: 10px; width: 145px; }
.recipe-facts span, .badge { color: var(--os-muted); background: var(--os-aqua-soft); border: 1px solid var(--os-edge); }
.room-code, .house-tier { color: var(--os-text); background: var(--os-card); border: 1px solid var(--os-edge); }
.shop-item, .recipe-item, .goal-item, .person-detail, .feed-item, .room-member { border-color: var(--os-edge); }
.shop-item button, .small-button { color: var(--os-aqua); background: var(--os-aqua-soft); border: 1px solid var(--os-edge); border-radius: 10px; }
.item-thumb { background: var(--os-aqua-soft); color: var(--os-aqua); border: 1px solid var(--os-edge); }
.item-info small, .feed-item small, .person-detail, .house-tier p { color: var(--os-muted); }
.text-button { color: var(--os-muted); }
.text-button:hover { color: var(--os-aqua); }
.resident-message { border-left: 2px solid var(--os-gold); border-radius: 0 13px 13px 0; }
.resident-message p { color: var(--os-muted); line-height: 1.7; }
.follow-through { border-left: 2px solid var(--os-aqua); }

#drawer[data-surface="settings"], #drawer[data-surface="stories"] {
  left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%, -50%);
  width: min(464px, calc(100vw - 40px)); max-height: calc(100dvh - 48px);
  border-radius: 27px; border: 1px solid var(--os-edge); outline: none;
  background: var(--os-glass-heavy); box-shadow: var(--os-inner-edge), var(--os-shadow);
  backdrop-filter: blur(28px); animation: none;
}
#drawer[data-surface="settings"] .drawer-header, #drawer[data-surface="stories"] .drawer-header { padding: 23px 27px 21px; }
#drawer[data-surface="settings"] #drawer-body, #drawer[data-surface="stories"] #drawer-body { max-height: none; padding: 14px 27px 28px; }
body:has(#drawer:is([data-surface="settings"], [data-surface="stories"]):not([hidden])) .pause-card { visibility: hidden; }
#drawer[data-surface="monitor"] { width: 440px; border: 6px solid var(--os-deep); outline: 1px solid var(--os-glint); border-radius: 25px; background: var(--os-glass-heavy); }
#drawer[data-surface="monitor"] .drawer-header { background: var(--os-aqua-soft); border-color: var(--os-edge); }
#drawer[data-surface="monitor"] #drawer-body { max-height: none; }
#drawer[data-surface="build"] { left: 416px; right: 200px; bottom: 22px; max-height: 300px; width: auto; border: 1px solid var(--os-edge); outline: none; border-radius: 23px; background: var(--os-glass-heavy); box-shadow: var(--os-inner-edge), var(--os-shadow); }
#drawer[data-surface="build"] .drawer-header { padding: 16px 20px 12px; border-bottom: 0; background: transparent; }
#drawer[data-surface="build"] #drawer-body { padding: 0 20px 16px; max-height: 235px; }
.build-card { color: var(--os-text); background: var(--os-card); border: 1px solid var(--os-edge); border-radius: 15px; padding: 14px; }
.build-card .item-thumb { background: var(--os-aqua-soft); }
.build-card b { color: var(--os-aqua); }
#drawer[data-surface="recipe"] { width: 300px; border: 1px solid var(--os-edge); outline: none; background: var(--os-glass-heavy); border-radius: 24px; }
.recipe-preview { background: var(--os-aqua-soft); border: 1px solid var(--os-edge); border-radius: 13px; }
.recipe-description h3 { font-family: var(--os-display); font-size: 29px; font-weight: 400; color: var(--os-text); }

/* 06 — Action sheets, conversation, and world feedback */
.radial .context-heading, .radial .action-option, .radial .context-categories button, .radial .context-footer button { background: var(--os-glass-heavy); color: var(--os-text); border: 1px solid var(--os-edge); box-shadow: var(--os-inner-edge), 0 10px 30px #00121d3d; }
.radial .context-heading { border-radius: 22px; }
.radial .action-option { border-radius: 16px; }
.radial .action-option:hover { background: var(--os-card-hover); border-color: var(--os-aqua); }
.radial .action-option small, .radial .context-person small { color: var(--os-muted); }
.radial .action-icon { background: var(--os-aqua-soft); color: var(--os-aqua); border-radius: 10px; }
.radial .context-categories button.active { background: var(--os-aqua); color: var(--os-aqua-ink); }
.radial .context-heading .context-close { background: var(--os-surface); color: var(--os-muted); border: 1px solid var(--os-edge); }
.conversation-card { background: var(--os-glass-heavy); color: var(--os-text); border: 1px solid var(--os-edge); border-radius: 20px; box-shadow: var(--os-inner-edge), var(--os-shadow); backdrop-filter: blur(20px); }
.conversation-card p { color: var(--os-text); }
.conversation-card small { color: var(--os-muted); }
#build-hint { border-radius: 17px; }
#tournament { border-color: var(--os-deep); border-radius: 25px; background: var(--os-deep); outline: 1px solid var(--os-edge); }
.monitor-bezel { background: radial-gradient(ellipse at top, #a5f4de13, transparent), var(--os-deep); color: var(--os-text); padding: 23px; }
.monitor-bezel h2 { color: var(--os-text); font-family: var(--os-display); font-size: 28px; font-weight: 400; }
.monitor-bezel p, .monitor-bezel .text-button { color: var(--os-muted); }
.monitor-bezel .eyebrow { color: var(--os-gold); }
.monitor-bezel .hero-button { background: var(--os-aqua); color: var(--os-aqua-ink); }
.timing-field { background: var(--os-raised); border: 1px solid var(--os-edge); border-radius: 12px; }
.timing-zone { background: var(--os-aqua); }

/* 07 — Coming home: title, household creation, and pause */
:root[data-theme] .title-shade { background: linear-gradient(90deg, var(--os-night) 0%, color-mix(in srgb, var(--os-night) 95%, transparent) 23%, color-mix(in srgb, var(--os-night) 65%, transparent) 40%, transparent 68%), linear-gradient(0deg, #00131b73, transparent 27%); }
.title-content { left: max(6.5vw, 28px); top: 49%; transform: translateY(-50%); width: 395px; max-height: calc(100dvh - 100px); overflow: auto; scrollbar-width: none; color: var(--os-text); padding: 8px 8px 15px 0; }
.title-seal { color: var(--os-aqua); gap: 10px; margin-bottom: 25px; }
.title-seal span { font-size: 8px; letter-spacing: 2.6px; }
.title-seal :where(svg,.kinora-image-icon) { width: 15px; height: 15px; }
:root[data-theme] .title-content h1 > span { font-family: var(--os-wordmark); color: var(--os-text); font-size: clamp(78px, 7.2vw, 112px); font-weight: 900; letter-spacing: -.07em; line-height: .86; transform: none; text-shadow: 0 2px 0 #c8ffee12; margin: 0 0 0 -4px; }
.title-star { color: var(--os-gold); font-size: .26em; font-weight: 400; position: relative; left: 5px; top: -5px; transform: none; text-shadow: none; }
:root[data-theme] .title-content h1 > strong { display: block; width: fit-content; font-family: inherit; font-size: 9px; font-weight: 500; line-height: 1.5; letter-spacing: 4px; margin: 25px 0 0; padding: 0; color: var(--os-aqua); background: none; border: 0; border-radius: 0; transform: none; box-shadow: none; text-shadow: none; }
:root[data-theme] .title-tagline { color: var(--os-muted); font-size: 14px; font-weight: 400; line-height: 1.7; max-width: 320px; margin: 23px 0 0; }
.title-actions { width: 308px; gap: 6px; margin-top: 29px; }
:root[data-theme] .title-actions .hero-button, :root[data-theme] .title-actions:has(#continue-game[hidden]) #new-household { padding: 17px 20px; border-radius: 16px; border: 1px solid #e4fff640; background: var(--os-aqua); color: var(--os-aqua-ink); box-shadow: inset 0 1px 0 #ffffff50, 0 10px 30px #00171a24; font-size: 14px; font-weight: 700; }
:root[data-theme] .title-actions .hero-button small { color: var(--os-aqua-ink); opacity: .75; font-size: 8px; letter-spacing: 1.6px; margin-bottom: 5px; }
:root[data-theme] .title-actions .hero-button:hover { background: var(--os-aqua); transform: translateY(-1px); filter: brightness(1.06); }
.title-link { border: 1px solid transparent; border-radius: 12px; padding: 12px 14px; font-size: 12px; font-weight: 500; color: var(--os-text); background: transparent; }
.title-link span { opacity: 1; }
.title-link > :where(svg,.kinora-image-icon) { color: var(--os-muted); width: 16px; height: 16px; }
.title-link:hover { background: var(--os-aqua-soft); border-color: var(--os-edge); }
.title-save { margin-top: 19px; gap: 9px; }
.title-save small { color: var(--os-faint); font-size: 10px; line-height: 1.6; max-width: 275px; }
.title-save .save-indicator, .save-indicator { background: var(--os-aqua); box-shadow: 0 0 0 3px var(--os-aqua-soft); }
.title-location { top: 27px; right: 28px; padding: 13px 16px; border-radius: 16px; border: 1px solid var(--os-edge); background: var(--os-glass); color: var(--os-text); box-shadow: var(--os-inner-edge), var(--os-shadow); backdrop-filter: blur(18px); }
.title-location > span:not(.location-dot) { color: var(--os-text); letter-spacing: 2px; font-size: 9px; }
.title-location small { color: var(--os-muted); font-size: 9px; }
.location-dot { background: var(--os-aqua); box-shadow: 0 0 12px #a3f2dc40; }
.title-corner { left: max(6.5vw, 28px); bottom: max(25px, env(safe-area-inset-bottom)); right: 28px; color: var(--os-muted); font-size: 8px; letter-spacing: 1.8px; }
.title-corner span:last-child { color: var(--os-muted); border: 1px solid var(--os-edge); border-radius: 8px; padding: 7px 10px; background: var(--os-glass); }
.welcome-wrap, .pause-wrap { background: #00141d73; backdrop-filter: blur(7px) saturate(.85); }
.welcome-card, .pause-card { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(432px, calc(100vw - 36px)); max-height: calc(100dvh - 40px); padding: 32px; border: 1px solid var(--os-edge); border-radius: 28px; color: var(--os-text); background: var(--os-glass-heavy); box-shadow: var(--os-inner-edge), var(--os-shadow); }
.welcome-card h2, .pause-card h2 { color: var(--os-text); font-family: var(--os-display); font-size: 36px; font-weight: 400; letter-spacing: -1px; line-height: 1.1; }
.welcome-card p, .pause-card p { color: var(--os-muted); font-size: 12px; line-height: 1.8; }
.welcome-card .eyebrow { color: var(--os-gold); letter-spacing: 1.6px; margin-bottom: 12px; }
.welcome-card label { color: var(--os-muted); font-size: 11px; margin-top: 20px; }
.welcome-card input, .welcome-card select { background: var(--os-card); border-color: var(--os-edge); color: var(--os-text); font-size: 12px; padding: 12px; }
.welcome-card .hero-button { margin-top: 25px; }
.welcome-card > small { color: var(--os-faint); line-height: 1.6; font-size: 10px; }
.close-corner { background: var(--os-aqua-soft); color: var(--os-muted); border: 1px solid var(--os-edge); border-radius: 50%; right: 18px; top: 18px; }
.swatches { gap: 10px; }
.swatch { width: 32px; height: 32px; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--os-edge); }
.swatch.selected { border-color: var(--os-surface); outline: 2px solid var(--os-aqua); }
.pause-cap { margin-bottom: 27px; color: var(--os-gold); font-size: 9px; letter-spacing: 1.8px; }
.pause-card .hero-button { margin: 27px 0 15px; padding: 16px 19px; border-radius: 14px; }
.menu-row { padding: 16px 10px; border-radius: 12px; color: var(--os-text); border-bottom-color: var(--os-edge); font-size: 12px; }
.menu-row :where(svg,.kinora-image-icon) { color: var(--os-muted); }
.menu-row:hover { background: var(--os-aqua-soft); }
.pause-footer { border-color: var(--os-edge); margin-top: 24px; padding-top: 20px; gap: 9px; }
.pause-footer small { color: var(--os-faint); line-height: 1.5; }
.pause-footer kbd { color: var(--os-muted); background: var(--os-aqua-soft); border: 1px solid var(--os-edge); border-radius: 6px; padding: 4px 5px; }

/* 08 — Real boot stages, never an estimated loading animation */
#loading, :root[data-theme="dark"] #loading {
  display: flex; flex-direction: column; align-items: stretch; justify-content: space-between;
  position: absolute; inset: 0; z-index: 90; overflow: auto; text-align: left;
  padding: max(28px, env(safe-area-inset-top)) max(40px, env(safe-area-inset-right)) max(23px, env(safe-area-inset-bottom)) max(40px, env(safe-area-inset-left));
  color: var(--os-text); background: var(--os-night); isolation: isolate;
}
.loading-aura { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.loading-aura::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 22% 53%, #55c5a31c, transparent 48%), radial-gradient(ellipse at 88% 15%, #456da42b, transparent 50%), linear-gradient(145deg, transparent 40%, #65bca708, transparent 75%); }
.loading-aura span { position: absolute; width: 63vw; height: 63vw; border: 1px solid #a3e4d40d; border-radius: 43%; top: 20%; left: -21%; transform: rotate(-20deg); box-shadow: inset 0 0 70px #9be7d005; }
.loading-aura span:nth-child(2) { width: 74vw; height: 74vw; top: 12%; left: -25%; transform: rotate(8deg); border-color: #a3e4d409; }
.loading-aura span:nth-child(3) { width: 49vw; height: 49vw; top: 27%; left: -14%; transform: rotate(37deg); border-color: #c9ffed12; background: linear-gradient(135deg, #a3f2dc03, transparent 60%); }
.loading-topline { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 20px; }
.loading-brand { display: flex; align-items: center; gap: 12px; color: var(--os-text); font-size: 12px; font-weight: 700; letter-spacing: 2px; }
.loading-brand-mark { position: relative; display: grid; place-items: center; width: 37px; height: 40px; background: linear-gradient(135deg, #d0fff228, #a3f2dc06); border: 1px solid var(--os-edge); color: var(--os-aqua); border-radius: 12px; font-family: var(--os-wordmark); font-size: 28px; font-weight: 900; letter-spacing: -3px; padding-right: 3px; box-shadow: inset 0 1px 0 var(--os-glint); }
.loading-brand-mark > span { position: absolute; font-size: 12px; right: 2px; top: 2px; color: var(--os-gold); letter-spacing: 0; }
#loading .loading-brand small { display: block; margin-top: 5px; color: var(--os-faint); font-size: 6px; letter-spacing: 1.8px; font-weight: 500; }
.loading-runtime { display: flex; align-items: center; gap: 8px; color: var(--os-faint); font-size: 8px; letter-spacing: 1.5px; border: 1px solid var(--os-edge); border-radius: 30px; padding: 10px 14px; background: var(--os-aqua-soft); }
.runtime-light { display: block; height: 5px; width: 5px; border: 1px solid var(--os-aqua); border-radius: 50%; }
.loading-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); gap: clamp(36px, 7vw, 120px); align-items: center; width: min(1100px, 100%); margin: 33px auto; }
.loading-story { padding: 8px 0 0 8px; }
.loading-overline { display: block; color: var(--os-gold); font-size: 8px; letter-spacing: 2.2px; margin-bottom: 29px; }
.loading-story h1 { color: var(--os-text); font-family: var(--os-wordmark); font-size: clamp(84px, 10vw, 152px); font-weight: 900; letter-spacing: -.075em; line-height: .83; margin: 0 0 25px -6px; }
.loading-story h1 > span { display: inline-block; position: relative; top: -.15em; left: .12em; font-weight: 400; font-size: .27em; color: var(--os-gold); letter-spacing: -.07em; }
#loading .loading-tagline { font-family: var(--os-display); font-size: clamp(26px, 3.3vw, 42px); line-height: 1.15; letter-spacing: -1px; color: var(--os-text); margin: 31px 0 0; }
.loading-tagline em { font-weight: 400; color: var(--os-aqua); }
.loading-world-note { display: flex; align-items: center; gap: 13px; border-top: 1px solid var(--os-edge); margin-top: 34px; padding-top: 23px; width: fit-content; min-width: 238px; }
.loading-world-note > span { display: grid; place-items: center; width: 36px; height: 36px; color: var(--os-aqua); border: 1px solid var(--os-edge); border-radius: 12px; font-size: 28px; font-family: var(--os-display); background: var(--os-aqua-soft); }
#loading .loading-world-note p { margin: 0; color: var(--os-muted); font-size: 11px; line-height: 1.65; }
.loading-status { padding: 27px 29px 19px; border-radius: 27px; background: linear-gradient(135deg, #d0fff209, transparent 65%), var(--os-glass); border: 1px solid var(--os-edge); box-shadow: var(--os-inner-edge), var(--os-shadow); backdrop-filter: blur(24px); }
.loading-status-cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--os-gold); font-size: 8px; letter-spacing: 1.6px; }
.loading-status-cap strong { color: var(--os-aqua); font-family: inherit; font-size: 11px; font-weight: 500; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
#loading h2 { color: var(--os-text); font-family: var(--os-display); font-weight: 400; font-size: 31px; line-height: 1.1; letter-spacing: -.8px; margin: 18px 0 12px; }
#loading #loading-copy { color: var(--os-muted); min-height: 37px; margin: 0; font-size: 11px; line-height: 1.65; max-width: 340px; }
#loading .loading-track { width: 100%; height: 3px; background: var(--os-edge); border-radius: 8px; margin: 20px 0 0; overflow: hidden; }
#loading #loading-progress { height: 100%; display: block; width: 0; background: var(--os-aqua); border-radius: inherit; transform: none; animation: none; transition: width .22s ease; }
.loading-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 11px 0 18px; }
#loading #loading-stage { color: var(--os-faint); font-size: 7px; font-weight: 500; letter-spacing: 1.2px; line-height: 1.6; margin: 0; }
#loading #loading-elapsed { color: var(--os-faint); font-size: 8px; letter-spacing: .3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.loading-milestones { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--os-edge); }
.loading-milestones li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; position: relative; padding: 12px 0; border-bottom: 1px solid var(--os-edge); }
.loading-milestones li:last-child { border-bottom: 0; }
.loading-step-number { width: 25px; height: 25px; display: grid; place-items: center; font-size: 8px; font-variant-numeric: tabular-nums; color: var(--os-faint); border: 1px solid var(--os-edge); border-radius: 9px; }
.loading-milestones strong { font-size: 12px; font-weight: 500; color: var(--os-muted); }
#loading .loading-milestones small { display: block; color: var(--os-faint); font-size: 9px; font-weight: 400; letter-spacing: 0; line-height: 1.5; margin-top: 3px; }
.loading-milestones [data-phase-state] { color: var(--os-faint); font-size: 8px; letter-spacing: .1px; }
.loading-milestones [data-state="active"] strong, .loading-milestones [data-state="active"] [data-phase-state] { color: var(--os-aqua); }
.loading-milestones [data-state="active"] .loading-step-number { color: var(--os-aqua); border-color: var(--os-aqua); background: var(--os-aqua-soft); box-shadow: 0 0 18px #6fe5c51a; }
.loading-milestones [data-state="complete"] .loading-step-number { font-size: 0; color: var(--os-aqua); border-color: var(--os-edge); background: var(--os-aqua-soft); }
.loading-milestones [data-state="complete"] .loading-step-number::after { content: "✓"; font-size: 11px; }
.loading-milestones [data-state="complete"] [data-phase-state] { color: var(--os-aqua); }
.loading-milestones [data-state="failed"] .loading-step-number, .loading-milestones [data-state="failed"] [data-phase-state] { color: var(--os-danger); border-color: var(--os-danger); }
.loading-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-shrink: 0; }
#loading .loading-footer p { color: var(--os-muted); font-family: var(--os-display); font-style: italic; font-size: 13px; margin: 0; }
.loading-footer > span { color: var(--os-faint); font-size: 7px; letter-spacing: 1.6px; }

/* 09 — A recoverable failure has the same care as a successful opening */
#game:has(#error:not([hidden])), :root[data-theme="dark"] #game:has(#error:not([hidden])) { background: radial-gradient(ellipse at 75% 12%, #7bceb21a, transparent 65%), var(--os-night); }
#error { width: min(476px, calc(100vw - 32px)); padding: 33px; border-radius: 28px; color: var(--os-text); background: var(--os-glass-heavy); border: 1px solid var(--os-edge); box-shadow: var(--os-inner-edge), var(--os-shadow); }
#error > .eyebrow { color: var(--os-gold); font-size: 8px; letter-spacing: 1.7px; }
#error h2 { color: var(--os-text); font-family: var(--os-display); font-weight: 400; font-size: 34px; letter-spacing: -.8px; margin: 15px 0; line-height: 1.1; }
#error p { color: var(--os-muted); line-height: 1.75; font-size: 12px; }
#error-stage { color: var(--os-faint); font-size: 10px; line-height: 1.6; }
#error .hero-button { border-radius: 13px; margin-top: 23px; }
#error .secondary-button { border-radius: 13px; }
.recovery-actions .text-button { color: var(--os-aqua); font-size: 11px; }
.startup-details { border-color: var(--os-edge); color: var(--os-muted); font-size: 11px; padding-top: 17px; }
.startup-details summary { font-weight: 500; }
.startup-details pre { color: var(--os-muted); background: var(--os-aqua-soft); border: 1px solid var(--os-edge); border-radius: 12px; padding: 14px; font-size: 10px; }

/* 10 — Inspection uses an actual captured room, explicitly not a live world */
body.interface-inspection { background: var(--os-night); }
.interface-inspection #game { position: relative; background: radial-gradient(ellipse at 82% 11%, #7acebc1b, transparent 58%), var(--os-night); }
.inspection-context { position: absolute; inset: 105px 5vw 86px 605px; display: flex; flex-direction: column; justify-content: center; gap: 29px; color: var(--os-text); }
.inspection-world { position: relative; margin: 0; width: 100%; max-width: 600px; aspect-ratio: 1.9; border-radius: 26px; overflow: hidden; border: 1px solid var(--os-glint); box-shadow: var(--os-inner-edge), 0 20px 70px #000d1a55; background: var(--os-surface); }
.inspection-world img { display: block; height: 100%; width: 100%; object-fit: cover; object-position: 50% 52%; }
.inspection-world::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, #071d25d9, transparent 48%); pointer-events: none; }
.inspection-world figcaption { position: absolute; left: 21px; right: 21px; bottom: 18px; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; color: #e7f7ed; font-size: 8px; line-height: 1.6; }
.inspection-world figcaption strong { display: block; font-weight: 500; font-size: 10px; letter-spacing: 1.3px; }
.inspection-world figcaption span:last-child { color: #cee1dc; font-size: 8px; text-align: right; }
.inspection-copy { max-width: 490px; }
.inspection-copy .aster-eyebrow { margin-bottom: 15px; color: var(--os-aqua); }
.inspection-context h1 { font-family: var(--os-wordmark); font-size: clamp(32px, 4.7vw, 64px); line-height: 1; font-weight: 900; letter-spacing: -.07em; margin: 0 0 12px -3px; color: var(--os-text); }
.inspection-context .inspection-motto { color: var(--os-text); font-family: var(--os-display); font-style: italic; font-size: 24px; line-height: 1.3; letter-spacing: -.6px; margin: 0 0 17px; }
.inspection-context p { color: var(--os-muted); font-size: 12px; line-height: 1.85; max-width: 420px; margin: 0 0 16px; }
.inspection-mode-note { border-left: 2px solid var(--os-gold); padding-left: 14px; color: var(--os-faint) !important; font-size: 10px !important; margin-top: 19px !important; }
.inspection-label { position: absolute; left: 24px; top: 22px; padding: 13px 17px; border: 1px solid var(--os-edge); border-radius: 18px; background: var(--os-glass); color: var(--os-text); box-shadow: var(--os-inner-edge), var(--os-shadow); font-size: 10px; letter-spacing: 1.2px; line-height: 1.4; }
.inspection-label span { display: block; color: var(--os-muted); font-size: 8px; letter-spacing: .1px; margin-top: 5px; }
.inspection-mode { position: absolute; top: 31px; right: 5vw; color: var(--os-faint); border: 1px solid var(--os-edge); border-radius: 30px; padding: 10px 14px; font-size: 9px; letter-spacing: .3px; background: var(--os-aqua-soft); }
.inspection-footer { position: absolute; left: 96px; right: 5vw; bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--os-faint); font-size: 10px; }
.inspection-footer a { color: var(--os-aqua); text-decoration: none; }
.inspection-footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
.inspection-footer-links { display: flex; gap: 22px; }
.interface-inspection .aster-sheet { bottom: 72px; }
.interface-inspection .aster-rail { bottom: 72px; }
.interface-inspection .aster-caption { display: none !important; }
.interface-inspection #notifications { left: auto; right: 24px; top: 90px; transform: none; max-width: 320px; z-index: 80; }

/* 11 — Motion, layer discipline, and device sizes */
@keyframes liquid-sheet-in { from { opacity: 0; transform: translateY(9px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes liquid-device-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
body:has(:is(#loading, #error, #pause-menu):not([hidden])) :is(.aster-rail, .aster-sheet, .aster-caption, .aster-scene-receipt) { visibility: hidden; pointer-events: none; }
body:has(#loading:not([hidden])) #world { visibility: hidden; }

@media (min-width: 1500px) {
  .title-content { width: 430px; }
  .title-actions { width: 326px; }
  .aster-sheet { width: 478px; }
  .inspection-context { left: 650px; right: 7vw; }
}
@media (max-width: 1100px) {
  .world-topbar { gap: 11px; }
  .world-topbar .audience { display: none; }
  .life-dock { width: 340px; }
  .action-dock { left: 382px; width: calc(100vw - 590px); }
  #drawer[data-surface="build"] { left: 382px; right: 24px; bottom: 88px; }
  .title-content { left: 5vw; }
  .title-corner { left: 5vw; }
  .loading-layout { grid-template-columns: minmax(0, 1fr) minmax(340px, 410px); gap: 35px; }
  .loading-story h1 { font-size: 100px; }
  .inspection-context { left: 590px; right: 30px; gap: 23px; }
  .inspection-world { aspect-ratio: 1.25; }
  .inspection-world figcaption { left: 15px; right: 15px; bottom: 14px; flex-wrap: wrap; gap: 5px; }
  .inspection-world figcaption span:last-child { text-align: left; }
  .inspection-context h1 { font-size: 40px; }
  .inspection-context .inspection-motto { font-size: 22px; }
  .inspection-context p { font-size: 11px; }
}
@media (max-height: 780px) and (min-width: 761px) {
  .aster-rail { top: 94px; bottom: 167px; gap: 4px; padding: 6px; width: 55px; }
  .aster-rail button { height: 38px; min-height: 38px; width: 40px; border-radius: 11px; }
  .aster-sheet { top: 94px; bottom: 167px; left: 91px; }
  .aster-sheet-head { padding: 20px 24px 17px; }
  .aster-sheet-head h2 { font-size: 29px; }
  .aster-sheet-body { padding: 18px 22px 24px; }
  .life-dock { padding: 11px 15px; }
  .title-content { top: 49%; max-height: calc(100dvh - 80px); }
  :root[data-theme] .title-content h1 > span { font-size: 78px; }
  .title-seal { margin-bottom: 20px; }
  :root[data-theme] .title-content h1 > strong { margin-top: 21px; }
  :root[data-theme] .title-tagline { margin-top: 18px; font-size: 13px; }
  .title-actions { margin-top: 22px; gap: 3px; }
  .title-link { padding: 10px 13px; }
  .title-save { margin-top: 15px; }
  #loading { padding-top: 22px; padding-bottom: 20px; }
  .loading-layout { margin: 22px auto; }
  .loading-status { padding: 22px 25px 15px; }
  .loading-milestones li { padding: 9px 0; }
  .loading-status h2 { font-size: 29px; }
  .loading-story h1 { font-size: 108px; }
  .loading-world-note { margin-top: 25px; padding-top: 18px; }
  .loading-overline { margin-bottom: 25px; }
  .inspection-context { top: 99px; bottom: 75px; gap: 20px; }
  .inspection-world { max-height: 220px; }
}
@media (max-width: 900px) {
  .loading-layout { grid-template-columns: minmax(0, .8fr) minmax(320px, 1fr); gap: 30px; }
  .loading-story { padding-left: 0; }
  .loading-story h1 { font-size: 85px; }
  #loading .loading-tagline { font-size: 31px; }
  .loading-status { padding: 24px 23px 16px; }
  .loading-world-note { min-width: 200px; }
  .loading-footer > span { font-size: 6px; }
  .inspection-context { opacity: .24; inset: 110px 28px 85px 360px; pointer-events: none; }
  .inspection-mode { top: 29px; right: 24px; max-width: 210px; font-size: 8px; }
}
@media (max-width: 760px) {
  .world-topbar { left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); max-width: calc(52vw - 13px); padding: 9px 10px 9px 7px; gap: 8px; border-radius: 16px; }
  .world-topbar .wallet, .world-topbar .audience, .world-topbar .top-divider { display: none; }
  .mini-brand { min-width: 77px; }
  .world-topbar .mini-brand strong { font-size: 10px !important; letter-spacing: .6px; }
  .world-topbar .mini-brand > span { font-size: 6px !important; letter-spacing: 1px; }
  .world-topbar .icon-button { width: 29px; height: 30px; }
  .world-clock { top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); max-width: 46vw; padding: 10px 9px 10px 12px; gap: 6px; border-radius: 16px; }
  .world-clock strong { font-size: 10px; }
  .world-clock small { font-size: 8px; margin-top: 3px; }
  .world-clock > :where(svg,.kinora-image-icon) { display: none; }
  .world-clock #sound { width: 26px; height: 30px; }
  .life-dock { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: auto; max-width: none; border-radius: 20px; padding: 12px 14px; grid-template-columns: 43px minmax(0, 1fr) 37px; gap: 0 11px; }
  .life-dock .avatar { width: 43px; height: 48px; border-radius: 12px; }
  .life-dock .avatar img { border-radius: 12px; }
  .character-summary strong { font-size: 19px; }
  .character-summary #player-title { font-size: 6px; }
  .phone-launch { height: 38px; width: 34px; }
  .needs-grid { margin-top: 12px; gap: 10px; }
  .need { gap: 6px; }
  .need :where(svg,.kinora-image-icon) { height: 13px; width: 13px; }
  .action-dock { left: 12px; bottom: 136px; width: calc(100vw - 171px); }
  .activity-panel { padding: 10px 12px; border-radius: 14px; }
  .activity-copy strong { font-size: 10px; }
  .activity-copy small { font-size: 9px; }
  .activity-track { margin-top: 8px; }
  #action-queue { bottom: 77px; }
  .time-dock { right: 12px; bottom: 136px; gap: 2px; padding: 5px; border-radius: 14px; }
  .time-dock button { width: 28px; height: 29px; border-radius: 9px; }
  .controls-hint { display: none; }
  .camera-controls { right: 12px; bottom: 210px; padding: 4px; border-radius: 13px; }
  .camera-controls .icon-button { width: 25px; height: 27px; }
  #wall-mode { padding: 0 5px; font-size: 9px; }
  .aster-rail { left: max(12px, env(safe-area-inset-left)); top: 86px; bottom: 248px; width: 47px; padding: 5px; gap: 4px; border-radius: 17px; }
  .aster-rail button { width: 35px; height: 37px; min-height: 37px; border-radius: 10px; }
  .aster-rail :where(svg,.kinora-image-icon) { width: 17px; height: 17px; }
  .aster-sheet { left: 70px; right: 12px; top: 86px; bottom: 248px; width: auto; border-radius: 20px; }
  .aster-sheet-head { padding: 18px 18px 16px; }
  .aster-sheet-head h2 { font-size: 25px; letter-spacing: -.6px; padding-right: 25px; }
  .aster-eyebrow { font-size: 7px; letter-spacing: 1.5px; }
  .aster-close { top: 16px; right: 13px; width: 27px; height: 27px; font-size: 19px; }
  .aster-sheet-body { padding: 17px 15px 22px; }
  .aster-sheet p { font-size: 11px; }
  .aster-caption { top: 95px; left: 78px; }
  .aster-caption strong { font-size: 27px; }
  .aster-caption p { font-size: 10px; max-width: 210px; }
  .df-feature-card { padding: 19px 16px; border-radius: 15px; }
  .df-feature-card h3, .df-map-head h3 { font-size: 25px; }
  .df-home-card { grid-template-columns: 1fr; }
  .df-home-drawing { display: none; }
  .df-lot { grid-template-columns: 1fr; padding: 15px; }
  .df-lot-icon { display: none; }
  .df-metrics b { font-size: 25px; }
  .df-metrics span { font-size: 7px; letter-spacing: .6px; }
  .df-atlas { min-height: 215px; }
  .aster-two { gap: 7px; }
  .df-small-action { font-size: 10px; padding: 9px 10px; }
  .aster-budgets { gap: 5px; }
  .aster-budgets span { padding: 5px 7px; font-size: 8px; }
  .aster-scene-receipt { right: 12px; top: 86px; max-width: 215px; padding: 16px; }
  .story-beacon { top: 84px; right: 12px; max-width: 210px; }
  #drawer { right: 12px; bottom: 205px; width: min(335px, calc(100vw - 24px)); max-height: calc(100dvh - 288px); border-radius: 33px; }
  #drawer[data-surface="monitor"] { right: 12px; bottom: 205px; width: min(390px, calc(100vw - 24px)); }
  #drawer[data-surface="recipe"] { right: 12px; bottom: 205px; width: min(305px, calc(100vw - 24px)); }
  #drawer[data-surface="build"] { left: 12px; right: 12px; bottom: 205px; width: auto; max-height: calc(100dvh - 290px); border-radius: 20px; }
  #drawer[data-surface="settings"], #drawer[data-surface="stories"] { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: calc(100vw - 28px); max-height: calc(100dvh - 30px); border-radius: 24px; }
  #drawer[data-surface="settings"] .drawer-header, #drawer[data-surface="stories"] .drawer-header { padding: 22px; }
  #drawer[data-surface="settings"] #drawer-body, #drawer[data-surface="stories"] #drawer-body { padding: 10px 22px 25px; max-height: none; }
  #tournament { right: 12px; bottom: 205px; width: min(325px, calc(100vw - 24px)); max-height: calc(100dvh - 290px); }
  #context-menu.radial { color: var(--os-text); background: var(--os-glass-heavy); border-color: var(--os-edge); border-radius: 23px; max-width: calc(100vw - 24px); }
  .radial .context-heading { background: transparent; border: 0; box-shadow: none; }
  .radial .action-option { background: var(--os-card); border-color: var(--os-edge); box-shadow: none; }
  .title-content { left: 28px; top: 49%; width: min(345px, calc(100vw - 48px)); max-height: calc(100dvh - 88px); padding-right: 8px; }
  :root[data-theme] .title-content h1 > span { font-size: 82px; }
  .title-seal { margin-bottom: 23px; }
  .title-seal span { font-size: 7px; }
  :root[data-theme] .title-content h1 > strong { font-size: 8px; letter-spacing: 3px; margin-top: 24px; }
  :root[data-theme] .title-tagline { font-size: 13px; margin-top: 23px; max-width: 275px; }
  .title-actions { width: min(300px, 100%); margin-top: 26px; gap: 4px; }
  .title-link { font-size: 12px; padding: 12px 14px; }
  .title-save { margin-top: 17px; }
  .title-save small { font-size: 9px; }
  .title-location { display: none; }
  .title-corner { left: 28px; right: 22px; bottom: 21px; font-size: 7px; }
  .title-corner span:last-child { display: none; }
  :root[data-theme] .title-shade { background: linear-gradient(90deg, color-mix(in srgb, var(--os-night) 98%, transparent), color-mix(in srgb, var(--os-night) 83%, transparent) 55%, color-mix(in srgb, var(--os-night) 45%, transparent)); }
  .welcome-card, .pause-card { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); padding: 28px; width: min(420px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); border-radius: 25px; }
  .welcome-card h2, .pause-card h2 { font-size: 33px; }
  #loading { padding: 21px 23px 20px; }
  .loading-topline { gap: 10px; }
  .loading-brand { gap: 10px; font-size: 11px; }
  .loading-brand-mark { width: 33px; height: 36px; font-size: 25px; border-radius: 10px; }
  .loading-runtime { font-size: 6px; letter-spacing: .8px; padding: 9px 10px; }
  .loading-layout { display: block; width: min(430px, 100%); margin: 27px auto; }
  .loading-story { display: none; }
  .loading-status { padding: 25px 23px 16px; border-radius: 24px; }
  #loading h2 { font-size: 30px; }
  .loading-milestones li { padding: 12px 0; gap: 9px; }
  .loading-milestones strong { font-size: 12px; }
  #loading .loading-milestones small { font-size: 9px; }
  .loading-footer { justify-content: center; }
  .loading-footer > span { display: none; }
  .loading-aura span { width: 130vw; height: 130vw; left: -30%; top: 35%; }
  .loading-aura span:nth-child(2) { width: 160vw; height: 160vw; left: -45%; top: 26%; }
  .loading-aura span:nth-child(3) { width: 100vw; height: 100vw; left: -18%; top: 42%; }
  #error { padding: 27px; border-radius: 25px; }
  #error h2 { font-size: 30px; }
  .inspection-label { left: 12px; top: 12px; right: 12px; padding: 13px 15px; border-radius: 16px; font-size: 9px; }
  .inspection-label span { font-size: 8px; max-width: 240px; }
  .inspection-mode { display: none; }
  .inspection-context { inset: 140px 25px 110px 95px; opacity: .18; }
  .inspection-context h1 { font-size: 45px; }
  .inspection-context .inspection-mode-note { display: none; }
  .interface-inspection .aster-sheet { top: 91px; bottom: 74px; }
  .interface-inspection .aster-rail { top: 91px; bottom: 74px; }
  .inspection-footer { left: 70px; right: 16px; bottom: 18px; font-size: 9px; align-items: flex-start; }
  .inspection-footer > span { display: none; }
  .inspection-footer-links { gap: 19px; flex-wrap: wrap; line-height: 1.7; }
  .interface-inspection #notifications { right: 12px; top: 86px; max-width: calc(100vw - 84px); }
}
@media (max-width: 380px) {
  .world-topbar { padding-right: 8px; gap: 5px; }
  .world-topbar .mini-brand > span { font-size: 5px !important; }
  .world-clock strong { font-size: 9px; }
  .world-clock { gap: 3px; padding-left: 9px; padding-right: 5px; }
  .aster-sheet-head h2 { font-size: 23px; }
  .aster-sheet-head { padding-left: 15px; }
  .aster-sheet-body { padding: 15px 12px 20px; }
  .aster-two { grid-template-columns: 1fr; }
  .df-feature-card h3 { font-size: 23px; }
  #loading { padding-left: 15px; padding-right: 15px; }
  .loading-status { padding-left: 18px; padding-right: 18px; }
  .loading-runtime { padding: 8px; font-size: 6px; }
  .loading-milestones { margin-top: 0; }
  #loading .loading-milestones small { font-size: 8px; }
  .loading-milestones [data-phase-state] { font-size: 7px; }
}
@media (max-height: 640px) {
  .loading-milestones li { padding: 8px 0; }
  #loading .loading-milestones small { display: none; }
  .loading-status { padding-top: 19px; padding-bottom: 13px; }
  .loading-layout { margin-top: 20px; margin-bottom: 20px; }
  #loading h2 { font-size: 28px; margin-top: 14px; }
  #loading #loading-copy { min-height: 0; }
  #loading .loading-track { margin-top: 14px; }
  .loading-meta { margin-bottom: 13px; }
  :root[data-theme] .title-content h1 > span { font-size: 63px; }
  .title-seal { margin-bottom: 15px; }
  :root[data-theme] .title-content h1 > strong { margin-top: 17px; }
  :root[data-theme] .title-tagline { margin-top: 15px; font-size: 12px; }
  .title-actions { margin-top: 17px; }
  .title-link { padding-top: 9px; padding-bottom: 9px; }
  .title-save { margin-top: 11px; }
}
@media (max-width: 760px) and (max-height: 600px) {
  .aster-rail { bottom: 198px; top: 77px; }
  .aster-sheet { top: 77px; bottom: 198px; }
  .camera-controls { bottom: 194px; }
  .life-dock { padding: 9px 12px; }
  .life-dock .avatar { height: 39px; width: 38px; }
  .needs-grid { margin-top: 9px; }
  .action-dock, .time-dock { bottom: 121px; }
  #drawer, #drawer[data-surface="monitor"], #drawer[data-surface="recipe"], #drawer[data-surface="build"], #tournament { top: 78px; bottom: 15px; max-height: none; }
  #drawer[data-surface="settings"], #drawer[data-surface="stories"] { top: 50%; bottom: auto; max-height: calc(100dvh - 24px); }
}

/* These preferences apply to every newly introduced material and transition. */
:root[data-solid-ui="true"] :is(.glass, .aster-rail, .aster-sheet, .aster-scene-receipt, #drawer, .title-location, .welcome-card, .pause-card, #error, .toast, .conversation-card, .loading-status, .inspection-label, .inspection-mode, .radial .context-heading, .radial .action-option, .radial .context-categories button, .radial .context-footer button) { background: var(--glass-strong); backdrop-filter: none; -webkit-backdrop-filter: none; }
:root[data-solid-ui="true"] :is(.aster-card, .df-feature-card, .df-lot, .df-learned-card, .df-inventory-header, .phone-option, .phone-wallpaper) { background: var(--os-surface); }
:root[data-solid-ui="true"] :is(.pause-wrap, .welcome-wrap) { background: var(--os-night); backdrop-filter: none; -webkit-backdrop-filter: none; }
:root[data-solid-ui="true"] .loading-aura { display: none; }
:root[data-reduce-motion="true"] *, :root[data-reduce-motion="true"] *::before, :root[data-reduce-motion="true"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (prefers-contrast: more) {
  :root, :root[data-theme="dark"] { --os-edge: #97bcb4; --os-muted: #d2e9df; --os-faint: #bdd8cd; }
  :root[data-theme="light"] { --os-edge: #597d70; --os-muted: #234f40; --os-faint: #345b4b; }
  :is(.glass, .aster-sheet, .aster-rail, .loading-status, #drawer) { background: var(--glass-strong); backdrop-filter: none; }
}
