/* 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 menu backdrop and loading screen share the same animated pattern. */
.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, visibility 0s linear 0.9s; }
html.world #backdrop { opacity: 0; visibility: hidden; pointer-events: none; }
#veil {
  z-index: 20;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
#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.leaving #veil { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
html.resuming #veil, html.portraits-ready.loading #veil { opacity: 1; visibility: visible; pointer-events: auto; transition: none; }
/* With the full loading screen up, uncover the canvas behind it so only one layer fades on entry. */
html.resuming #backdrop, html.portraits-ready.loading #backdrop { opacity: 0; visibility: hidden; pointer-events: none; transition: none; }
html.resuming #lobby { display: none; }
html.portraits-ready.loading #lobby { visibility: hidden; }

/* ---------- lobby: the world 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; }
html.checking .panel { animation-play-state: paused; } /* (index.html: until the relay says whether your world is still there) */
.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; }
/* (the code row and the friends part come with the panel: no part of the menu arrives late) */
@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); } }
.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 world shows): deep pink words, and no dark edges on the menu */
html:not(.world) .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(.world) #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, #friendsBtn.new::after { /* a new kind caught since you last looked; a friend request */
  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 world ("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, #friendsPanel, #mapPanel, #bagPanel, #buildPanel, #photoPanel {
  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; max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain; 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; }
