/* bobo-daily's mobile layout on the shared dark theme (@pet/ui/theme: the reference implementation's night, purple
   controls, gold for what is chosen; its --ui-* properties): one screen at a time over the whole viewport, the tab bar
   (@pet/ui/tabs) at the bottom (safe areas respected). The home screen is the room: the 3D view fills it, bubbles over
   the pets, the top row (the home's name; ↗ 分享, 📓, sound at the right), the camera switch under it at the right, the
   chat line (🎵, the text, hold-to-speak) above the tab bar. Daily keeps its own look; adoption uses @pet/ui/adoption. */
:root { --bg: var(--ui-bg, #16141c); --ink: var(--ui-text, #ece9f3); --dim: var(--ui-dim, #a39fb0); --accent: var(--ui-purple, #9b7bff); --card: var(--ui-card, rgba(33,30,42,.86)); --glass: var(--ui-glass, rgba(28,25,36,.66)); --rim: var(--ui-rim, rgba(255,255,255,.16)); color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--ui-font, -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", system-ui, sans-serif); overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#screens { position: relative; flex: 1; overflow: hidden; }
.screen { position: absolute; inset: 0; display: none; }
.screen.on { display: block; }
button { font: inherit; color: inherit; border: 1px solid var(--rim); border-radius: 999px; padding: 8px 14px; background: var(--glass); cursor: pointer; touch-action: manipulation; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--ui-gold, #ffd98c); outline-offset: 2px; }

/* the adoption (@pet/ui/adoption draws it): over the whole page, the tab bar too, while it is open */
#screen-adopt.open { display: block; position: fixed; inset: 0; z-index: 30; }

/* the tab bar: @pet/ui/tabs draws it */
#tabs { flex: none; }

/* the room */
#room { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 62%, #2c2638 0%, var(--bg) 72%); }
#room-three { position: absolute; inset: 0; touch-action: none; }
#room-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
#room-top { position: absolute; left: 0; right: 0; top: 0; z-index: 4; display: flex; align-items: center; gap: 8px; padding: max(9px, env(safe-area-inset-top)) 10px 14px 14px; pointer-events: none; background: linear-gradient(to bottom, rgba(22,20,28,.55), rgba(22,20,28,0)); }
#room-top > * { pointer-events: auto; }
#room-name { min-width: 0; max-width: calc(100vw - 230px); height: 34px; line-height: 32px; padding: 0 13px; border-radius: 17px; border: 1px solid var(--rim); background: var(--glass); font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#room-state { font-size: 12px; color: var(--dim); text-shadow: 0 1px 4px rgba(0,0,0,.8); }
#room-top .spacer { flex: 1; }
#room-top .home-acts { display: flex; align-items: center; gap: 6px; }
#room-sound { height: 34px; min-width: 40px; padding: 0 10px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (max-width: 359px) { #home-share { padding: 0; width: 34px; font-size: 0; } #home-share::before { content: "↗"; font-size: 16px; } }
#room-loading { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: var(--bg); color: var(--dim); transition: opacity .3s; }
#room-loading.done { opacity: 0; pointer-events: none; }
#room-loading .bar { width: 60%; height: 6px; border-radius: 3px; background: #2a2636; overflow: hidden; }
#room-loading .bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#room-banner { position: absolute; left: 16px; right: 16px; top: 30%; z-index: 7; display: none; padding: 16px; border-radius: 16px; border: 1px solid var(--rim); background: var(--card); box-shadow: 0 8px 30px rgba(0,0,0,.45); text-align: center; }
#room-banner.on { display: block; }

#bubbles { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.bubble { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .25s; max-width: min(70vw, 300px); padding: 7px 12px; border-radius: 16px; background: #fff; color: #1b1824; font-size: 15px; font-weight: 500; box-shadow: 0 4px 18px rgba(0,0,0,.35); white-space: pre-wrap; word-break: break-word; }
.bubble.on { opacity: 1; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #fff; }

#room-chat { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 18px 10px 10px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; background: linear-gradient(to top, rgba(22,20,28,.5), rgba(22,20,28,0)); }
#room-chat > * { pointer-events: auto; }
#room-lines { display: flex; flex-direction: column; gap: 4px; max-height: 30vh; overflow: hidden; justify-content: flex-end; pointer-events: none; }
#room-lines .line { align-self: flex-start; max-width: 85%; padding: 5px 10px; border-radius: 12px; background: rgba(33,30,42,.78); border: 1px solid rgba(255,255,255,.08); font-size: 14px; overflow-wrap: anywhere; }
#room-lines .line.mine { align-self: flex-end; background: rgba(122,92,240,.78); }
#room-lines .line b { font-size: 11px; color: var(--ui-purple-light, #c7b5ff); display: block; }
#room-ear { align-self: center; font-size: 13px; color: var(--ink); background: var(--glass); padding: 3px 10px; border-radius: 10px; }
#room-compose { display: flex; gap: 6px; align-items: center; }
#room-text { flex: 1; min-width: 0; height: 40px; font: inherit; font-size: 16px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--rim); background: rgba(33,30,42,.62); color: var(--ink); outline: none; }
#room-text::placeholder { color: rgba(236,233,243,.62); }
#room-text:focus { border-color: var(--accent); }
#room-compose button { height: 40px; padding: 0 12px; }
#room-talk { white-space: nowrap; user-select: none; -webkit-user-select: none; }
#room-talk.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#room-talk.err { background: #5c2a33; }

/* the karaoke HUD (@pet/ui/singing): under the top row */
#song-hud { --ui-song-top: calc(max(9px, env(safe-area-inset-top)) + 50px); }
/* the home's controls (@pet/ui/controls): the camera switch (全景 / 跟拍, ⌖) stacked at the right edge under the top row
   (the karaoke HUD leaves it room), 🎵 / ⏹ first in the compose bar */
#room-cam { position: absolute; right: max(8px, env(safe-area-inset-right)); top: calc(max(9px, env(safe-area-inset-top)) + 50px); z-index: 4; }
#song-hud.ui-song { width: min(560px, calc(100% - 128px)); }
#room-compose #room-sing { width: 40px; min-width: 40px; padding: 0; font-size: 18px; }
