:root { --bg: #14161c; --panel: #1c1f27; --line: #2c303b; --text: #e8e6e1; --dim: #9aa0ab; --pip: #7cc95c; --live: #ff4d4d; --say: #fff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { display: flex; overflow: hidden; }
#stage { position: relative; flex: 1; min-width: 0; }
#view { display: block; width: 100%; height: 100%; }
#side { width: 380px; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); }
#tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
#tabs button { flex: 1; background: none; border: 0; color: var(--dim); padding: 11px 4px; font: inherit; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; }
#tabs button.on { color: var(--text); border-bottom-color: var(--pip); }
.tab { display: none; flex: 1; overflow-y: auto; padding: 12px 14px 40px; }
.tab.on { display: block; }
#top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 14px; padding: 10px 14px;
  background: linear-gradient(#000a, #0000); pointer-events: none; }
#top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; flex-shrink: 0; white-space: nowrap; }
.brand b { color: var(--pip); }
#livelabel { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #555; }
.dot.live { background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #ff4d4d99; } 70% { box-shadow: 0 0 0 9px #ff4d4d00; } 100% { box-shadow: 0 0 0 0 #ff4d4d00; } }
.clock { flex-shrink: 0; font: 600 20px ui-monospace, Consolas, monospace; text-shadow: 0 1px 3px #000; }
.ctrls { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ctrls select, .ctrls button { background: #0009; color: var(--text); border: 1px solid #fff3; border-radius: 6px; padding: 5px 9px; font: inherit; font-size: 13px; cursor: pointer; }
.ctrls button.on { border-color: var(--pip); color: var(--pip); }
#now { position: absolute; left: 14px; bottom: 14px; max-width: min(560px, 70%); background: #000b; border-radius: 8px; padding: 8px 12px;
  font-size: 14px; display: none; }
#now.show { display: block; }
#now .act { color: var(--pip); font-weight: 600; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; color: var(--dim); background: var(--bg); }
#help { position: absolute; right: 14px; bottom: 14px; font-size: 12px; color: #fffa; text-shadow: 0 1px 2px #000; }
#bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bubble { position: absolute; transform: translate(-50%, -100%); max-width: 300px; background: var(--say); color: #111; border-radius: 14px;
  padding: 8px 12px; font-size: 14px; box-shadow: 0 3px 12px #0006; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: var(--say); }
.bubble .who { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: #3d7a26; letter-spacing: .05em; }
.bubble.thought { background: #eef4ff; font-style: italic; border-radius: 22px; }
.bubble.thought::after { border: 0; width: 10px; height: 10px; border-radius: 50%; background: #eef4ff; bottom: -14px; left: 45%; }
.tag { position: absolute; transform: translate(-50%, -100%); background: #000a; color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 9px; }
.ev { border-bottom: 1px solid var(--line); padding: 8px 0; }
.ev .t { color: var(--dim); font: 12px ui-monospace, Consolas, monospace; margin-right: 6px; }
.ev .a { color: var(--pip); font-weight: 600; }
.ev .r { color: var(--dim); font-size: 13px; margin-top: 2px; }
.ev.fail .a { color: #e0a030; }
.ev.cur { background: #ffffff08; }
.ev .say { margin: 4px 0 0 10px; font-size: 14px; }
.ev .say b { color: #cfd6e0; }
.ev.think { font-style: italic; color: #c8d2ff; }
.muted { color: var(--dim); }
h2 { font-size: 15px; margin: 16px 0 6px; color: var(--pip); }
h3 { font-size: 14px; margin: 14px 0 4px; }
.md p { margin: 0 0 10px; }
.bar { height: 8px; background: #fff1; border-radius: 4px; overflow: hidden; margin: 3px 0 10px; }
.bar > i { display: block; height: 100%; background: var(--pip); }
video { width: 100%; border-radius: 8px; background: #000; margin: 6px 0 2px; max-height: 70vh; }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; background: #fff2; margin-left: 6px; }
button.link { background: none; border: 0; color: var(--pip); padding: 0; font: inherit; cursor: pointer; }
@media (max-width: 800px) {
  body { flex-direction: column; }
  #stage { flex: 1 1 58%; }
  #side { width: auto; flex: 1 1 42%; border-left: 0; border-top: 1px solid var(--line); }
  #help { display: none; }
  .clock { font-size: 16px; }
}

#debug { position: fixed; left: 8px; top: 48px; z-index: 9; background: #000c; color: #9f9; font-size: 12px; padding: 4px 8px; margin: 0; max-width: 1000px; white-space: pre-wrap; }
#updating { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); background: #000b; color: var(--pip); font-size: 13px; padding: 4px 12px; border-radius: 12px; display: none; }
#updating.show { display: block; }

/* Art tab: every painting Pip has made, the gallery ones first */
.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.art-card { margin: 0; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.art-card.gallery { border-color: rgba(255, 214, 120, .55); box-shadow: 0 0 12px rgba(255, 214, 120, .15); }
.art-card img, .art-wait { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #20242c; display: block; }
.art-wait { display: flex; align-items: center; justify-content: center; font-size: 12px; opacity: .7; font-style: italic; }
.art-card figcaption { margin-top: 6px; font-size: 13px; line-height: 1.35; }
.art-blurb { margin-top: 4px; font-style: italic; opacity: .85; }

/* Pip's brain, top-right corner (site/brain.js) */
#brain { position: absolute; top: 54px; right: 14px; width: 270px; background: #0d0a14d9; border: 1px solid #ffffff1f;
  border-radius: 12px; padding: 6px 8px 8px; color: #eee; font-size: 11px; backdrop-filter: blur(4px); z-index: 3;
  transition: width .25s; }
#brain.big { width: min(720px, 70%); }
#brain canvas { display: block; width: 100%; aspect-ratio: 1.45; cursor: crosshair; }
#brain .bhead { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
#brain .bhead b { color: var(--pip, #9f9); letter-spacing: .03em; }
#brain .bstat { flex: 1; color: #fff8; font-size: 10px; }
#brain button { background: #ffffff14; color: #eee; border: 0; border-radius: 6px; padding: 1px 7px; cursor: pointer; font-size: 11px; }
#brain .bfoot { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
#brain .bday { flex: 1; accent-color: #c792ff; }
#brain .blabel { min-width: 42px; text-align: right; color: #fffa; }
#brain .blegend { display: none; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; color: #fffb; }
#brain.big .blegend { display: flex; }
#brain .blegend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
#brain .btip { display: none; position: absolute; left: 8px; right: 8px; bottom: 34px; background: #000d; padding: 4px 7px;
  border-radius: 6px; pointer-events: none; font-size: 11px; }

/* Searches tab */
.search-day { margin: 14px 0 6px; font-size: 13px; opacity: .7; text-transform: uppercase; letter-spacing: .06em; }
.search { padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); border-left: 3px solid #5fd3ff; }
.search.question { border-left-color: #c792ff; }
.search.web { border-left-color: #ffd25f; }
.search.study { border-left-color: #8ef0c8; }
.search-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.search-head b { flex: 1; min-width: 60%; }
.search-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .65; }
.search-found { margin-top: 4px; font-size: 13px; line-height: 1.4; opacity: .9; }
.search-src { display: inline-block; margin-top: 4px; font-size: 12px; color: #5fd3ff; }

/* Music tab */
.music-sub { margin: 14px 0 6px; font-size: 13px; opacity: .75; text-transform: uppercase; letter-spacing: .06em; }
.song { padding: 9px 10px; margin-bottom: 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); border-left: 3px solid #c792ff; }
.song.now { border-left-color: #7dff8a; box-shadow: 0 0 14px rgba(125, 255, 138, .15); }
.song-head { display: flex; gap: 10px; align-items: center; }
.song-rating { min-width: 44px; text-align: center; font-weight: 700; font-size: 14px; padding: 4px 0; border-radius: 6px; background: rgba(199, 146, 255, .18); }
.song-title { flex: 1; min-width: 0; }
.song-thought { margin-top: 6px; font-style: italic; font-size: 13px; line-height: 1.4; }
.song audio { width: 100%; height: 30px; margin-top: 6px; }
.song-lic { display: inline-block; margin-top: 2px; font-size: 11px; color: #5fd3ff; }
.taste-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.taste-name { width: 92px; text-transform: capitalize; }
.taste-track { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.taste-bar { height: 100%; background: linear-gradient(90deg, #c792ff, #7dff8a); }
