/* Joke Radio! A small radio studio: teal acoustic-panel wall, a red desk, Ollie the otter in headphones at a
   boom mic, and the joke on a big card that flips over for the answer. Look D on the design canvas
   (https://claude.ai/artifact/PVsev9cwyWSevrLyABjEYJ), Nick's pick 2026-11-21. No purple. */
:root { --wall: #2b7a8c; --wall2: #236a7a; --desk: #d8432f; --desk2: #a92f1f; --ink: #1c2a33; --cream: #fff3cf; --paper: #fff8ec; --sun: #ffd23f; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--wall); }
body { font-family: 'Bricolage Grotesque', system-ui, sans-serif; color: var(--ink); touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button { font-family: inherit; cursor: pointer; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; }
#room {
	position: absolute; inset: 0;
	background:
		repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 60px, rgba(0, 0, 0, .07) 60px 62px),
		repeating-linear-gradient(0deg, transparent 0 60px, rgba(0, 0, 0, .07) 60px 62px),
		linear-gradient(var(--wall), var(--wall2));
}
#room::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26%; background: linear-gradient(var(--desk), #c93b28); border-top: 12px solid var(--desk2); }

#top { position: relative; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 76px 0; min-height: 64px; }
#title { margin: 0; font-size: 28px; font-weight: 800; color: var(--cream); white-space: nowrap; }
.sign { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 14px; font-weight: 800; letter-spacing: 2px; display: inline-flex; align-items: center; background: rgba(0, 0, 0, .25); color: rgba(255, 255, 255, .35); transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap; }
#onair { background: #ff4b3a; color: #fff; box-shadow: 0 0 16px rgba(255, 75, 58, .75); }
.sign.lit { background: var(--sun); color: var(--ink); box-shadow: 0 0 22px rgba(255, 210, 63, .9); }
#modes { display: flex; background: var(--ink); border-radius: 999px; padding: 4px; gap: 4px; flex: none; }
#modes .mode { height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--cream); font-size: 17px; font-weight: 600; white-space: nowrap; }
#modes .mode[aria-pressed=true] { background: var(--sun); color: var(--ink); font-weight: 700; }
#score { color: var(--cream); font-size: 17px; font-weight: 700; white-space: nowrap; }
#bookBtn { margin-left: auto; height: 48px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--cream); color: var(--ink); font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
#bookBtn .n { background: var(--ink); color: var(--cream); border-radius: 10px; padding: 1px 9px; font-size: 16px; }

#stations { position: relative; z-index: 10; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 10px 76px 0; }
#stations button { height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: rgba(255, 243, 207, .16); color: var(--cream); font-size: 16px; font-weight: 600; white-space: nowrap; }
#stations button[aria-pressed=true] { background: var(--sun); color: var(--ink); font-weight: 700; }
#app[data-mode=bongo] #stations { visibility: hidden; }

#stage { position: relative; flex: 1; z-index: 5; min-height: 0; display: flex; align-items: flex-end; justify-content: center; gap: 3vw; padding: 0 76px; }
#signs { display: flex; gap: 8px; }
#performer { position: relative; height: min(64vh, 500px); aspect-ratio: 330 / 400; flex: none; margin-bottom: -2vh; }
.ollie-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ollie-svg .hit { cursor: pointer; }
.ollie-svg .head { transform-origin: 160px 190px; transition: transform .25s; }
.ollie-svg .armR { transform-origin: 200px 214px; transition: transform .25s; }
.ollie-svg .eyes, .ollie-svg .mouth { display: none; }
#ollie:not([data-eyes]) .eyes-open, #ollie[data-eyes=open] .eyes-open, #ollie[data-eyes=happy] .eyes-happy { display: inline; }
#ollie:not([data-mouth]) .mouth-smile, #ollie[data-mouth=smile] .mouth-smile, #ollie[data-mouth=talk] .mouth-talk,
#ollie[data-mouth=laugh] .mouth-laugh, #ollie[data-mouth=oops] .mouth-oops { display: inline; }
.ollie-svg .mouth-talk { transform-origin: 160px 160px; transform: scaleY(var(--mo, .3)); }
#ollie { position: absolute; inset: 0; transform-origin: 50% 90%; }
#ollie.idle .head { animation: nod 3.2s ease-in-out infinite; }
@keyframes nod { 50% { transform: rotate(2deg) translateY(2px); } }
#ollie.talking .armR { animation: gesture 1.3s ease-in-out infinite; }
@keyframes gesture { 50% { transform: rotate(-16deg); } }
#ollie.laugh .head { animation: chuckle .26s ease-in-out infinite; }
@keyframes chuckle { 50% { transform: translateY(-4px) rotate(-3deg); } }
#ollie.think .head { transform: rotate(-7deg); }
#ollie.think .armR { transform: rotate(-38deg); }
#ollie.shy .head { transform: rotate(8deg) translateY(4px); }
#ollie.bow .head { transform: translateY(10px); }

