@font-face { font-family: "Lilita One"; src: url(fonts/lilita-one.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Fredoka; src: url(fonts/fredoka-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --field: #0fa39a; --deep: #08746e; --deeper: #06565a; --ink: #06393a; --paper: #fff7e3; --hot: #ff3d6e;
  --top: 58px; --tray: 122px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 900px) { :root { --top: 64px; --tray: 96px; } }
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--field); color: #fff; font: 700 16px/1.25 Fredoka, system-ui, sans-serif;
  background-image: radial-gradient(circle at 50% 40%, #19bdb2 0, var(--field) 55%, #0b8c85 100%); }
h1, h2, h3, .btn, b.cnt, .code, .step b, .acts b { font-family: "Lilita One", "Arial Black", sans-serif; font-weight: 400; }
#board { position: fixed; inset: 0; touch-action: none; display: block; }
#app { position: fixed; inset: 0; pointer-events: none; }
#app > * { pointer-events: auto; }
.boardbox { position: fixed; pointer-events: none !important; }

/* buttons: chunky, level, a label only */
.btn { appearance: none; border: 0; border-radius: 14px; background: var(--paper); color: var(--ink); font-size: 19px; line-height: 1; padding: 0 16px; min-height: 48px; min-width: 48px;
  box-shadow: 0 5px 0 var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap; transform: translateY(-2px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.hot { background: var(--hot); color: #fff; }
.btn.ghost { background: var(--deep); color: #fff; }
.btn.big { min-height: 60px; font-size: 26px; width: 100%; }
.btn:disabled { opacity: 0.45; cursor: default; }
kbd { font: 700 12px/1 Fredoka, sans-serif; background: var(--ink); color: #fff; border-radius: 6px; padding: 4px 6px; }
.btn.hot kbd, .btn.ghost kbd { background: rgba(0,0,0,0.35); }
.face { width: 30px; height: 30px; object-fit: contain; flex: none; }
.hint { font-size: 14px; opacity: 0.92; }

/* ---- the play screen ---- */
#top { position: fixed; left: 0; right: 0; top: 0; height: calc(var(--top) + var(--sat)); padding: var(--sat) 6px 0; background: var(--deep); display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 0 var(--deeper); }
.chips { flex: 1; display: flex; gap: 4px; min-width: 0; }
.chip { flex: 1 1 0; min-width: 0; display: grid; grid-template: "f n" auto "b b" 8px / auto 1fr; align-items: center; column-gap: 4px; row-gap: 3px; padding: 5px 6px 6px; border-radius: 12px; background: var(--deeper); border: 3px solid transparent; }
.chip .face { grid-area: f; width: 26px; height: 26px; }
.chip .cnt { grid-area: n; font-size: 22px; line-height: 1; color: var(--c); text-shadow: 0 2px 0 var(--ink); }
.chip .who { display: none; }
.chip .bar { grid-area: b; position: relative; height: 8px; border-radius: 4px; background: #0a3f42; }
.chip .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--c); max-width: 100%; }
.chip .bar u { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1px; background: #fff; border-radius: 2px; }
.chip.cur { border-color: #fff; background: var(--ink); }
.chip.out { opacity: 0.35; }
@media (min-width: 560px) { .chip { grid-template: "f w n" auto "b b b" 8px / auto 1fr auto; } .chip .who { display: block; grid-area: w; font-size: 14px; overflow: hidden; white-space: nowrap; } }
.menu { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--deeper); display: grid; place-content: center; gap: 5px; cursor: pointer; }
.menu i { display: block; width: 20px; height: 3px; border-radius: 2px; background: #fff; }

#tray { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tray) + var(--sab)); padding: 8px 8px calc(8px + var(--sab)); background: var(--deep); box-shadow: 0 -4px 0 var(--deeper); display: flex; flex-direction: column; justify-content: space-between; gap: 6px; overflow: hidden; }
#tray .line { min-height: 40px; display: flex; flex-wrap: wrap; align-items: center; align-content: center; column-gap: 8px; font-size: 15px; line-height: 1.2; }
#tray .line.bad b { color: #ffd0c9; }
#tray .line span { opacity: 0.92; }
#tray .row { display: flex; align-items: center; gap: 8px; min-height: 52px; }
#tray .row .btn { flex: 1 1 auto; padding: 0 10px; font-size: 18px; }
#tray .row.ctl { min-height: 50px; }
#tray .row.ctl .btn { flex: 1 1 auto; }
#tray .lab { font: 400 18px "Lilita One", sans-serif; width: 54px; flex: none; }
.acts b { font-size: 34px; line-height: 1; }
.pips { display: inline-flex; gap: 5px; margin-left: 4px; }
.pip { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); }
.pip.x { background: #ff8a1f; border-radius: 4px; }
.pip.used { background: transparent; border-color: rgba(255,255,255,0.45); }
.burns { margin-left: auto; font-size: 13px; }
.step { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.step b { min-width: 40px; text-align: center; font-size: 28px; line-height: 1; }
.sb { appearance: none; border: 0; width: 46px; height: 46px; border-radius: 12px; background: var(--paper); color: var(--ink); font: 400 28px/1 "Lilita One", sans-serif; box-shadow: 0 4px 0 var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.sb:disabled { opacity: 0.4; }
.sb kbd { font-size: 10px; padding: 3px 4px; }
@media (min-width: 900px) {
  #tray { flex-direction: row; align-items: center; justify-content: center; gap: 22px; padding: 10px 24px; }
  #tray .line { font-size: 17px; max-width: 46%; }
  #tray .row .btn { flex: 0 0 auto; padding: 0 16px; }
  #tray .row.ctl { gap: 10px; }
  .burns { margin-left: 8px; }
}

/* ---- home: the name is loud, a match plays itself, the animals bob along the bottom edge ---- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; pointer-events: none !important; padding: calc(12px + var(--sat)) 16px calc(12px + var(--sab)); }
.screen > * { pointer-events: auto; }
.wordmark { display: flex; flex-direction: column; align-items: flex-start; line-height: 0.82; font-size: min(27vw, 21vh); color: #fff; letter-spacing: 0.01em; text-shadow: 0 0.06em 0 var(--ink), 0 0.11em 0 rgba(6,57,58,0.35); animation: sway 3.2s ease-in-out infinite; transform-origin: 20% 60%; }
.wordmark span:last-child { color: #ffe14a; }
@keyframes sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(1.5deg) scale(1.02); } }
.home .door { margin-top: auto; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 420px; align-self: center; padding-bottom: 58px; }
.home .links { display: flex; gap: 8px; }
.home .links .btn { flex: 1; font-size: 15px; min-height: 44px; padding: 0 6px; }
.parade { position: fixed; left: 0; right: 0; bottom: calc(-14px + var(--sab)); display: flex; justify-content: space-around; pointer-events: none !important; }
.parade .face { width: 62px; height: 62px; }
.bob { animation: bob 1.1s ease-in-out infinite; }
.b1 { animation-delay: -0.2s; } .b2 { animation-delay: -0.45s; } .b3 { animation-delay: -0.6s; } .b4 { animation-delay: -0.8s; } .b5 { animation-delay: -0.95s; }
@keyframes bob { 0%, 100% { transform: translateY(10px) rotate(-6deg); } 50% { transform: translateY(-8px) rotate(6deg); } }
@media (min-width: 900px) {
  .home { padding: 40px 0 0 6vw; }
  .wordmark { font-size: min(15vw, 30vh); }
  .home .door { align-self: flex-start; margin-top: 4vh; max-width: 380px; padding-bottom: 0; }
  .parade { right: auto; width: 44vw; }
  .parade .face { width: 84px; height: 84px; }
}

/* ---- setup, together, lobby: one column on the field, the match still playing behind ---- */
.panel { align-items: stretch; gap: 14px; max-width: 520px; margin: 0 auto; width: 100%; overflow-y: auto; pointer-events: auto !important; }
.panel h2 { font-size: 34px; text-shadow: 0 3px 0 var(--ink); margin-top: 6px; }
.back { align-self: flex-start; min-height: 44px; font-size: 16px; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; appearance: none; border: 0; min-height: 52px; border-radius: 14px; background: var(--deep); color: #fff; font: 400 20px "Lilita One", sans-serif; box-shadow: 0 5px 0 var(--ink); cursor: pointer; }
.seg button.on { background: #ffe14a; color: var(--ink); }
.seg.big button { min-height: 64px; font-size: 32px; }
.lineup { display: flex; gap: 8px; min-height: 56px; align-items: center; }
.lineup .face { width: 52px; height: 52px; animation: bob 1.1s ease-in-out infinite; }
.lineup .face:nth-child(2n) { animation-delay: -0.5s; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 16px; }
.field input { border: 0; border-radius: 14px; padding: 12px 14px; font: 400 26px "Lilita One", sans-serif; color: var(--ink); background: var(--paper); box-shadow: inset 0 4px 0 rgba(6,57,58,0.18); width: 100%; text-transform: none; }
#code { text-transform: uppercase; letter-spacing: 0.2em; }
.code { color: #ffe14a; letter-spacing: 0.12em; }
.seats { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.seats li { display: flex; align-items: center; gap: 10px; background: var(--deep); border-left: 10px solid var(--c); border-radius: 12px; padding: 8px 12px; font-size: 18px; }
.seats li span { margin-left: auto; font-size: 14px; opacity: 0.9; }
.panel .row { display: flex; gap: 8px; } .panel .row .btn { flex: 1; }

/* ---- sheets: result, rules, credits, menu. They wait for a button. ---- */
.veil { position: fixed; inset: 0; background: rgba(6,57,58,0.72); display: flex; align-items: center; justify-content: center; padding: calc(10px + var(--sat)) 10px calc(10px + var(--sab)); }
.sheet { background: var(--field); border: 5px solid var(--ink); border-radius: 22px; padding: 16px; width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 0 var(--ink); }
.sheet h2 { font-size: 40px; line-height: 1; text-shadow: 0 3px 0 var(--ink); }
.sheet h3 { font-size: 22px; }
.sheet .row { display: flex; gap: 8px; flex-wrap: wrap; } .sheet .row .btn { flex: 1 1 auto; }
.scores { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.scores li { display: grid; grid-template-columns: 32px 1fr auto auto auto; align-items: center; gap: 10px; background: var(--deep); border-left: 10px solid var(--c); border-radius: 12px; padding: 7px 10px; font-size: 15px; }
.scores li.won { background: var(--ink); outline: 3px solid #ffe14a; }
.scores li b { font: 400 20px "Lilita One", sans-serif; }
.rules article { display: flex; gap: 12px; align-items: center; background: var(--deep); border-radius: 14px; padding: 8px 12px 8px 8px; }
.rules article img { width: 132px; height: 110px; flex: none; }
.rules article p { font-size: 15px; }
.credits p { font-size: 15px; } .credits p b { color: #ffe14a; margin-right: 6px; } .credits h3 { margin-top: 6px; }
.menu.sheet { max-width: 420px; gap: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tray) + var(--sab) + 12px); transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 16px; font-size: 16px; max-width: calc(100vw - 24px); text-align: center; pointer-events: none !important; border: 3px solid #fff; z-index: 5; }
.toast.bad { border-color: #ff7b6e; }
body:not([data-screen=game]) .toast { bottom: 50%; }
.tweaks { position: fixed; right: 8px; top: calc(var(--top) + var(--sat) + 8px); background: var(--ink); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; z-index: 6; }
.tweaks label { display: flex; justify-content: space-between; gap: 10px; align-items: center; } .tweaks select { font-size: 13px; }

/* ---- phone-check fixes ---- */
.sheet h2, .panel h2 { line-height: 1.15; }
.wordmark { align-self: flex-start; line-height: 1.02; }
.wordmark span { display: block; }
.wordmark span + span { position: relative; top: -0.18em; }
@media (max-width: 559px) {
  .chips.n5 .chip, .chips.n6 .chip { grid-template: "f" auto "n" auto "b" 6px / 1fr; justify-items: center; row-gap: 1px; padding: 3px 2px 5px; }
  .chips.n5 .chip .face, .chips.n6 .chip .face { width: 20px; height: 20px; }
  .chips.n5 .chip .cnt, .chips.n6 .chip .cnt { font-size: 17px; }
  .chips.n5 .chip .bar, .chips.n6 .chip .bar { width: 100%; height: 6px; }
}
@media (max-width: 350px) {
  #tray .lab { width: 46px; font-size: 16px; }
  #tray .row { gap: 5px; }
  .sb { width: 40px; height: 44px; }
  .step b { min-width: 32px; font-size: 24px; }
  #tray .row .btn { font-size: 16px; padding: 0 6px; }
}
@media (min-width: 900px) { .parade { bottom: -40px; } .parade .face { width: 76px; height: 76px; } }
