@font-face { font-family: 'Luckiest Guy'; src: url(/fonts/luckiest-guy-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 400; src: url(/fonts/rubik-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 600; src: url(/fonts/rubik-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 800; src: url(/fonts/rubik-latin-800-normal.woff2) format('woff2'); font-display: swap; }

:root {
  --bg: #dff3ff; --paper: #ffffff; --ink: #12304a; --muted: #5d7b92; --line: #b9dcf2;
  --aqua: #19b5e6; --aqua-dark: #0b7ea6; --orange: #ff8a3d; --orange-dark: #b9541a;
  --green: #23b67f; --red: #f0524f; --yellow: #ffd23f; --me: #19b5e6; --them: #ff8a3d;
  --display: 'Luckiest Guy', 'Arial Black', Impact, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.45 var(--body); overscroll-behavior: none; background: var(--bg);
  background-image: radial-gradient(circle at 14px 14px, rgba(25, 181, 230, .16) 4px, transparent 5px); background-size: 34px 34px;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
.screen { width: min(540px, 100%); display: flex; flex-direction: column; gap: 14px; flex: 1; }
button { font: inherit; color: inherit; cursor: pointer; }
img { -webkit-user-drag: none; user-select: none; }
p { margin: 0; } .muted { color: var(--muted); } .center { text-align: center; }

.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.bar .sp { flex: 1; }
.logo { font: 22px/1 var(--display); color: var(--aqua-dark); letter-spacing: .4px; padding-top: 4px; text-decoration: none; }
.logo span { color: var(--orange); }
.chip { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); font-size: 18px; font-weight: 800; display: grid; place-items: center; }

.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; padding: 18px; box-shadow: 0 6px 0 rgba(18, 48, 74, .2); }
h1 { font: 42px/1 var(--display); margin: 2px 0 0; text-align: center; letter-spacing: .5px; }
h1 em { font-style: normal; color: var(--aqua-dark); }
h2 { font: 26px/1.08 var(--display); margin: 0; letter-spacing: .3px; }
.btn { border: 3px solid var(--ink); border-radius: 16px; padding: 14px 18px 10px; font: 22px/1 var(--display); letter-spacing: .5px; background: var(--paper); box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s; width: 100%; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.blue { background: var(--aqua); color: #fff; } .btn.orange { background: var(--orange); color: #fff; } .btn.yellow { background: var(--yellow); }
.btn.small { font-size: 17px; padding: 10px 14px 7px; width: auto; }
.btn[disabled] { opacity: .55; pointer-events: none; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; color: var(--muted); }
input[type=text] { font: 600 18px var(--body); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 11px 14px; background: #fff; width: 100%; }
input[type=text]:focus { outline: 3px solid var(--yellow); }
.hero { width: min(100%, 420px); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 20px; border: 3px solid var(--ink); margin: 0 auto; display: block; box-shadow: 0 6px 0 rgba(18, 48, 74, .2); }
.cats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.cats img { width: 100%; aspect-ratio: 1; object-fit: contain; }

.code { font: 54px/1 var(--display); letter-spacing: 6px; text-align: center; color: var(--orange); padding-top: 8px; }
.linkbox { display: flex; gap: 8px; align-items: center; background: #fff; border: 2px dashed var(--line); border-radius: 14px; padding: 8px 8px 8px 12px; font-size: 14px; }
.linkbox span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* the tug of war */
.tug { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.names { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 15px; }
.names span { max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.names .me { color: var(--aqua-dark); } .names .them { color: var(--orange-dark); }
.names i { font-style: normal; font-weight: 600; color: var(--muted); }
.rope { position: relative; height: 74px; border-radius: 16px; background: linear-gradient(90deg, rgba(25,181,230,.28) 0 14%, #f2f8fc 14% 86%, rgba(255,138,61,.3) 86%); border: 3px solid var(--ink); overflow: hidden; }
.rope::before { content: ''; position: absolute; left: 6%; right: 6%; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: repeating-linear-gradient(90deg, #c69a5b 0 10px, #a67c3d 10px 20px); }
.rope::after { content: ''; position: absolute; left: 50%; top: 6px; bottom: 6px; border-left: 3px dashed rgba(18,48,74,.25); }
.rope .cooler { position: absolute; top: 4px; width: 60px; height: 60px; margin-left: -30px; left: 50%; transition: left .7s cubic-bezier(.3,1.4,.5,1); z-index: 1; object-fit: contain; }
.rope .cooler.shake { animation: wob .5s; }
@keyframes wob { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }

/* question */
.qcard { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.cat { display: flex; align-items: center; gap: 10px; }
.cat img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.cat b { font: 20px/1 var(--display); letter-spacing: .3px; padding-top: 4px; color: var(--aqua-dark); }
.cat .sp { flex: 1; }
.qtext { font-size: 20px; font-weight: 800; line-height: 1.25; min-height: 50px; }
.timer { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; border: 2px solid var(--ink); }
.timer i { display: block; height: 100%; width: 100%; background: var(--aqua); transform-origin: left; }
.timer i.low { background: var(--red); }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; border: 3px solid var(--ink); border-radius: 14px; background: #fff; padding: 13px 14px; font-weight: 600; font-size: 17px; box-shadow: 0 4px 0 var(--ink); display: flex; align-items: center; gap: 10px; transition: transform .08s, box-shadow .08s; }
.opt:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.opt .k { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.opt .tx { flex: 1; }
.opt .who { flex: none; display: flex; gap: 4px; }
.opt .who i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
.opt .who i.me { background: var(--me); } .opt .who i.them { background: var(--them); }
.opt.mine { background: #e3f6fd; border-color: var(--aqua-dark); }
.opt.right { background: #d5f5e7; border-color: var(--green); }
.opt.wrong { background: #fde1e0; border-color: var(--red); }
.opt[disabled] { pointer-events: none; box-shadow: none; transform: translateY(3px); }
.double { display: flex; align-items: center; gap: 10px; border: 3px dashed var(--ink); border-radius: 14px; background: #fff8dc; padding: 8px 12px; font-weight: 800; }
.double img { width: 38px; height: 38px; object-fit: contain; }
.double small { display: block; font-weight: 600; color: var(--muted); }
.double.on { border-style: solid; background: var(--yellow); }
.double[disabled] { opacity: .45; pointer-events: none; }
.result { font-weight: 800; text-align: center; min-height: 24px; }
.result .up { color: var(--green); } .result .down { color: var(--red); }
.bigcat { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 10px; flex: 1; justify-content: center; }
.bigcat img { width: 150px; height: 150px; object-fit: contain; animation: pop .45s cubic-bezier(.3,1.6,.5,1); }
.bigcat b { font: 34px/1 var(--display); color: var(--aqua-dark); padding-top: 6px; }
@keyframes pop { 0% { transform: scale(.3) rotate(-20deg); opacity: 0; } }
.count { font: 96px/1 var(--display); text-align: center; color: var(--orange); text-shadow: 0 5px 0 var(--orange-dark); }
.banner { font: 36px/1.05 var(--display); text-align: center; color: var(--aqua-dark); padding-top: 6px; }
.prize { width: 170px; height: 170px; object-fit: contain; margin: 0 auto; display: block; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; font-weight: 600; padding: 10px 16px; border-radius: 999px; z-index: 9; }
dialog { border: 3px solid var(--ink); border-radius: 22px; background: var(--paper); color: var(--ink); padding: 22px 20px 18px; width: min(460px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(18, 48, 74, .55); }
dialog ol { margin: 8px 0 14px; padding-left: 22px; } dialog li { margin: 4px 0; }
@media (max-height: 700px) { h1 { font-size: 34px; } .rope { height: 62px; } .rope .cooler { width: 50px; height: 50px; margin-left: -25px; } .qtext { font-size: 18px; } .opt { padding: 10px 12px; } }
@media (prefers-reduced-motion: reduce) { .rope .cooler { transition: none; } .bigcat img, .rope .cooler.shake { animation: none; } }

/* keep everything inside a phone's width */
.screen { min-width: 0; max-width: 100%; }
.screen > *, .card > * { min-width: 0; max-width: 100%; }
.opts { grid-template-columns: minmax(0, 1fr); }
.names span, .meta span { min-width: 0; }
.chip { white-space: nowrap; }
.logo { white-space: nowrap; font-size: 20px; }
.qtext, .opt .tx { overflow-wrap: anywhere; }

/* ---------- Drop Four: kitchen palette and the mug shelf ---------- */
:root { --bg: #f1e8da; --paper: #fffdf8; --ink: #2b2a33; --muted: #76707c; --line: #dccfb9; --aqua: #2f7fe0; --aqua-dark: #1c56a3; --orange: #e8483f; --orange-dark: #a32720; --yellow: #ffd23f; --a: #2f7fe0; --b: #e8483f; --wood: #c99a5f; --wood-dark: #8e6332; --hole: #f6ecda; }
body { background-image: radial-gradient(circle at 13px 13px, rgba(142, 99, 50, .13) 3px, transparent 4px); background-size: 28px 28px; }
.logo { font-size: 26px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.round { width: 44px; height: 44px; }
.chip { padding: 10px 12px; }

.duelbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 10px; }
.mgr { display: flex; align-items: center; gap: 8px; min-width: 0; border-radius: 14px; padding: 4px 6px; border: 3px solid transparent; }
.mgr.b { flex-direction: row-reverse; text-align: right; }
.mgr .mug { width: 46px; height: 46px; flex: none; }
.mgr .who { min-width: 0; }
.mgr .who b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; line-height: 1.15; overflow: hidden; white-space: normal; overflow-wrap: anywhere; }
.mgr .who span { font: 24px/1 var(--display); padding-top: 4px; display: block; }
.mgr.a .who span { color: var(--a); } .mgr.b .who span { color: var(--b); }
.mgr.turn { border-color: var(--ink); background: #fff7d1; }
.vs { font: 20px/1 var(--display); color: var(--muted); }
.statusbox { display: flex; flex-direction: column; gap: 8px; }
.status { text-align: center; font-weight: 800; min-height: 24px; overflow-wrap: anywhere; }
.status.mine { color: #14784f; }
.foot { display: flex; flex-direction: column; gap: 14px; }
.foot:empty { display: none; }
.prize { width: 120px; height: 120px; }

/* a mug token: the picture, plus a badge that differs by shape (dot for blue, cross for red) */
.mug { position: relative; display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; }
.mug img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.mug.noimg { border: 3px solid var(--ink); }
.mug.noimg.s0 { background: var(--a); }
.mug.noimg.s1 { background: repeating-linear-gradient(45deg, var(--b) 0 6px, #f47d76 6px 10px); }
.mug .mark { position: absolute; right: 0; bottom: 0; width: 36%; height: 36%; min-width: 12px; min-height: 12px; background: #fff; border: 2px solid var(--ink); }
.mug.s0 .mark { border-radius: 50%; }
.mug.s0 .mark::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; background: var(--a); }
.mug.s1 .mark { border-radius: 3px; }
.mug.s1 .mark::after { content: ''; position: absolute; inset: 8%; background: linear-gradient(45deg, transparent 38%, var(--b) 38% 62%, transparent 62%), linear-gradient(-45deg, transparent 38%, var(--b) 38% 62%, transparent 62%); }

/* the shelf */
.shelf { background: var(--wood); border: 3px solid var(--ink); border-radius: 22px; padding: 4px 6px 8px; box-shadow: 0 6px 0 rgba(43, 42, 51, .2); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.ghosts, .cols { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.ghost { display: block; aspect-ratio: 1; padding: 4px; }
.ghost .mug { opacity: .8; }
.col { display: grid; grid-template-rows: repeat(6, auto); gap: 3px; padding: 3px 2px; margin: 0; border: 0; border-radius: 12px; background: transparent; min-width: 0; cursor: pointer; }
.shelf.locked .col, .col.full { cursor: default; }
.col.sel { background: rgba(255, 210, 63, .75); }
.col:focus-visible { outline: 3px solid var(--ink); outline-offset: -1px; }
.slot { display: block; aspect-ratio: 1; border-radius: 50%; background: var(--hole); box-shadow: inset 0 3px 0 rgba(43, 42, 51, .22); border: 2px solid var(--wood-dark); padding: 1px; }
.mug.drop { animation: fall calc(.14s + var(--r, 0) * .07s) cubic-bezier(.45, 0, .9, .55); }
@keyframes fall { 0% { transform: translateY(calc((var(--r, 0) + 1) * -112%)); } 100% { transform: translateY(0); } }
.shelf.over .mug { opacity: .45; }
.shelf.over .mug.win { opacity: 1; outline: 4px solid var(--yellow); outline-offset: -1px; box-shadow: 0 0 0 2px var(--ink); animation: cheer .7s ease-in-out 3; z-index: 1; }
.shelf.over .slot:has(.mug.win) { background: var(--yellow); border-color: var(--ink); }
@keyframes cheer { 50% { transform: scale(1.12); } }

.heroes { display: flex; justify-content: center; align-items: center; gap: 14px; }
.heroes .mug { width: 110px; height: 110px; flex: none; }
.heroes .vs { font-size: 34px; }
@media (max-height: 700px) { .prize { width: 84px; height: 84px; } }
@media (prefers-reduced-motion: reduce) { .mug.drop, .shelf.over .mug.win { animation: none; } .btn { transition: none; } }
