@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; }

/* ---------- Box Battle: office palette and the floor plan ---------- */
:root { --bg: #efe9df; --paper: #fffdf8; --ink: #2a2a35; --muted: #77727f; --line: #d9d0c1; --aqua: #2f7fe0; --aqua-dark: #1c56a3; --orange: #e8483f; --orange-dark: #a32720; --yellow: #ffd23f; --a: #2f7fe0; --b: #e8483f; }
body { background-image: linear-gradient(rgba(42, 42, 53, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(42, 42, 53, .05) 1px, transparent 1px); background-size: 26px 26px; }
.logo { font-size: 26px; }
.duelbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 10px 12px; }
.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 img { width: 54px; height: 54px; object-fit: contain; flex: none; }
.mgr .who { min-width: 0; }
.mgr .who b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgr .who span { font: 26px/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); }
.status { text-align: center; font-weight: 800; min-height: 24px; }
.status.mine { color: var(--green); }
.board { width: 100%; height: auto; display: block; touch-action: manipulation; user-select: none; }
.floor { background: #fff; border: 3px solid var(--ink); border-radius: 22px; padding: 8px; box-shadow: 0 6px 0 rgba(42, 42, 53, .2); }
.board .wall { stroke: #e3dccf; stroke-width: 9; stroke-linecap: round; }
.board .wall.s0 { stroke: var(--a); } .board .wall.s1 { stroke: var(--b); }
.board .wall.last { stroke-width: 13; }
.board .hit { fill: transparent; cursor: pointer; }
.board .wall { pointer-events: none; transition: stroke .08s, stroke-width .08s; }
.board .wall.free.hover { stroke: #ffc400; stroke-width: 14; }
.board .hit:focus { outline: none; }
.board .hit:focus-visible { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 4; }
.board:not(.locked) .wall.free { stroke: #d8cfbf; stroke-dasharray: 2 13; stroke-width: 7; }
.board:not(.locked) .wall.free.hover { stroke-dasharray: none; }
.board.locked .hit { pointer-events: none; cursor: default; }
.board .dot { fill: var(--ink); }
.board .cub.s0 { fill: #d6e7fb; } .board .cub.s1 { fill: #fbdcd9; }
.board .cub.new { animation: claim .5s ease-out; }
@keyframes claim { 0% { opacity: 0; } 40% { opacity: 1; fill: #fff3a8; } }
.board .tag { font: 800 13px var(--body); text-anchor: middle; fill: var(--ink); }
.board image.new { animation: drop .45s cubic-bezier(.3, 1.5, .5, 1); transform-box: fill-box; transform-origin: center; }
@keyframes drop { 0% { transform: translateY(-30px) scale(.4); opacity: 0; } }
.heroes { display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.heroes img { width: 120px; height: 150px; object-fit: contain; }
.heroes .vs { font-size: 34px; padding-bottom: 50px; }
.staff { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.staff img { width: 44px; height: 44px; object-fit: contain; }
@media (prefers-reduced-motion: reduce) { .board .cub.new, .board image.new { animation: none; } }

/* ---------- Type Fight: inbox palette and the race ---------- */
:root { --bg: #e9eef7; --paper: #fffefb; --ink: #232a45; --muted: #6b7390; --line: #c9d3e8; --aqua: #3b6fe0; --aqua-dark: #2450b3; --orange: #ff7a2f; --orange-dark: #b84d12; --yellow: #ffd23f; --green: #17935f; --red: #d93a36; --me: #3b6fe0; --them: #ff7a2f; }
body { background-image: linear-gradient(rgba(35, 42, 69, .05) 1px, transparent 1px); background-size: 100% 28px; }
.logo { font-size: 26px; }
.round { width: 44px; height: 44px; }
.chip { min-height: 44px; display: inline-flex; align-items: center; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--aqua-dark); outline-offset: 2px; }
.small { font-size: 13.5px; }
.heroes { display: flex; justify-content: center; align-items: center; gap: 12px; }
.heroes img { width: 110px; height: 110px; object-fit: contain; }
.vs { font: 30px/1 var(--display); color: var(--muted); }

.race { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.racer { display: grid; grid-template-columns: minmax(0, 104px) minmax(0, 1fr) 68px; align-items: center; gap: 8px; }
.racer .who { min-width: 0; line-height: 1.15; }
.racer .who b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.racer .pts { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.racer .track { height: 18px; border: 2px solid var(--ink); border-radius: 9px; background: #fff; overflow: hidden; }
.racer .track i { display: block; height: 100%; width: 0; transition: width .18s linear; }
.racer.me .track i { background: var(--me); }
.racer.them .track i { background: repeating-linear-gradient(135deg, var(--them) 0 8px, #ffa46d 8px 16px); } /* striped, so colour is not the only clue */
.racer .wpm { font-size: 13px; font-weight: 800; text-align: right; white-space: nowrap; }
.status { text-align: center; font-weight: 800; min-height: 24px; }
.status.mine { color: var(--green); }

.sheet { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 150px; }
.mail { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 2px dashed var(--line); padding-bottom: 6px; }
.sentence { font: 600 21px/1.5 var(--body); white-space: pre-wrap; overflow-wrap: break-word; user-select: none; -webkit-user-select: none; }
.sentence .ok { color: var(--green); }
.sentence .rest { color: #9aa1b5; }
.sentence .cur { color: var(--ink); background: #fff1b0; box-shadow: inset 0 -3px 0 var(--ink); border-radius: 3px; }
.sentence .bad { color: #fff; background: var(--red); border-radius: 3px; box-shadow: inset 0 -3px 0 var(--ink); text-decoration: underline wavy #fff; }
.oops { font-size: 13.5px; font-weight: 800; color: var(--red); }
.oops::before { content: '\26A0  '; }
input.typebox { font-size: 19px; min-height: 52px; border-color: var(--aqua-dark); }
.sheet .count { font-size: 80px; }
.sticker { width: 84px; height: 84px; object-fit: contain; display: block; margin: 0 auto; }
.summary { display: flex; flex-direction: column; gap: 6px; }
.verdict { font: 24px/1.1 var(--display); text-align: center; padding-top: 4px; }
.verdict.win { color: var(--green); } .verdict.lose { color: var(--orange-dark); }
.stat { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; border-top: 2px dashed var(--line); padding-top: 6px; }
.stat b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { font-weight: 600; white-space: nowrap; }
.warn { color: var(--red); font-weight: 600; font-size: 14px; }
.final { font: 64px/1 var(--display); text-align: center; color: var(--orange); }
.prize { width: 140px; height: 140px; }
@media (max-width: 380px) { .sentence { font-size: 19px; } .racer { grid-template-columns: minmax(0, 84px) minmax(0, 1fr) 64px; } }
@media (max-height: 560px) { .sheet { min-height: 0; } .sheet .count { font-size: 56px; } .sticker { width: 56px; height: 56px; } }
@media (prefers-reduced-motion: reduce) { .racer .track i { transition: none; } .dots::after { animation: none; content: '...'; } }
