/* bobo-daily's mobile layout: one screen at a time over the whole viewport, the tab bar at the bottom (safe areas
   respected). The home screen is the room: the 3D view fills it, bubbles over the pets, the chat line and hold-to-speak
   above the tab bar. */
:root { --bg: #fff6ea; --ink: #2b2118; --dim: #8a7b6c; --accent: #ff8a3d; --card: #ffffff; --bar: 56px; color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.4 -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: 0; border-radius: 999px; padding: 8px 14px; background: #f1e4d3; cursor: pointer; touch-action: manipulation; }
button.primary { background: var(--accent); color: #fff; }

/* the tab bar */
#tabs { flex: none; display: flex; height: calc(var(--bar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid #eadccb; }
#tabs button { flex: 1; border-radius: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--dim); }
#tabs button .icon { font-size: 20px; line-height: 1; }
#tabs button[aria-selected="true"] { color: var(--accent); font-weight: 600; }

/* placeholders (notebook, Daily) */
.placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--dim); text-align: center; padding: 24px; }
.placeholder .big { font-size: 40px; }

/* the room */
#room { position: absolute; inset: 0; overflow: hidden; background: #f6e7d2; }
#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: calc(8px + env(safe-area-inset-top)) 12px 8px; pointer-events: none; }
#room-top > * { pointer-events: auto; }
#room-name { font-weight: 700; text-shadow: 0 1px 2px #fff; }
#room-state { font-size: 12px; color: var(--dim); }
#room-top .spacer { flex: 1; }
#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: #eadccb; 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; background: var(--card); box-shadow: 0 8px 30px rgba(0,0,0,.15); 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; font-size: 15px; font-weight: 500; box-shadow: 0 4px 18px rgba(0,0,0,.18); 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: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#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(255,255,255,.85); font-size: 14px; }
#room-lines .line.mine { align-self: flex-end; background: #ffe2cc; }
#room-lines .line b { font-size: 11px; color: var(--dim); display: block; }
#room-ear { align-self: center; font-size: 13px; color: var(--dim); background: rgba(255,255,255,.85); padding: 3px 10px; border-radius: 10px; }
#room-compose { display: flex; gap: 6px; align-items: center; }
#room-text { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 10px 14px; border-radius: 999px; border: 1px solid #eadccb; background: var(--card); }
#room-talk { white-space: nowrap; user-select: none; -webkit-user-select: none; }
#room-talk.on { background: var(--accent); color: #fff; }
#room-talk.err { background: #f3c1c1; }

#notice { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 20; padding: 8px 14px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13px; }
