:root {
  --sky: #93befd; --ink: #141414; --paper: #fff; --blush: #fbc4f8; --lamp: #f2c35e; --cash: #84be62;
  --teal: #66afb2; --navy: #0a2470; --red: #cb1517; --cream: #fbe3a8; --mute: #4c4f5c;
  --f-display: "Bowlby One", "Arial Black", Impact, sans-serif;
  --f-hand: "Gaegu", "Comic Sans MS", cursive;
  --f-body: "Nunito", ui-rounded, system-ui, sans-serif;
  --f-mono: "DM Mono", ui-monospace, Menlo, monospace;
  --shadow: 6px 7px 0 var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--sky); color: var(--ink); font-family: var(--f-body); }
a { color: inherit; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; max-width: 1480px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-display); font-size: 26px; white-space: nowrap; }
.brand img { border: 3px solid var(--ink); border-radius: 50%; background: #fff; }
.brand b { color: var(--red); -webkit-text-stroke: 1px var(--ink); }
.top-right { display: flex; gap: 10px; }
.btn { font: 800 16px var(--f-body); background: #fff; border: 4px solid var(--ink); border-radius: 14px; padding: 10px 16px; box-shadow: 4px 4px 0 var(--ink); cursor: pointer; color: var(--ink); }
.btn.small { font-size: 14px; padding: 7px 12px; }
.btn.dark { background: var(--ink); color: #fff; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.holder { background: var(--lamp); color: var(--ink); }

/* stream on the left, chat column on the right (stacks on phones) */
main { max-width: 1480px; margin: 0 auto; padding: 0 16px 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); column-gap: 20px;
  grid-template-areas: "stage chat" "actions chat" "hint chat" "panels panels"; }
.stage-wrap { grid-area: stage; }
.actions { grid-area: actions; }
.hint { grid-area: hint; }
.panels { grid-area: panels; }
.stage-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; border: 5px solid var(--ink); border-radius: 22px; overflow: hidden; box-shadow: 8px 10px 0 var(--ink); background: var(--cream); }
#stage { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; transform-origin: 0 0; overflow: hidden; user-select: none; }
.layer { position: absolute; left: 0; top: 0; }
#world { width: 1280px; height: 720px; }
#cutaway { z-index: 5; } #fx { z-index: 6; } #burger, .cameo { z-index: 4; }
#banner, #toasts { z-index: 9; } .hud, #ticker, #cta { z-index: 8; }
#sky { width: 100%; height: 100%; background: #93befd url(img/z-1500.webp) 0 0 / 1300px 433px; transition: filter .8s; }
#sky.night { background: radial-gradient(circle at 75% 30%, #fffbe6 0 26px, transparent 27px), radial-gradient(#fff 1.5px, transparent 2px) 0 0 / 46px 46px, linear-gradient(#061440, #0a2470); }
#sky.moon { background: radial-gradient(circle at 70% 40%, #fffbe6 0 70px, #f2c35e 71px 76px, transparent 77px), radial-gradient(#fff 1.5px, transparent 2px) 0 0 / 40px 40px, linear-gradient(#061440, #2a1a5e); }
.portrait-img { width: 100%; height: 100%; background: url(img/chad-1200.webp) 50% 30% / 150%; }
.unlock { display: none; }
.unlock.on { display: inline; }

#wildeWrap { left: 560px; top: 168px; width: 520px; height: 469px; transform-origin: 50% 100%; }
#wilde { position: relative; width: 100%; height: 100%; }
#wildeFront, #face { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#wildeFront { filter: drop-shadow(0 0 1px var(--ink)); }
#wildeBack { position: absolute; left: 70px; top: 8px; width: 380px; display: none; filter: drop-shadow(0 0 1px var(--ink)); }
#wilde.back #wildeFront, #wilde.back #face { display: none; }
#wilde.back #wildeBack { display: block; }

#monitor { left: 302px; top: 312px; width: 276px; height: 166px; border-radius: 6px; overflow: hidden; }
#chart { display: block; }
#dim { width: 1280px; height: 720px; background: #2a3f8a; opacity: 0; pointer-events: none; transition: opacity 1.2s; mix-blend-mode: multiply; }
#fx { pointer-events: none; }
#burger { display: none; }
.cameo { width: 360px; display: none; filter: drop-shadow(0 0 1px var(--ink)); }

#cutaway { width: 1280px; height: 720px; display: none; background: #000; }
#cutImg { position: absolute; inset: 0; background-size: cover; background-position: 50% 50%; }
#cutCap { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); white-space: nowrap; font: 900 44px var(--f-body); background: #fff; border: 6px solid var(--ink); border-radius: 22px; padding: 12px 30px; box-shadow: 8px 9px 0 var(--ink); }

.hud { position: absolute; top: 18px; font: 900 22px var(--f-body); background: #fff; border: 5px solid var(--ink); border-radius: 999px; padding: 6px 18px; box-shadow: 5px 5px 0 var(--ink); }
#hudLive { left: 18px; display: flex; align-items: center; gap: 8px; }
#hudLive i { width: 14px; height: 14px; border-radius: 50%; background: var(--red); display: inline-block; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
#hudMcap { right: 18px; font-family: var(--f-mono); }
#hudMcap small { font: 800 14px var(--f-body); color: var(--mute); }
#banner { position: absolute; left: 50%; top: 150px; transform: translate(-50%, -50%) scale(0); font: 112px var(--f-display); color: #fff; -webkit-text-stroke: 14px var(--ink); paint-order: stroke fill; text-shadow: 9px 10px 0 var(--ink); white-space: nowrap; pointer-events: none; }
#toasts { position: absolute; left: 18px; bottom: 60px; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 8px; pointer-events: none; }
.toast { max-width: 370px; overflow: hidden; text-overflow: ellipsis; font: 800 22px var(--f-body); background: #fff; border: 4px solid var(--ink); border-radius: 14px; padding: 6px 16px; box-shadow: 4px 4px 0 var(--ink); animation: toast 3.2s forwards; white-space: nowrap; }
.toast b.buy { color: #2f8a2f; } .toast b.sell { color: var(--red); }
.toast .tier { font-size: 14px; background: var(--lamp); border: 2px solid var(--ink); border-radius: 6px; padding: 0 5px; margin-left: 4px; vertical-align: 2px; }
@keyframes toast { 0% { transform: translateY(-20px) scale(.6); opacity: 0; } 10% { transform: none; opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
#ticker { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: var(--ink); display: flex; align-items: center; gap: 10px; padding: 0 12px; overflow: hidden; }
.tk { flex: none; font: 800 18px var(--f-body); color: #fff; padding: 3px 12px; border-radius: 999px; border: 2px solid #fff; animation: tk .4s; }
.tk-wait { font: 700 17px var(--f-body); color: #9b9792; }
.tk.buy { background: #2f8a2f; } .tk.sell { background: var(--red); }
@keyframes tk { from { transform: translateX(-60px); opacity: 0; } }
#goalBox { position: absolute; left: 50%; bottom: 58px; width: 470px; transform: translateX(-50%); z-index: 8; background: #fff; border: 5px solid var(--ink); border-radius: 18px; padding: 8px 14px 10px; box-shadow: 5px 6px 0 var(--ink); display: none; }
#goalBox.on { display: block; }
#goalBox.done { background: var(--lamp); animation: goalPulse .8s ease-in-out infinite alternate; }
#goalBox.pick { background: var(--blush); }
@keyframes goalPulse { to { transform: translateX(-50%) scale(1.04); } }
#goalTitle { font: 900 20px/1.2 var(--f-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#goalTitle b { font-family: var(--f-display); font-weight: 400; color: var(--red); margin-right: 6px; }
.gbar { height: 16px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: #ebebeb; margin: 6px 0 4px; }
.gbar i { display: block; height: 100%; width: 0; background: var(--cash); transition: width .6s; }
#goalMeta { font: 800 15px var(--f-body); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#unmute { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9; font: 900 30px var(--f-body); background: var(--lamp); border: 5px solid var(--ink); border-radius: 18px; padding: 12px 24px; box-shadow: 6px 7px 0 var(--ink); cursor: pointer; display: none; }
#unmute.on { display: block; }
#nowPlaying { position: absolute; right: 18px; top: 84px; z-index: 8; font: 800 16px var(--f-body); background: var(--ink); color: #fff; border-radius: 999px; padding: 4px 12px; display: none; }
#nowPlaying.on { display: block; }
.goals { list-style: none; margin: 0; padding: 0; font-weight: 800; display: grid; gap: 10px; }
.goals .empty { color: var(--mute); }
.goals .gbar { height: 12px; margin: 4px 0 0; }
.goals .done { color: #2f8a2f; }
.goals .queued { color: var(--mute); font-size: 14px; }
#cta { position: absolute; right: 18px; bottom: 60px; font: 900 24px var(--f-body); background: var(--lamp); border: 5px solid var(--ink); border-radius: 16px; padding: 6px 16px; box-shadow: 5px 5px 0 var(--ink); display: none; }
body.stream #cta { display: block; }

.actions { display: flex; gap: 14px; justify-content: center; margin: 22px 0 6px; }
.act { flex: 1; max-width: 220px; display: flex; flex-direction: column; align-items: center; background: #fff; border: 5px solid var(--ink); border-radius: 18px; padding: 10px 8px; box-shadow: var(--shadow); cursor: pointer; color: var(--ink); }
.act .big { font: 34px var(--f-display); }
.act small { font: 800 14px var(--f-body); color: var(--mute); }
.act[data-act="slap"] { background: var(--blush); }
.act[data-act="feed"] { background: var(--lamp); }
.act[data-act="pet"] { background: #cfeabf; }
.act:active { transform: translate(4px, 5px); box-shadow: 2px 2px 0 var(--ink); }
.act:disabled { opacity: .6; }
.act.spent { opacity: .55; filter: grayscale(.6); }
.hint { text-align: center; font: 700 15px var(--f-body); margin: 8px 0 22px; }

#bubble { position: absolute; left: 470px; top: 22px; width: 580px; z-index: 7; background: #fff; border: 5px solid var(--ink); border-radius: 28px; padding: 12px 22px 14px; box-shadow: 7px 8px 0 var(--ink); opacity: 0; transform: scale(.6); transform-origin: 70% 100%; transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1); pointer-events: none; }
#bubble.on { opacity: 1; transform: none; }
#bubble::after { content: ""; position: absolute; left: 380px; bottom: -26px; width: 34px; height: 34px; background: #fff; border-right: 5px solid var(--ink); border-bottom: 5px solid var(--ink); transform: skewX(-30deg) rotate(45deg); }
#bubbleReply { font: 800 17px var(--f-body); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bubbleReply:empty { display: none; }
#bubbleText { font: 900 26px/1.2 var(--f-body); min-height: 31px; }
#chatOverlay { position: absolute; left: 18px; top: 86px; width: 400px; max-height: 206px; overflow: hidden; z-index: 7; display: none; flex-direction: column; justify-content: flex-end; gap: 6px; }
body.stream #chatOverlay { display: flex; }
#chatOverlay div { flex: none; font: 800 16px/1.25 var(--f-body); background: rgba(255, 255, 255, .92); border: 3px solid var(--ink); border-radius: 12px; padding: 4px 10px; animation: tk .3s; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#chatOverlay b { color: var(--navy); }

.card.chat { grid-area: chat; display: flex; flex-direction: column; min-height: 0; margin-bottom: 22px; }
.card.chat h3 small { font: 700 13px var(--f-body); color: var(--mute); }
#chatList { list-style: none; margin: 0 0 10px; padding: 0; height: 0; flex: 1 1 auto; min-height: 160px; overflow: auto; font-weight: 700; display: flex; flex-direction: column; gap: 6px; }
#chatList li { line-height: 1.35; overflow-wrap: anywhere; }
#chatList li.wilde { background: var(--cream); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 10px; }
#chatList .empty { color: var(--mute); }
#chatList b { color: var(--navy); }
#chatList .tier { font-size: 11px; background: var(--lamp); border: 2px solid var(--ink); border-radius: 5px; padding: 0 4px; margin-left: 4px; vertical-align: 2px; }
#chatForm { display: flex; flex-wrap: wrap; gap: 8px; }
#chatForm[hidden] { display: none; }
#chatGate p { margin: 0 0 8px; }
#chatForm input { font: 700 16px var(--f-body); border: 3px solid var(--ink); border-radius: 12px; padding: 8px 10px; min-width: 0; }
#chatText { flex: 1; }
@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "actions" "hint" "chat" "panels"; }
  #chatList { height: 260px; flex: none; }
}

.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.card { background: #fff; border: 4px solid var(--ink); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card h3 { margin: 0 0 8px; font: 26px var(--f-hand); font-weight: 700; }
.card label { display: block; font: 800 13px var(--f-body); margin-top: 8px; color: var(--mute); }
.mood { font: 28px var(--f-display); }
.moodDesc { margin: 2px 0 6px; font-weight: 700; }
.bar { height: 18px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: #ebebeb; }
.bar i { display: block; height: 100%; width: 0; background: var(--lamp); transition: width .6s; }
.bar.happy i { background: var(--blush); }
.bar.room i { background: var(--cash); }
.lvl { font: 800 18px var(--f-body); }
.lvl b { font: 30px var(--f-display); }
.small { font-size: 14px; color: var(--mute); font-weight: 700; }
.stats { display: grid; grid-template-columns: auto auto; gap: 6px 10px; margin: 0; font-weight: 800; }
.stats dt { color: var(--mute); } .stats dd { margin: 0; text-align: right; font-family: var(--f-mono); }
.board { margin: 0; padding-left: 22px; font-weight: 800; }
.board li { display: flex; justify-content: space-between; gap: 8px; font-family: var(--f-mono); font-size: 14px; }
.board .empty { color: var(--mute); font-family: var(--f-body); }
.feed { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; font-weight: 700; }
.feed li { padding: 5px 0; border-bottom: 2px dashed #ebebeb; display: flex; gap: 10px; }
.feed time { font: 13px var(--f-mono); color: var(--mute); flex: none; padding-top: 2px; }
.feed .buy { color: #2f8a2f; } .feed .sell { color: var(--red); }

footer { text-align: center; padding: 10px 16px 40px; font-weight: 800; }
footer p { font-weight: 600; font-size: 13px; color: var(--mute); }

dialog { border: 5px solid var(--ink); border-radius: 20px; box-shadow: 8px 9px 0 var(--ink); padding: 20px; max-width: 360px; width: calc(100% - 32px); }
dialog h3 { margin: 0 0 4px; font: 24px var(--f-display); }
#walletList { display: grid; gap: 8px; margin: 14px 0; }
#walletList button { display: flex; align-items: center; gap: 10px; font: 800 16px var(--f-body); background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
#walletList img { width: 26px; height: 26px; }
#nameStep[hidden], #walletList[hidden] { display: none; }
#walletErr.ok { color: #2f8a2f; }
#nameStep label { display: block; margin: 6px 0 8px; }
.nameRow { display: flex; gap: 8px; }
#nameInput { flex: 1; min-width: 0; font: 700 16px var(--f-body); border: 3px solid var(--ink); border-radius: 12px; padding: 8px 10px; }
.err { color: var(--red); }

@media (max-width: 900px) { .panels { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .panels { grid-template-columns: 1fr; }
  .brand { font-size: 19px; gap: 8px; }
  .brand img { width: 32px; height: 32px; }
  .top { padding: 12px; }
  .top-right { gap: 6px; }
  .btn.small { font-size: 12px; padding: 6px 9px; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
  .act .big { font-size: 24px; }
  .stage-wrap { border-width: 4px; border-radius: 14px; box-shadow: 5px 6px 0 var(--ink); }
}

/* stream mode: just the stage, filling the window */
body.stream { background: #000; overflow: hidden; }
body.stream .top, body.stream .actions, body.stream .hint, body.stream .panels, body.stream footer { display: none; }
body.stream main { max-width: none; padding: 0; display: block; }
body.stream .stage-wrap { border: 0; border-radius: 0; box-shadow: none; width: 100vw; height: 100vh; aspect-ratio: auto; }
