/* Ingen aning. Grangrönt, gult och rött, runda tjocka bokstäver. En kolumn på mobilen, 16:9 på TV:n. */
:root {
  --ground: #0E3B2E;
  --panel: #17513F;
  --cream: #FFF4DC;
  --muted: #BFD8CB;
  --ink: #0B2A21;
  --ink-soft: #3D5A4E;
  --yellow: #FFC94A;
  --yellow-deep: #B8862A;
  --red: #C8323C;
  --display: Fredoka, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --body: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--cream);
  font-family: var(--body); font-weight: 600; font-size: 17px; line-height: 1.4;
  -webkit-text-size-adjust: 100%; overflow-x: hidden;
}
button, input { font-family: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 36px; line-height: 1.1; text-wrap: balance; }
p { margin: 0; }

@keyframes pop { 0% { transform: scale(0) rotate(-14deg); opacity: 0 } 70% { transform: scale(1.12) rotate(4deg); opacity: 1 } 100% { transform: scale(1) rotate(0); opacity: 1 } }
@keyframes rise { from { transform: translateY(26px); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes wobble { 0%, 100% { transform: scale(1.04) rotate(-4deg) } 50% { transform: scale(1.04) rotate(2deg) } }
@keyframes swing { 0%, 100% { transform: rotate(-3.5deg) } 50% { transform: rotate(3.5deg) } }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
@keyframes fall { from { transform: translateY(-5vh) } to { transform: translateY(105vh) } }
@keyframes stamp { 0% { transform: scale(3) rotate(-20deg); opacity: 0 } 60% { transform: scale(.9) rotate(-5deg); opacity: 1 } 100% { transform: scale(1) rotate(-5deg); opacity: 1 } }
@keyframes grow { from { transform: scaleX(0) } to { transform: scaleX(1) } }
@keyframes dotjump { 0%, 80%, 100% { transform: translateY(0); opacity: .45 } 40% { transform: translateY(-14px); opacity: 1 } }

.snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.snow span { position: absolute; top: 0; border-radius: 50%; background: var(--cream); animation: fall linear infinite; }

.screen {
  position: relative; width: 100%; max-width: 460px; min-height: 100vh; min-height: 100dvh; margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 18px;
}
.enter.screen { animation: rise .45s both; }
.center { align-items: center; text-align: center; }
.middle { justify-content: center; }
.grow { flex-grow: 1; min-height: 8px; }
.kicker { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 15px; }

.btn {
  min-height: 62px; padding: 8px 20px; border: 0; border-radius: 20px; background: var(--yellow); color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 22px; box-shadow: 0 6px 0 var(--yellow-deep);
  transition: transform .08s, box-shadow .08s; flex-shrink: 0;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--yellow-deep); }
.btn.ghost { background: none; color: var(--cream); border: 2px solid var(--cream); box-shadow: none; }
.btn.ghost:active { transform: scale(.97); }
.btn.slim { min-height: 48px; font-family: var(--body); font-weight: 800; font-size: 16px; border-radius: 16px; }
.btn[disabled] { background: var(--panel); color: var(--muted); box-shadow: none; cursor: default; }
.enter .btn.late { animation: pop .4s .2s both; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.input {
  height: 64px; width: 100%; border: 0; border-radius: 20px; padding: 0 20px; background: var(--cream); color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 26px;
}
.input.code { text-transform: uppercase; letter-spacing: .2em; }

.tiles { display: flex; gap: 8px; }
.tile {
  width: 58px; height: 68px; border-radius: 14px; background: var(--yellow); color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 42px; display: flex; align-items: center; justify-content: center;
}
.tile:nth-child(even) { background: var(--cream); }
.enter .tile { animation: pop .5s both; }
.enter .tile:nth-child(2) { animation-delay: .08s } .enter .tile:nth-child(3) { animation-delay: .16s } .enter .tile:nth-child(4) { animation-delay: .24s }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 6px; border-radius: 999px; background: var(--panel); font-weight: 800; }
.chip.new { animation: pop .45s both; }
.chip.off { opacity: .45; }
.dot {
  --s: 34px; width: var(--s); height: var(--s); flex-shrink: 0; border-radius: 50%; color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: calc(var(--s) * .56);
  display: flex; align-items: center; justify-content: center;
}
.panel { background: var(--panel); border-radius: 18px; padding: 14px 18px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--panel); background: var(--panel); color: var(--cream); font-weight: 800; font-size: 15px; }
.pill.on { background: var(--cream); color: var(--ink); border-color: var(--yellow); }

