:root {
  --glass-bg: rgba(24, 22, 20, 0.44);
  --glass-panel-bg: rgba(26, 24, 22, 0.70);
  --glass-border: rgba(255, 248, 238, 0.14);
  --glass-rim: inset 0 0.5px 0 rgba(255, 248, 238, 0.24);
  --fill-subtle: rgba(255, 255, 255, 0.08);
  --fill-hover: rgba(255, 255, 255, 0.14);
  --fill-card: rgba(255, 255, 255, 0.06);
  --text-main: #f5f5f7;
  --text-dim: rgba(235, 235, 245, 0.60);
  --text-ter: rgba(235, 235, 245, 0.38);
  --pearl-bg: rgba(255, 255, 255, 0.94);
  --pearl-fg: #111114;
  --accent: #f5f5f7;
  --accent-soft: rgba(255, 255, 255, 0.18);
  --sys-red: rgba(255, 69, 58, 0.88);
  --sys-green: #30d158;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", system-ui, sans-serif;
  --kb-offset: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: #0b0b0e; color: var(--text-main); font-family: var(--font-ui);
  user-select: none; -webkit-user-select: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
.sf-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.sf-ico {
  width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round;
}
#world-canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; touch-action: none; -webkit-touch-callout: none; }
#world-canvas:active { cursor: grabbing; }
#hud-root { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

/* Apple visionOS Liquid Frosted Glass Surfaces */
.glass-pill {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(34px) saturate(190%);
  backdrop-filter: blur(34px) saturate(190%);
  border: 0.5px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: var(--glass-rim), 0 12px 32px rgba(0, 0, 0, 0.26);
}
.glass-panel {
  background: var(--glass-panel-bg);
  -webkit-backdrop-filter: blur(36px) saturate(195%);
  backdrop-filter: blur(36px) saturate(195%);
  border: 0.5px solid var(--glass-border);
  border-radius: 26px;
  box-shadow: var(--glass-rim), 0 24px 56px rgba(0, 0, 0, 0.34);
}

/* Silky 60/120fps Apple Spring Physics */
@keyframes applePopIn {
  from { opacity: 0.04; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes appleCenterIn {
  from { opacity: 0.04; transform: translateX(-50%) translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes appleModalIn {
  from { opacity: 0.04; transform: translate(-50%, calc(-50% + 12px)) scale(0.978); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes pulseWait { 0%, 100% { opacity: 0.52; } 50% { opacity: 1; } }
@keyframes siriSpin { to { transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

button, .chip, .icon-btn, .chat-pill, .chat-icon-btn, .dock-btn, .shuttle-card {
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  background: var(--fill-subtle);
  color: var(--text-main);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  white-space: nowrap;
  transition: transform 0.16s var(--spring), background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
button:hover:not(:disabled), .chip:hover:not(:disabled) { background: var(--fill-hover); }
button:active:not(:disabled), .chip:active:not(:disabled) { transform: scale(0.95); }
button:disabled { opacity: 0.45; cursor: wait; }

/* Apple Pearl-White Active / Primary CTA */
button.is-active, .chip.is-active, .icon-btn.is-active, .chat-pill.is-active, .dock-btn.is-active {
  background: var(--pearl-bg);
  color: var(--pearl-fg);
  font-weight: 600;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.20);
}
button.is-active:hover:not(:disabled), .chip.is-active:hover:not(:disabled) { background: #ffffff; }

/* Top Status Row (#zone-pill + #go-home-btn + #top-fullscreen-btn) */
.top-bar { position: fixed; top: calc(12px + var(--safe-top)); left: 14px; z-index: 26; display: inline-flex; align-items: center; gap: 8px; pointer-events: none; }
.top-bar-acts { display: inline-flex; align-items: center; gap: 6px; pointer-events: none; flex-shrink: 0; }
#zone-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 36px;
  max-width: min(240px, calc(100vw - 810px)); padding: 0 14px;
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zone-dot {
  width: 6.5px; height: 6.5px; border-radius: 50%; flex-shrink: 0;
  background: var(--sys-green); box-shadow: 0 0 8px rgba(48, 209, 88, 0.78);
}
.dock-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 36px; padding: 0 12px; font-size: 12.5px; color: rgba(245, 245, 247, 0.88); pointer-events: auto; }
.dock-home {
  height: 36px; padding: 0 13px; gap: 5px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--pearl-fg);
  font-weight: 600;
  border: 0.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}
.dock-home:hover:not(:disabled) { background: #ffffff; color: #000000; }
.dock-home .sf-ico { width: 15px; height: 15px; }

/* Unified visionOS Floating Glass Capsule Dock */
.quick-dock {
  position: fixed; top: calc(12px + var(--safe-top)); right: 14px; z-index: 30;
  display: inline-flex; align-items: center; gap: 2px; padding: 3px 5px;
  background: rgba(24, 22, 20, 0.42);
  -webkit-backdrop-filter: blur(28px) saturate(165%);
  backdrop-filter: blur(28px) saturate(165%);
  border: 0.5px solid rgba(255, 248, 238, 0.14);
  border-radius: 999px;
  box-shadow: inset 0 0.5px 0 rgba(255, 248, 238, 0.22), 0 8px 22px rgba(0, 0, 0, 0.18);
  max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; pointer-events: auto;
}
.quick-dock::-webkit-scrollbar { display: none; }
.quick-dock .dock-btn { background: transparent; border: none; box-shadow: none; height: 34px; min-height: 34px; padding: 0 9px; font-size: 12.5px; color: rgba(245, 245, 247, 0.86); }
.quick-dock .dock-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); color: #ffffff; }
.quick-dock .dock-btn.is-active, .quick-dock .dock-btn.is-active:hover:not(:disabled) { background: var(--pearl-bg); color: var(--pearl-fg); font-weight: 600; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.20); }
#quick-time-btn .time-ico-sun { display: none; }
#quick-time-btn.is-dusk .time-ico-moon { display: none; }
#quick-time-btn.is-dusk .time-ico-sun { display: inline-block; }
.is-art-chip { background: rgba(255, 255, 255, 0.12); color: #ffffff; }

/* Toast & Art Floating Preview */
.toast-banner {
  position: fixed; top: calc(58px + var(--safe-top)); right: 14px; z-index: 50;
  max-width: min(380px, calc(100vw - 24px)); padding: 8px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-main); animation: applePopIn 0.16s var(--spring);
}
body.is-factory .toast-banner { top: calc(104px + var(--safe-top)); }
#wf-hud-layer .wf-slot-top-right { top: calc(58px + var(--safe-top)); right: 14px; }
.toast-banner.is-error { background: rgba(68, 22, 24, 0.78); border-color: rgba(255, 69, 58, 0.45); color: #ffd7d4; }
.art-float-card {
  position: fixed; top: calc(104px + var(--safe-top)); right: 14px; z-index: 33;
  display: flex; align-items: center; gap: 12px; max-width: min(360px, calc(100vw - 24px));
  padding: 10px 12px; border-radius: 20px; pointer-events: auto; animation: applePopIn 0.16s var(--spring);
}
.art-float-img { width: 60px; height: 60px; object-fit: cover; border-radius: 12px; flex-shrink: 0; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28); }
.art-float-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
#art-float-close-btn { width: 32px; height: 32px; padding: 0; justify-content: center; }
.power-float-card {
  position: fixed; top: calc(104px + var(--safe-top)); right: 14px; z-index: 38;
  display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px; border-radius: 20px; pointer-events: auto; animation: applePopIn 0.16s var(--spring);
}
.power-float-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.power-float-detail { font-size: 12.5px; line-height: 1.45; color: var(--text-dim); word-break: break-word; }

/* Siri-Inspired Floating Live Voice Call Capsule */
.live-call-pill {
  position: fixed; top: calc(58px + var(--safe-top)); left: 14px; z-index: 34;
  display: inline-flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 24px));
  padding: 6px 8px 6px 8px; border-radius: 999px; pointer-events: auto;
  animation: applePopIn 0.16s var(--spring);
}
.live-call-orb {
  --orb-scale: 1; position: relative; width: 34px; height: 34px; padding: 0; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; border: none;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.92), rgba(100, 210, 255, 0.65) 42%, rgba(191, 90, 242, 0.55) 75%, rgba(255, 55, 95, 0.38));
  box-shadow: 0 0 16px rgba(100, 210, 255, 0.42), inset 0 0.5px 2px rgba(255, 255, 255, 0.8);
  transform: scale(var(--orb-scale)); transition: transform 0.08s linear;
}
.orb-core {
  width: 12px; height: 12px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}
.live-call-pill[data-call-state="speaking"] .live-call-orb {
  box-shadow: 0 0 22px rgba(191, 90, 242, 0.68), 0 0 12px rgba(100, 210, 255, 0.6);
}
.live-call-pill[data-call-state="thinking"] .orb-core { animation: pulseWait 0.85s ease-in-out infinite; }
.orb-ring {
  position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  animation: pulseWait 1.8s ease-in-out infinite; pointer-events: none;
}
.live-call-info { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 7px; overflow: hidden; }
.live-call-status { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-mute-btn { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.live-mute-btn .mic-ico-off { display: none; }
.live-mute-btn.is-muted .mic-ico-on { display: none; }
.live-mute-btn.is-muted .mic-ico-off { display: inline-block; }
.icon-btn.is-muted { background: rgba(255, 69, 58, 0.22); color: #ffb3ad; }
.icon-btn.is-hangup { background: var(--sys-red); color: #ffffff; font-weight: 600; padding: 0 13px; height: 34px; flex-shrink: 0; }
.icon-btn.is-hangup:hover:not(:disabled) { background: rgba(255, 69, 58, 1); }
.icon-btn.is-danger-soft { color: #ff9f98; }

/* Touch Controls & Play Pad */
.touch-stick { position: fixed; width: 92px; height: 92px; margin-left: -46px; margin-top: -46px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.22); backdrop-filter: blur(16px); z-index: 18; pointer-events: none; }
.touch-stick.is-sprint { border-color: rgba(255, 255, 255, 0.65); box-shadow: 0 0 18px rgba(255, 255, 255, 0.28); }
.touch-knob { position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: rgba(255, 255, 255, 0.78); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32); }
.play-pad { position: fixed; right: 12px; bottom: calc(68px + var(--safe-bottom)); z-index: 24; display: flex; flex-direction: column; gap: 9px; pointer-events: auto; touch-action: none; }
.pad-btn { width: 42px; height: 42px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: rgba(245, 245, 247, 0.9); user-select: none; }
.pad-btn .sf-ico { width: 18px; height: 18px; }
.pad-btn.is-active { background: var(--pearl-bg); color: var(--pearl-fg); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.26); }
.emote-tray { position: fixed; right: 64px; bottom: calc(68px + var(--safe-bottom)); z-index: 26; display: grid; grid-template-columns: repeat(4, minmax(66px, 1fr)); gap: 6px; padding: 10px; border-radius: 20px; max-width: min(320px, calc(100vw - 76px)); pointer-events: auto; animation: applePopIn 0.16s var(--spring); }
.emote-chip { padding: 7px 6px; font-size: 12px; border-radius: 12px; background: var(--fill-subtle); white-space: nowrap; }
.emote-chip:hover { background: var(--fill-hover); }

/* Floating Prompts, Subtitles & Edit Bar */
.action-prompt {
  position: fixed; bottom: calc(20px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 25;
  padding: 9px 18px; min-height: 38px; font-size: 13.5px; font-weight: 500; letter-spacing: 0.01em;
  white-space: nowrap; max-width: calc(100vw - 28px); overflow: hidden; text-overflow: ellipsis;
  pointer-events: auto; color: var(--text-main); animation: appleCenterIn 0.16s var(--spring);
}
.action-prompt:active:not(:disabled) { transform: translateX(-50%) scale(0.96); }
.edit-bar {
  position: fixed; bottom: calc(20px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 28;
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 20px); padding: 8px 14px; border-radius: 22px; font-size: 13px;
  pointer-events: auto; animation: appleCenterIn 0.16s var(--spring);
}
.edit-selected { color: var(--text-main); font-weight: 600; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.subtitle-float {
  position: fixed; bottom: calc(70px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 22;
  max-width: min(600px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 20px;
  font-size: 14px; line-height: 1.48; display: flex; align-items: baseline; gap: 8px;
}
.speaker-tag { color: rgba(255, 255, 255, 0.78); font-weight: 600; font-size: 12px; letter-spacing: 0.01em; flex-shrink: 0; }
.mood-tag {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 500;
  color: var(--text-dim); background: var(--fill-subtle); border-radius: 999px;
  padding: 3px 10px; flex-shrink: 0; white-space: nowrap;
}

/* Airy Apple iMessage / Siri #chat-bar */
.chat-bar {
  position: fixed; bottom: calc(16px + var(--safe-bottom) + var(--kb-offset)); left: 50%; transform: translateX(-50%);
  z-index: 37; width: min(640px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 26px;
  pointer-events: auto; display: flex; flex-direction: column; gap: 9px;
  animation: appleCenterIn 0.18s var(--spring);
}
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; }
.chat-head-right { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.studio-row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* Apple Segmented Pill Track */
.seg-track {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--fill-subtle); border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg-track::-webkit-scrollbar { display: none; }
.seg-track .chat-pill {
  background: transparent; height: 28px; min-height: 28px; padding: 0 12px;
  font-size: 12.5px; font-weight: 500; color: var(--text-dim); border-radius: 999px;
}
.seg-track .chat-pill:hover:not(:disabled) { color: var(--text-main); }
.seg-track .chat-pill.is-active {
  background: var(--pearl-bg); color: var(--pearl-fg); font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.chat-close-btn {
  width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.10); color: var(--text-dim); flex-shrink: 0;
}
.chat-close-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); color: #ffffff; }
.chat-close-btn .sf-ico { width: 15px; height: 15px; }

/* Single-Row Gliding Action Ribbon */
.chat-quick-ribbon {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding: 1px 0;
}
.chat-quick-ribbon::-webkit-scrollbar { display: none; }
.chat-pill {
  display: inline-flex; align-items: center; gap: 4.5px;
  padding: 5px 11px; font-size: 12.5px; line-height: 1.2; border-radius: 999px;
  background: var(--fill-subtle); color: rgba(245, 245, 247, 0.88); flex-shrink: 0;
}
.chat-pill .sf-ico { width: 13.5px; height: 13.5px; }

.soul-drawer {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px;
  border-radius: 18px; background: var(--fill-card);
}
.soul-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.soul-form-row { display: flex; gap: 6px; align-items: center; }
.soul-form-row input { flex: 1; min-width: 0; }

/* Chat Stream & Moment Cards */
.chat-stream { max-height: 192px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding-right: 2px; -webkit-overflow-scrolling: touch; }
.chat-msg { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; max-width: 90%; padding: 8px 12px; font-size: 13.5px; line-height: 1.48; word-break: break-word; }
.chat-msg.is-companion { align-self: flex-start; background: rgba(255, 255, 255, 0.08); border-radius: 18px 18px 18px 6px; }
.chat-msg.is-user { align-self: flex-end; background: rgba(255, 255, 255, 0.20); color: #ffffff; border-radius: 18px 18px 6px 18px; }
.chat-msg.is-thinking { color: var(--text-dim); animation: pulseWait 1.2s ease-in-out infinite; }
.chat-reply { display: flex; align-items: baseline; gap: 8px; padding: 3px 6px; font-size: 14px; line-height: 1.45; color: var(--text-main); }
.chat-say { flex: 1; min-width: 0; word-break: break-word; }

/* Unified Apple Input Capsule (#chat-form) */
.chat-form {
  display: flex; gap: 2px; align-items: center; flex-wrap: nowrap;
  background: rgba(255, 255, 255, 0.08);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 3px 4px 3px 5px;
}
.chat-bar.is-study .chat-form { border-radius: 22px; align-items: flex-end; padding: 6px; }
.chat-icon-btn {
  width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0;
  border-radius: 50%; background: transparent; color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); color: #ffffff; }
.chat-icon-btn.is-active { background: rgba(255, 255, 255, 0.16); color: #ffffff; box-shadow: none; }
.chat-icon-btn.is-recording, .chip.is-recording {
  background: var(--sys-red); color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 69, 58, 0.55); animation: pulseWait 0.9s ease-in-out infinite;
}
#chat-send {
  width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0;
  border-radius: 50%; background: #ffffff; color: #111114;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}
#chat-send .sf-ico { width: 17px; height: 17px; stroke-width: 2.3; }
#chat-send:hover:not(:disabled) { background: #f2f2f7; }

/* Tonal Borderless Inputs & Selects */
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  user-select: text; -webkit-user-select: text;
  background: rgba(255, 255, 255, 0.08);
  border: 0.5px solid transparent;
  border-radius: 14px;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 13.5px;
  padding: 8px 12px;
  outline: none;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-ter); }
input:focus, textarea:focus, select:focus { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); }
.chat-form input[type="text"] {
  flex: 1; min-width: 0; background: transparent; border: none;
  border-radius: 0; padding: 6px 8px;
}
.chat-form input[type="text"]:focus { background: transparent; border-color: transparent; }
.wish-search-form { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.wish-search-form input[type="text"] { flex: 1; min-width: 120px; }
select option { background: #1c1c22; color: var(--text-main); }

/* Art Studio & Moment Cards */
.voice-clone-box { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 0.5px solid rgba(255, 255, 255, 0.10); }
.art-guide-banner { font-size: 12.5px; line-height: 1.45; color: var(--text-dim); padding: 0 2px; }
.art-gen-stack { display: flex; flex-direction: column; gap: 8px; }
.art-gen-stack input[type="text"] { width: 100%; }
.art-gen-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.art-gen-actions button { flex: 1; min-width: 136px; justify-content: center; display: inline-flex; align-items: center; }
.studio-modal.is-art-only > .v2c-sec:not(#art-studio-sec) { display: none; }
.studio-modal:not(.is-art-only) .art-expand-btn { display: none; }
.art-expand-btn { justify-content: center; width: 100%; padding: 9px 14px; background: rgba(255, 255, 255, 0.08); color: var(--text-main); }
.art-preview-box { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.07); }
.art-preview-img { width: 82px; height: 82px; object-fit: cover; border-radius: 12px; flex-shrink: 0; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28); }
.art-preview-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.chat-moment-card { flex-basis: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.07); }
.chat-moment-img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.comp-row .c-voice { max-width: 196px; }
.chat-attach-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-radius: 14px; background: var(--fill-card); font-size: 12px; color: var(--text-dim); }
.chat-power-chips { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 1px 0; }
.chat-power-chips::-webkit-scrollbar { display: none; }
.chat-power-chip { padding: 4px 10px; font-size: 12px; line-height: 1.25; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: rgba(245, 245, 247, 0.88); flex-shrink: 0; white-space: nowrap; }
.chat-power-chip:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); color: #ffffff; }
.chat-power-card { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding: 9px 11px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); border: 0.5px solid rgba(255, 255, 255, 0.20); }
.chat-power-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chat-power-detail { font-size: 12px; line-height: 1.45; color: var(--text-dim); word-break: break-word; }
.chat-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 9px; flex-shrink: 0; }

/* Sheets & Command Palette (Grabber + Clean Inset Sections) */
.palette::before, .v2c-modal::before {
  content: ""; display: block; width: 36px; height: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.26); margin: -2px auto 2px; flex-shrink: 0;
}
.palette {
  position: fixed; top: calc(56px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 40;
  width: min(1040px, calc(100vw - 24px)); max-height: calc(100dvh - 68px - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto; padding: 10px 14px 12px; pointer-events: auto;
  display: flex; flex-direction: column; gap: 6px; -webkit-overflow-scrolling: touch;
  animation: appleCenterIn 0.17s var(--spring);
}
.palette-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.palette-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-main); }
.palette-meta { margin-left: auto; font-size: 12px; color: var(--text-dim); }
.icon-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; font-size: 12.5px; border-radius: 999px; flex-shrink: 0; white-space: nowrap; }
.icon-btn .sf-ico, .chip .sf-ico { width: 14px; height: 14px; flex-shrink: 0; }

.sticky-card {
  position: fixed; bottom: calc(24px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 36;
  width: min(460px, calc(100vw - 24px)); padding: 16px 18px; pointer-events: auto;
  display: flex; flex-direction: column; gap: 9px; animation: appleCenterIn 0.17s var(--spring);
}
.sticky-head { display: flex; align-items: center; gap: 8px; }
.sticky-body { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-main); word-break: break-word; }
.souvenir-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 11px; border-radius: 14px; background: var(--fill-card); }
.palette-section { display: flex; flex-direction: column; gap: 4px; }
.section-label { font-size: 12px; font-weight: 500; color: var(--text-dim); letter-spacing: 0.01em; }
.chip-grid, .seg-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.palette .chip-grid { gap: 4px 5px; }
.palette .chip { padding: 4px 9px; font-size: 12px; }
#world-list { max-height: 172px; overflow-y: auto; }
.controls-row { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; padding: 6px 10px; border-radius: 16px; background: var(--fill-card); }
.controls-row .chip { padding: 4px 10px; font-size: 12px; }
.control-group { display: flex; flex-direction: column; gap: 4px; }
.sticky-wall-extras { display: flex; flex-direction: column; gap: 7px; padding-top: 8px; border-top: 0.5px solid rgba(255, 255, 255, 0.10); }
.sticky-journal { padding: 8px 11px; border-radius: 12px; font-size: 12.5px; color: var(--text-main); background: var(--fill-subtle); }
.sticky-history-list { display: flex; flex-direction: column; gap: 5px; max-height: 150px; overflow-y: auto; }
.sticky-note-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; font-size: 12.5px; background: var(--fill-card); }
.sticky-note-text { flex: 1; min-width: 0; word-break: break-word; }
.sticky-note-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 7px; flex-shrink: 0; }
.item-capsule-card { width: min(520px, calc(100vw - 24px)); }
.capsule-body-row { display: flex; align-items: flex-start; gap: 12px; }
.capsule-meta-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; font-size: 12.5px; line-height: 1.25; border-radius: 999px; background: var(--fill-subtle); color: var(--text-main); text-decoration: none; }

