/* Eva's & Max's Pet Café – overlay UI styles (title, My cafés, menu,
   toast). Same family look as the other Eva's & Max's games (see
   ../BRAND.md): Fredoka, chunky rounded buttons with a solid bottom edge, ink
   outlines and the wordmark. This game's own accent is warm latte brown and
   caramel with a touch of coral and mint, and its title strip is a striped
   café awning with a scalloped edge. The 3D
   rooms (#scene) sit behind #ui; the play screen's own styles (tray, HUD) are
   in play.css. */

@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/fredoka-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/fredoka-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/fredoka-latin-700-normal.woff2) format('woff2'); }

:root {
  --ink: #3d2c55;
  --ink-soft: #7d6c93;
  --paper: #fffaf2;
  --line: #efe3d2;
  --line-d: #e3d3bc;
  --green: #4cc76a;
  --green-d: #2f9a4c;
  --blue: #4dabf7;
  --blue-d: #2b84cc;
  --yellow: #ffd43b;
  --yellow-d: #dba600;
  --red: #ff6b6b;
  --red-d: #d14848;
  /* this game's own accents: latte brown, caramel and milk foam, a coral and a
     mint touch, and soft pastels for the café styles */
  --latte: #c98a4b;
  --latte-d: #96602e;
  --caramel: #eaa55c;
  --foam: #f7dcb8;
  --foam-l: #fff1e0;
  --coral: #ff8a70;
  --coral-d: #e0654c;
  --mint: #8fdcc0;
  --mint-l: #e3f7ef;
  --coin: #ffd43b;
  --coin-l: #fff6cc;
  --sage: #9ccaa0;
  --sage-d: #6fa678;
  --sage-l: #e5f3e3;
  --lavender: #c9b8f2;
  --lavender-d: #9d87d8;
  --lavender-l: #f1ecfd;
  --butter-l: #fff7d6;
  --butter: #ffe39a;
  --sky-top: #fbeedd;
  --sky-bottom: #f3e6d3;
  --font: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Arial Rounded MT Bold', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 12px 34px rgba(61, 44, 85, 0.18);
  --edge: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, rgba(234, 165, 92, 0.32), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(143, 220, 192, 0.34), transparent 45%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%) fixed;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-font-smoothing: antialiased;
}

#scene { position: fixed; inset: 0; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

button, a.btn { font-family: inherit; color: inherit; touch-action: manipulation; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 4px solid rgba(201, 138, 75, 0.7); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- chunky buttons (shared brand style) ---------- */

.btn {
  --b: #fff;
  --bd: var(--line-d);
  --fg: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  font-size: 21px;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%), var(--b);
  box-shadow: 0 6px 0 var(--bd), 0 12px 18px rgba(61, 44, 85, 0.14);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--bd), 0 4px 8px rgba(61, 44, 85, 0.14); }