/* Lappen som hänger i snöret */
.hang { display: flex; flex-direction: column; align-items: center; transform-origin: 50% 7px; animation: swing 2.6s ease-in-out infinite; }
.hang.flipped { animation-duration: 4.5s; }
.hang .knob { width: 14px; height: 14px; border-radius: 50%; background: var(--yellow); position: relative; z-index: 2; }
.hang .string { width: 4px; height: 64px; margin-top: -4px; background: var(--yellow); border-radius: 2px; position: relative; z-index: 2; }
.tag { width: min(290px, 78vw); aspect-ratio: 29 / 38; margin-top: -31px; padding: 0; border: 0; background: none; perspective: 1100px; color: inherit; }
.tag .inner { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2, .9, .3, 1.15); }
.hang.flipped .tag .inner { transform: rotateY(180deg); }
.tag .face {
  position: absolute; inset: 0; border-radius: 28px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center;
}
.tag .face::before { content: ""; position: absolute; top: 18px; left: 50%; margin-left: -11px; width: 22px; height: 22px; border-radius: 50%; background: var(--ground); }
.tag .front { background: var(--red); border: 6px dashed var(--cream); }
.tag .back { background: var(--cream); color: var(--ink); transform: rotateY(180deg); }
.tag .big { font-family: var(--display); font-weight: 700; font-size: 50px; line-height: 1; }
.tag .word { font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1.05; color: var(--red); overflow-wrap: anywhere; }
.tag .q { font-family: var(--display); font-weight: 700; font-size: 110px; line-height: .9; color: var(--red); }
.tag .note { font-size: 16px; color: var(--ink-soft); }
.after { visibility: hidden; align-self: stretch; display: flex; flex-direction: column; }
.hang.flipped ~ .after { visibility: visible; }
.hang.flipped ~ .after .btn { animation: pop .45s .5s both; }