#bubble { position: absolute; z-index: 7; left: 4%; bottom: 96%; width: max-content; max-width: min(400px, 40vw); background: #fff; border-radius: 18px; padding: 10px 16px; font-size: clamp(17px, 2.7vh, 21px); line-height: 1.25; font-weight: 600; box-shadow: 0 6px 0 rgba(0, 0, 0, .18); opacity: 0; transition: opacity .18s; pointer-events: none; }
#bubble.show { opacity: 1; }
#bubble.her { background: var(--sun); }

#cardWrap { width: min(600px, 46vw); height: min(400px, 52vh); margin-bottom: 11vh; flex: none; }
/* The flip is a squash-and-swap, not a 3D rotate: with backface-visibility the card showed blank or
   mirrored (WebKit on her phone, and Chrome too), so the card squashes to a sliver, swaps faces, springs back. */
#card { position: relative; width: 100%; height: 100%; cursor: pointer; transition: transform .16s ease-in; }
#card.squash { transform: scaleX(0.02); }
#card.spring { transition: transform .24s cubic-bezier(.3, 1.4, .5, 1); }
#card:not(.flipped) .back, #card.flipped .front { display: none; }
#card.hidden { visibility: hidden; }
#cardWrap.waiting { animation: wiggle 1s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1.5deg); } 75% { transform: rotate(1.5deg); } }
#card .face { position: absolute; inset: 0; border-radius: 24px; background: var(--paper); box-shadow: 0 18px 30px rgba(0, 0, 0, .3); padding: 26px 34px; display: flex; flex-direction: column; gap: 10px; border-top: 14px solid var(--cc, #2f7d74); text-align: left; }
#card .back { background: #fffbe0; }
#card .cat { font-size: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cc, #2f7d74); }
#card .txt { flex: 1; display: flex; align-items: center; font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: clamp(26px, 6vh, 46px); line-height: 1.15; }
#card .txt.mid { font-size: clamp(21px, 4.4vh, 34px); }
#card .txt.long { font-size: clamp(15px, 2.8vh, 22px); line-height: 1.3; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; }

