:root {
  --ink: #2b2340;
  --paper: #fffdf5;
  --cream: #fff6df;
  --line: rgba(80, 140, 220, .18);
  --red: #e8322b;
  --red-d: #a81d18;
  --blue: #1f8fe0;
  --blue-d: #135f9c;
  --yellow: #ffcf1f;
  --yellow-d: #c99a00;
  --green: #3fb948;
  --green-d: #23802b;
  --pink: #ff6fae;
  --purple: #7b5cff;
  --display: "Luckiest Guy", "Arial Black", sans-serif;
  --body: "Baloo 2", system-ui, sans-serif;
  --hand: "Gochi Hand", "Comic Sans MS", cursive;
  /* slightly uneven corners so cards look cut out by hand */
  --wobble: 18px 24px 16px 26px / 24px 16px 26px 18px;
  --wobble-sm: 12px 15px 11px 16px / 15px 11px 16px 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #9bd8ff;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 600;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; }
kbd {
  font: 800 12px/1 var(--body); padding: 3px 6px 2px; border-radius: 6px;
  background: #fff; border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink);
}

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- shared bits ---------- */
.hand { font-family: var(--hand); font-weight: 400; font-size: 20px; color: #4a4062; }
.hand.small { font-size: 16px; }

.paper {
  position: relative;
  background:
    linear-gradient(90deg, transparent 38px, rgba(232, 80, 80, .28) 38px 40px, transparent 40px),
    repeating-linear-gradient(var(--paper) 0 27px, var(--line) 27px 29px);
  background-color: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--wobble);
  box-shadow: 5px 7px 0 var(--ink);
}
/* a strip of tape holding the card down */
.paper::before {
  content: ""; position: absolute; top: -13px; left: 50%; width: 92px; height: 24px;
  background: rgba(255, 228, 120, .75); border-left: 2px dashed rgba(0, 0, 0, .08); border-right: 2px dashed rgba(0, 0, 0, .08);
  transform: translateX(-50%) rotate(-3deg); pointer-events: none;
}
.card { padding: 26px 22px 20px; }
.tilt-l { transform: rotate(-.8deg); }
.tilt-r { transform: rotate(.7deg); }

.tag {
  display: inline-block; font: 22px/1 var(--display); letter-spacing: .5px; color: #fff;
  padding: 7px 14px 4px; border: 3px solid var(--ink); border-radius: var(--wobble-sm);
  transform: rotate(-2.5deg); text-shadow: 0 2px 0 var(--ink); box-shadow: 3px 4px 0 var(--ink);
}
.tag.red { background: var(--red); }
.tag.blue { background: var(--blue); }
.tag.yellow { background: var(--yellow); color: var(--ink); text-shadow: none; }
.card > .tag:first-child { position: absolute; top: -18px; left: 18px; }

.btn {
  display: block; width: 100%; cursor: pointer;
  font: 24px/1 var(--display); letter-spacing: .6px; color: #fff;
  padding: 13px 18px 9px; border: 3px solid var(--ink); border-radius: var(--wobble);
  text-shadow: 0 2px 0 var(--ink);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18), 0 5px 0 var(--ink);
  transition: transform .1s, filter .1s;
  background: var(--blue);
}
.btn:hover:not(:disabled) { transform: translateY(-2px) rotate(-.8deg); filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 2px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.big { font-size: 28px; padding: 16px 20px 11px; }
.btn.small { font-size: 17px; padding: 9px 12px 6px; width: auto; }
.btn.red { background: var(--red); }
.btn.blue { background: var(--blue); }
.btn.yellow { background: var(--yellow); color: var(--ink); text-shadow: 0 2px 0 rgba(255, 255, 255, .6); }
.btn.green { background: var(--green); }
.btn.ghost { background: var(--paper); color: var(--ink); text-shadow: none; }

input {
  width: 100%; background: #fff; color: var(--ink);
  border: 3px solid var(--ink); border-radius: var(--wobble-sm);
  padding: 9px 12px 6px; font: 800 18px var(--body); outline: none;
  user-select: text; -webkit-user-select: text;
}
input:focus { box-shadow: 0 0 0 4px var(--yellow); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--wobble-sm);
  box-shadow: 2px 3px 0 var(--ink); padding: 5px 11px 3px;
  font: 17px/1.1 var(--display); letter-spacing: .4px;
}
button.chip { cursor: pointer; }
button.chip:hover { transform: rotate(-2deg); }

.face {
  width: 34px; height: 34px; object-fit: cover; flex: none;
  border: 3px solid var(--ink); border-radius: 9px; background: var(--c, #ccc);
  box-shadow: 0 0 0 3px var(--c, #ccc) inset;
}

.game-badge {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; font-size: 26px; line-height: 1;
  background: var(--c); border: 3px solid var(--ink); border-radius: 50% 46% 52% 44%;
  box-shadow: 2px 3px 0 var(--ink); transform: rotate(-6deg);
}

/* ---------- start screen ---------- */
#menu { position: fixed; inset: 0; z-index: 2; overflow-y: auto; pointer-events: none; }
#menu > * { pointer-events: auto; }
.menu-head { position: absolute; top: 18px; left: 26px; }
.logo { margin: 0; display: flex; align-items: center; font: clamp(52px, 7.5vw, 108px)/1 var(--display); color: #fff; }
.logo span {
  display: inline-block; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--ink); animation: hop 2.6s ease-in-out infinite;
}
.logo .gap { width: .28em; }
.l1 { color: var(--red); rotate: -8deg; animation-delay: 0s !important; }
.l2 { color: var(--yellow); rotate: 5deg; animation-delay: .1s !important; }
.l3 { color: var(--blue); rotate: -4deg; animation-delay: .2s !important; }
.l4 { color: var(--green); rotate: 6deg; animation-delay: .35s !important; }
.l5 { color: var(--pink); rotate: -6deg; animation-delay: .45s !important; }
.l6 { color: var(--yellow); rotate: 4deg; animation-delay: .55s !important; }
.l7 { color: var(--red); rotate: -3deg; animation-delay: .65s !important; }
.l8 { color: var(--blue); rotate: 8deg; animation-delay: .75s !important; }
@keyframes hop { 0%, 70%, 100% { translate: 0 0; } 80% { translate: 0 -12px; } 90% { translate: 0 2px; } }
.for-gfl {
  margin: 6px 0 0 8px; font-size: 30px; color: #fff; transform: rotate(-3deg);
  text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
}
.for-gfl .heart { color: var(--red); display: inline-block; animation: beat 1.2s infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.3); } 30% { transform: scale(1); } }

.menu-side {
  position: absolute; top: 18px; right: 22px; bottom: 18px; width: min(430px, calc(100% - 32px));
  display: flex; flex-direction: column; gap: 22px; overflow-y: auto; padding: 18px 10px 14px 6px;
}
.menu-card { flex: none; }
.menu-play { display: flex; flex-direction: column; gap: 12px; }
.join-row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
#code-input { text-transform: uppercase; letter-spacing: 8px; text-align: center; font: 26px var(--display); padding-top: 11px; }
.status { margin: 0; min-height: 1.3em; font-weight: 800; text-shadow: 0 1px 0 #fff; }
.status.error { color: var(--red-d); }
.menu-small { display: flex; gap: 10px; justify-content: center; }

@media (max-width: 900px) {
  .menu-head { position: relative; top: 0; left: 0; padding: 14px 16px 0; }
  .menu-side { position: relative; top: auto; right: auto; bottom: auto; width: auto; margin: 32vh 16px 24px; overflow: visible; padding: 18px 0 0; }
}

.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(43, 35, 64, .45); }
.modal-card { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.games-list { list-style: none; margin: 8px 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.games-list li { display: flex; gap: 12px; align-items: center; }
.games-list b { display: block; font: 19px var(--display); letter-spacing: .4px; font-weight: 400; }
.games-list span { font-size: 15px; }

/* ---------- look editor ---------- */
.look-editor { display: flex; flex-direction: column; gap: 10px; }
.le-name { display: flex; align-items: center; gap: 10px; }
.le-name .hand { flex: none; }
.le-chars { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.le-char {
  position: relative; padding: 0; cursor: pointer; background: var(--c);
  border: 3px solid var(--ink); border-radius: var(--wobble-sm); box-shadow: 2px 3px 0 var(--ink);
  transition: transform .1s; overflow: visible;
}
.le-char img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.le-char span { display: none; }
.le-char:hover { transform: translateY(-3px) rotate(-3deg); }
.le-char.on { transform: translateY(-3px) scale(1.08); box-shadow: 2px 3px 0 var(--ink), 0 0 0 3px var(--yellow); z-index: 1; }
.le-char.on::after {
  content: "you"; position: absolute; top: -13px; right: -9px; font: 15px var(--hand); color: var(--ink);
  background: var(--yellow); border: 2px solid var(--ink); border-radius: 8px; padding: 0 4px; transform: rotate(12deg);
}
.le-row { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 6px; }
.le-chips, .le-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.le-chip {
  width: 38px; height: 38px; font-size: 20px; line-height: 1; cursor: pointer;
  background: #fff; border: 3px solid var(--ink); border-radius: 50% 44% 52% 46%; box-shadow: 1px 2px 0 var(--ink);
}
.le-chip.on { background: var(--yellow); transform: rotate(-8deg) scale(1.1); }
.le-color {
  width: 28px; height: 28px; cursor: pointer; background: var(--c);
  border: 3px solid var(--ink); border-radius: 46% 54% 48% 52%;
}
.le-color.on { transform: scale(1.25); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ink); }

/* ---------- party chrome ---------- */
#party { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
#party > * { pointer-events: auto; }
#topbar {
  position: absolute; top: 10px; left: 12px; right: 12px; z-index: 10;
  display: flex; align-items: center; gap: 10px; pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.tb-logo { font: 24px var(--display); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.tb-logo b { color: var(--yellow); font-weight: 400; }
.tb-right { margin-left: auto; display: flex; gap: 8px; }
.chip.code b { letter-spacing: 3px; font-weight: 400; color: var(--blue); }
.chip.icon { padding: 3px 8px 2px; font-size: 18px; }
body[data-phase="play"] .tb-logo, body[data-phase="play"] #tb-round { display: none; }

#screen { position: absolute; inset: 0; pointer-events: none; }
#screen > * { pointer-events: none; }
#screen .card, #screen .panel, #screen button, #screen input, #screen .play-layer, #screen .pantry, #screen .compose { pointer-events: auto; }

#emotes {
  position: absolute; left: 12px; bottom: 12px; z-index: 9; display: flex; flex-wrap: wrap; gap: 6px; max-width: min(560px, calc(100% - 24px));
}
body[data-phase="play"] #emotes { display: none; }
.emote {
  cursor: pointer; font: 700 14px/1 var(--body); padding: 6px 9px 5px; background: var(--paper);
  border: 2px solid var(--ink); border-radius: 12px 14px 12px 4px; box-shadow: 1px 2px 0 var(--ink);
}
.emote kbd { font-size: 10px; margin-right: 5px; padding: 1px 4px; box-shadow: none; }
.emote:hover { background: var(--yellow); transform: rotate(-2deg); }
@media (max-width: 700px) { .emote kbd { display: none; } .emote { font-size: 12px; } }

#toasts { position: absolute; top: 62px; right: 12px; z-index: 11; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.toast {
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--wobble-sm); box-shadow: 2px 3px 0 var(--ink);
  padding: 5px 12px 3px; font: 700 15px var(--body); animation: toast 3.6s forwards;
}
.toast.emote { background: #fff; font-family: var(--hand); font-size: 19px; font-weight: 400; }
@keyframes toast { 0% { opacity: 0; transform: translateX(20px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- lobby ---------- */
.lobby {
  position: absolute; top: 62px; right: 14px; bottom: 14px; width: min(440px, calc(100% - 28px));
  display: flex; flex-direction: column; gap: 26px; overflow-y: auto; padding: 14px 8px 10px 4px; pointer-events: auto !important;
}
.panel { background: var(--paper); border: 3px solid var(--ink); border-radius: var(--wobble); box-shadow: 5px 7px 0 var(--ink); padding: 18px; position: relative; }
.lobby-panel { display: flex; flex-direction: column; gap: 12px; }
.locker { padding-top: 26px; }
.locker > .tag { position: absolute; top: -16px; left: 16px; }
.code-note { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.big-code {
  font: 54px/1 var(--display); letter-spacing: 10px; padding: 10px 16px 4px 26px; cursor: pointer;
  background: var(--yellow); border: 3px solid var(--ink); border-radius: var(--wobble); box-shadow: inset 0 -5px 0 var(--yellow-d), 3px 4px 0 var(--ink);
  transform: rotate(-1.5deg);
}
.big-code.solo { font-size: 32px; letter-spacing: 2px; padding: 12px 18px 6px; cursor: default; }
.lobby-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lobby-list li { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 10px; min-height: 44px; font-weight: 800; }
.lobby-list li.me { background: rgba(255, 207, 31, .35); }
.lobby-list li.empty { border: 2px dashed rgba(43, 35, 64, .25); justify-content: center; }
.lobby-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.pill { font: 12px/1 var(--display); letter-spacing: .3px; padding: 4px 6px 2px; border-radius: 8px; background: var(--red); color: #fff; }
.pill.cpu { background: var(--purple); }
.host-ctrls { display: flex; flex-direction: column; gap: 10px; }
.host-ctrls .row { display: flex; gap: 8px; }
.host-ctrls .row .btn { flex: 1; }
.rounds { display: flex; align-items: center; gap: 10px; }
.seg { display: flex; gap: 6px; }
.seg button {
  cursor: pointer; width: 44px; height: 38px; font: 20px var(--display); padding-top: 4px;
  background: #fff; border: 3px solid var(--ink); border-radius: var(--wobble-sm);
}
.seg button.on { background: var(--blue); color: #fff; transform: rotate(-4deg); }
.waiting { text-align: center; margin: 4px 0 0; }

@media (max-width: 900px) {
  .lobby { top: 44vh; bottom: 0; right: 0; width: 100%; padding: 18px 16px 70px; }
}

/* ---------- pick ---------- */
.pick { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.round-tag { font-size: 30px; position: static !important; }
.slot {
  position: relative; width: min(420px, calc(100% - 32px)); height: 92px; overflow: hidden;
  background: var(--paper); border: 4px solid var(--ink); border-radius: var(--wobble); box-shadow: 6px 8px 0 var(--ink);
}
.slot.landed { animation: land .5s cubic-bezier(.3, 1.8, .5, 1); background: #fff7cf; }
@keyframes land { from { transform: scale(1.15) rotate(-2deg); } }
.reel { display: flex; flex-direction: column; }
.reel-card { flex: none; height: 92px; display: flex; align-items: center; gap: 14px; padding: 0 22px; font: 30px var(--display); letter-spacing: .5px; }
.slot-glass { position: absolute; inset: 0; background: linear-gradient(rgba(255, 255, 255, .6), transparent 30%, transparent 70%, rgba(255, 255, 255, .6)); pointer-events: none; }
.pick-sub { font-size: 30px; color: #fff; text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink); margin: 0; }

/* ---------- intro ---------- */
.intro { position: absolute; inset: 0; display: grid; place-items: center; padding: 70px 16px 70px; overflow-y: auto; pointer-events: auto !important; }
.intro-card { width: min(580px, 100%); }
.intro-head { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.intro-head .game-badge { width: 64px; height: 64px; font-size: 36px; }
.intro-head h2 { margin: 0; font: clamp(30px, 5vw, 42px)/1 var(--display); letter-spacing: .6px; font-weight: 400; color: var(--c); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.intro-head p { margin: 2px 0 0; font-size: 22px; }
.how { margin: 10px 0 8px; padding-left: 26px; font-size: 18px; line-height: 1.35; }
.how li { margin: 4px 0; }
.how li::marker { font-family: var(--display); color: var(--red); }
.controls-line { font-size: 16px; padding: 8px 12px; background: rgba(31, 143, 224, .1); border-radius: 12px; }
.controls-line .hand { margin-right: 6px; }
.ready-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.rd { position: relative; opacity: .45; transition: opacity .2s; }
.rd .face { width: 40px; height: 40px; }
.rd.ok { opacity: 1; }
.rd.ok::after { content: "✓"; position: absolute; right: -6px; bottom: -6px; width: 20px; height: 20px; display: grid; place-items: center; font: 900 14px var(--body); color: #fff; background: var(--green); border: 2px solid var(--ink); border-radius: 50%; }
.intro-foot { display: flex; gap: 14px; align-items: center; }
.intro-foot .btn { flex: 1; }

/* ---------- play ---------- */
.play { position: absolute; inset: 0; }
.play-layer { position: absolute; inset: 0; touch-action: none; }
.play-hud { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; z-index: 5; pointer-events: none; }
.ph-title { display: flex; align-items: center; gap: 8px; font: 22px var(--display); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.ph-title .game-badge { width: 36px; height: 36px; font-size: 20px; -webkit-text-stroke: 0; }
.ph-timer { font-size: 22px; min-width: 76px; justify-content: center; }
.ph-timer.low { background: var(--red); color: #fff; animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.1) rotate(-3deg); } }
.play-standings { position: absolute; left: 10px; top: 64px; display: flex; flex-direction: column; gap: 5px; z-index: 5; pointer-events: none; }
.st {
  display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; background: rgba(255, 253, 245, .92);
  border: 2px solid var(--ink); border-radius: 10px 12px 12px 8px; font: 700 14px var(--body);
}
.st .face { width: 28px; height: 28px; border-width: 2px; border-radius: 7px; }
.st.me { background: #fff1a8; }
.st.out { opacity: .45; text-decoration: line-through; }
.banner {
  position: absolute; left: 50%; top: 22%; z-index: 6; pointer-events: none; white-space: nowrap;
  font: clamp(34px, 7vw, 76px)/1 var(--display); color: var(--yellow); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink); opacity: 0; transform: translate(-50%, 0) scale(.6) rotate(-4deg); transition: opacity .25s, transform .25s;
}
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(-4deg); transition: transform .18s cubic-bezier(.3, 1.8, .5, 1); }
.banner.bad { color: #ff6b6b; }
.banner.red { color: var(--red); } .banner.blue { color: #3fa7ff; } .banner.green { color: #57d65f; } .banner.yellow { color: var(--yellow); }
.countdown {
  position: absolute; left: 50%; top: 42%; z-index: 7; pointer-events: none; opacity: 0;
  font: clamp(90px, 18vw, 190px)/1 var(--display); color: #fff; -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; text-shadow: 0 9px 0 var(--ink);
  transform: translate(-50%, -50%);
}
.countdown.pop { animation: cd .9s forwards; }
.countdown.go { color: var(--yellow); }
@keyframes cd { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2) rotate(-8deg); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.9); } }
.spectate { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); font-size: 24px; color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.stick { position: absolute; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; background: rgba(255, 255, 255, .3); border: 3px solid rgba(43, 35, 64, .5); pointer-events: none; z-index: 4; }
.stick .knob { position: absolute; left: 26px; top: 26px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .85); border: 3px solid var(--ink); }

/* ---------- results / board / podium ---------- */
.results, .board, .podium { position: absolute; top: 62px; right: 14px; bottom: 14px; width: min(440px, calc(100% - 28px)); display: flex; flex-direction: column; justify-content: center; }
.results-card, .standings, .final-card { max-height: 100%; overflow-y: auto; }
.res-list, .st-list { list-style: none; margin: 8px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.res-list li, .st-list li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 12px; font-weight: 800; animation: slidein .4s backwards; animation-delay: var(--d, 0s); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px) rotate(3deg); } }
.res-list li.me, .st-list li.me { background: rgba(255, 207, 31, .35); }
.res-list .place, .st-list .rank { font: 20px var(--display); width: 44px; flex: none; }
.res-list .p1 .place { color: #d4a000; }
.res-list .nm, .st-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-list .stat { font-size: 13px; color: #6a6080; white-space: nowrap; }
.res-list .gain, .st-list .sp {
  flex: none; min-width: 42px; text-align: center; font: 20px var(--display); padding: 4px 6px 1px; color: #fff;
  background: var(--blue); border: 2px solid var(--ink); border-radius: 50% 44% 52% 46%;
}
.res-list .p1 .gain { background: var(--yellow); color: var(--ink); }
.st-list .wins { font-size: 14px; }
.champ { margin: 4px 0 2px; font: clamp(30px, 5vw, 44px)/1.05 var(--display); font-weight: 400; color: var(--yellow); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.final-card .btn { margin-top: 10px; }
@media (max-width: 900px) {
  .results, .board, .podium { top: auto; bottom: 0; right: 0; width: 100%; max-height: 55vh; padding: 0 12px 64px; }
}

/* ---------- minigame overlays (typing, cooking, fps) ---------- */
.compose {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(860px, calc(100% - 24px)); z-index: 6;
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 5px 7px 0 var(--ink); overflow: hidden;
  font-family: Arial, Helvetica, sans-serif; font-weight: 400; color: #202124;
}
.compose-head { display: flex; justify-content: space-between; background: #f2f6fc; padding: 8px 14px; font-size: 14px; font-weight: 700; }
.compose-head .logo-mail { font-family: var(--display); font-weight: 400; color: var(--red); letter-spacing: .5px; }
.compose-field { padding: 6px 14px; border-bottom: 1px solid #e3e3e3; font-size: 14px; }
.compose-field span { color: #5f6368; margin-right: 8px; }
.compose-text { padding: 12px 14px; font: 21px/1.55 ui-monospace, Menlo, Consolas, monospace; color: #b3b7bd; white-space: pre-wrap; cursor: text; min-height: 110px; max-height: 32vh; overflow-y: auto; }
.compose-text .ok { color: #202124; }
.compose-text .bad { color: #fff; background: var(--red); border-radius: 3px; }
.compose-text .cur { box-shadow: inset 2px 0 0 #1a73e8; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { box-shadow: none; } }
.compose.blurred .compose-text { filter: blur(3px); }
.compose.blurred::after { content: "click here to keep typing"; position: absolute; inset: 0; display: grid; place-items: center; font: 26px var(--hand); color: var(--ink); pointer-events: none; }
.compose-foot { display: flex; align-items: center; gap: 12px; padding: 8px 14px 10px; }
.compose-send { background: #0b57d0; color: #fff; border: 0; border-radius: 18px; padding: 8px 20px; font: 700 14px Arial, sans-serif; opacity: .5; }
.compose.sent .compose-send { opacity: 1; }
.compose-hint { font-size: 14px; color: #5f6368; }
.compose-hint.bad { color: var(--red); font-weight: 700; }
.compose-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; font-size: 16px; pointer-events: none; }

.pantry {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(900px, calc(100% - 20px)); z-index: 6;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px;
}
.order-card { padding: 20px 16px 12px; }
.order-card .dish { font: 26px/1 var(--display); letter-spacing: .4px; margin: 2px 0 6px; }
.order-card ul { list-style: none; margin: 0; padding: 0; font-size: 17px; }
.order-card li { display: flex; justify-content: space-between; border-top: 2px dashed rgba(43, 35, 64, .18); padding: 2px 0; }
.order-card li:first-child { border-top: 0; }
.order-card li.done { color: var(--green-d); text-decoration: line-through; }
.order-card .pot { margin-top: 6px; font-size: 22px; min-height: 30px; }
.order-card .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.ingredients { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-content: end; }
.ing {
  display: flex; flex-direction: column; align-items: center; padding: 4px 2px 3px; cursor: pointer;
  background: #fff; border: 3px solid var(--ink); border-radius: var(--wobble-sm); box-shadow: 2px 3px 0 var(--ink);
  font: 700 13px/1.1 var(--body);
}
.ing i { font-style: normal; font-size: 28px; line-height: 1.15; }
.ing:active { transform: translateY(2px); box-shadow: 1px 1px 0 var(--ink); }
.ing:disabled { opacity: .5; }
@media (max-width: 700px) {
  .pantry { grid-template-columns: 1fr; }
  .ingredients { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
  .ing i { font-size: 22px; }
  .ing span { font-size: 10px; }
  .order-card { padding: 16px 12px 8px; }
}

.fps-hud { position: absolute; inset: 0; pointer-events: none; }
.crosshair {
  position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 1.5px var(--ink)) drop-shadow(0 0 1px var(--ink));
  background:
    radial-gradient(circle, #fff 0 2px, transparent 2.5px) center / 24px 24px no-repeat,
    linear-gradient(#fff, #fff) center top / 3px 7px no-repeat,
    linear-gradient(#fff, #fff) center bottom / 3px 7px no-repeat,
    linear-gradient(#fff, #fff) left center / 7px 3px no-repeat,
    linear-gradient(#fff, #fff) right center / 7px 3px no-repeat;
}
.hitmarker { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%) rotate(45deg); opacity: 0; --hm: #fff;
  background:
    linear-gradient(var(--hm), var(--hm)) center top / 3px 10px no-repeat,
    linear-gradient(var(--hm), var(--hm)) center bottom / 3px 10px no-repeat,
    linear-gradient(var(--hm), var(--hm)) left center / 10px 3px no-repeat,
    linear-gradient(var(--hm), var(--hm)) right center / 10px 3px no-repeat;
  filter: drop-shadow(0 0 1.5px var(--ink)); }
.hitmarker.head { --hm: var(--red); }
.hitmarker.show { opacity: 1; }
.vignette { position: absolute; inset: 0; opacity: 0; transition: opacity .4s; box-shadow: inset 0 0 120px 30px rgba(232, 50, 43, .75); }
.vignette.show { opacity: 1; transition: none; }
.vitals { position: absolute; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 10px; padding: 8px 14px; }
.hp-bar { width: 160px; height: 18px; background: #d9cfb6; border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; }
.hp-fill { height: 100%; width: 100%; background: var(--green); transition: width .15s; }
.hp-fill.low { background: var(--red); }
.hp-text { font: 30px var(--display); min-width: 54px; text-align: right; }
.ammo { position: absolute; right: 16px; bottom: 16px; padding: 4px 16px 6px; text-align: right; }
.ammo b { font: 40px var(--display); font-weight: 400; }
.ammo span { font: 20px var(--display); opacity: .55; }
.ammo b.empty { color: var(--red); }
.reload { font: 15px var(--display); color: var(--red); visibility: hidden; }
.reload.on { visibility: visible; }
.killfeed { position: absolute; top: 64px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.killfeed div { background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 3px 10px 1px; font: 16px var(--display); animation: toast 4s forwards; }
.killfeed .k { color: var(--blue); } .killfeed .v { color: var(--red); }
.death { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(43, 35, 64, .35); }
.death h2 { margin: 0; font: clamp(60px, 12vw, 120px) var(--display); font-weight: 400; color: var(--red); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink); transform: rotate(-5deg); }
.death p { margin: 6px 0 0; font: 24px var(--display); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.lock-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(43, 35, 64, .4); pointer-events: auto; }
.lock-overlay .card { width: min(360px, calc(100% - 32px)); text-align: center; }

.hit-pad { position: absolute; z-index: 5; bottom: 18px; width: 46%; height: 34%; pointer-events: auto; display: grid; place-items: center; font: 40px var(--display); color: rgba(255, 255, 255, .9); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; border: 4px dashed rgba(255, 255, 255, .5); border-radius: 28px; }
.hit-pad.left { left: 2%; } .hit-pad.right { right: 2%; }
.jump-pad { position: absolute; z-index: 5; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(320px, 70%); padding: 18px; pointer-events: auto; }
@media (hover: hover) and (pointer: fine) { .hit-pad, .jump-pad.touch-only { display: none; } }
