:root { --red: #B3261E; --pine: #2E6B3A; --gold: #E8B04B; --snow: #F4EDE1; --wood: #6B4226; --night: #1E2A44; --ink: #2a1a10; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--snow); font-family: Fredoka, system-ui, -apple-system, "Segoe UI", sans-serif; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
[hidden] { display: none !important; }
.plain { padding: 2rem; }
a { color: var(--gold); }
kbd { display: inline-block; min-width: 1.6em; padding: 0 0.35em; border-radius: 6px; background: var(--snow); color: var(--ink); font: 600 0.85em/1.5 Fredoka, system-ui, sans-serif; text-align: center; box-shadow: 0 2px 0 #b7a98f; }
.pb { display: inline-flex; align-items: center; justify-content: center; width: 1.5em; height: 1.5em; border-radius: 50%; font-weight: 700; font-size: 0.85em; color: #fff; vertical-align: middle; }
.pb.a { background: #3f9a3a; } .pb.b { background: #c8322a; } .pb.x { background: #2f6fc2; } .pb.y { background: #d9a520; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; background: radial-gradient(ellipse at center, rgba(30, 42, 68, 0.35), rgba(12, 16, 28, 0.82)); z-index: 20; overflow: auto; }
.card { background: linear-gradient(#fbf6ec, #efe3cc); color: var(--ink); border-radius: 22px; padding: 1.4rem 1.8rem; max-width: 560px; width: 100%; box-shadow: 0 10px 0 #b49b74, 0 22px 50px rgba(0, 0, 0, 0.5); text-align: center; border: 4px solid #fff7e6; }
.card.wide { max-width: 860px; }
.card h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); margin: 0 0 0.2rem; color: var(--red); letter-spacing: 0.01em; text-shadow: 0 3px 0 #f3c6a4, 0 6px 0 rgba(0, 0, 0, 0.12); }
.card h2 { margin: 0.8rem 0 0.4rem; font-size: 1.3rem; color: var(--pine); }
.tag { font-size: 1.1rem; margin: 0.2rem 0 0.8rem; }
.small { font-size: 0.9rem; opacity: 0.85; }
.row { display: flex; gap: 0.6rem; justify-content: center; margin: 0.6rem 0; }
.row.wrap { flex-wrap: wrap; }
button { font: 600 1.05rem Fredoka, system-ui, sans-serif; border: 0; border-radius: 14px; padding: 0.6rem 1.2rem; min-height: 44px; background: #e3d3b4; color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 #b49b74; transition: transform 0.06s; }
button:hover, button.focus { background: #f0e2c4; outline: 3px solid var(--gold); }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #b49b74; }
button.primary { background: var(--red); color: #fff; box-shadow: 0 4px 0 #6e1712; }
button.primary:hover, button.primary.focus { background: #c93a2f; }
.menu { display: flex; flex-direction: column; gap: 0.6rem; }
.card.menu { max-width: 360px; }
.row.menu { flex-direction: row; }
details { text-align: left; margin-top: 0.8rem; font-size: 0.95rem; }
summary { cursor: pointer; font-weight: 600; color: var(--pine); }
ol { margin: 0.4rem 0; padding-left: 1.3rem; } li { margin: 0.2rem 0; }
table.keys { border-collapse: collapse; width: 100%; margin-top: 0.4rem; font-size: 0.9rem; }
table.keys td, table.keys th { padding: 0.25rem 0.4rem; border-bottom: 1px solid #d9c9a8; text-align: left; }
.credit { margin-top: 0.8rem; }

/* advent calendar */
#calendar { display: grid; grid-template-columns: repeat(13, 1fr); gap: 5px; margin: 0.4rem 0; }
.door { aspect-ratio: 1; border-radius: 7px; background: var(--pine); color: var(--snow); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.95rem; position: relative; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15), 0 2px 0 #1a3d22; cursor: pointer; }
.door:nth-child(3n) { background: var(--red); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15), 0 2px 0 #6e1712; }
.door:nth-child(4n+1) { background: #a07a2c; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15), 0 2px 0 #6a4f1a; }
.door.locked { opacity: 0.55; }
.door.locked::after { content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); right: 5px; top: 50%; }
.door.practice { grid-column: span 2; aspect-ratio: auto; background: var(--gold); color: var(--ink); font-size: 0.85rem; line-height: 1.1; box-shadow: 0 2px 0 #9a7428, 0 0 0 3px #fff7e6; }
.door.sel { outline: 3px solid var(--ink); }

/* join slots */
#slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.slot { border: 3px dashed #c8b28a; border-radius: 14px; padding: 0.6rem 0.4rem; min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; color: #8d7a5a; font-size: 0.9rem; }
.slot.on { border-style: solid; color: var(--ink); background: #fffaf0; }
.slot .hat { width: 34px; height: 34px; border-radius: 50% 50% 8px 8px; background: currentColor; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.slot b { font-size: 1.1rem; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#orders { position: absolute; top: 10px; left: 12px; right: 140px; display: flex; gap: 10px; align-items: flex-start; }
.letter { width: 232px; background: #fbf4e4; color: var(--ink); border-radius: 6px 6px 14px 6px; padding: 5px 8px 8px; box-shadow: 0 5px 0 #b49b74, 0 10px 18px rgba(0, 0, 0, 0.35); transform: rotate(-1.2deg); animation: drop 0.45s cubic-bezier(.2, 1.6, .5, 1); position: relative; }
.letter:nth-child(2n) { transform: rotate(1deg); }
.letter .say { font-size: 0.74rem; line-height: 1.15; font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.letter .kid { font-style: normal; opacity: 0.65; }
/* The recipe: part + part = toy, big enough to read from the sofa. */
.letter .rec { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; }
.letter .op { font-size: 1.5rem; font-weight: 700; color: var(--wood); line-height: 1; }
.letter .pt { width: 58px; height: 64px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; position: relative; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18); }
.letter .pt img { width: 44px; height: 44px; margin-top: 1px; }
.letter .pt b { font-size: 0.78rem; line-height: 1; letter-spacing: 0.04em; margin-top: -2px; }
.letter .pt i { position: absolute; top: -6px; right: -7px; font-style: normal; font-size: 0.72rem; font-weight: 700; background: #fff7e6; color: var(--wood); border: 2px solid #B07A40; border-radius: 8px; padding: 0 5px; transform: rotate(8deg); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.letter .pt.peg { background: #D9A066; } .letter .pt.tin { background: #A9B9C6; } .letter .pt.felt { background: #C0453A; color: #fff; }
.letter .pt.wood { background: #D9A066; }
.letter .pt.ginger { background: #E9CFA0; }
.letter img.toy { width: 64px; height: 64px; background: #efe0c0; border-radius: 10px; box-shadow: inset 0 0 0 2px #e2cfa8; }
.letter .bar { height: 7px; border-radius: 4px; background: #e2d2b2; overflow: hidden; margin-top: 3px; }
.letter .bar i { display: block; height: 100%; width: 100%; background: var(--pine); transform-origin: left; }
.letter.low .bar i { background: var(--red); }
.letter.low { animation: wob 0.4s infinite; }
.letter.gone { animation: crumple 0.6s forwards; }
.letter.done { animation: post 0.6s forwards; }
.letter .stamp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; color: var(--red); transform: rotate(-12deg); text-shadow: 0 0 6px #fff; }
.letter.done .stamp { color: var(--pine); }
@keyframes drop { from { transform: translateY(-120px) rotate(-8deg); } }
@keyframes wob { 50% { transform: rotate(1.5deg) scale(1.02); } }
@keyframes crumple { to { transform: scale(0.2) rotate(40deg); opacity: 0; } }
@keyframes post { to { transform: translateY(-140px) rotate(8deg); opacity: 0; } }
#clock { position: absolute; top: 12px; right: 16px; font-size: 2.4rem; font-weight: 700; background: rgba(20, 14, 10, 0.55); padding: 0.1rem 0.8rem; border-radius: 16px; color: var(--snow); }
#clock.low { color: #ffb4a8; animation: wob 0.5s infinite; }
#score { position: absolute; left: 16px; bottom: 14px; font-size: 2.2rem; font-weight: 700; background: rgba(20, 14, 10, 0.55); padding: 0.1rem 0.9rem; border-radius: 16px; color: var(--gold); display: flex; gap: 0.6rem; align-items: baseline; }
#score small { font-size: 1rem; color: var(--snow); opacity: 0.85; }
#labels .lab { position: absolute; transform: translate(-50%, -100%); text-align: center; white-space: nowrap; }
.lab .tagp { display: inline-block; font-weight: 700; font-size: 0.8rem; color: #fff; padding: 0 0.45em; border-radius: 8px; }
.lab .hint { display: block; margin-top: 2px; font-size: 0.82rem; font-weight: 600; background: rgba(251, 244, 228, 0.92); color: var(--ink); border-radius: 10px; padding: 0.05rem 0.5rem; }
.lab .hint:empty { display: none; }
.lab .hint kbd, .lab .hint .pb { font-size: 0.75rem; }
#feed { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; }
#feed div { background: rgba(20, 14, 10, 0.65); padding: 0.15rem 0.8rem; border-radius: 12px; font-size: 1rem; animation: fade 2.4s forwards; }
@keyframes fade { 0% { transform: translateY(8px); opacity: 0; } 10% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
#big { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 700; color: #fff; text-shadow: 0 4px 0 var(--red), 0 8px 20px rgba(0, 0, 0, 0.5); pointer-events: none; }
#big.pop { animation: pop 1.6s forwards; }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 12% { transform: scale(1.12); opacity: 1; } 20% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.center { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 8rem; font-weight: 700; color: #fff; text-shadow: 0 6px 0 var(--red); z-index: 10; pointer-events: none; }

/* end */
#end-stars { font-size: 3.4rem; letter-spacing: 0.2em; color: #d8c7a6; }
#end-stars .on { color: var(--gold); text-shadow: 0 3px 0 #9a7428; display: inline-block; animation: pop2 0.4s backwards; }
@keyframes pop2 { from { transform: scale(2.2); opacity: 0; } }
#end-head { font-size: 2rem; color: var(--red); margin-top: 0; }
#end-stats { display: flex; gap: 1.4rem; justify-content: center; flex-wrap: wrap; margin: 0.4rem 0; }
#end-stats div { font-size: 0.9rem; } #end-stats b { display: block; font-size: 1.6rem; color: var(--pine); }
#vote { margin-top: 0.6rem; }
#vote button { font-size: 0.9rem; padding: 0.4rem 0.8rem; }
#vote button.picked { background: var(--pine); color: #fff; }
#more { margin-top: 0.6rem; }

@media (max-height: 640px) { .card { padding: 0.8rem 1.2rem; } .card h1 { font-size: 2.2rem; } .letter { width: 214px; } .letter .pt { width: 52px; height: 58px; } .letter .pt img { width: 40px; height: 40px; } .letter img.toy { width: 56px; height: 56px; } }
/* The star card on the result screen, and a gold edge on the screen while Santa's watching. */
#card-img { display: block; width: min(100%, 420px); margin: 0.6rem auto 0; border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }
#card-img:not([src]) { display: none; }
#share-note:empty { display: none; }
#hud.santa::after { content: ''; position: fixed; inset: 0; box-shadow: inset 0 0 0 6px var(--gold), inset 0 0 60px rgba(232, 176, 75, 0.45); pointer-events: none; animation: glow 1.2s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: 0.55; } to { opacity: 1; } }
.door .st { position: absolute; bottom: 1px; left: 0; right: 0; font-style: normal; font-size: 0.55rem; color: var(--gold); letter-spacing: -1px; text-align: center; line-height: 1; }
.door.practice .st { color: var(--red); }
.door.today:not(.sel) { box-shadow: 0 0 0 3px var(--gold), 0 2px 0 #1a3d22; }
.door:not(.locked):not(.practice):hover { filter: brightness(1.15); }
#hud.sleigh::before { content: ''; position: fixed; inset: 0; box-shadow: inset 0 0 0 5px var(--red), inset 0 0 50px rgba(179, 38, 30, 0.35); pointer-events: none; animation: glow 0.9s ease-in-out infinite alternate; }
/* A wrapped present waiting to go in the sleigh: its letter gets a ribbon and the clock stops. */
.letter.boxed { box-shadow: 0 5px 0 #8a6a2a, 0 0 0 3px #E8B04B, 0 10px 18px rgba(0, 0, 0, 0.35); }
.letter.boxed::after { content: 'WRAPPED ➜ SLEIGH'; position: absolute; left: -4px; right: -4px; top: 38%; text-align: center; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.05em; color: #fff; background: #B3261E; border-top: 3px solid #E8B04B; border-bottom: 3px solid #E8B04B; padding: 3px 0; transform: rotate(-4deg); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); }
.letter.boxed .bar i { background: #E8B04B !important; }
/* the worker picker in each join slot */
.slot { cursor: pointer; }
.slot .av { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.slot .av img { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #fff7e6 55%, transparent 56%); border: 3px solid var(--c); }
.slot .av i { font-style: normal; font-size: 0.7rem; opacity: 0.6; }
.slot .avn { font-size: 0.8rem; color: var(--ink); opacity: 0.75; margin-top: -0.2rem; }
#unlock-next { margin-top: 0.2rem; }
#end-unlock { display: flex; align-items: center; gap: 0.6rem; justify-content: center; background: #fff3d6; border: 3px solid #E8B04B; border-radius: 14px; padding: 0.4rem 0.8rem; margin: 0.5rem 0; animation: drop 0.5s cubic-bezier(.2, 1.6, .5, 1) 1.2s both; }
#end-unlock img { width: 56px; height: 56px; }

/* Round 8: a cosy evening vignette over the room (under the HUD), the waking-toy arrows and the first-shift strip. */
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse 75% 70% at 50% 50%, rgba(0,0,0,0) 55%, rgba(30,12,4,0.42) 100%); }
#waking .wk { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; animation: wkbob 0.6s ease-in-out infinite alternate; }
#waking .wk img { width: 46px; height: 46px; border-radius: 50%; background: #FFF4D6; border: 3px solid #E8B04B; box-shadow: 0 0 14px rgba(232,176,75,0.9); }
#waking .wk i { font-style: normal; color: #E8B04B; font-size: 26px; line-height: 0.9; text-shadow: 0 0 6px #000; }
#waking .wk.edge i { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; }
@keyframes wkbob { from { margin-top: 0; } to { margin-top: -8px; } }
#teach { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: rgba(251, 244, 228, 0.94); color: var(--ink); border-radius: 18px; padding: 6px 12px; box-shadow: 0 4px 18px rgba(0,0,0,0.35); transition: opacity 0.6s; }
#teach.gone { opacity: 0; }
#teach .st { display: flex; flex-direction: column; align-items: center; width: 64px; font-weight: 700; font-size: 0.78rem; position: relative; opacity: 0.75; }
#teach .st img { width: 40px; height: 40px; object-fit: contain; }
#teach .st.ok { opacity: 1; color: #2E6B3A; }
#teach .st.ok::after { content: '✓'; position: absolute; right: 6px; top: -4px; background: #2E6B3A; color: #fff; border-radius: 50%; width: 20px; height: 20px; line-height: 20px; text-align: center; font-size: 0.8rem; }
#teach .ar { color: #B3261E; font-weight: 700; }
#pause .card { max-height: 92vh; overflow-y: auto; }

/* How to play panel (house rules §4): a scrolling card over everything, closed by default. */
#how { z-index: 40; }
.how-card { position: relative; max-width: 620px; max-height: 92vh; overflow-y: auto; text-align: left; font-size: 0.98rem; line-height: 1.4; user-select: text; -webkit-user-select: text; touch-action: pan-y; }
.how-card h2 { margin-top: 0; color: var(--red); font-size: 1.6rem; padding-right: 2.4rem; }
.how-card h3 { margin: 0.9rem 0 0.3rem; color: var(--pine); font-size: 1.1rem; }
.how-card p, .how-card ul, .how-card dl { margin: 0.3rem 0; }
.how-card ul { padding-left: 1.2rem; }
.how-card dt { font-weight: 600; margin-top: 0.4rem; }
.how-card dd { margin: 0 0 0 1rem; }
.how-card kbd { margin: 0 1px; }
.how-close { position: absolute; top: 0.7rem; right: 0.8rem; width: 44px; height: 44px; padding: 0; font-size: 1.6rem; line-height: 1; }
#vote .row.wrap { flex-wrap: nowrap; overflow-x: auto; justify-content: safe center; padding-bottom: 4px; }
#vote .row.wrap button { flex: 0 0 auto; }
#door { margin-top: 0.3rem; display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; justify-content: center; align-items: center; }
#door #want-thanks { flex-basis: 100%; margin: 0; }
.want { font-size: 0.9rem; padding: 0.4rem 0.9rem; background: #efe0c0; }
.want.picked { background: var(--pine); color: #fff; }
#suggest-end { --gs-link: var(--pine); }

/* games/studio#181: phones as controllers. The join card on the title (code and QR), and the controller page (?pad=). */
.pb.ph { width: auto; padding: 0 0.45em; border-radius: 0.75em; background: #5b4a8a; }
#crew-row { display: flex; gap: 0.6rem; align-items: stretch; }
#crew-row #slots { flex: 1; }
#phone-join { display: flex; gap: 0.5rem; align-items: center; border: 3px solid #c8b28a; border-radius: 14px; padding: 0.35rem 0.5rem; background: #fffaf0; width: 13.5rem; text-align: left; opacity: 0.75; }
#phone-join[hidden] { display: none; }
#phone-join.ready { opacity: 1; border-color: #5b4a8a; }
#phone-join .pj-qr { width: 84px; height: 84px; flex: none; background: #fff; border-radius: 6px; }
#phone-join .pj-qr svg { width: 100%; height: 100%; display: block; }
#phone-join .pj-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
#phone-join .pj-code { font-size: 1.55rem; font-weight: 700; letter-spacing: 0.12em; color: #5b4a8a; }
#phone-join .pj-url { font-size: 0.66rem; color: #8d7a5a; word-break: break-all; }
#phone-join .pj-sub { font-size: 0.72rem; }
@media (max-width: 760px) { #crew-row { flex-direction: column; } #phone-join { width: auto; } }

html.padmode body > *:not(#pad):not(script) { display: none !important; }
html.padmode, html.padmode body { overflow: hidden; overscroll-behavior: none; touch-action: none; height: 100%; }
#pad { position: fixed; inset: 0; display: flex; flex-direction: column; background: radial-gradient(circle at 50% 0, #2c3a5c, var(--night) 70%); color: var(--snow); font-family: Fredoka, system-ui, sans-serif; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); --me: #888; }
#pad[hidden] { display: none; }
#pd-top { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.8rem; background: var(--me); box-shadow: 0 3px 0 rgba(0,0,0,0.3); min-height: 56px; }
#pd-top img { width: 46px; height: 46px; object-fit: contain; background: rgba(255,255,255,0.25); border-radius: 50%; }
#pd-top img[hidden], #pd-top img:not([src]) { display: none; }
#pd-top > div { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.15; }
#pd-who { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pd-status { font-size: 0.8rem; opacity: 0.9; }
#pd-rtt { font-size: 0.72rem; opacity: 0.75; }
#pd-pause { min-height: 40px; padding: 0.3rem 0.8rem; font-size: 0.9rem; }
.pd-panel { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.9rem; padding: 1rem 1.4rem; text-align: center; }
.pd-panel[hidden] { display: none; }
.pd-panel h1 { font-size: 2.2rem; margin: 0; color: var(--gold); }
.pd-panel p { margin: 0; max-width: 22rem; }
.pd-panel label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
.pd-panel input { font: 600 1.2rem Fredoka, system-ui, sans-serif; padding: 0.5rem 0.8rem; border-radius: 12px; border: 0; text-align: center; width: 12rem; touch-action: manipulation; }
.pd-panel button { min-height: 56px; font-size: 1.2rem; padding: 0.6rem 1.6rem; }
#pd-picker { display: flex; align-items: center; gap: 1rem; }
#pd-picker > div { display: flex; flex-direction: column; align-items: center; }
#pd-picker img { width: min(42vw, 30vh, 180px); height: min(42vw, 30vh, 180px); object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.4)); }
#pd-picker img:not([src]) { visibility: hidden; }
#pd-picker button { width: 64px; height: 64px; border-radius: 50%; font-size: 1.4rem; padding: 0; }
#pd-picker button[hidden] { visibility: hidden; display: inline-block; }
#pd-av { font-size: 1.2rem; }
#pad .row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
#pd-play { display: none; flex: 1; position: relative; }
#pad.playing #pd-play { display: flex; }
#pad.playing #pd-lobby, #pad.playing #pd-start { display: none; }
#pd-stickzone { flex: 1 1 50%; position: relative; touch-action: none; border-right: 2px dashed rgba(255,255,255,0.08); }
#pd-stickzone .pd-hint { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; font-size: 0.85rem; opacity: 0.5; pointer-events: none; }
#pd-stickzone.used .pd-hint { display: none; }
#pd-stick { position: absolute; width: 0; height: 0; pointer-events: none; }
#pd-stick::before { content: ''; position: absolute; left: -64px; top: -64px; width: 128px; height: 128px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.35); background: rgba(255,255,255,0.06); }
#pd-stick i { position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; border-radius: 50%; background: var(--me); box-shadow: 0 0 0 3px rgba(255,255,255,0.6); }
#pd-btns { flex: 1 1 50%; position: relative; touch-action: none; --s: min(27vw, 25vh, 124px); }
#pd-btns button { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; font-size: 1.15rem; font-weight: 700; color: #fff; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; line-height: 1; }
#pd-btns button small { font-size: 0.7rem; font-weight: 600; opacity: 0.85; margin-top: 2px; }
#pd-btns button.down { transform: translateY(4px) scale(0.96); box-shadow: 0 0 0 rgba(0,0,0,0); filter: brightness(1.2); }
#pd-grab { right: calc(var(--s) * 0.78); bottom: calc(var(--s) * 0.22); background: #3f9a3a; box-shadow: 0 6px 0 #22561f; }
#pd-dash { right: 6px; bottom: calc(var(--s) * 1.05); background: #c8322a; box-shadow: 0 6px 0 #6e1712; }
#pd-use { right: calc(var(--s) * 0.95); bottom: calc(var(--s) * 1.45); background: #2f6fc2; box-shadow: 0 6px 0 #173d6e; width: calc(var(--s) * 0.82) !important; height: calc(var(--s) * 0.82) !important; }
@media (orientation: landscape) { #pd-btns { --s: min(18vw, 30vh, 120px); } #pd-top { min-height: 44px; padding: 0.25rem 0.8rem; } #pd-top img { width: 36px; height: 36px; } }
#pd-btns button:focus, #pd-btns button:focus-visible { outline: none; }

/* games/studio#182: solo on a phone. Held upright, the room (turned a quarter in render.js) sits in a band between the
   letters and clock above and the touch controls below, never under them. Sideways, the controls take the two sides. */
.pb.ga, .pb.us, .pb.dv { width: auto; padding: 0 0.45em; border-radius: 0.75em; }
.pb.ga { background: #3f9a3a; } .pb.us { background: #2f6fc2; } .pb.dv { background: #c8322a; }
#solo-hint { display: none; }
html.solo #solo-hint { display: block; }
html.solo #phone-join, html.solo #join-hint { display: none !important; }
html.solo #slots { grid-template-columns: 1fr; }
html.solo #slots .slot:not(.on) { display: none; }
@media (max-width: 520px) {
  #calendar { grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .card { padding: 1rem 0.9rem; }
  #bigscreen .menu { margin: 0.9rem 0; }
}
#pad-in { font: 700 1.4rem Fredoka, system-ui, sans-serif; letter-spacing: 0.15em; text-transform: uppercase; width: 8.5rem; text-align: center; border-radius: 12px; border: 3px solid #c8b28a; padding: 0.3rem; touch-action: manipulation; }
#bigscreen .menu button { min-height: 54px; font-size: 1.15rem; }

html.solo { --top: calc(env(safe-area-inset-top, 0px) + 92px); --bot: calc(env(safe-area-inset-bottom, 0px) + 206px); --side: max(150px, 21vw); }
html.solo.tall canvas#game { top: var(--top); bottom: auto; height: calc(100vh - var(--top) - var(--bot)); height: calc(100dvh - var(--top) - var(--bot)); }
html.solo:not(.tall) canvas#game { left: var(--side); right: auto; width: calc(100vw - 2 * var(--side)); }
html.solo #vignette { display: none; }
#touch { position: fixed; z-index: 6; touch-action: none; display: flex; }
#touch[hidden] { display: none; }
html.tall #touch { left: 0; right: 0; bottom: 0; height: var(--bot); padding-bottom: env(safe-area-inset-bottom, 0px); background: linear-gradient(#3a2618, #24170e); border-top: 3px solid #6B4226; box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.4); }
html.solo:not(.tall) #touch { inset: 0; pointer-events: none; }
html.solo:not(.tall) #tc-stickzone, html.solo:not(.tall) #tc-btns { pointer-events: auto; position: absolute; top: 0; bottom: 0; width: var(--side); background: linear-gradient(90deg, #2c1d12, #24170e); }
html.solo:not(.tall) #tc-stickzone { left: 0; border-right: 3px solid #6B4226; }
html.solo:not(.tall) #tc-btns { right: 0; border-left: 3px solid #6B4226; }
#tc-stickzone { flex: 1 1 50%; position: relative; touch-action: none; }
#tc-stickzone .pd-hint { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; font-size: 0.8rem; opacity: 0.55; pointer-events: none; padding: 0 0.5rem; }
#tc-stickzone.used .pd-hint { display: none; }
#tc-stick { position: absolute; width: 0; height: 0; pointer-events: none; }
#tc-stick::before { content: ''; position: absolute; left: -56px; top: -56px; width: 112px; height: 112px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.35); background: rgba(255,255,255,0.06); }
#tc-stick i { position: absolute; left: -26px; top: -26px; width: 52px; height: 52px; border-radius: 50%; background: #B3261E; box-shadow: 0 0 0 3px rgba(255,255,255,0.6); }
#tc-btns { flex: 1 1 50%; position: relative; touch-action: none; --s: min(80px, 22vw); }
html.solo:not(.tall) #tc-btns { --s: min(76px, 21vh); }
#tc-btns button { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; font-size: 1.05rem; font-weight: 700; color: #fff; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; line-height: 1; min-height: 0; }
#tc-btns button small { font-size: 0.66rem; font-weight: 600; opacity: 0.85; margin-top: 2px; }
#tc-btns button.down { transform: translateY(4px) scale(0.96); box-shadow: 0 0 0 rgba(0,0,0,0); filter: brightness(1.2); }
#tc-btns button:focus, #tc-btns button:focus-visible, #tc-btns button:hover { outline: none; }
#tc-grab { right: calc(var(--s) * 0.95); bottom: calc(var(--s) * 0.2); background: #3f9a3a; box-shadow: 0 6px 0 #22561f; }
#tc-dash { right: 10px; bottom: calc(var(--s) * 0.95); background: #c8322a; box-shadow: 0 6px 0 #6e1712; }
#tc-use { right: calc(var(--s) * 1.15); bottom: calc(var(--s) * 1.3); background: #2f6fc2; box-shadow: 0 6px 0 #173d6e; width: calc(var(--s) * 0.82) !important; height: calc(var(--s) * 0.82) !important; }
#tc-grab:hover { background: #3f9a3a; } #tc-dash:hover { background: #c8322a; } #tc-use:hover { background: #2f6fc2; }
#tc-pause { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); min-height: 0; width: 46px; height: 38px; padding: 0; font-size: 0.9rem; z-index: 2; }
html.solo:not(.tall) #tc-pause { pointer-events: auto; left: 8px; top: auto; bottom: 8px; transform: none; }
@media (any-pointer: fine) { #touch { display: none !important; } }

/* The HUD on a phone: compact letters (the recipe only), a small clock and score. */
html.solo #orders { top: calc(env(safe-area-inset-top, 0px) + 6px); left: 6px; right: 74px; gap: 5px; }
html.solo:not(.tall) #orders { left: calc(var(--side) + 6px); right: calc(var(--side) + 6px); }
html.solo .letter { width: 96px; padding: 3px 4px 5px; }
html.solo .letter .say { display: none; }
html.solo .letter .rec { margin-top: 0; }
html.solo .letter .op { font-size: 0.85rem; }
html.solo .letter .pt { width: 26px; height: 34px; border-radius: 6px; }
html.solo .letter .pt img { width: 22px; height: 22px; }
html.solo .letter .pt b { font-size: 0.42rem; letter-spacing: 0; }
html.solo .letter .pt i { font-size: 0.45rem; padding: 0 2px; top: -5px; right: -5px; border-width: 1px; }
html.solo .letter img.toy { width: 32px; height: 32px; }
html.solo .letter .bar { height: 6px; }
html.solo .letter.boxed::after { font-size: 0.5rem; }
html.solo .letter .stamp { font-size: 0.8rem; }
html.solo #clock { top: calc(env(safe-area-inset-top, 0px) + 6px); right: 6px; font-size: 1.35rem; padding: 0.05rem 0.5rem; border-radius: 12px; }
html.solo #score { left: auto; right: 6px; bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 42px); font-size: 1.2rem; padding: 0.05rem 0.5rem; border-radius: 12px; flex-direction: column; gap: 0; align-items: flex-end; line-height: 1.1; }
html.solo #score small { font-size: 0.55rem; }
html.solo:not(.tall) #clock { right: calc(var(--side) + 6px); }
html.solo:not(.tall) #score { right: calc(var(--side) + 6px); }
html.solo #feed { bottom: calc(var(--bot) + 6px); width: 94vw; }
html.solo:not(.tall) #feed { bottom: 8px; width: calc(100vw - 2 * var(--side) - 12px); }
html.solo #feed div { font-size: 0.8rem; text-align: center; }
html.solo #big { font-size: 1.7rem; top: 38%; padding: 0 0.5rem; }
html.solo #teach { top: calc(var(--top) + 4px); padding: 4px 6px; gap: 2px; border-radius: 14px; }
html.solo:not(.tall) #teach { top: auto; bottom: 6px; }
html.solo.teaching:not(.tall) #feed { bottom: 80px; }
html.solo #teach .st { width: 54px; font-size: 0.66rem; }
html.solo #teach .st img { width: 28px; height: 28px; }
html.solo #teach .st small { font-size: 0.55rem; font-weight: 600; white-space: nowrap; margin-top: 1px; }
html.solo #teach .st small .pb { font-size: 0.55rem; height: 1.4em; }
html.solo #teach .ar { font-size: 0.7rem; }
html.solo .lab .tagp { font-size: 0.68rem; }
html.solo .lab .hint { font-size: 0.72rem; padding: 0 0.35rem; }
html.solo .lab .hint kbd, html.solo .lab .hint .pb { font-size: 0.62rem; }
html.solo #waking .wk img { width: 38px; height: 38px; }
html.solo .center { font-size: 5rem; }
/* Round 11 (Jeff: the room was too small to play on a phone). Held upright, the first-shift strip folds away behind a
   one-line "Next" pill in the controls band and opens over the top of the room only when tapped; the controls band is
   slimmer; the camera follows your elf, zoomed in (render.js setZoom), with a Room/Zoom toggle. */
html.solo.tall { --bot: calc(env(safe-area-inset-bottom, 0px) + 178px); }
html.solo.tall #tc-btns { --s: min(72px, 19vw); }
html.solo.tall.teaching:not(.teach-open) #teach { display: none; }
html.solo.tall #teach { top: calc(var(--top) + 4px); cursor: pointer; }
#tc-zoom, #tc-next { position: absolute; min-height: 0; height: 34px; padding: 0 0.6rem; font-size: 0.82rem; z-index: 2; }
#tc-next[hidden] { display: none; }
html.tall #tc-pause { left: 6px; top: 6px; transform: none; height: 32px; width: 40px; }
html.tall #tc-zoom { left: 52px; top: 6px; height: 32px; font-size: 0.75rem; padding: 0 0.5rem; }
/* One row along the top of the band, clear of where the left thumb lands and of the Use button. */
html.tall #tc-next { left: 110px; top: 6px; height: 32px; max-width: min(122px, calc(100vw - 253px)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(251, 244, 228, 0.94); color: var(--ink); box-shadow: 0 3px 0 rgba(0,0,0,0.35); font-size: 0.68rem; padding: 0 0.45rem; }
html.tall #tc-next:hover, html.tall #tc-next:focus, #tc-zoom:focus { outline: none; }
html.tall #tc-next:hover, html.tall #tc-next:focus { background: rgba(251, 244, 228, 0.94); }
#tc-next .pb { font-size: 0.66rem; height: 1.45em; }
#tc-next i { font-style: normal; opacity: 0.6; }
html.solo:not(.tall) #tc-zoom { pointer-events: auto; left: 60px; bottom: 8px; }
html.solo:not(.tall) #tc-next { display: none; }
/* Narrow screens: the end screen's four buttons wrap two by two instead of running off the card. */
@media (max-width: 520px) { #end .row.menu { flex-wrap: wrap; } #end .row.menu button { flex: 1 1 40%; } #end-stats { gap: 0.4rem 1rem; } }
