:root {
  --panel: rgba(34, 27, 20, 0.90);
  --panel-solid: #221b14;
  --line: rgba(255, 236, 200, 0.12);
  --text: #f6ecd8;
  --muted: #c8b89b;
  --accent: #f0a85a;
  --kalo: #c98a55;
  --suri: #f2a6c4;
  --good: #8fd37a;
  --mid: #f1c95c;
  --low: #ef7b5a;
  --bubble: #fffaf0;
  --bubble-text: #3b2a1a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1230; color: var(--text); font-family: Nunito, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#overlay { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------- world labels ---------- */
.capy-tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; transform-origin: 50% 100%; will-change: transform; }
.capy-tag > * { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.capy-tag .name { display: none; }
.capy-tag.named .name { display: block; }
.capy-tag .name { transform: scale(var(--s, 1)) translate(-50%, -100%); font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 13px; padding: 1px 8px; border-radius: 99px; background: rgba(34, 27, 20, 0.7); white-space: nowrap; }
.capy-tag .bubble { transform: scale(var(--s, 1)) translate(-50%, calc(-100% - 30px)); display: none; max-width: 240px; width: max-content; padding: 7px 11px; border-radius: 14px; background: var(--bubble); color: var(--bubble-text); font-size: 13.5px; line-height: 1.3; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.capy-tag .bubble.on { display: block; animation: pop .25s ease-out; }
.capy-tag .bubble.say::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--bubble); border-bottom: 0; }
.capy-tag .bubble.think { background: rgba(255,250,240,.85); font-style: italic; letter-spacing: 2px; padding: 3px 10px; }
@keyframes pop { from { opacity: 0; } }
.proj-tag { position: absolute; left: 0; top: 0; }
.proj-tag { display: flex; gap: 6px; align-items: center; font-size: 12px; white-space: nowrap; padding: 2px 8px; border-radius: 8px; background: rgba(34,27,20,.6); translate: -50% -100%; }
.proj-tag span { color: var(--accent); }
.floater { position: absolute; left: 0; top: 0; translate: -50% -50%; font-size: 22px; font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,.3); }
.floater.heart { color: #ff7aa2; }
.floater.nom { color: #fff3c4; font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 16px; }
.floater.sparkle { color: #ffe27a; }
/* walking up to a resident */
#near { position: fixed; left: calc((100vw - var(--panel-space)) / 2); bottom: 12px; translate: -50% 0; z-index: 6; padding: 8px 12px 9px; border-radius: 14px; background: var(--panel); box-shadow: 0 6px 22px rgba(0,0,0,.25); text-align: center; animation: recap-in .35s ease-out; }
#near.hidden { display: none; }
#near .near-head { font-size: 13.5px; margin-bottom: 6px; }
#near .near-row { display: flex; gap: 6px; justify-content: center; }
#near button { border: 0; border-radius: 10px; padding: 6px 11px; background: var(--accent); color: #2a1c0e; font-weight: 700; font-size: 13px; cursor: pointer; }
#near button.near-more { background: transparent; color: inherit; font-weight: 600; text-decoration: underline; }
#near button:disabled { opacity: .5; }
#near-msg { font-size: 12px; color: var(--muted); min-height: 0; margin-top: 4px; }
#near-msg:empty { display: none; }
@media (max-width: 860px) { #near { left: 50%; bottom: calc(64px + env(safe-area-inset-bottom)); } }
body.near-on #now-line { display: none !important; }
body.broadcast #near, body.clean #near { display: none !important; }
/* the evening recap */
#recap { position: fixed; left: 50%; top: 84px; translate: -50% 0; z-index: 7; width: min(560px, calc(100vw - 32px)); padding: 16px 20px 14px; border-radius: 16px;
  background: rgba(20, 24, 48, 0.86); color: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.35); backdrop-filter: blur(6px); animation: recap-in .6s ease-out; }
#recap.hidden, body.clean #recap { display: none; }
#recap .recap-title { font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 21px; margin: 0 26px 8px 0; color: #ffe2a8; }
#recap .recap-lines { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; font-size: 15px; line-height: 1.35; }
#recap-close { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: #fff; opacity: .7; font-size: 22px; cursor: pointer; }
body.broadcast #recap { top: 50%; translate: -50% -50%; width: 640px; padding: 22px 28px 20px; }
body.broadcast #recap .recap-title { font-size: 30px; }
body.broadcast #recap .recap-lines { font-size: 20px; gap: 8px; }
body.broadcast #recap-close { display: none; }
@keyframes recap-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.floater.note { color: #fffbe8; font-size: 22px; text-shadow: 0 1px 3px rgba(0,0,0,.5); }

/* ---------- HUD ---------- */
#hud { position: fixed; top: 12px; left: 12px; padding: 10px 14px; border-radius: 14px; background: var(--panel); }
#hud .title { font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 20px; }
#hud .clock { color: var(--muted); font-size: 14px; margin-top: 1px; }
.brain { font-size: 11.5px; margin-top: 4px; color: var(--muted); }
.brain .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--mid); vertical-align: 1px; }
.brain.gemini .dot { background: var(--good); }

:root { --panel-w: 300px; --panel-space: calc(var(--panel-w) + 24px); --sheet-h: 46vh; }
body.panel-collapsed { --panel-space: 0px; }
.hud-btns { display: flex; gap: 5px; margin-top: 7px; }
.hud-btns .sound-btn { margin-top: 0; }
#cams { position: fixed; top: 12px; left: max(236px, calc((100vw - var(--panel-space) - 520px) / 2)); display: flex; gap: 4px; padding: 5px; border-radius: 14px; background: var(--panel); }
#cams button { border: 0; background: transparent; padding: 6px 10px; border-radius: 10px; font-size: 13.5px; white-space: nowrap; }
#cams button:hover { background: rgba(255,255,255,.08); }
#cams button.on { background: var(--accent); color: #2a1c0e; font-weight: 700; }
#cams .sep { width: 1px; background: var(--line); margin: 4px 2px; }

/* ---------- gifts ---------- */
#gifts { position: fixed; left: 12px; bottom: 12px; padding: 8px 10px; border-radius: 14px; background: var(--panel); max-width: 330px; }
#gifts.collapsed { display: none; }
.gifts-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gifts-head { font-size: 12.5px; color: var(--muted); flex: 1; }
.mini-btn { border: 0; background: rgba(255,255,255,.08); border-radius: 8px; width: 28px; height: 24px; line-height: 1; font-size: 16px; font-weight: 700; color: var(--text); flex: none; }
.mini-btn:hover { background: rgba(255,255,255,.16); }
.gifts-head b { color: var(--text); }
#allowance { color: var(--accent); }
.gift-row { display: flex; flex-wrap: wrap; gap: 6px; }
.gift-row button { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 50px; padding: 5px 4px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255,255,255,.05); font-size: 19px; transition: transform .1s, background .15s; }
.gift-row button span { font-size: 11px; color: var(--muted); }
.gift-row button:hover { background: rgba(240,168,90,.18); transform: translateY(-2px); }
.gift-row button:active { transform: scale(.95); }
.gift-row button:disabled { opacity: .4; cursor: default; transform: none; }
#gift-msg { min-height: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- panel ---------- */
#panel { position: fixed; top: 12px; right: 12px; bottom: 12px; width: var(--panel-w); display: flex; flex-direction: column; border-radius: 16px; background: var(--panel); overflow: hidden; }
#panel.collapsed { display: none; }
#panel-toggle { position: absolute; right: 7px; top: 8px; z-index: 2; }
#panel-resize { position: absolute; left: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 3; touch-action: none; }
#panel-resize:hover, #panel-resize.dragging { background: linear-gradient(90deg, rgba(240,168,90,.45), transparent); }
.tabs { display: flex; gap: 2px; padding: 6px 40px 6px 8px; border-bottom: 1px solid var(--line); }
/* buttons that reopen hidden boxes */
#dock { display: contents; }
.dock-btn { position: fixed; z-index: 5; border: 0; border-radius: 12px; padding: 8px 13px; background: var(--accent); color: #2a1c0e; font-weight: 700; font-size: 13.5px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
#panel-open { top: 12px; right: 12px; }
#gifts-open { left: 12px; bottom: 12px; }
body:not(.panel-collapsed) #panel-open, body:not(.gifts-collapsed) #gifts-open { display: none; }
/* controls guide */
#help { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(5,8,20,.55); }
.help-card { position: relative; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px 20px 16px; border-radius: 18px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.help-card h2 { margin: 0 0 4px; font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 22px; }
.help-lead { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.help-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 18px; }
.help-cols h3 { margin: 6px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.help-cols ul { margin: 0 0 6px; padding-left: 16px; font-size: 13.5px; line-height: 1.5; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; margin-right: 2px; border-radius: 5px; border: 1px solid var(--line); background: rgba(255,255,255,.08); font: 600 12px Nunito, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; text-align: center; }
.help-close { position: absolute; top: 10px; right: 10px; border: 0; background: rgba(255,255,255,.08); border-radius: 8px; width: 30px; height: 30px; }
.help-ok { margin-top: 10px; border: 0; border-radius: 10px; padding: 8px 18px; background: var(--accent); color: #2a1c0e; font-weight: 700; }
@media (pointer: coarse) { .ctl-desk { display: none; } }
@media (pointer: fine) { .ctl-touch { display: none; } }
.tabs button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.tabs button.on { background: rgba(255,255,255,.09); color: var(--text); }
.tab-body { flex: 1; overflow-y: auto; padding: 10px 12px 14px; }
.hidden { display: none !important; }

.card { padding: 11px 12px; border-radius: 13px; background: rgba(255,255,255,.04); border: 1px solid var(--line); margin-bottom: 10px; cursor: pointer; }
.card.sel { border-color: var(--accent); }
.card h3 { margin: 0; font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 17px; display: flex; align-items: baseline; gap: 8px; }
.card h3 .mood { font-family: Nunito, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 12px; color: var(--muted); }
.card .doing { font-size: 13px; color: var(--accent); margin: 3px 0 6px; }
.card .thought { font-size: 13.5px; font-style: italic; line-height: 1.35; margin-bottom: 8px; color: #efe2c8; }
.card .thought::before { content: "💭 "; font-style: normal; }
.meters { display: grid; grid-template-columns: 74px 1fr; gap: 3px 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; transition: width .6s; }
.card .goal { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.35; }
.card .goal b { color: var(--text); font-weight: 600; }
.bond { font-size: 12px; color: var(--muted); text-align: center; margin: 2px 0 10px; }
.bond b { color: #ff9bbd; }

#feed { list-style: none; margin: 0; padding: 0; }
#feed li { font-size: 13px; line-height: 1.35; padding: 6px 0; border-bottom: 1px solid var(--line); }
#feed li time { color: var(--muted); font-size: 11px; margin-right: 6px; }
.entry { padding: 10px 0; border-bottom: 1px solid var(--line); }
.entry .who { font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 14px; }
.entry .who small { color: var(--muted); font-family: Nunito, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 400; margin-left: 6px; }
.entry p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.45; color: #efe2c8; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

#hint { position: fixed; left: calc((100vw - var(--panel-space)) / 2); top: 64px; translate: -50% 0; padding: 6px 12px; border-radius: 10px; background: var(--panel); font-size: 12.5px; color: var(--muted); pointer-events: none; transition: opacity .6s; white-space: nowrap; }
#hint.off { opacity: 0; }
@media (max-width: 860px) { #hint { left: 50%; top: 104px; bottom: auto; white-space: normal; text-align: center; max-width: calc(100vw - 32px); } }
.card.compact { padding: 8px 11px; }
.card.compact .meters, .card.compact .goal.dream { display: none; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 2px 6px; }
#tab-talk { display: flex; flex-direction: column; }
#tab-talk.hidden { display: none; }
.talk-head { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.talk-head b { color: var(--text); }
#talk-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.msg { max-width: 85%; padding: 7px 10px; border-radius: 12px; font-size: 13.5px; line-height: 1.35; }
.msg.keeper { align-self: flex-end; background: var(--accent); color: #2a1c0e; border-bottom-right-radius: 4px; }
.msg.capy { align-self: flex-start; background: rgba(255,255,255,.08); border-bottom-left-radius: 4px; }
.msg .who { font-size: 11px; font-weight: 700; opacity: .75; display: block; margin-bottom: 2px; }
.msg .thought { display: block; font-style: italic; font-size: 12px; opacity: .7; margin-top: 3px; }
.msg.pending { opacity: .6; font-style: italic; }
#talk-form { display: flex; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
#talk-input { flex: 1; min-width: 0; font: inherit; color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
#talk-form button { border: 0; border-radius: 10px; padding: 8px 14px; background: var(--accent); color: #2a1c0e; font-weight: 700; }
.sound-btn { margin-top: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 9px; padding: 4px 10px; font-size: 12.5px; }
.sound-btn[aria-pressed="true"] { background: var(--accent); color: #2a1c0e; border-color: transparent; font-weight: 700; }
.work { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.work.finished { border-color: rgba(143,211,122,.4); }
.work.abandoned { opacity: .6; }
.work-head b { font-size: 13.5px; }
.work-head small { color: var(--muted); font-size: 11.5px; }
.work ol { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.4; color: #e4d6bb; }
.tabs button { padding: 7px 4px; font-size: 12.5px; }
#note-form { display: flex; gap: 6px; margin-top: 8px; }
#note-input { flex: 1; min-width: 0; font: inherit; font-size: 12.5px; color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; }
#note-form button { border: 0; border-radius: 9px; padding: 6px 12px; background: var(--accent); color: #2a1c0e; font-weight: 700; font-size: 12.5px; }
#note-msg { min-height: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 320px; }
#notes-mod { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
#notes-mod summary { cursor: pointer; }
.note-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.note-row.removed { opacity: .45; text-decoration: line-through; }
.note-row span { flex: 1; }
.note-row button { border: 1px solid var(--line); background: transparent; border-radius: 7px; padding: 2px 8px; font-size: 11.5px; color: var(--muted); }
#loading { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 22px; background: #0b1230; transition: opacity .6s; }
#loading.gone { opacity: 0; pointer-events: none; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  /* compact top: title + clock + small buttons, then the camera row */
  #hud { top: 8px; left: 8px; right: 8px; height: 40px; padding: 0 8px 0 12px; display: flex; align-items: center; gap: 8px; }
  #hud .title { font-size: 15px; white-space: nowrap; }
  #hud .clock { font-size: 12.5px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #hud .brain { display: none; }
  .hud-btns { margin: 0; }
  .hud-btns .sound-btn { padding: 4px 8px; font-size: 14px; }
  .hud-btns .lbl { display: none; }
  #cams { top: 54px; left: 8px; right: 8px; transform: none; overflow-x: auto; padding: 4px; align-items: center; scrollbar-width: none; }
  #cams::-webkit-scrollbar { display: none; }
  #cams button { padding: 5px 9px; font-size: 12.5px; flex: none; }
  /* bottom: a dock with two clear buttons; each opens its own sheet */
  #dock { display: flex; position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); gap: 8px; z-index: 5; }
  .dock-btn { position: static; flex: 1; padding: 11px 8px; font-size: 14px; }
  body:not(.panel-collapsed) #dock { display: none; }
  body.panel-collapsed:not(.gifts-collapsed) #gifts-open { display: none; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--sheet-h); border-radius: 16px 16px 0 0; padding-top: 14px; }
  #panel-resize { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 18px; cursor: ns-resize; }
  #panel-resize::after { content: ""; position: absolute; left: 50%; top: 6px; width: 44px; height: 4px; margin-left: -22px; border-radius: 3px; background: rgba(255,255,255,.3); }
  #panel-resize:hover, #panel-resize.dragging { background: none; }
  #panel-toggle { top: 18px; }
  #gifts { left: 8px; right: 8px; max-width: none; bottom: calc(62px + env(safe-area-inset-bottom)); padding: 7px 8px; }
  body:not(.panel-collapsed) #gifts { bottom: calc(var(--sheet-h) + 8px); }
  .gift-row button { flex: 1; min-width: 0; font-size: 17px; padding: 4px 2px; }
}

#usage-box table.usage { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; }
#usage-box table.usage th, #usage-box table.usage td { text-align: left; padding: 2px 4px; border-bottom: 1px solid rgba(127,127,127,.2); }
#usage-box table.usage td:nth-child(n+2), #usage-box table.usage th:nth-child(n+2) { text-align: right; }
#usage-box p { margin: 6px 0 2px; font-size: 13px; }
#focus-chips { display: flex; gap: 4px; flex: none; }
#focus-chips button { white-space: nowrap; flex: none; }
#gift-msg:empty, #note-msg:empty { display: none; }

#hud h1.title { margin: 0; }
.help-links { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.help-links a { color: var(--accent); }

/* ---------- treats, account and shop ---------- */
#special-row { margin-top: 6px; }
.special-head { font-size: 12px; color: var(--accent); margin-bottom: 4px; }
#special-buttons button { border-color: rgba(240,168,90,.45); background: rgba(240,168,90,.12); }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 12.5px; padding: 4px 0; text-decoration: underline; text-underline-offset: 2px; }
#shop { position: fixed; inset: 0; z-index: 21; display: grid; place-items: center; padding: 16px; background: rgba(5,8,20,.55); }
#shop.hidden { display: none; }
.shop-card { width: min(640px, 100%); }
.shop-card h3 { margin: 14px 0 6px; font-size: 15px; }
.shop-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 10px; }
.product { display: flex; flex-direction: column; gap: 4px; padding: 11px 12px; border-radius: 13px; border: 1px solid var(--line); background: rgba(255,255,255,.04); }
.product b { font-size: 14.5px; }
.product span { font-size: 12.5px; color: var(--muted); flex: 1; }
.product button { align-self: flex-start; border: 0; border-radius: 10px; padding: 7px 14px; background: var(--accent); color: #2a1c0e; font-weight: 700; }
.product button:disabled { opacity: .5; }
.google-btn { display: inline-block; padding: 9px 16px; border-radius: 10px; background: #fff; color: #222; font-weight: 700; text-decoration: none; }
.shop-test { margin: 6px 0; padding: 7px 10px; border-radius: 9px; background: rgba(241,201,92,.15); color: var(--mid); font-size: 12.5px; }
.shop-thanks { margin: 6px 0; padding: 8px 10px; border-radius: 9px; background: rgba(143,211,122,.15); color: var(--good); font-size: 13.5px; }
.naming-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.naming-row select, .naming-row input[type=text], .naming-row input:not([type]) { flex: 1; min-width: 120px; font: inherit; font-size: 13px; color: var(--text); background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; }
.naming-row select option { color: #222; }
.naming-row .help-ok { margin-top: 0; }
.chk { font-size: 12.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; }
#profile { margin-top: 12px; font-size: 13px; color: var(--muted); }
#profile summary { cursor: pointer; }
.shop-small { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.shop-small a { color: var(--accent); }
#naming-msg, #profile-msg { min-height: 16px; font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* the sign-in / treats button stands out, and keeps its label on phones */
#account-btn.account-cta { background: var(--accent); color: #2a1c0e; border-color: transparent; font-weight: 700; }
@media (max-width: 860px) { #account-btn { padding: 4px 10px; font-size: 13px; white-space: nowrap; } }

/* ---------- the "what's happening" line ---------- */
#now-line { position: fixed; z-index: 4; bottom: 14px; left: calc((100vw - var(--panel-space)) / 2); translate: -50% 0; max-width: min(560px, calc(100vw - var(--panel-space) - 380px));
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 99px; background: var(--panel); font-size: 14.5px; font-weight: 600; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
#now-line .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--who, var(--accent)); }
#now-line #now-text { overflow: hidden; text-overflow: ellipsis; }
#now-line.empty { display: none; }
body.gifts-collapsed #now-line { max-width: min(560px, calc(100vw - var(--panel-space) - 200px)); }
.goal.changed { color: var(--good); }
.goal.changed b { color: var(--good); }
.goal.changed small { color: var(--muted); margin-left: 4px; }
@media (max-width: 860px) {
  #now-line { left: 50%; bottom: calc(66px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); font-size: 13.5px; padding: 7px 13px; }
  body:not(.gifts-collapsed) #now-line, body:not(.panel-collapsed) #now-line { display: none; }
}

/* ---------- broadcast view (?broadcast) ---------- */
#bc { display: none; }
body.broadcast #bc { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 6; font-family: Nunito, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif; }
body.broadcast #hud, body.broadcast #cams, body.broadcast #gifts, body.broadcast #panel, body.broadcast #dock, body.broadcast #help,
body.broadcast #hint, body.broadcast #shop, body.broadcast #loading.gone { display: none !important; }
.bc-brand { position: absolute; top: 18px; left: 22px; padding: 8px 16px; border-radius: 14px; background: var(--panel); font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 22px; }
.bc-brand #bc-clock { font-family: Nunito, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 16px; color: var(--muted); }
.bc-live { color: #ff5a5a; font-size: 15px; margin-right: 6px; letter-spacing: .04em; }
#bc-cast { position: absolute; top: 18px; right: 22px; display: flex; flex-direction: column; gap: 8px; width: 360px; }
.bc-who { padding: 8px 14px; border-radius: 13px; background: var(--panel); border-left: 5px solid var(--who); font-size: 15px; line-height: 1.3; }
.bc-who b { font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 17px; color: var(--who); margin-right: 6px; }
.bc-who span { color: var(--text); }
#bc-ticker { position: absolute; left: 22px; bottom: 22px; width: 520px; display: flex; flex-direction: column-reverse; gap: 6px; }
.bc-tick { padding: 7px 12px; border-radius: 11px; background: var(--panel); font-size: 14px; line-height: 1.35; animation: pop .4s ease-out; }
.bc-tick:not(:first-child) { opacity: .72; }
.bc-cta { position: absolute; right: 22px; bottom: 22px; padding: 9px 16px; border-radius: 13px; background: var(--accent); color: #2a1c0e; font-family: Fredoka, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 600; font-size: 20px; }
.bc-cta span { font-family: Nunito, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 14px; font-weight: 700; }
body.broadcast #now-line { left: 50%; bottom: 80px; max-width: 760px; font-size: 18px; padding: 10px 20px; display: flex !important; }
/* portrait (9:16) for phone platforms */
body.broadcast.portrait .bc-brand { left: 50%; translate: -50% 0; top: 28px; font-size: 26px; white-space: nowrap; }
body.broadcast.portrait #bc-cast { top: 92px; left: 24px; right: 24px; width: auto; }
body.broadcast.portrait #bc-ticker { left: 24px; right: 24px; width: auto; bottom: 150px; }
body.broadcast.portrait .bc-cta { left: 50%; right: auto; translate: -50% 0; bottom: 40px; white-space: nowrap; }
body.broadcast.portrait #now-line { bottom: 98px; max-width: calc(100vw - 48px); }

body.clean #bc, body.clean #now-line, body.clean #overlay { display: none !important; }

.goal.jar .bar { margin-top: 4px; }
#shop-jars .goal.jar { font-size: 13px; color: var(--muted); margin: 6px 0; }
#shop-jars .goal.jar b { color: var(--text); }