.avatar { --s: 150px; animation: bob 1.6s ease-in-out infinite; }
.peek { background: var(--cream); color: var(--ink); border-radius: 16px; padding: 12px 22px; font-family: var(--display); font-weight: 700; font-size: 24px; animation: pop .35s both; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.vote {
  min-height: 104px; padding: 12px 8px; border-radius: 22px; border: 3px solid var(--panel); background: var(--panel); color: var(--cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 17px;
}
.vote .dot { --s: 50px; }
.vote.on { background: var(--cream); color: var(--ink); border-color: var(--yellow); animation: wobble .5s ease-in-out 1 both; }

.dots { display: flex; gap: 14px; }
.dots span { width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); animation: dotjump 1.2s ease-in-out infinite; }
.dots span:nth-child(2) { background: var(--cream); animation-delay: .15s } .dots span:nth-child(3) { background: var(--red); animation-delay: .3s }

.slip { border-radius: 24px; padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; }
.slip b { font-family: var(--display); font-weight: 700; font-size: 32px; line-height: 1.05; overflow-wrap: anywhere; }
.slip.guess { background: var(--cream); color: var(--ink); transform: rotate(-2deg); }
.slip.guess span { color: var(--ink-soft); } .slip.guess b { color: var(--red); }
.slip.truth { background: var(--panel); transform: rotate(1.5deg); }
.slip.truth span { color: var(--muted); }
.enter .slip { animation: pop .5s .1s both; } .enter .slip.truth { animation-delay: .25s; }
.enter .slip.guess { --r: -2deg; }

.stamp { padding: 4px 26px 8px; border: 5px solid var(--yellow); border-radius: 18px; color: var(--yellow); font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 1; transform: rotate(-5deg); max-width: 100%; overflow-wrap: anywhere; }
.enter .stamp { animation: stamp .6s .15s both; }
.enter .d1 { animation: rise .5s .7s both } .enter .d2 { animation: rise .5s .9s both } .enter .d3 { animation: rise .5s 1.1s both }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.bar .name { width: 104px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track { flex-grow: 1; height: 14px; border-radius: 7px; background: var(--panel); overflow: hidden; }
.bar .fill { display: block; height: 100%; border-radius: 7px; background: #7FA898; transform-origin: left center; }
.bar .fill.spy { background: var(--yellow); }
.enter .bar .fill { animation: grow .6s 1.1s both; }
.bar .n { width: 16px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.board { display: flex; flex-direction: column; gap: 5px; }
.line { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.line .dot { --s: 24px; }
.line .name { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gain { min-width: 34px; text-align: center; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 800; font-size: 14px; }
.enter .gain { animation: pop .4s 1.6s both; }
.gain.none { visibility: hidden; }
.total { width: 26px; text-align: right; font-family: var(--display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 10; background: var(--red); color: var(--cream); border-radius: 16px; padding: 14px 18px; font-weight: 800; text-align: center; animation: rise .3s both; }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 10; background: var(--yellow); color: var(--ink); padding: 6px 12px; font-weight: 800; font-size: 14px; text-align: center; }
.logo { font-family: var(--display); font-weight: 700; font-size: 64px; line-height: .95; }
.logo em { font-style: normal; color: var(--yellow); display: inline-block; transform: rotate(-4deg); }

/* ---------- Få plats på en mobilskärm i webbläsaren, utan att scrolla ---------- */
html, body { overflow: hidden; }
body:not(.tv) #app { height: 100%; }
.screen {
  height: 100vh; height: 100dvh; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: max(clamp(14px, 3dvh, 28px), env(safe-area-inset-top)) 22px 0;
  gap: clamp(10px, 2dvh, 18px);
}
.screen.middle { padding-bottom: 22px; }
h1 { font-size: clamp(27px, 5dvh, 36px); }
.foot {
  margin-top: auto; position: sticky; bottom: 0; z-index: 3; align-self: stretch; background: var(--ground);
  display: flex; flex-direction: column; gap: 10px; padding: 10px 0 max(16px, env(safe-area-inset-bottom));
}
.footrow { display: flex; gap: 10px; }
.footrow .btn:first-child { flex: 1; }
.toprow { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.link { background: none; border: 0; color: var(--muted); font-weight: 800; font-size: 15px; text-decoration: underline; min-height: 44px; padding: 0 4px; }
.tile { width: clamp(46px, 13vw, 58px); height: clamp(54px, 15vw, 68px); font-size: clamp(32px, 9.5vw, 42px); }
.pills.scrollx { flex-wrap: nowrap; overflow-x: auto; margin: 0 -22px; padding: 2px 22px 6px; scrollbar-width: none; }
.pills.scrollx::-webkit-scrollbar { display: none; }
.pills.scrollx .pill { flex-shrink: 0; white-space: nowrap; }
.chip { padding: 5px 14px 5px 5px; font-size: 16px; }
.chip .dot { --s: 30px; }
.tag { width: min(290px, 78vw, calc((100dvh - 320px) * .763)); container-type: inline-size; }
.tag .face { padding: 8cqw; gap: 4cqw; border-radius: 9cqw; }
.tag .front { border-width: max(3px, 2cqw); }
.tag .big { font-size: 17cqw; }
.tag .big.sub { font-size: 9.5cqw; }
.tag .word { font-size: 14cqw; }
.tag .q { font-size: 36cqw; }
.tag .note { font-size: max(12px, 5.4cqw); line-height: 1.3; }
.hang .string { height: clamp(40px, 7dvh, 64px); }
.avatar { --s: clamp(84px, 20dvh, 150px); }
.grid2.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.vote { min-height: clamp(70px, 13dvh, 104px); padding: 8px 6px; gap: 6px; font-size: 15px; }
.vote .dot { --s: clamp(34px, 6.5dvh, 50px); }
.vote span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slip { padding: clamp(12px, 2.4dvh, 20px) 20px; }
.slip b { font-size: clamp(24px, 4.6dvh, 32px); }
.stamp { font-size: clamp(34px, 7.5dvh, 56px); max-width: 86%; text-align: center; }
.board.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; row-gap: 4px; }
.board.two .kicker { grid-column: 1 / -1; }
.board.two .line { gap: 6px; min-height: 26px; font-size: 15px; }
.board.two .gain { min-width: 28px; font-size: 12px; }
.board.two .total { width: 20px; font-size: 17px; }
.logo { font-size: clamp(48px, 10dvh, 64px); }
.screen.tight { gap: clamp(7px, 1.3dvh, 14px); }
.screen.tight .panel { padding: 10px 14px; }
@media (max-height: 620px) { .screen.tight p { font-size: 15px; line-height: 1.3; } .screen.tight .line { min-height: 24px; } }
.chips.dense { gap: 6px; }
.chips.dense .chip { font-size: 14px; padding: 4px 11px 4px 4px; gap: 6px; }
.chips.dense .chip .dot { --s: 24px; }
.tvlink { align-self: center; color: var(--muted); font-size: 14px; padding: 12px 8px max(14px, env(safe-area-inset-bottom)); }
.tvlink:hover { color: var(--cream); }

/* ---------- TV ---------- */
.tv { height: 100%; overflow: hidden; font-size: 2vw; }
.tv .stage { position: relative; height: 100%; padding: 6vh 5.5vw; display: flex; flex-direction: column; gap: 3.5vh; }
.tv .enter.stage { animation: rise .5s both; }
.tv .stage.spread { justify-content: space-evenly; }
.tv h1 { font-size: 5.2vw; }
.tv .kicker { font-size: 1.6vw; }
.tv .lead { font-size: 2.2vw; color: var(--muted); }
.tv .lead b { color: var(--cream); font-weight: 800; }
.tv .split { display: flex; gap: 4.5vw; align-items: center; }
.tv .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2.4vh; align-items: flex-start; }
.tv .tiles { gap: 1.1vw; }
.tv .tile { width: 8vw; height: 9.6vw; border-radius: 1.8vw; font-size: 6.2vw; }
.tv .qr { width: 23vw; height: 23vw; flex-shrink: 0; border-radius: 2.2vw; background: var(--cream); padding: 1.4vw; transform: rotate(3deg); }
.tv .qr svg { width: 100%; height: 100%; display: block; }
.tv .enter .qr { animation: rise .6s .3s both; }
.tv .chips { gap: 1.1vw; }
.tv .chip { font-size: 2.2vw; padding: .6vw 2vw .6vw .6vw; gap: 1vw; }
.tv .chip .dot { --s: 4vw; }
.tv .people { display: flex; flex-wrap: wrap; justify-content: center; gap: 2vw; }
.tv .person { width: 11vw; display: flex; flex-direction: column; align-items: center; gap: 1.2vh; font-weight: 800; font-size: 1.7vw; }
.tv .person .dot { --s: 8.6vw; }
.tv .person .nm { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv .person .st { border-radius: 999px; padding: .2vw 1.2vw; font-size: 1.4vw; background: var(--panel); color: var(--muted); }
.tv .person.wait .dot { opacity: .45; animation: bob 1.4s ease-in-out infinite; }
.tv .person.done .dot { box-shadow: 0 0 0 .5vw var(--yellow); }
.tv .person.done .st { background: var(--yellow); color: var(--ink); }
.tv .person.done.new .dot { animation: pop .5s both; }
.tv .avatar { --s: 17vw; }
.tv .slip { border-radius: 2.4vw; padding: 2.4vw 3vw; }
.tv .slip span { font-size: 1.7vw; } .tv .slip b { font-size: 5vw; }
.tv .logo { font-size: 64px; }
.tv .stamp { max-width: 100%; }
.tv .chip .dot { --s: 4vw; }
.tv .stamp { border-width: .7vw; border-radius: 2.4vw; padding: .4vw 3.4vw 1vw; font-size: 11vw; }
.tv .boardbox { width: 37vw; flex-shrink: 0; background: var(--panel); border-radius: 2.5vw; padding: 2.2vw 2.5vw; display: flex; flex-direction: column; gap: 1.2vh; }
.tv .line { gap: 1vw; font-size: 1.9vw; min-height: 0; }
.tv .line .dot { --s: 2.8vw; }
.tv .gain { min-width: 3.6vw; font-size: 1.5vw; }
.tv .total { width: 2.6vw; font-size: 2.3vw; }
.tv .word { font-family: var(--display); font-weight: 700; color: var(--yellow); }
.tv .form { max-width: 36vw; margin: auto; display: flex; flex-direction: column; gap: 2vh; align-items: stretch; text-align: center; font-size: 17px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