.tin { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; padding: 7px; background: #fff; border: 1px solid var(--line); border-radius: 6px; font-weight: 800; }
.tin b { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.tin .no { opacity: 0.4; }
#fishPanel .foot { margin-top: 12px; font-size: 12px; color: var(--ink-2); text-align: center; }

/* friends: your username, requests, who's online (in the menu and in the Friends panel) */
#friendsPanel { width: 320px; max-height: calc(100dvh - 80px); overflow-y: auto; font-size: 14px; }
.friends { text-align: left; font-size: 14px; }
#lobbyFriends { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
#lobbyFriends:empty { display: none; }
.friends .ttitle { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 8px; }
.friends .ttitle .label { margin: 0; }
.friends .ttitle b { color: var(--accent); }
.friends .row { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.friends .row:last-of-type { border-bottom: none; }
.friends .who { flex: 1; min-width: 0; line-height: 1.2; }
.friends .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friends .who small { color: var(--ink-2); font-size: 12px; font-weight: 600; }
.friends .dot { width: 9px; height: 9px; border-radius: 50%; background: #cfc6bb; flex: none; }
.friends .dot.on { background: #3cc46a; box-shadow: 0 0 0 3px rgba(60, 196, 106, 0.2); }
.friends button { padding: 6px 11px; font-size: 13px; }
.friends button.ghost { background: transparent; box-shadow: none; color: var(--ink-2); padding: 5px 7px; }
.friends .add { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.friends .add input { flex: 1; min-width: 0; }
.friends .note { margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: var(--ink-2); }
.friends .note + .ttitle { margin-top: 14px; }
.friends .add.col { flex-direction: column; align-items: stretch; gap: 8px; }
.friends .add.col button { align-self: flex-start; padding: 7px 16px; }
.friends .keep { margin-top: 12px; }
.friends .keepBox { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.friends .keepBox .note { margin-top: 0; }
.friends .noteRow { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.friends button.small { padding: 6px 10px; font-size: 13px; }
.friends .err { color: var(--accent); }
/* a friend came online: a note with a Join button (bottom left) */
#friendNote { position: fixed; left: 14px; bottom: 70px; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-weight: 800; animation: pop2 0.22s ease-out; }
#friendNote[hidden] { display: none; }
#friendNote button { padding: 6px 12px; font-size: 13px; }
@keyframes pop2 { from { opacity: 0; transform: translateY(6px); } }
.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 { min-width: 200px; font-size: 14px; } /* (in #topLeft, under the room code) */
/* the stats overlay (F3): small and dark, like the ones in games; it doesn't take clicks */
#perf { background: rgba(20, 24, 32, 0.78); color: #e8eef5; padding: 6px 8px; pointer-events: none; box-shadow: none;
  font: 600 11.5px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; }
#perfText { white-space: pre-wrap; }
#perfGraph { display: block; width: 240px; height: 40px; margin-bottom: 4px; background: rgba(255, 255, 255, 0.06); border-radius: 4px; }
@media (max-width: 600px) { #perf { font-size: 10px; } #perfGraph { width: 180px; height: 30px; } }
.ttitle { margin-bottom: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); }
.thead, .trow { display: grid; grid-template-columns: 1fr 64px 48px; align-items: center; gap: 6px; }
.thead { margin-bottom: 4px; font-size: 11px; font-weight: 800; color: var(--ink-2); text-align: center; }
.trow { padding: 3px 0; font-weight: 700; }
.trow .tname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow b { text-align: center; font-size: 17px; font-weight: 800; color: var(--accent); }
.trow .tfish { color: #2f8fd0; }
.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 world */
.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; justify-content: flex-start; }
/* centred when it fits; when it's taller than the screen (the friends list), it scrolls from the top instead of
   being cut off above it */
.overlay > :first-child { margin-top: auto; }
.overlay > :last-child { margin-bottom: auto; }

#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 { background: var(--accent); color: #fff; font-size: 17px; border: 0; }
#pad button.ready { background: var(--sun); border-color: #f0d77a; }
#pad button.on { background: var(--mint); border-color: #9fd9b1; color: var(--mint-ink); }
#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 { min-width: 0; }
  .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 counter gets compact ("you 3 / Bear 2") */
@media (max-width: 520px) {
  #tally .ttitle { display: none; }
  #tally { padding: 6px 10px; }
  #invite { max-width: 100%; }
  #invite button { white-space: normal; }
}
.friends input { padding: 7px 10px; font-size: 14px; text-transform: none; letter-spacing: normal; text-align: left; font-weight: 700; }
.friends input::placeholder { text-transform: none; letter-spacing: normal; }

/* the map */
#mapPanel { width: 380px; }
#mapPanel .ttitle { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; }
#mapPanel .ttitle small { font-size: 11px; font-weight: 600; color: var(--ink-2); text-transform: none; letter-spacing: 0; }
.map { position: relative; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.map canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#mapPanel .legend { display: flex; justify-content: center; gap: 14px; margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
#mapPanel .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px var(--line); }
@media (max-width: 600px) { #mapPanel { top: 54px; right: 10px; width: min(380px, calc(100vw - 20px)); } }
.friends .dice { font-size: 17px; padding: 4px 6px; }
.friends .ttitle > span { display: flex; align-items: baseline; gap: 2px; }
.friends button.soft { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.friends button.link { padding: 0 2px; font-size: 12px; text-decoration: underline; }

/* the book's tabs, pictures and memories */
#fishPanel .tabs { display: flex; gap: 4px; margin: -2px 0 12px; padding: 3px; background: #f4efe9; border-radius: 8px; }
#fishPanel .tabs button { flex: 1; padding: 6px 4px; font-size: 13px; background: transparent; box-shadow: none; color: var(--ink-2); }
#fishPanel .tabs button.on { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }
.dex .pic { display: flex; align-items: center; justify-content: center; width: 40px; height: 32px; margin: 0 auto 5px; border-radius: 8px; font-size: 20px; color: #a79eab; font-weight: 800; }
.mems { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mems div { padding: 7px 9px; background: #fff; border: 1px solid var(--line); border-radius: 6px; line-height: 1.25; }
.mems b { display: block; font-size: 13px; }
.mems small { font-size: 11px; color: var(--ink-2); }
.mems .no { background: #f4f0ec; color: #a79eab; border-style: dashed; }
.mems .no small { color: #b3abb7; }

/* inventory bag: everything you're carrying right now */
#bagPanel { width: 320px; max-height: calc(100dvh - 80px); overflow-y: auto; font-size: 13px; }
#bagPanel .ttitle { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; }
#bagPanel .ttitle b { color: var(--accent); font-size: 13px; text-transform: none; letter-spacing: 0; }
#bagPanel .ttitle.sub { margin: 12px 0 6px; font-size: 10px; }
#bagPanel .ttitle.sub button { padding: 3px 8px; font-size: 11px; text-transform: none; letter-spacing: 0; background: var(--accent-soft); color: var(--accent); box-shadow: none; }
#bagPanel .bagGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#bagPanel .slot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 5px; background: #fff; border: 1px solid var(--line); border-radius: 7px; text-align: center; line-height: 1.2; }
#bagPanel .slot.empty { opacity: 0.42; background: #f7f3ee; }
#bagPanel .slot .ico { font-size: 19px; line-height: 1; }
#bagPanel .slot svg { display: block; width: 42px; height: 24px; shape-rendering: crispEdges; }
#bagPanel .slot b { font-size: 12px; font-weight: 800; color: var(--ink); }
#bagPanel .slot small { font-size: 11px; font-weight: 700; color: var(--ink-2); }
#bagPanel .paw { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
#bagPanel .paw i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(45, 37, 52, 0.16); flex: none; }
#bagPanel .paw span { line-height: 1.25; }
#bagPanel .paw b { display: block; font-size: 13px; }
#bagPanel .paw small { font-size: 11px; color: var(--ink-2); }
#bagPanel .none { margin: 0; padding: 8px 10px; background: #f7f3ee; border-radius: 7px; font-size: 12px; color: var(--ink-2); }

/* building: what you can make from shells */
#buildPanel { width: 300px; font-size: 14px; }
#buildPanel .ttitle { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; }
#buildPanel .ttitle b { color: var(--accent); }
.builds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.builds button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; text-align: left; background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.builds button small { font-size: 11px; font-weight: 600; color: var(--ink-2); }
.builds button:disabled { opacity: 0.45; cursor: default; }
#buildPanel { width: 320px; }
#buildPanel .ttitle.sub { margin: 12px 0 6px; font-size: 10px; }
#buildPanel .ttitle.sub small { font-size: 11px; font-weight: 700; color: var(--mint-ink); text-transform: none; letter-spacing: 0; }
#buildPanel .bag { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 7px 10px; background: #f4efe9; border-radius: 8px; font-size: 14px; font-weight: 800; }
.builds button small.need { color: var(--accent); }
#buildPanel .foot { margin-top: 10px; display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
/* a note in a bottle: writing one, or reading one found on the beach */
#notePanel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; width: min(360px, calc(100vw - 28px)); padding: 16px; border-radius: 10px; box-shadow: var(--shadow); background: #fffaf0; }
#notePanel h3 { margin: 0 0 8px; font-size: 15px; }
#notePanel textarea { width: 100%; height: 84px; resize: none; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 15px; }
#notePanel .letter { padding: 14px; background: #fff; border: 1px dashed #e3cfa8; border-radius: 8px; font-size: 16px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
#notePanel .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
#notePanel .row small { margin-right: auto; align-self: center; color: var(--ink-2); font-size: 12px; }

/* the photo panel: take one now or in 3 s, a frame, stickers */
#photoPanel { width: 280px; font-size: 14px; }
#photoPanel .ttitle { margin: 0 0 8px; }
#photoPanel .row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
#photoPanel .row button { padding: 7px 10px; font-size: 13px; background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
#photoPanel .row button.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
#photoPanel .row.go button { flex: 1; background: var(--accent); color: #fff; box-shadow: none; }
#photoPanel .stickers button { font-size: 18px; padding: 4px 8px; }

/* ---------- phones: one tidy layout (touch screens, small or turned sideways) ----------
   A menu from the toolbar is a sheet under the toolbar that fits the screen and scrolls inside: the screen's
   width in portrait (half-covered cards on the left looked broken), the right-hand side in landscape. While one is
   open, what it would cover steps aside: the buttons and the hint (and in portrait the cards on the left). */
@media (max-width: 700px), (max-height: 500px) {
  body.touch #corner { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
  body.touch :is(#stylePanel, #fishPanel, #friendsPanel, #mapPanel, #bagPanel, #buildPanel, #photoPanel) {
    top: calc(54px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
    max-height: calc(100dvh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.touch:has(:is(#stylePanel, #fishPanel, #friendsPanel, #mapPanel, #bagPanel, #buildPanel, #photoPanel):not([hidden])) :is(#pad, #prompt, #topLeft, #friendNote) { visibility: hidden; }
  /* the hint and what you can do now: smaller, so it doesn't fill the middle of the screen */
  body.touch #prompt { font-size: 13px; padding: 7px 12px; line-height: 1.3; }
  /* the stats (F3): compact */
  body.touch #perf { font-size: 9.5px; line-height: 1.35; padding: 5px 7px; background: rgba(20, 24, 32, 0.6); }
  body.touch #perfGraph { width: 150px; height: 22px; margin-bottom: 3px; }
}
@media (max-width: 420px) {
  #corner .chip { padding: 6px 7px; }
  #corner svg { width: 17px; height: 17px; }
}
@media (max-width: 600px) {
  body.touch :is(#stylePanel, #fishPanel, #friendsPanel, #mapPanel, #bagPanel, #buildPanel, #photoPanel) {
    left: calc(10px + env(safe-area-inset-left));
    width: auto;
  }
  body.touch:has(:is(#stylePanel, #fishPanel, #friendsPanel, #mapPanel, #bagPanel, #buildPanel, #photoPanel):not([hidden])) :is(#topLeft, #friendNote) { visibility: hidden; }
}
@media (max-height: 500px) {
  body.touch :is(#stylePanel, #fishPanel, #friendsPanel, #bagPanel, #buildPanel, #photoPanel) { width: min(380px, calc(100vw - 20px)); }
  /* the map is square: as wide as fits the height (with its title and legend) */
  body.touch #mapPanel { width: min(380px, calc(100dvh - 128px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
  /* the hint sits between the two thumbs: never under the buttons on the right */
  body.touch #prompt { max-width: calc(100vw - 2 * (170px + env(safe-area-inset-right))); }
}
/* short screens (a phone on its side): the title on the left, vertically centred, and the menu card on the right,
   as tall as the screen and scrolling inside (the column layout's auto margins pushed the title into the corner) */
@media (max-height: 500px) {
  .overlay {
    flex-direction: row; justify-content: center; align-items: center; gap: clamp(16px, 4vw, 40px);
    padding: 10px calc(12px + env(safe-area-inset-right)) 10px calc(12px + env(safe-area-inset-left)); overflow: hidden;
  }
  .overlay > :first-child, .overlay > :last-child { margin: 0; }
  .overlay .title { flex: 0 1 auto; min-width: 0; max-width: 40vw; }
  .overlay h1 { font-size: clamp(44px, 9vw, 72px); }
  .overlay .sub { font-size: clamp(13px, 2vw, 16px); }
  .overlay .panel { flex: 0 1 auto; width: min(460px, 56vw); max-height: calc(100dvh - 20px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 12px; }
}
/* very short screens: smaller buttons, so the grid of six doesn't fill the side of the screen */
@media (max-height: 400px) {
  #pad { grid-template-columns: 60px 60px; gap: 6px; }
  #pad button { height: 44px; font-size: 13px; }
  #pad button.big { font-size: 15px; }
}
/* on its side the toolbar sits on the right, so the cards on the left go right up into the corner */
@media (max-height: 500px) and (min-width: 560px) {
  #topLeft, body.touch #hud #topLeft { top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); }
}

/* the toolbar (hotbar): what's in your paws, at the bottom like in most games */
#hotbar { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; border-radius: 10px;
  background: rgba(32, 26, 38, 0.55); pointer-events: auto; touch-action: manipulation; }
#hotbar:empty { display: none; }
#hotbar button { position: relative; width: 46px; height: 46px; padding: 0; border-radius: 8px; background: rgba(255, 253, 250, 0.88);
  box-shadow: inset 0 0 0 1px var(--line); font-size: 22px; line-height: 1; }
#hotbar button.on { background: #fff; box-shadow: inset 0 0 0 3px var(--accent); transform: translateY(-3px); }
#hotbar kbd { position: absolute; top: 2px; left: 3px; min-width: 0; height: auto; padding: 0; font-size: 9px; background: none; box-shadow: none; color: var(--ink-2); }
#hotbar small { position: absolute; right: 3px; bottom: 1px; font-size: 11px; font-weight: 800; color: var(--ink); }
#prompt { bottom: 112px; }
body.touch #hotbar kbd { display: none; }
/* phones: beside the buttons (portrait, wrapping), between the thumbs (landscape) */
@media (max-width: 700px) {
  body.touch #hotbar { left: calc(10px + env(safe-area-inset-left)); bottom: calc(16px + env(safe-area-inset-bottom)); transform: none;
    flex-wrap: wrap; max-width: calc(100vw - 190px); }
  body.touch #hotbar button { width: 40px; height: 40px; font-size: 19px; }
  body.touch #hotbar button.on { transform: none; }
}
@media (max-height: 500px) {
  body.touch #hotbar { bottom: calc(10px + env(safe-area-inset-bottom)); max-width: calc(100vw - 2 * (170px + env(safe-area-inset-right))); }
  body.touch #hotbar button { width: 38px; height: 38px; font-size: 18px; }
  body.touch #prompt { bottom: calc(62px + env(safe-area-inset-bottom)); }
}

/* the ☰ button: only where the toolbar shows symbols alone */
#moreBtn { display: none !important; }
@media (max-width: 700px), (max-height: 500px) {
  #moreBtn:not([hidden]) { display: inline-flex !important; }
  /* unfolded: one button per row with its name, over everything */
  #corner.expanded { flex-direction: column; align-items: stretch; z-index: 8; box-shadow: var(--shadow); }
  #corner.expanded .wide { display: inline; }
  #corner.expanded .chip { justify-content: flex-start; padding: 9px 14px 9px 10px; font-size: 15px; }
  #corner.expanded .chip + .chip::before { left: 8px; right: 8px; top: -1px; bottom: auto; width: auto; height: 1px; }
}
/* phones upright: the toolbar stands in the top right corner, the cards on the left go right up to the top, and
   menus open beside it */
@media (max-width: 600px) {
  body.touch #corner { flex-direction: column; top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
  body.touch #corner .chip + .chip::before { left: 7px; right: 7px; top: -1px; bottom: auto; width: auto; height: 1px; }
  body.touch #hud #topLeft { top: calc(10px + env(safe-area-inset-top)); max-width: calc(100vw - 80px); }
  body.touch :is(#stylePanel, #fishPanel, #friendsPanel, #mapPanel, #buildPanel, #photoPanel, #bagPanel) {
    top: calc(10px + env(safe-area-inset-top)); right: calc(62px + env(safe-area-inset-right));
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}

/* the invite card: the code, then the button under it */
#invite { flex-direction: column; align-items: stretch; gap: 7px; }
#invite .code { display: flex; align-items: baseline; gap: 8px; }
#invite #copyBtn { width: 100%; }
/* the snack and fish count: compact, one line per animal, the numbers big */
#tally { min-width: 0; padding: 6px 10px; }
#tally .trow { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
#tally .tname { flex: 1; min-width: 44px; font-size: 13px; color: var(--ink-2); }
#tally .trow.mine .tname { color: var(--mint-ink); }
#tally .trow b { display: inline-flex; align-items: center; gap: 4px; min-width: 46px; justify-content: flex-end; font-size: 18px; }
#tally .thead { display: none; }
/* phones: bigger words in every card and menu (small text was hard to read) */
@media (max-width: 700px), (max-height: 500px) {
  body.touch .chip, body.touch #status, body.touch #invite { font-size: 15px; }
  body.touch #invite b { font-size: 18px; }
  body.touch #invite button, body.touch #prompt { font-size: 15px; }
  body.touch #tally .tname { font-size: 14px; }
  body.touch #tally .trow b { font-size: 19px; }
  body.touch :is(#stylePanel, #fishPanel, #friendsPanel, #mapPanel, #buildPanel, #photoPanel, #bagPanel) { font-size: 15px; }
  body.touch :is(#stylePanel, #fishPanel, #friendsPanel, #buildPanel, #photoPanel, #bagPanel) :is(small, .note) { font-size: 13px; }
  body.touch .ttitle { font-size: 12px; }
  body.touch #toast { font-size: 16px; }
}
/* crafting, in the bag (like Terraria's or Raft's inventory): what you can make first, each ingredient have/need */
#bagPanel button.slot { font: inherit; text-align: center; cursor: pointer; }
#bagPanel .slot.held { box-shadow: inset 0 0 0 2px var(--accent); }
#bagPanel .ctabs { display: flex; gap: 4px; margin: 0 0 8px; padding: 3px; background: #f4efe9; border-radius: 8px; }
#bagPanel .ctabs button { flex: 1; padding: 5px 4px; font-size: 12px; background: transparent; box-shadow: none; color: var(--ink-2); }
#bagPanel .ctabs button.on { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }
.recipes { display: flex; flex-direction: column; gap: 6px; }
.recipe { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); opacity: 0.72; }
.recipe.can { opacity: 1; box-shadow: inset 0 0 0 1.5px #9fd6ae; }
.recipe .big { font-size: 24px; width: 30px; text-align: center; flex: none; }
.recipe .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.recipe .info small { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.recipe .info .own { color: var(--mint-ink); }
.recipe .needs { display: flex; flex-wrap: wrap; gap: 4px; }
.recipe .need { font-size: 12px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: #f4efe9; }
.recipe .need.ok { color: var(--mint-ink); background: #e3f5e8; }
.recipe .need.short { color: var(--accent); background: #fde7ef; }
.recipe .go { display: flex; flex-direction: column; gap: 4px; flex: none; }
.recipe .go button { padding: 6px 12px; font-size: 13px; }
#bagPanel { width: 360px; }
/* phones: the action buttons in one column down the right edge */
body.touch #pad { grid-template-columns: 64px; gap: 6px; right: calc(8px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); }
body.touch #pad button { height: 50px; }
@media (max-height: 500px) {
  body.touch #pad { gap: 4px; bottom: calc(8px + env(safe-area-inset-bottom)); }
  body.touch #pad button { height: 42px; font-size: 13px; }
}
@media (max-width: 700px) {
  body.touch #hotbar { max-width: calc(100vw - 100px); }
  body.touch #prompt { max-width: calc(100vw - 100px); left: calc(50% - 40px); }
}
@media (max-height: 500px) {
  body.touch #hotbar { max-width: calc(100vw - 2 * (90px + env(safe-area-inset-right))); }
  body.touch #prompt { max-width: calc(100vw - 2 * (90px + env(safe-area-inset-right))); }
}
/* phones: the toolbar buttons as big as the action buttons (they were small to tap) */
@media (max-width: 600px) {
  body.touch #corner { padding: 4px; gap: 2px; }
  body.touch #corner .chip { width: 56px; height: 44px; justify-content: center; padding: 0; }
  body.touch #corner.expanded .chip { width: auto; justify-content: flex-start; padding: 0 16px 0 14px; }
  body.touch #corner svg { width: 22px; height: 22px; }
  body.touch #hotbar button { width: 50px; height: 50px; font-size: 24px; }
  body.touch #hud #topLeft { max-width: calc(100vw - 84px); }
}
@media (max-height: 500px) {
  body.touch #corner .chip { min-width: 48px; height: 42px; justify-content: center; }
  body.touch #corner svg { width: 21px; height: 21px; }
  body.touch #hotbar button { width: 44px; height: 44px; font-size: 21px; }
}
/* phones: the top toolbar is folded away behind ☰ (it was a long column); ☰ opens it with names, choosing closes it */
@media (max-width: 700px), (max-height: 500px) {
  body.touch #corner:not(.expanded) > .chip:not(#moreBtn) { display: none; }
  body.touch #corner:not(.expanded) { padding: 3px; }
  body.touch #corner:not(.expanded):has(.chip.new) #moreBtn::after { /* something new in the book or the friends list */
    content: ''; position: absolute; top: 5px; right: 5px; width: 9px; height: 9px;
    border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper);
  }
  body.touch :is(#stylePanel, #fishPanel, #friendsPanel, #mapPanel, #buildPanel, #photoPanel, #bagPanel) { top: calc(64px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
  body.touch #hud #topLeft { max-width: calc(100vw - 90px); }
}
@media (max-height: 500px) {
  body.touch #corner.expanded { display: grid; grid-template-columns: 1fr 1fr; max-height: calc(100dvh - 20px); overflow-y: auto; }
  body.touch #corner.expanded #moreBtn { grid-column: 1 / -1; }
  body.touch #corner.expanded .chip { height: 44px; }
}
/* phones: the toolbar's buttons snug round their icon and name (they had big gaps, small words and small icons) */
@media (max-width: 700px), (max-height: 500px) {
  body.touch #corner:not(.expanded) #moreBtn { width: 48px; height: 48px; padding: 0; justify-content: center; }
  body.touch #corner svg { width: 26px; height: 26px; }
  body.touch #corner.expanded { padding: 4px; gap: 0; }
  body.touch #corner.expanded .chip { width: auto; min-width: 0; height: 46px; padding: 0 16px 0 10px; gap: 12px; font-size: 18px; font-weight: 800; justify-content: flex-start; }
}
@media (max-height: 500px) {
  body.touch #corner.expanded .chip { height: 42px; font-size: 17px; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 700px),
       (prefers-reduced-motion: no-preference) and (max-height: 500px) {
  body.touch #corner.expanded {
    transform-origin: top right;
    animation: phone-menu-in 200ms cubic-bezier(.2, .8, .2, 1) both;
  }
  body.touch #corner.expanded.closing {
    animation: phone-menu-out 160ms ease-in both;
  }
  body.touch #corner.expanded:not(.closing) > .chip:not(#moreBtn) {
    animation: phone-menu-item-in 180ms ease-out both;
  }
  body.touch #corner.closing > .chip:not(#moreBtn) { pointer-events: none; }
}
@keyframes phone-menu-in {
  from { opacity: .75; transform: translateY(-7px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes phone-menu-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: .75; transform: translateY(-7px) scale(.97); }
}
@keyframes phone-menu-item-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