#guide { position: relative; z-index: 10; align-self: center; margin: -6px 0 8px; background: var(--cream); border-radius: 999px; padding: 4px 16px 4px 5px; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 40px); }
#guide .num { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--sun); display: grid; place-items: center; font-weight: 800; flex: none; }
#controls { position: relative; z-index: 9; display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 76px 18px; min-height: 84px; }
.big { height: 62px; padding: 0 28px; border-radius: 16px; border: 0; background: var(--ink); color: var(--sun); font-size: 22px; font-weight: 700; box-shadow: 0 5px 0 #0b1318; white-space: nowrap; }
.big.alt { background: var(--cream); color: var(--ink); box-shadow: 0 5px 0 var(--desk2); }
.big:active, .rate:active, .small:active { transform: translateY(4px); box-shadow: 0 1px 0 #0b1318; }
.big.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }
.rate { height: 58px; padding: 0 18px; border-radius: 16px; border: 0; background: var(--cream); color: var(--ink); font-size: 19px; font-weight: 700; box-shadow: 0 5px 0 var(--desk2); display: flex; align-items: center; gap: 8px; }
.rate .f { font-size: 26px; }
.small { height: 58px; padding: 0 18px; border-radius: 16px; border: 0; background: #9ae6ff; color: var(--ink); font-size: 19px; font-weight: 700; box-shadow: 0 5px 0 var(--desk2); }
#controls .label { display: none; } /* the numbered step above already says it */

form.say { display: flex; gap: 10px; align-items: center; width: min(780px, 100%); }
form.say input { flex: 1; min-width: 0; height: 60px; border-radius: 16px; border: 0; padding: 0 20px; box-shadow: inset 0 0 0 3px var(--ink); font: 600 22px 'Bricolage Grotesque', system-ui, sans-serif; color: var(--ink); background: #fff; -webkit-user-select: text; user-select: text; }
form.say input.nudge { animation: nudge .4s; }
@keyframes nudge { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
form.say .mic { width: 60px; height: 60px; flex: none; border-radius: 16px; border: 0; background: var(--cream); font-size: 26px; box-shadow: 0 5px 0 var(--desk2); }
form.say .mic.on { background: #ff6b5e; animation: pulse 1s infinite; }
form.say .big { height: 60px; padding: 0 22px; font-size: 20px; }

.veil { position: fixed; inset: 0; z-index: 50; background: rgba(10, 30, 36, .6); display: grid; place-items: center; padding: 14px; }
.veil[hidden] { display: none; }
.card { width: min(820px, 100%); max-height: calc(100vh - 28px); display: flex; flex-direction: column; background: var(--paper); border-radius: 22px; box-shadow: 0 8px 0 rgba(0, 0, 0, .3); overflow: hidden; }
.card header { display: flex; align-items: center; gap: 12px; padding: 14px 16px 8px; }
.card h2 { margin: 0; font-size: 26px; }
.card .count { color: #6b5a44; font-size: 17px; font-weight: 600; }
.card .x { margin-left: auto; width: 48px; height: 48px; border-radius: 12px; border: 0; background: var(--ink); color: var(--cream); font-size: 22px; font-weight: 700; flex: none; }
.dad { margin: 0 16px 8px; background: #fff1a8; border-radius: 12px; padding: 8px 12px; font-size: 17px; font-weight: 600; }
.tabs { display: flex; gap: 8px; padding: 4px 16px 10px; overflow-x: auto; flex: none; }
.tab { flex: none; height: 44px; padding: 0 14px; border-radius: 999px; border: 0; background: #ece2cc; font-size: 16px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.tab[aria-pressed=true] { background: var(--ink); color: var(--sun); }
.list { overflow-y: auto; padding: 4px 16px 16px; display: grid; gap: 10px; -webkit-overflow-scrolling: touch; }
.jk { background: #fff; border-radius: 14px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; box-shadow: 0 2px 0 rgba(0, 0, 0, .08); }
.jk.locked { background: #efe6d6; color: #7a6a56; }
.jk .q { font-size: 18px; font-weight: 600; }
.jk .a { font-size: 18px; color: #b5361f; font-weight: 700; }
.jk .rt { font-size: 20px; }
.jk .by { font-size: 14px; font-weight: 700; color: #1f7a63; }
.jk .btns { grid-column: 2; grid-row: 1 / span 3; display: flex; flex-direction: column; gap: 6px; }
.jk .btns button { height: 44px; min-width: 110px; border-radius: 12px; border: 0; background: var(--sun); font-size: 16px; font-weight: 700; color: var(--ink); }
.jk .btns button.send { background: #9ae6ff; }
.empty { text-align: center; padding: 30px; font-size: 19px; color: #6b5a44; }
#toast { position: fixed; top: 76px; right: 16px; z-index: 60; background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 16px; font-size: 18px; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }

@media (max-height: 600px) {
	#top { min-height: 56px; } #title { font-size: 24px; }
	#stations button { height: 40px; font-size: 15px; }
	.big { height: 54px; font-size: 20px; } .rate, .small { height: 52px; font-size: 17px; }
	#controls { min-height: 72px; padding-bottom: 12px; }
	#signs { display: none; }
}
@media (max-width: 1300px) { #score { display: none; } }
@media (max-width: 1000px) { #signs { display: none; } }
@media (max-width: 700px), (orientation: portrait) {
	#top { flex-wrap: wrap; row-gap: 6px; padding-right: 70px; }
	#modes { order: 3; width: 100%; } #modes .mode { flex: 1; }
	#bookBtn .t { display: none; }
	#stations { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding: 8px 12px 0; }
	#stage { flex-direction: column; align-items: center; justify-content: space-evenly; padding: 8px 12px 0; gap: 6px; overflow: hidden; }
	#cardWrap { width: min(560px, 92vw); height: min(270px, 31vh); margin-bottom: 0; order: -1; }
	#performer { height: min(23vh, 190px); }
	#bubble { left: 92%; bottom: 40%; max-width: min(240px, 56vw); font-size: 16px; }
	#performer { align-self: flex-start; margin-left: 2vw; margin-bottom: 0; }
	#controls { padding: 0 12px 14px 64px; } /* bottom-left corner is the shared 🔊 */
	.rate .t { display: none; }
	.big { font-size: 19px; padding: 0 18px; }
	.jk { grid-template-columns: 1fr; } .jk .btns { grid-column: 1; grid-row: auto; flex-direction: row; }
}

/* the lab's shared sign-in reminder (shared/save.js) sits fixed at the bottom: lift the buttons above it while it shows */
#app.nudged #controls { padding-bottom: 84px; }