.btn:disabled { opacity: 0.5; filter: grayscale(0.6); cursor: default; }
.btn .ico { font-size: 0.95em; }
.btn-green { --b: var(--green); --bd: var(--green-d); --fg: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.btn-blue { --b: var(--blue); --bd: var(--blue-d); --fg: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.btn-red { --b: var(--red); --bd: var(--red-d); --fg: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.btn-yellow { --b: var(--yellow); --bd: var(--yellow-d); --fg: #5a3d00; }
.btn-latte { --b: var(--latte); --bd: var(--latte-d); --fg: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.btn-soft { --b: #fff; --bd: var(--line-d); --fg: var(--ink); }
.btn-big { min-height: 64px; font-size: 24px; border-radius: 20px; padding: 0 28px; }
.btn-huge { min-height: 72px; font-size: 29px; border-radius: 24px; box-shadow: 0 8px 0 var(--bd), 0 16px 24px rgba(61, 44, 85, 0.18); }
.btn-huge:active:not(:disabled) { transform: translateY(7px); }

.round-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  box-shadow: 0 0 0 2px var(--line), 0 4px 0 2px var(--line-d), 0 6px 14px rgba(61, 44, 85, 0.14);
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s, filter 0.2s;
}
.round-btn:active { transform: translateY(3px); box-shadow: 0 0 0 2px var(--line), 0 1px 0 2px var(--line-d); }
.round-btn.off { opacity: 0.55; filter: grayscale(1); }
.round-btn.on { background: var(--yellow); box-shadow: 0 4px 0 var(--yellow-d), 0 6px 14px rgba(61, 44, 85, 0.14); }

/* a paper card with 28px corners (title, rooms, menu) */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  background: var(--paper);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: #fff; box-shadow: 0 3px 0 var(--line-d); font-size: 18px; font-weight: 600; white-space: nowrap; }
.pill-latte { background: var(--foam-l); color: #8a5526; box-shadow: 0 3px 0 var(--foam); }
.pill-coin { background: var(--coin-l); color: #7a5600; box-shadow: 0 3px 0 #f2d35c; }
.pill-sage { background: var(--sage-l); color: #3f7a4a; box-shadow: 0 3px 0 #c3e2c4; }
.pill-lavender { background: var(--lavender-l); color: #6a52b0; box-shadow: 0 3px 0 #dcd1f7; }

/* ---------- screens (overlays) ---------- */

.screen { position: absolute; inset: 0; opacity: 0; transition: opacity 0.45s; }
.screen.in { opacity: 1; }
.screen.out { opacity: 0; pointer-events: none; }

/* the title strip: a café awning in latte and milk-foam stripes, with a
   scalloped edge below where each stripe ends in its own little bump */
.cafe-strip {
  position: relative;
  height: 30px;
  flex: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 60%),
    repeating-linear-gradient(90deg, var(--latte) 0 24px, var(--foam) 24px 48px);
}
.cafe-strip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 12px;
  background:
    radial-gradient(circle at 12px 0, var(--latte) 0 12px, transparent 12.5px) 0 0 / 48px 12px repeat-x,
    radial-gradient(circle at 36px 0, var(--foam) 0 12px, transparent 12.5px) 0 0 / 48px 12px repeat-x;
  filter: drop-shadow(0 2px 0 rgba(150, 96, 46, 0.18));
}

/* ---------- the wordmark ---------- */

.logo { margin: 6px 0 0; text-align: center; line-height: 1; }
.logo-top { display: block; font-size: 40px; font-weight: 700; letter-spacing: 0.5px; }
.logo-top .ltr {
  display: inline-block;
  color: var(--c);
  transform: rotate(var(--tilt));
  text-shadow: 3px 0 #fff, -3px 0 #fff, 0 3px #fff, 0 -3px #fff, 2px 2px #fff, -2px -2px #fff, 2px -2px #fff, -2px 2px #fff, 0 7px 0 rgba(61, 44, 85, 0.2);
  animation: letterIn 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) calc(var(--i) * 55ms + 150ms) both;
}
.logo-top .sp { display: inline-block; width: 0.3em; }
.logo-game { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 16px; margin-top: 10px; padding: 4px 0 12px; }
/* the game's word: big capitals in caramel and coral, outlined in ink with a deep ink drop */
.logo-word {
  display: inline-block;
  font-size: 54px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--caramel);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink), 0 10px 12px rgba(61, 44, 85, 0.22);
  animation: wordIn 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) 0.8s both;
}
.logo-word.w2 { color: var(--coral); animation-delay: 0.95s; position: relative; }
/* a little steaming cup set down by CAFÉ */
.logo-word.w2::after {
  content: '☕';
  position: absolute;
  right: -34px;
  bottom: 4px;
  font-size: 26px;
  -webkit-text-stroke: 0;
  text-shadow: none;
  transform: rotate(18deg);
}
.tagline { margin: 14px 0 6px; text-align: center; font-size: 18px; color: var(--ink-soft); }

/* ---------- Eva and Max ---------- */

.kid { position: absolute; bottom: -6px; width: calc(var(--kid-h) * 0.8); height: var(--kid-h); overflow: visible; animation: kidIn 0.8s cubic-bezier(0.2, 1.5, 0.4, 1) 1.1s both; }
.kid-eva { left: -12px; }
.kid-max { right: -12px; animation-delay: 1.25s; }
.kid-shadow { fill: rgba(61, 44, 85, 0.14); animation: kidShadow 1.4s ease-in-out infinite alternate; }
.kid-body { animation: kidBob 1.4s ease-in-out infinite alternate; }
.kid-head { animation: kidTilt 2.6s ease-in-out infinite alternate; }
.kid-eyes { animation: kidBlink 4.8s infinite; }
.kid-pony { animation: kidPony 1.4s ease-in-out infinite alternate; }
.kid-tail { animation: kidTail 0.9s ease-in-out infinite alternate; }
.kid-steam { animation: kidSteam 1.6s ease-in-out infinite alternate; }
.kid-eva .kid-wave { animation: kidWaveL 0.6s ease-in-out infinite alternate; }
.kid-max .kid-wave { animation: kidWaveR 0.6s ease-in-out -0.3s infinite alternate; }
.kid-max .kid-body, .kid-max .kid-shadow { animation-delay: -0.7s; }
.kid-max .kid-head { animation-delay: -1.3s; animation-direction: alternate-reverse; }
.kid-max .kid-eyes { animation-delay: 1.8s; }

/* ---------- title ---------- */

.title-screen { display: grid; place-items: center; padding: var(--edge); }
.title-card {
  width: min(600px, 100%);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.6s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.title-screen.in .title-card { transform: none; }
.title-home, .title-music { position: absolute; top: 50px; z-index: 2; }
.title-home { left: 16px; }
.title-music { right: 16px; }
.title-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 26px 26px 4px; }
.title-hero { --kid-h: 140px; position: relative; padding: 0 calc(var(--kid-h) * 0.62); min-width: 0; }
/* family mode: "Who's playing?" (the family's kids, js/ui/screens.js) */
.who { margin: 10px 0 8px; text-align: center; }
.who-q { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--ink-soft); }
.who-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; }
.who-btn { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 76px; padding: 6px 8px 6px; border: 3px solid var(--line-d); border-radius: 20px; background: var(--paper); color: var(--ink); font: 700 16px Fredoka, sans-serif; cursor: pointer; box-shadow: 0 4px 0 var(--line-d); transition: transform 0.15s; }
.who-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line-d); }
.who-btn.on { border-color: var(--green-d); background: #e6f8ea; box-shadow: 0 4px 0 var(--green-d); cursor: default; }
.who-btn .kid { position: static; width: 52px; height: 64px; animation: none; }
.who-btn:not(.on) .kid * { animation-play-state: paused; }
.who-name { max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.title-how { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin: 6px 0 4px; }
.title-how .pill { font-size: 15px; padding: 5px 12px; }
.title-actions { display: flex; gap: 12px; padding: 16px 22px 22px; border-top: 3px dashed var(--line); }
.title-actions .btn-huge { flex: 1; }

/* ---------- My rooms ---------- */

.rooms-screen { display: grid; place-items: center; padding: var(--edge); background: rgba(255, 241, 227, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.rooms-card {
  width: min(940px, 100%);
  transform: translateY(24px);
  transition: transform 0.55s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.rooms-screen.in .rooms-card { transform: none; }
.rooms-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px 24px 26px; }
.rooms-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 4px 0 20px; }
.rooms-title { margin: 0; font-size: 34px; text-align: center; white-space: nowrap; }
.rooms-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.rooms-count, .rooms-coins { font-size: 18px; }
.rooms-coins { font-size: 20px; font-weight: 700; }

.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px 18px; padding: 6px 4px 8px; }

/* a room is a little framed picture: a tinted window with its emoji (or a
   snapshot), the name under it, ✏️ and ✕ tucked on the corners */
.room-card {
  --tint: var(--foam-l);
  --tint-d: var(--foam);
  --edge-c: var(--latte);
  --edge-d: var(--latte-d);
  position: relative;
  border-radius: 24px;
  animation: cardIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) var(--d, 0ms) both;
}
.room-card.st-living-room { --tint: var(--foam-l); --tint-d: var(--foam); --edge-c: #dfae7c; --edge-d: #b07a45; }
.room-card.st-bedroom { --tint: var(--lavender-l); --tint-d: #dcd1f7; --edge-c: var(--lavender); --edge-d: var(--lavender-d); }
.room-card.st-kitchen { --tint: var(--butter-l); --tint-d: var(--butter); --edge-c: #ffd56b; --edge-d: #d9a92b; }
.room-card.st-garden { --tint: var(--sage-l); --tint-d: #c7e3c6; --edge-c: var(--sage); --edge-d: var(--sage-d); }
.room-open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding: 10px 10px 12px;
  border: 0;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 0 0 3px var(--edge-c), 0 6px 0 3px var(--edge-d), 0 12px 18px rgba(61, 44, 85, 0.12);
  text-align: center;
  transition: transform 0.1s, box-shadow 0.1s;
}
.room-open:active { transform: translateY(4px); box-shadow: 0 0 0 3px var(--edge-c), 0 2px 0 3px var(--edge-d); }
.room-pic {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(180deg, transparent 62%, rgba(61, 44, 85, 0.06) 62%),
    radial-gradient(circle at 40% 35%, #fff, var(--tint-d));
}
.room-pic img, .room-pic canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.room-emoji { font-size: 58px; line-height: 1; filter: drop-shadow(0 4px 2px rgba(61, 44, 85, 0.15)); }
.room-text { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; min-width: 0; }
.room-name { font-size: 22px; line-height: 1.15; overflow-wrap: anywhere; }
.room-text small { align-self: center; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--tint); font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.room-input {
  width: 100%;
  min-width: 0;
  padding: 6px 10px;
  border: 3px solid var(--latte);
  border-radius: 12px;
  font: 600 20px var(--font);
  color: var(--ink);
  text-align: center;
  background: var(--foam-l);
  -webkit-user-select: text;
  user-select: text;
}

.mini-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 0 0 2.5px var(--edge-c), 0 3px 0 2.5px var(--edge-d);
  transition: transform 0.1s;
}
.mini-btn:active { transform: translateY(2px); }
.room-edit { left: -10px; top: -12px; }
.room-del { right: -10px; top: -12px; color: var(--red-d); }

.room-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 190px;
  border: 4px dashed var(--line-d);
  background: rgba(255, 255, 255, 0.6);
  font-size: 22px;
  color: var(--ink-soft);
  transition: transform 0.1s, background 0.2s;
}
.room-new:active { transform: translateY(3px); background: var(--foam-l); }
.room-plus {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 5px 0 var(--green-d);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

/* ---------- a little question over a card (delete, clear, which room) ---------- */

.ask {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(61, 44, 85, 0.22);
  opacity: 0;
  transition: opacity 0.25s;
}
.ask.in { opacity: 1; }
.ask-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(400px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 20px 24px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
  transform: scale(0.88);
  transition: transform 0.35s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.ask.in .ask-card { transform: none; }
.ask-emoji { font-size: 52px; line-height: 1; }
.ask-text { margin: 0; font-size: 26px; font-weight: 600; line-height: 1.2; }
.ask-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: 100%; margin-top: 6px; }
.ask-btns .btn { flex: 1 1 140px; }

.pick-card { width: min(520px, 100%); }
.pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; margin: 4px 0 6px; }
.pick-btn {
  --tint: var(--foam-l);
  --edge-c: #dfae7c;
  --edge-d: #b07a45;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px 10px;
  border: 0;
  border-radius: 20px;
  background: var(--tint);
  font-size: 21px;
  font-weight: 600;
  box-shadow: 0 0 0 3px var(--edge-c), 0 5px 0 3px var(--edge-d);
  transition: transform 0.1s, box-shadow 0.1s;
}
.pick-btn:active { transform: translateY(4px); box-shadow: 0 0 0 3px var(--edge-c), 0 1px 0 3px var(--edge-d); }
.pick-btn.st-bedroom { --tint: var(--lavender-l); --edge-c: var(--lavender); --edge-d: var(--lavender-d); }
.pick-btn.st-kitchen { --tint: var(--butter-l); --edge-c: #ffd56b; --edge-d: #d9a92b; }
.pick-btn.st-garden { --tint: var(--sage-l); --edge-c: var(--sage); --edge-d: var(--sage-d); }
.pick-emoji { font-size: 46px; line-height: 1.1; }
.pick-cancel { min-width: 160px; }

/* ---------- menu ---------- */

.menu-screen { display: grid; place-items: center; padding: var(--edge); background: rgba(61, 44, 85, 0.14); }
.menu-card {
  align-items: center;
  gap: 14px;
  width: min(440px, 100%);
  padding: 0 0 24px;
  overflow-y: auto;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.in > .menu-card { transform: none; }
.menu-card .cafe-strip { width: 100%; }
.menu-card h2 { margin: 22px 0 0; font-size: 32px; }
.menu-toggles { display: flex; justify-content: center; gap: 18px; margin: 2px 0 6px; }
.toggle { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.toggle .round-btn { width: 60px; height: 60px; font-size: 28px; }
.menu-btns { display: flex; flex-direction: column; gap: 14px; width: 100%; padding: 0 24px; }
.menu-btns .btn { width: 100%; }

.toast { position: absolute; top: 86px; left: 50%; max-width: calc(100% - 32px); padding: 10px 22px; border-radius: 999px; background: #fff; color: var(--ink); font-size: 20px; font-weight: 600; box-shadow: 0 0 0 3px #dfae7c, 0 4px 0 3px var(--latte-d), var(--shadow); transform: translate(-50%, -20px); opacity: 0; transition: 0.4s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none !important; }
.toast.in { transform: translate(-50%, 0); opacity: 1; }

/* ---------- small screens ---------- */

@media (max-width: 760px), (orientation: portrait) {
  .title-screen { padding: 10px; align-items: end; }
  .title-card { width: 100%; max-height: min(100%, 760px); }
}

@media (max-width: 640px) {
  :root { --edge: 10px; }
  .title-scroll { padding: 20px 16px 4px; }
  .title-hero { --kid-h: min(100px, 23vw); }
  .logo-top { font-size: min(32px, 7.6vw); }
  .logo-word { font-size: min(44px, 10.8vw); -webkit-text-stroke-width: 2.5px; text-shadow: 0 4px 0 var(--ink), 0 8px 10px rgba(61, 44, 85, 0.2); }
  .logo-word.w2::after { display: none; }
  .logo-game { gap: 0 12px; }
  .title-home, .title-music { top: 44px; width: 42px; height: 42px; font-size: 19px; }
  .title-home { left: 8px; }
  .title-music { right: 8px; }
  .tagline { font-size: 16px; margin-top: 10px; }
  .title-how .pill { font-size: 13px; }
  .who-btn { min-width: 64px; font-size: 14px; }
  .who-btn .kid { width: 42px; height: 52px; }
  .title-actions { padding: 14px; }
  .btn-huge { min-height: 64px; font-size: 25px; }
  .round-btn { width: 44px; height: 44px; font-size: 20px; }

  .rooms-screen { padding: 10px; }
  .rooms-scroll { padding: 16px 16px 22px; }
  .rooms-head { margin-bottom: 16px; }
  .rooms-title { font-size: 28px; }
  .rooms-head { grid-template-columns: auto 1fr; row-gap: 10px; }
  .rooms-title { text-align: left; }
  .rooms-pills { grid-column: 1 / -1; justify-content: center; }
  .rooms-count, .rooms-coins { font-size: 16px; padding: 5px 11px; }
  .rooms-coins { font-size: 18px; }
  .room-grid { grid-template-columns: repeat(2, 1fr); gap: 20px 14px; }
  .room-open { padding: 8px 8px 10px; }
  .room-emoji { font-size: 44px; }
  .room-name { font-size: 19px; }
  .room-text small { font-size: 13px; }
  .room-new { min-height: 150px; font-size: 19px; }
  .room-plus { width: 54px; height: 54px; font-size: 38px; }
  .mini-btn { width: 36px; height: 36px; font-size: 16px; }
  .room-edit { left: -8px; top: -10px; }
  .room-del { right: -8px; top: -10px; }
  .ask-text { font-size: 23px; }
  .pick-emoji { font-size: 40px; }
  .pick-btn { font-size: 19px; }

  .toggle .round-btn { width: 56px; height: 56px; }
  .toast { font-size: 17px; top: 76px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .title-hero { --kid-h: 96px; }
  .title-scroll { padding-top: 14px; }
  .logo-top { font-size: 30px; }
  .logo-word { font-size: 40px; }
  .title-how { display: none; }
  .title-actions { padding: 10px 18px 14px; }
  .rooms-head { margin-bottom: 12px; }
  .room-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .room-emoji { font-size: 40px; }
  .room-new { min-height: 140px; }
}

/* ---------- animations ---------- */

@keyframes letterIn { from { opacity: 0; transform: translateY(-24px) rotate(var(--tilt)) scale(0.5); } to { opacity: 1; transform: rotate(var(--tilt)); } }
@keyframes wordIn { from { opacity: 0; transform: translateY(18px) scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes kidIn { from { opacity: 0; transform: translateY(40px) scale(0.3); } to { opacity: 1; transform: none; } }
@keyframes kidBob { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@keyframes kidShadow { from { transform: scale(1); } to { transform: scale(0.88); } }
@keyframes kidTilt { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes kidWaveL { from { transform: rotate(-18deg); } to { transform: rotate(-42deg); } }
@keyframes kidWaveR { from { transform: rotate(18deg); } to { transform: rotate(42deg); } }
@keyframes kidPony { from { transform: rotate(-7deg); } to { transform: rotate(8deg); } }
@keyframes kidTail { from { transform: rotate(-12deg); } to { transform: rotate(14deg); } }
@keyframes kidSteam { from { transform: translateY(0) scaleY(1); opacity: 0.9; } to { transform: translateY(-2px) scaleY(1.1); opacity: 0.4; } }
@keyframes kidBlink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