.wish-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); gap: 7px; max-height: 160px; overflow-y: auto; }
.wish-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 11px; border-radius: 14px; background: var(--fill-card); }
.wish-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wish-name { font-size: 13px; font-weight: 500; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wish-sub { font-size: 11.5px; color: var(--text-dim); }
.wish-place-btn { padding: 5px 11px; font-size: 12px; flex-shrink: 0; }
.placed-list { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.placed-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--fill-subtle); }
.placed-del { padding: 0 4px; min-height: 0; background: transparent; color: var(--text-dim); font-size: 13px; }

.loading-veil { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(10, 10, 14, 0.56); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); pointer-events: auto; }
.loading-card { display: inline-flex; align-items: center; gap: 10px; padding: 11px 20px; font-size: 13.5px; font-weight: 500; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.22); border-top-color: #ffffff; animation: spin 0.8s linear infinite; }
.customs-bar { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 7px 12px; border-radius: 14px; background: var(--fill-card); }

/* visionOS / iOS 18 Floating Sheets (.v2c-modal) */
.v2c-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 45;
  width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 76px - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto; padding: 16px 20px 20px; pointer-events: auto;
  display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch;
  animation: appleModalIn 0.18s var(--spring);
}
.v2c-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.v2c-head > div { min-width: 0; flex: 1; }
.v2c-title { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; color: var(--text-main); }
.v2c-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.4; }
.v2c-status-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.v2c-pill { padding: 4px 11px; border-radius: 999px; font-size: 12px; background: var(--fill-subtle); color: var(--text-dim); }
.v2c-pill.is-ok { background: rgba(48, 209, 88, 0.16); color: #8af0a6; }
.v2c-pill.is-warn { background: rgba(255, 214, 10, 0.16); color: #ffe57f; }
.v2c-pill.is-err { background: rgba(255, 69, 58, 0.18); color: #ffb3ad; }
.v2c-sec { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; background: var(--fill-card); border: none; }
.v2c-list, .comp-editor-list { display: flex; flex-direction: column; gap: 8px; max-height: 230px; overflow-y: auto; }
.comp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
.comp-row .c-name { width: 118px; }
.comp-row .c-persona { flex: 1; min-width: 170px; }
.comp-row .c-model { width: 152px; }
.comp-row .c-num { width: 68px; padding: 7px 8px; }
.studio-byok-grid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.studio-byok-grid input[type="text"], .studio-byok-grid input[type="password"] { flex: 1; min-width: 150px; }
.byok-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-main); width: 100%; cursor: pointer; }
.shuttle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.shuttle-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.06);
  white-space: normal;
}
.shuttle-card:hover { background: rgba(255, 255, 255, 0.12); }
.shuttle-card-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.shuttle-card-sub { font-size: 12px; line-height: 1.4; color: var(--text-dim); }
.v2c-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); cursor: pointer; }
.v2c-row.is-contraband { background: rgba(255, 69, 58, 0.10); }
.v2c-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.v2c-row-title { font-size: 13px; font-weight: 500; }
.v2c-row-sub { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2c-badge { flex-shrink: 0; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; background: var(--fill-subtle); }
.v2c-badge.is-ok { color: #8af0a6; background: rgba(48, 209, 88, 0.16); }
.v2c-badge.is-err { color: #ffb3ad; background: rgba(255, 69, 58, 0.18); }
.v2c-empty { font-size: 12px; color: var(--text-dim); padding: 4px 2px; }
.v2c-pending, .v2c-feedback { padding: 9px 12px; border-radius: 14px; font-size: 12.5px; line-height: 1.45; background: var(--fill-subtle); }
.v2c-feedback.is-ok { background: rgba(48, 209, 88, 0.18); color: #b8f7c9; }
.v2c-feedback.is-err { background: rgba(255, 69, 58, 0.20); color: #ffc8c2; }
.v2c-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* Brain, Memory & Study Styles */
.brain-tabs { align-self: flex-start; }
.brain-inline-check { width: auto; flex-shrink: 0; }
.brain-textarea { width: 100%; resize: vertical; min-height: 112px; line-height: 1.5; }
.brain-mem-list { max-height: 205px; }
.mem-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 9px 11px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
.mem-row.is-pinned { background: rgba(255, 255, 255, 0.11); }
.mem-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mem-text { font-size: 13px; line-height: 1.45; word-break: break-word; user-select: text; -webkit-user-select: text; }
.mem-meta { display: flex; flex-wrap: wrap; gap: 5px; font-size: 11px; color: var(--text-dim); }
.mem-badge { padding: 2px 7px; border-radius: 999px; background: var(--fill-subtle); font-size: 10.5px; }
.mem-ops { display: flex; gap: 4px; flex-shrink: 0; }
.mem-ops .chip { padding: 3px 8px; font-size: 11.5px; min-height: 28px; }
.brain-obs-box { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 0.5px solid rgba(255, 255, 255, 0.10); }
.mcp-trace-bar { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.mcp-call-badge { color: #a9f5c2; background: rgba(48, 209, 88, 0.16); }
.mcp-call-badge.is-err { color: #ffc3ba; background: rgba(255, 69, 58, 0.18); }
.mcp-server-card { align-items: flex-start; }
.mcp-tool-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.mcp-tool-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 9px; border-radius: 999px; font-size: 11.5px; background: var(--fill-subtle); }
.mcp-tool-pill .chip { padding: 2px 7px; font-size: 11px; min-height: 24px; }
.mcp-call-out { white-space: pre-wrap; max-height: 130px; overflow-y: auto; user-select: text; -webkit-user-select: text; font-size: 12px; }
#mbx-vis-select { background: rgba(255, 255, 255, 0.08); color: inherit; outline: none; }
.focus-timer-pill { position: fixed; top: calc(58px + var(--safe-top)); left: 14px; z-index: 33; display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; pointer-events: auto; font-size: 12.5px; }
.study-review-drawer { display: flex; flex-direction: column; gap: 7px; padding: 10px 12px; border-radius: 16px; background: var(--fill-card); max-height: 220px; overflow-y: auto; }
.study-review-card { display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.study-quiz-box { padding: 7px 10px; border-radius: 10px; background: var(--fill-subtle); font-size: 12.5px; display: flex; flex-direction: column; gap: 5px; }

/* Study Markdown & Math */
.chat-bar.is-study { width: min(860px, calc(100vw - 24px)); max-height: calc(100dvh - 82px - var(--safe-top) - var(--safe-bottom)); }
.chat-bar.is-study .chat-stream { max-height: min(56dvh, 520px); }
.study-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding: 7px 10px; border-radius: 16px; background: var(--fill-card); }
.study-hint { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.study-input { flex: 1; min-width: 140px; min-height: 46px; max-height: 128px; resize: vertical; line-height: 1.45; background: transparent; border: none; }
.study-input:focus { background: transparent; border-color: transparent; }
.chat-msg.is-study { flex-direction: column; align-items: stretch; width: 100%; max-width: 100%; gap: 6px; padding: 11px 13px; }
.chat-msg.is-user .study-user-text { white-space: pre-wrap; user-select: text; -webkit-user-select: text; }
.study-msg-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.study-spoken { padding: 6px 11px; border-radius: 11px; font-size: 13px; color: var(--text-main); background: var(--fill-subtle); user-select: text; -webkit-user-select: text; }
.study-thinking { font-size: 12px; color: var(--text-dim); background: rgba(0, 0, 0, 0.22); border-radius: 10px; padding: 5px 10px; }
.study-thinking summary { cursor: pointer; font-weight: 500; }
.study-think-pre { margin: 5px 0 0; white-space: pre-wrap; font-family: inherit; font-size: 11.5px; line-height: 1.45; max-height: 140px; overflow-y: auto; }
.study-md { font-size: 13.5px; line-height: 1.62; color: var(--text-main); user-select: text; -webkit-user-select: text; overflow-x: auto; }
.study-h { margin: 8px 0 4px; color: #ffffff; font-size: 14.5px; }
.study-p { margin: 4px 0; }
.study-list { margin: 4px 0 6px; padding-left: 20px; }
.study-list li { margin: 2px 0; }
.study-quote { margin: 5px 0; padding: 5px 11px; border-left: 2.5px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.04); color: var(--text-dim); border-radius: 0 10px 10px 0; }
.study-hr { border: none; border-top: 0.5px solid rgba(255, 255, 255, 0.14); margin: 7px 0; }
.study-inline-code { padding: 1px 6px; border-radius: 6px; font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; background: rgba(255, 255, 255, 0.10); color: #f5f5f7; }
.study-code-wrap { margin: 7px 0; border-radius: 14px; background: rgba(12, 12, 16, 0.72); border: 0.5px solid rgba(255, 255, 255, 0.12); overflow: hidden; }
.study-code-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 11px; font-size: 11.5px; color: var(--text-dim); background: rgba(255, 255, 255, 0.05); }
.study-copy-btn { padding: 2px 8px; font-size: 11px; }
.study-pre { margin: 0; padding: 10px 12px; overflow-x: auto; font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; line-height: 1.5; color: #f5f5f7; user-select: text; -webkit-user-select: text; }
.math-block { margin: 7px 0; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); text-align: center; overflow-x: auto; font-family: "Cambria Math", "Times New Roman", Georgia, serif; font-size: 15px; line-height: 1.7; }
.math-inline { font-family: "Cambria Math", "Times New Roman", Georgia, serif; padding: 0 2px; color: #ffffff; }
.math-var { font-style: italic; }
.math-fn, .math-text { font-style: normal; }
.math-bold { font-weight: 700; }
.math-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 3px; font-size: 0.9em; line-height: 1.15; }
.math-num { padding: 0 3px 1px; border-bottom: 1px solid currentColor; }
.math-den { padding: 1px 3px 0; }
.math-sqrt { display: inline-flex; align-items: baseline; }
.math-rad { margin-right: 1px; }
.math-radicand { border-top: 1px solid currentColor; padding: 0 3px 0 1px; }
.math-overline { border-top: 1px solid currentColor; padding-top: 1px; }
.math-accent { position: relative; display: inline-block; }
.math-acc-mark { margin-left: -0.3em; }
.math-sup, .math-sub { font-size: 0.76em; }
.study-table { width: 100%; border-collapse: collapse; margin: 7px 0; font-size: 12.5px; }
.study-table th, .study-table td { border: 0.5px solid rgba(255, 255, 255, 0.16); padding: 5px 9px; text-align: left; }
.study-table th { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.study-actions-row { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 0.5px solid rgba(255, 255, 255, 0.10); }
.study-actions-row .chip { padding: 3px 9px; font-size: 11.5px; }

/* Tabletop Play Modal */
.tabletop-play-modal { width: min(680px, calc(100vw - 24px)); }
.play-controls-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.play-controls-bar input { flex: 1; min-width: 170px; }
.play-art-wrap { align-items: center; }
.play-art-img { width: 124px; height: 124px; object-fit: cover; border-radius: 14px; flex-shrink: 0; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32); }
.play-log { max-height: 260px; overflow-y: auto; gap: 8px; padding: 12px; -webkit-overflow-scrolling: touch; }
.play-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 92%; padding: 9px 12px; border-radius: 16px 16px 16px 6px; background: rgba(255, 255, 255, 0.08); font-size: 13.5px; line-height: 1.5; }
.play-msg.is-user { align-self: flex-end; border-radius: 16px 16px 6px 16px; background: rgba(255, 255, 255, 0.20); color: #ffffff; }
.play-msg.is-side { background: rgba(255, 214, 10, 0.10); border: 0.5px solid rgba(255, 214, 10, 0.22); }
.play-msg-text { white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text; }

/* Story Studio Modal */
.story-studio-modal { width: min(760px, calc(100vw - 24px)); }
.story-top-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.story-top-bar .seg-group { flex-wrap: wrap; }
#story-book-select { max-width: 210px; background: rgba(255, 255, 255, 0.08); color: inherit; }
.story-media-bar { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 14px; background: var(--fill-subtle); flex-wrap: wrap; }
.story-art-img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; flex-shrink: 0; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.story-media-meta { flex: 1; min-width: 190px; display: flex; flex-direction: column; gap: 7px; }
.story-chapter-body { max-height: 250px; overflow-y: auto; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); font-size: 14px; line-height: 1.72; color: var(--text-main); white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text; -webkit-overflow-scrolling: touch; }
.story-narration-lines { display: flex; flex-direction: column; gap: 5px; }
.story-cast-line { display: flex; align-items: baseline; gap: 7px; padding: 6px 10px; border-radius: 11px; background: rgba(255, 255, 255, 0.06); font-size: 12.5px; line-height: 1.45; }
.story-choices-bar { display: flex; flex-wrap: wrap; gap: 7px; }
.story-choice-btn { text-align: left; padding: 6px 12px; border-radius: 14px; font-size: 12.5px; background: rgba(255, 255, 255, 0.10); }
.story-choice-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.20); }
.story-cast-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.story-cast-card, .story-fs-row, .story-issue-card { padding: 9px 11px; border-radius: 13px; background: var(--fill-card); display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; line-height: 1.48; }
.story-fs-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.story-fs-pill { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(255, 255, 255, 0.12); }
.story-fs-pill.is-seeded { background: rgba(100, 210, 255, 0.20); color: #9de4ff; }
.story-fs-pill.is-boosted { background: rgba(255, 214, 10, 0.20); color: #ffe57f; }
.story-fs-pill.is-resolved { background: rgba(48, 209, 88, 0.22); color: #8af2a7; }
.story-fs-pill.is-dropped { background: rgba(255, 69, 58, 0.18); color: #ffb3ad; }
.story-issue-card.is-critical { border-left: 3px solid var(--sys-red); }
.story-issue-card.is-warning { border-left: 3px solid #ffd60a; }
.story-issue-card.is-info { border-left: 3px solid #64d2ff; }

/* Responsive Mobile Portrait (390x844 iOS 18 Floating Squircle Layout) */
@media (max-width: 768px) {
  .subtitle-float { max-width: calc(100vw - 136px); bottom: calc(68px + var(--safe-bottom)); padding: 9px 14px; }
  .play-pad { right: 10px; bottom: calc(64px + var(--safe-bottom)); gap: 8px; }
  .emote-tray { right: 60px; bottom: calc(64px + var(--safe-bottom)); max-width: calc(100vw - 72px); }
  .emote-chip { min-height: 36px; font-size: 11.5px; }

  .top-bar { top: calc(8px + var(--safe-top)); left: 10px; right: 10px; display: flex; justify-content: space-between; }
  #zone-pill { max-width: calc(100vw - 182px); height: 34px; padding: 0 12px; font-size: 12px; }
  .dock-home, #top-fullscreen-btn { height: 34px; min-height: 34px; padding: 0 11px; font-size: 12px; }

  .quick-dock {
    top: calc(48px + var(--safe-top)); left: 8px; right: 8px; justify-content: space-between;
    gap: 1px; padding: 3px 4px; max-width: calc(100vw - 16px);
  }
  .quick-dock .dock-btn { height: 36px; min-height: 36px; padding: 0 5px; font-size: 11px; gap: 2.5px; flex-shrink: 0; }
  .quick-dock .dock-btn .sf-ico { width: 15px; height: 15px; }
  .quick-dock .dock-btn span:not(.dock-keep) { display: none; }
  .quick-dock .dock-btn:not(:has(.dock-keep)) { width: 28px; padding: 0; }

  .live-call-pill { top: calc(96px + var(--safe-top)); left: 10px; right: 10px; max-width: none; }
  .toast-banner { top: calc(154px + var(--safe-top)); left: 12px; right: 12px; max-width: none; text-align: center; }
  body.is-factory .toast-banner { top: calc(198px + var(--safe-top)); }
  #wf-hud-layer .wf-slot-top-left { top: calc(96px + var(--safe-top)); left: 10px; }
  #wf-hud-layer .wf-slot-top-right { top: calc(96px + var(--safe-top)); right: 10px; }
  body.has-live-call .toast-banner { top: calc(206px + var(--safe-top)); }
  .art-float-card, .power-float-card { top: calc(146px + var(--safe-top)); left: 10px; right: 10px; width: auto; max-width: none; }
  body.has-live-call .art-float-card, body.has-live-call .power-float-card { top: calc(198px + var(--safe-top)); }

  input:not([type="checkbox"]), textarea, select { font-size: 16px; min-height: 40px; }
  button, .chip, .icon-btn, .chat-pill, .chat-icon-btn { min-height: 36px; }
  .seg-track .chat-pill { height: 32px; min-height: 32px; padding: 0 11px; }
  .chat-close-btn { width: 36px; height: 36px; min-height: 36px; }
  .chat-icon-btn:not(#chat-mic-btn) { width: 33px; min-width: 33px; }
  .chat-form input[type="text"] { min-height: 36px; padding: 4px 5px; }
  .edit-bar { flex-direction: column; gap: 6px; padding: 9px 12px; border-radius: 22px; }
  .edit-bar #edit-actions { flex-wrap: nowrap; gap: 6px; }
  .edit-bar .icon-btn { padding: 0 10px; font-size: 12px; }
  .mem-ops .chip { min-height: 36px; }

  .chat-bar {
    left: 8px; right: 8px; width: auto; transform: none;
    bottom: calc(8px + var(--safe-bottom) + var(--kb-offset));
    border-radius: 26px; padding: 11px 12px; gap: 8px;
    animation: applePopIn 0.16s var(--spring);
  }
  .palette, .v2c-modal {
    top: auto; bottom: calc(8px + var(--safe-bottom) + var(--kb-offset));
    left: 6px; right: 6px; width: auto;
    max-height: min(72dvh, calc(100dvh - 154px - var(--safe-top)));
    transform: none; border-radius: 26px;
    padding: 14px 14px 16px;
    animation: applePopIn 0.16s var(--spring);
  }
  .comp-row .c-name, .comp-row .c-model { flex: 1; min-width: 120px; }
  #mbx-wish-form { flex-wrap: wrap; }
  #mbx-wish-input { min-width: 100%; order: -1; }

  .chat-bar.is-study {
    left: 6px; right: 6px; width: auto;
    max-height: calc(100dvh - 150px - var(--safe-top) - var(--safe-bottom));
    padding: 10px 11px; gap: 7px;
  }
  .chat-bar.is-study .chat-head, .chat-bar.is-study .study-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chat-bar.is-study .seg-group { flex-wrap: nowrap; flex-shrink: 0; }
  .chat-bar.is-study .chat-pill { white-space: nowrap; flex-shrink: 0; }
  .chat-bar.is-study .chat-stream { max-height: min(44dvh, 360px); }
  .chat-bar.is-study .study-input { font-size: 16px; min-height: 50px; padding: 6px 8px; }
  .story-top-bar { gap: 6px; }
  #story-book-select { max-width: 100%; flex: 1; }
  .story-chapter-body { max-height: 170px; font-size: 13.5px; }
  .story-art-img { width: 72px; height: 72px; }
  #story-turn-form { flex-wrap: wrap; }
  #story-turn-input { min-width: 100%; }
}

.glass-card { background: var(--glass-panel-bg); -webkit-backdrop-filter: blur(36px) saturate(195%); backdrop-filter: blur(36px) saturate(195%); border: 0.5px solid var(--glass-border); border-radius: 22px; box-shadow: var(--glass-rim), 0 24px 56px rgba(0, 0, 0, 0.34); pointer-events: auto; }
.center-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 16px 20px 20px; pointer-events: auto; animation: appleModalIn 0.18s var(--spring); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill-btn.is-primary { background: var(--pearl-bg); color: var(--pearl-fg); font-weight: 600; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.20); }
.pill-btn.is-primary:hover:not(:disabled) { background: #ffffff; }
.dock-more-popover { position: fixed; top: calc(58px + var(--safe-top)); right: 14px; z-index: 52; width: 318px; padding: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; border-radius: 16px; pointer-events: auto; }
.dock-more-popover .chip { min-height: 36px; justify-content: flex-start; text-align: left; }
.chat-load-more-btn { align-self: center; margin: 2px auto 6px; padding: 4px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.08); color: var(--text-dim); font-size: 12px; cursor: pointer; }
.chat-load-more-btn:hover { color: var(--text-main); border-color: var(--accent); }
.furnish-presets-sec { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(255,255,255,0.14); }
.furnish-preset-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.furnish-preset-chip { display: inline-flex; align-items: center; gap: 3px; }
.living-hub-modal { z-index: 46; width: min(720px, calc(100vw - 28px)); max-height: min(82dvh, 720px); display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }
.hub-tabs { flex-wrap: wrap; }
.hub-body { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.hub-action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hub-art-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hub-art-card { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.hub-art-thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; background: rgba(0,0,0,0.28); }
.hub-art-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-art-acts { display: flex; flex-wrap: wrap; gap: 4px; }
.hub-list { display: flex; flex-direction: column; gap: 7px; }
.hub-list-row, .hub-pet-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); }
.hub-pet-card { flex-direction: column; align-items: stretch; }
.hub-pet-head, .hub-pet-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.hub-pet-head input { flex: 1; min-width: 120px; }
.hub-list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hub-empty, .muted-sub { font-size: 13px; color: var(--text-dim); }
.hub-empty { padding: 10px; text-align: center; }
.hub-vol-row { align-items: center; }
.hub-vol-row input[type="range"] { flex: 1; }
.photo-mode-bar { position: fixed; left: 50%; bottom: calc(18px + var(--safe-bottom)); transform: translateX(-50%); z-index: 48; display: flex; align-items: center; gap: 8px; padding: 7px 12px; pointer-events: auto; }
.photo-fov-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.photo-fov-wrap input[type="range"] { width: 92px; }
body.is-photo-mode #top-bar, body.is-photo-mode #quick-dock, body.is-photo-mode #dock-more-popover, body.is-photo-mode #action-prompt, body.is-photo-mode #subtitle-float, body.is-photo-mode #home-onboard-pill, body.is-photo-mode #uw-pwa-guide-modal, body.is-photo-mode #music-mini-pill, body.is-photo-mode #play-pad, body.is-photo-mode #uw-intimacy-bar { display: none !important; }
.pwa-guide-modal { width: min(460px, calc(100vw - 24px)); z-index: 56; }
.pwa-guide-steps { gap: 10px; }
.pwa-step-row { display: flex; flex-direction: column; gap: 3px; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.pwa-step-row strong { color: var(--text-main); font-size: 13.5px; }
.home-onboard-pill { position: fixed; left: 14px; bottom: 18px; z-index: 33; padding: 7px 13px; font-size: 12.5px; cursor: pointer; pointer-events: auto; }
.home-onboard-card { position: fixed; left: 14px; bottom: 18px; z-index: 45; width: min(350px, calc(100vw - 28px)); padding: 14px; display: flex; flex-direction: column; gap: 10px; border-radius: 16px; pointer-events: auto; }
.onboard-head, .onboard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.onboard-desc { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
@media (max-width: 768px) {
  .dock-more-popover { top: calc(96px + var(--safe-top)); left: 8px; right: 8px; width: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .living-hub-modal { width: calc(100vw - 16px); max-height: calc(100dvh - 130px); padding: 12px; }
  .hub-art-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-mode-bar { left: 8px; right: 8px; transform: none; flex-wrap: wrap; justify-content: center; bottom: calc(16px + var(--safe-bottom)); }
  .home-onboard-pill { left: 10px; bottom: calc(134px + var(--safe-bottom)); font-size: 12px; padding: 6px 11px; }
  .home-onboard-card { left: 10px; right: 10px; width: auto; bottom: calc(134px + var(--safe-bottom)); }
}
.shuttle-card-thumb { width: 100%; height: 76px; object-fit: cover; border-radius: 8px; margin-bottom: 5px; display: block; border: 1px solid rgba(255,255,255,0.12); }
.shuttle-mode-badge { display: inline-block; align-self: flex-start; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(231,194,125,0.2); color: #ffe8b0; border: 1px solid rgba(231,194,125,0.45); margin-bottom: 3px; }
.world2d-thumb-chip { display: inline-flex; align-items: center; gap: 6px; padding-left: 5px; }
.world2d-chip-thumb { width: 28px; height: 20px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }

