/* Fonts served with the game (SIL Open Font License, see vendor/*-OFL.txt):
   Nunito for the interface (variable 400-800), Fredoka for the "bears" title */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(vendor/Nunito-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(vendor/Fredoka-latin.woff2) format('woff2');
}

:root {
  --ink: #2d2534;
  --ink-2: #6e6577;
  --paper: #fffdfa;
  --line: rgba(45, 37, 52, 0.12);
  --accent: #e0548c;
  --accent-soft: #ffe1ec;
  --mint: #d9f3e1;
  --mint-ink: #22804a;
  --sun: #fff3c4;
  --sky: #a8d8ff;
  --bar: rgba(30, 24, 38, 0.8);
  --shadow: 0 10px 28px -12px rgba(30, 20, 40, 0.45), 0 2px 6px rgba(30, 20, 40, 0.08);
  --shadow-sm: 0 4px 12px -6px rgba(30, 20, 40, 0.4), 0 1px 2px rgba(30, 20, 40, 0.06);
  --r: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sky);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 600;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: grab;
  touch-action: none;
}
#game:active { cursor: grabbing; }

/* key caps: "F", "Space"… in prompts, the controls bar and the emote wheel */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  font: 800 12px/1 'Nunito', system-ui, sans-serif;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35);
  vertical-align: middle;
}

/* the loading screen (stylised's first load, and a reload back into the island): fades in before a reload,
   out once the game is drawing. A sky over a meadow, soft clouds drifting, the title and a progress bar. */
.pattern { /* the loading screens (the backdrop and the veil): soft stripes with little panda and bear faces, drifting */
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #ffe9ee;
}
.pattern::before {
  content: '';
  position: absolute;
  inset: -160px 0 0 -160px; /* (one tile bigger, so it can slide a whole tile and start over without a seam) */
  background: url(assets/pattern.svg) 0 0 / 160px 160px repeat;
  animation: patternSlide 9s linear infinite;
  will-change: transform; /* (slid by the graphics chip: smooth even while the game sets itself up) */
}
.pattern::after { /* a soft glow in the middle, so the menu and the logo stand out */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(255, 250, 246, 0.72), rgba(255, 250, 246, 0) 62%);
}
@keyframes patternSlide { to { transform: translate(160px, 160px); } }
#backdrop { transition: opacity 0.9s ease; }
html.island #backdrop { opacity: 0; pointer-events: none; }
#veil {
  z-index: 20;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
#veil .loader { position: relative; z-index: 1; text-align: center; transform: translateY(-6vh); }
#veil .logo {
  font: 700 clamp(72px, 14vw, 120px)/0.95 'Fredoka', 'Nunito', sans-serif;
  letter-spacing: -2px;
  color: #fff;
  -webkit-text-stroke: 2px rgba(224, 84, 140, 0.9);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(160, 50, 95, 0.55), 0 12px 34px rgba(30, 15, 40, 0.35);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: translateY(-5px) scale(1.02); } }
#veil p { margin: 10px 0 18px; font-size: 17px; font-weight: 800; color: #fff; text-shadow: 0 2px 8px rgba(30, 15, 40, 0.35); }
#veil .bar { width: min(300px, 70vw); height: 12px; margin: 0 auto; padding: 2px; border-radius: 8px; background: rgba(255, 255, 255, 0.55); box-shadow: var(--shadow-sm); }
#veil .bar { overflow: hidden; }
#veil .bar i { display: block; width: 35%; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ff8fbd, var(--accent)); animation: slide 1.1s ease-in-out infinite alternate; }
@keyframes slide { from { transform: translateX(-10%); } to { transform: translateX(200%); } }
html.resuming #veil, html.leaving #veil { opacity: 1; pointer-events: auto; }
html.resuming #veil { transition: opacity 0.45s ease; }
html.resuming #lobby { display: none; }

/* ---------- lobby: the island turning behind a title, two character cards, and a join row ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(ellipse at 50% 45%, rgba(20, 12, 30, 0) 30%, rgba(20, 12, 30, 0.35) 100%);
}
/* the menu arrives: the title drops in, the panel rises, the cards pop in one after another */
.title { animation: dropIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.panel { animation: riseIn 0.55s 0.12s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.pick { animation: popIn 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.pick.panda { animation-delay: 0.3s; }
.pick.bear { animation-delay: 0.4s; }
.join { animation: riseIn 0.45s 0.5s ease both; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-30px) scale(0.92); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(26px); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } }
.pick .portrait:not([src]) { opacity: 0; }
.pick .portrait { transition: opacity 0.4s ease; }
.waiting { animation: wait 0.8s ease-in-out infinite alternate !important; }
@keyframes wait { to { filter: brightness(1.12); transform: scale(0.97); } }
.title { text-align: center; color: #fff; text-shadow: 0 3px 0 rgba(160, 50, 95, 0.55), 0 10px 30px rgba(30, 15, 40, 0.45); }
h1 {
  margin: 0;
  font: 700 clamp(64px, 12vw, 104px)/0.95 'Fredoka', 'Nunito', sans-serif;
  letter-spacing: -2px;
  color: #fff;
  -webkit-text-stroke: 2px rgba(224, 84, 140, 0.9);
  paint-order: stroke fill;
}
.sub { margin: 6px 0 0; font-size: 18px; font-weight: 800; letter-spacing: 0.02em; }
/* over the light pattern (before the island shows): deep pink words, and no dark edges on the menu */
html:not(.island) .sub, #veil p { color: #b23a72; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 12px rgba(255, 255, 255, 0.9); }
html:not(.island) #lobby { background: none; }

.panel {
  width: min(460px, 92vw);
  padding: 20px 20px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
  box-shadow: var(--shadow), 0 30px 60px -30px rgba(30, 15, 40, 0.6);
}
.label { margin: 0 0 12px; font-size: 12px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2); }
.hint { margin: 10px 0 14px; font-size: 13px; color: var(--ink-2); }

.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 10px 14px;
  border-radius: 12px;
  border: 2px solid transparent;
  color: var(--ink);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08), var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.pick:hover { transform: translateY(-3px); border-color: var(--accent); filter: none; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08), var(--shadow); }
.pick.panda { background: linear-gradient(#f1fbf3, #d6f0dd); }
.pick.bear { background: linear-gradient(#fff3df, #f6d9b2); }
.pick .portrait { width: 132px; height: 132px; margin: -4px 0 2px; object-fit: contain; }
.pick:hover .portrait { animation: bob 1.4s ease-in-out infinite; } /* (only while hovered: always starts upright) */
@keyframes bob { 50% { transform: translateY(-5px); } }
.pick b { font-size: 21px; font-weight: 800; }
.pick small { font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 1.3; }

.join {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  background: #f6f1ec;
}
.join span { flex: 1; text-align: left; padding-left: 4px; font-size: 14px; font-weight: 800; color: var(--ink-2); }
.join input { width: 118px; }
.msg { min-height: 1.4em; margin: 14px 0 0; font-size: 14px; line-height: 1.4; color: var(--accent); }
.msg:empty { min-height: 0; margin: 0; }


button, input {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  border: 0;
  border-radius: 6px;
}

button {
  padding: 10px 16px;
  font-weight: 800;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: filter 0.12s ease, transform 0.12s ease;
}
button:hover { filter: brightness(1.06); }
button:active { transform: translateY(1px); box-shadow: none; }
button:disabled { opacity: 0.5; cursor: wait; transform: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


input {
  width: 140px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid rgba(45, 37, 52, 0.2);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 800;
  outline: none;
}
input:focus { border-color: var(--accent); }
input::placeholder { color: rgba(45, 37, 52, 0.3); }


/* ---------- hud ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.chip {
  position: absolute;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 14px;
  line-height: 1.35;
  box-shadow: var(--shadow-sm);
}

#topLeft {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: calc(100vw - 28px);
}
#topLeft .chip { position: relative; }
#status:empty { display: none; }

#invite {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  color: var(--ink-2);
}
#invite b { font-size: 17px; font-weight: 800; color: var(--accent); letter-spacing: 2px; }
#invite { flex-wrap: wrap; max-width: min(460px, calc(100vw - 28px)); }
#invite button { font-size: 13px; padding: 6px 10px; }
#linkBox { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; }
#linkText {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
}
#linkNote { font-size: 12px; line-height: 1.4; color: var(--accent); }
#linkNote:empty { display: none; }

/* the corner toolbar: one bar of buttons with icons */
#corner {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  padding: 3px;
  gap: 2px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
#corner .chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
#corner .chip:hover { background: rgba(45, 37, 52, 0.06); filter: none; }
#corner .chip + .chip::before { /* thin dividers between buttons */
  content: ''; position: absolute; left: -2px; top: 7px; bottom: 7px; width: 1px; background: var(--line);
}
#corner svg { width: 17px; height: 17px; flex: none; }
#corner #leaveBtn { color: var(--accent); }
#fishBtn.new::after { /* a new kind caught since you last looked */
  content: ''; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper);
}

/* short messages over the island ("photo saved", "a shooting star!") */
#toast {
  position: fixed;
  top: 20vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  background: var(--paper);
  pointer-events: none;
  animation: pop 0.22s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(6px); } }
/* the camera flash */
#flash { position: fixed; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
#flash.go { animation: flash 0.4s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

/* panels that open from the toolbar */
#stylePanel, #fishPanel {
  position: fixed;
  top: 62px;
  right: 14px;
  z-index: 2;
  padding: 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: drop 0.16s ease-out;
}
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
#stylePanel { width: 290px; font-size: 14px; }
#stylePanel .ttitle { margin: 2px 0 8px; }

/* the fish book: a card per catch, greyed out with a hint until you've caught one */
#fishPanel {
  width: 350px;
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  font-size: 13px;
}
#fishPanel .ttitle { margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; }
#fishPanel .ttitle b { color: var(--accent); font-size: 15px; }
.dex { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dex div { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 4px 7px; text-align: center; line-height: 1.25; font-weight: 800; }
.dex svg { display: block; width: 48px; height: 28px; margin: 0 auto 5px; shape-rendering: crispEdges; }
.dex .no { background: #f4f0ec; color: #a79eab; border-style: dashed; }
.dex .rare { background: #fff6d2; border-color: #f0d77a; }
.dex small { display: block; font-size: 11px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.dex .no small { color: #b3abb7; }
#fishPanel .foot { margin-top: 12px; font-size: 12px; color: var(--ink-2); text-align: center; }
.srow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.srow button { padding: 6px 11px; font-size: 14px; font-weight: 700; background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.srow button.on { background: var(--mint); border-color: #9fd9b1; color: var(--mint-ink); }
.srow .swatch { width: 28px; height: 28px; padding: 0; border-radius: 6px; }
.srow .swatch.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
#nameInput {
  width: 100%;
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
}

/* emote wheel */
#wheel { position: fixed; inset: 0; pointer-events: none; }
#wheel .emo {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  width: 78px;
  padding: 10px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
#wheel .emo:hover { border-color: var(--accent); filter: none; }
#wheel .emo img { width: 28px; height: 28px; image-rendering: pixelated; }
#wheel kbd { position: absolute; top: 4px; left: 4px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; border-radius: 4px; }
.wheel-mid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 13px; font-weight: 800; padding: 5px 10px; border-radius: 6px; color: #fff; background: var(--bar); }

.return { width: 100%; margin: 0 0 16px; padding: 12px; background: var(--mint-ink); color: #fff; font-size: 15px; line-height: 1.35; }

#tally { top: 62px; right: 14px; min-width: 200px; font-size: 14px; }
.ttitle { margin-bottom: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); }
.trow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 3px 0; font-weight: 700; }
.trow b { margin-left: auto; font-size: 17px; font-weight: 800; color: var(--accent); }
.trow.mine .tname { color: var(--mint-ink); }
.titems { flex-basis: 100%; display: flex; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.titems:empty { display: none; }
.ti { display: inline-flex; align-items: center; gap: 4px; }
.ti i { width: 9px; height: 9px; display: inline-block; border-radius: 2px; }

/* what you can do right now: "[F] pick a flower · [H] hug Bear" */
#prompt {
  bottom: 86px; /* above the controls bar, even when it wraps onto two lines */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}
#prompt .sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
#prompt kbd { margin-right: 2px; }
#prompt.urgent { background: var(--sun); border-color: #f0d77a; animation: nudge 0.5s ease-in-out infinite alternate; }
@keyframes nudge { to { transform: translateX(-50%) scale(1.05); } }

/* the controls bar: dark, with key caps, set apart from the island */
.help {
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 11px;
  max-width: calc(100vw - 28px);
  padding: 6px 12px;
  background: var(--bar);
  border: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
  font-weight: 700;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.help span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.help kbd { background: #fff; color: var(--ink); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2); min-width: 20px; height: 20px; font-size: 11px; }
.help kbd + kbd { margin-left: -3px; }
.help kbd.m { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55); }

/* ---------- name tags ---------- */
#tags { position: fixed; inset: 0; pointer-events: none; }
.tag {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  padding: 2px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.tag.mine { background: var(--mint); color: var(--mint-ink); border-color: #9fd9b1; }

/* ---------- phones and tablets ---------- */
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input { -webkit-user-select: text; user-select: text; }
.narrow { display: none; }
button { touch-action: manipulation; }
#game { height: 100dvh; }
.overlay { overflow-y: auto; padding: 16px 0; }

#touch { position: fixed; inset: 0; pointer-events: none; }
#stickZone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50vw;
  height: 62vh;
  pointer-events: auto;
  touch-action: none;
}
#stickBase {
  position: absolute;
  left: -50px;
  top: -50px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 253, 250, 0.28);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75), 0 4px 14px rgba(30, 20, 40, 0.2);
}
#stickKnob {
  position: absolute;
  left: 28px;
  top: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
#pad {
  position: absolute;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 66px 66px;
  gap: 8px;
  pointer-events: none; /* the gaps between buttons belong to the game view (look, pinch) */
  touch-action: none;
}
#pad button {
  pointer-events: auto;
  height: 54px;
  padding: 0;
  font-size: 14px;
  font-weight: 800;
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 253, 250, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm), inset 0 -2px 0 rgba(0, 0, 0, 0.06);
}
#pad button.big { grid-column: span 2; height: 56px; background: var(--accent); color: #fff; font-size: 17px; border: 0; }
#pad button.ready { background: var(--sun); border-color: #f0d77a; }
#pad button.pressed { transform: translateY(2px); filter: brightness(0.94); }

body.touch .help { display: none; }
body.touch #prompt {
  bottom: auto;
  top: calc(64px + env(safe-area-inset-top));
  max-width: calc(100vw - 32px);
  white-space: normal;
  text-align: center;
}
body.touch #hud #topLeft { top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); }
body.touch #corner { top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); }

/* small screens: icon-only toolbar, smaller cards, tally only shows totals */
@media (max-width: 700px), (max-height: 500px) {
  .chip { font-size: 13px; padding: 6px 10px; }
  #corner { top: 10px; right: 10px; padding: 2px; }
  #corner .chip { padding: 7px 9px; }
  #corner svg { width: 19px; height: 19px; }
  .wide { display: none; }
  .narrow { display: inline; }
  #topLeft { top: 58px; left: 10px; gap: 6px; max-width: calc(100vw - 20px); }
  body.touch #hud #topLeft { top: calc(58px + env(safe-area-inset-top)); left: 10px; }
  #tally { top: 58px; right: 10px; min-width: 0; }
  body.touch #tally { top: calc(58px + env(safe-area-inset-top)); }
  .titems { display: none; }
  .trow b { margin-left: 10px; }
  #invite b { font-size: 15px; }
  #stylePanel { top: 54px; right: 10px; width: min(290px, calc(100vw - 20px)); }
  #fishPanel { top: 54px; right: 10px; width: min(350px, calc(100vw - 20px)); max-height: calc(100dvh - 64px); }
  body.touch #fishPanel { top: calc(54px + env(safe-area-inset-top)); max-height: calc(100dvh - 64px - env(safe-area-inset-top)); }
  body.touch #prompt { top: auto; bottom: calc(220px + env(safe-area-inset-bottom)); } /* above the buttons */
  #wheel .emo { width: 68px; font-size: 12px; }
  .panel { padding: 16px 14px 14px; }
  .pick .portrait { width: 104px; height: 104px; }
  #toast { font-size: 15px; }
}
@media (max-height: 500px) {
  .overlay { flex-direction: row; gap: 24px; }
  h1 { font-size: 64px; }
  .pick .portrait { width: 84px; height: 84px; }
  .pick small { display: none; }
  body.touch #prompt { bottom: calc(18px + env(safe-area-inset-bottom)); }
}

/* narrow phones: the status and invite share the top with the snack counter, so the counter gets compact ("you 3 / Bear 2") so the invite box fits beside it */
@media (max-width: 520px) {
  #tally .ttitle { display: none; }
  #tally { padding: 6px 10px; }
  #topLeft { max-width: calc(100vw - 112px); }
  #invite { max-width: 100%; }
  #invite button { white-space: normal; }
}
