:root {
  --bg:        #1E1533;
  --bg-deep:   #150D26;
  --surface:   #2A1F47;
  --surface-2: #372A59;
  --line:      rgba(255, 255, 255, 0.09);
  --text:      #F5F0FF;
  --muted:     #A99CC9;
  --magenta:   #FF4D9D;
  --yellow:    #FFD23F;
  --violet:    #8B5CF6;
  --danger:    #FF6B6B;
  --green:     #3DD68C;

  --fusion: linear-gradient(135deg, #FF4D9D 0%, #8B5CF6 100%);
  --radius: 22px;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  /* Default fallback — overridden by monthly .month-* class */
  background: linear-gradient(to top,
    #2fd47f 0%,
    #2f8fe0 32%,
    #7c3aed 60%,
    #2a1240 82%,
    #000000 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ---------- Seasonal backgrounds (one per month, auto-applied) ---------- */
body[class*="month-"] {
  background: none;
  background-color: #000;
}
body[class*="month-"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
body[class*="month-"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.80) 100%);
}
body.month-1::before  { background-image: url(../images/backgrounds/1.jpg);  }
body.month-2::before  { background-image: url(../images/backgrounds/2.jpg);  }
body.month-3::before  { background-image: url(../images/backgrounds/3.jpg);  }
body.month-4::before  { background-image: url(../images/backgrounds/4.jpg);  }
body.month-5::before  { background-image: url(../images/backgrounds/5.jpg);  }
body.month-6::before  { background-image: url(../images/backgrounds/6.jpg);  }
body.month-7::before  { background-image: url(../images/backgrounds/7.jpg);  }
body.month-8::before  { background-image: url(../images/backgrounds/8.jpg);  }
body.month-9::before  { background-image: url(../images/backgrounds/9.jpg);  }
body.month-10::before { background-image: url(../images/backgrounds/10.jpg); }
body.month-11::before { background-image: url(../images/backgrounds/11.jpg); }
body.month-12::before { background-image: url(../images/backgrounds/12.jpg); }

/* ---------- Intro splash ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px calc(24px + env(safe-area-inset-right, 0px)) 24px calc(24px + env(safe-area-inset-left, 0px));
  background:
    radial-gradient(1200px 600px at 50% -10%, #3A265E 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  animation: fade .3s ease;
}
.intro[hidden] { display: none; }
.intro.is-hiding {
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}
.intro-avatar {
  width: clamp(190px, 56vw, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 28%;               /* keep her face in frame */
  border: 4px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 60px rgba(255, 77, 157, 0.25);
}
.intro-title {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(30px, 9vw, 46px);
  letter-spacing: -0.5px;
  margin: 26px 0 0;
  line-height: 1;
}
.intro-version {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 8px 0 0;
  opacity: 0.85;
}
.intro-text {
  color: var(--muted);
  font-size: clamp(16px, 4.6vw, 21px);
  font-weight: 700;
  line-height: 1.4;
  margin: 16px 0 0;
}
.intro-btn {
  margin-top: 34px;
  padding: 18px 52px;
  border: 0;
  border-radius: var(--radius);
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 24px;
  color: #fff;
  background: var(--fusion);
  box-shadow: 0 14px 34px rgba(255, 77, 157, 0.4);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
}
.intro-btn:active { transform: translateY(2px) scale(0.98); }

.app {
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 20px 108px;   /* room for the tab bar */
  display: flex;
  flex-direction: column;
}

/* Subtle refresh button, top-right */
.refresh-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: 12px;
  z-index: 30;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  opacity: 0.55;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity .15s ease, transform .3s ease, color .15s ease;
}
.refresh-btn:hover { opacity: 1; color: var(--text); }
.refresh-btn:active { transform: scale(0.9); }

/* Subtle version number, left of the refresh button */
.bg-cycle-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  left: 6px;
  z-index: 30;
  width: 40px;
  height: 40px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  -webkit-tap-highlight-color: transparent;
}

.version {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: 54px;
  z-index: 30;
  height: 34px;
  display: flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.28);
  pointer-events: none;
}
.refresh-btn.is-spinning svg { animation: spin .7s linear infinite; }

/* ---------- Views ---------- */
.view { display: none; flex: 1; flex-direction: column; animation: viewIn .25s ease; }
.view.is-active { display: flex; }

/* Centre the Create view in the viewport. Safe because .app uses min-height,
   not height: if the content ever outgrows the screen the page simply grows
   and scrolls, instead of centring clipping the top out of reach.
   Library stays top-aligned — a gallery reads top-down, and its empty state
   already centres itself. */
#view-create.is-active { justify-content: center; }
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Top bar ---------- */
.topbar { padding: 26px 4px 8px; }

.topbar-head {
  display: flex;
  flex-direction: column;   /* picture stacked above the title */
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: fit-content;       /* shrink to the lockup so it can actually centre */
  max-width: 100%;
  margin: 0 auto;
}
.avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 181px;
  height: 181px;
}
.avatar-lock {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
  pointer-events: none;
  z-index: 1;
  animation: lockPop .25s ease;
}
.avatar-lock[hidden] { display: none; }
@keyframes lockPop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.topbar-avatar {
  width: 181px;
  height: 181px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  transition: transform .15s ease;
  animation: avatarGlow 5s ease-in-out infinite;
}
@keyframes avatarGlow {
  0%, 100% { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 22px 4px rgba(255, 255, 255, 0.35); }
  50%      { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 48px 12px rgba(255, 255, 255, 0.8); }
}
.topbar-avatar:active { transform: scale(0.96); }
@media (prefers-reduced-motion: reduce) {
  .topbar-avatar { animation: none; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 30px 6px rgba(255, 255, 255, 0.5); }
}
/* Showing your latest creation instead of the photo: fill the circle nicely */
.topbar-avatar.showing-emoji {
  object-fit: contain;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 77, 157, 0.35), transparent 70%),
    var(--surface);
}
.topbar-text {
  min-width: 0;
  text-align: center;
  position: relative;
  z-index: 1;
  margin-top: -52px;   /* pull the title up so it overlaps the photo */
  padding: 10px 24px;
  /* soft dark glow behind the title for contrast against the photo */
  background: radial-gradient(ellipse at center,
    rgba(21, 13, 38, 0.9) 0%,
    rgba(21, 13, 38, 0.6) 45%,
    transparent 75%);
}
.topbar-text .wordmark { text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7); }

.wordmark {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.5px;
  margin: 0;
  line-height: 1;
}
#view-create .wordmark { font-size: 38px; }   /* a little bigger on the main screen */
.wordmark-accent { color: var(--yellow); }

.tagline {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  margin: 8px 0 0;
}

/* ---------- Fusion (the hero) ---------- */
.fusion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 30px 0 26px;
}

.slot-wrap {
  position: relative;
  flex: 1 1 0;                 /* grow to fill the row width */
  max-width: 200px;           /* but not too big on wide screens */
}
.slot-hint {
  position: absolute;
  top: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  pointer-events: none;
  display: none;              /* shown only on first load via .show-hints */
  animation: hintBob 1s ease-in-out infinite alternate;
}
.fusion.show-hints .slot-hint { display: block; }
@keyframes hintBob { from { transform: translateY(0); } to { transform: translateY(-4px); } }

.slot {
  position: relative;
  width: 100%;                 /* fill the wrapper */
  height: auto;
  aspect-ratio: 1;            /* keep the slots square */
  border-radius: 30px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .2s ease;
  font-family: inherit;
}
.slot:active { transform: scale(0.95); }
.slot:focus-within {
  outline: none;
  border-color: var(--magenta);
  box-shadow: 0 0 0 4px rgba(255, 77, 157, 0.25), 0 10px 30px rgba(255, 77, 157, 0.2);
}
.slot-glyph {
  font-size: clamp(62px, 20vw, 104px);   /* scales with the wider slots */
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}
.slot-glyph.is-empty { opacity: 0.28; }

/* Casino-reel spin for "I feel lucky" */
.slot { overflow: hidden; }              /* clip the rolling glyph like a reel window */
@keyframes reelRoll {
  0%   { transform: translateY(-16%); }
  100% { transform: translateY(16%); }
}
.slot-glyph.is-spinning {
  animation: reelRoll .1s linear infinite;
  filter: blur(0.7px) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}
@keyframes reelLand {
  0%   { transform: translateY(-34%) scale(1.18); }
  55%  { transform: translateY(7%)   scale(0.9); }
  100% { transform: translateY(0)    scale(1); }
}
.slot-glyph.is-landed { animation: reelLand .36s cubic-bezier(.2, .8, .3, 1.25); }

@media (prefers-reduced-motion: reduce) {
  .slot-glyph.is-spinning { animation: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); }
  .slot-glyph.is-landed { animation: none; }
}

.fusion-mark {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 30px;
  color: var(--yellow);
  opacity: 0.85;
}

/* ---------- Merge button ---------- */
.merge-btn {
  position: relative;
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: var(--radius);
  padding: 18px;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 20px;
  color: #fff;
  background: var(--fusion);
  box-shadow: 0 12px 30px rgba(255, 77, 157, 0.32);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
  overflow: hidden;
}
.merge-btn:active { transform: translateY(2px) scale(0.99); box-shadow: 0 6px 16px rgba(255, 77, 157, 0.3); }
/* Quick wiggle, then rest; repeats until MASH or SPIN is pressed. */
.merge-btn.is-nudging { animation: mashNudge 2.4s ease-in-out .3s infinite; }
@keyframes mashNudge {
  0%, 30%, 100% { transform: rotate(0) scale(1); }
  5%  { transform: rotate(-2.5deg) scale(1.03); }
  10% { transform: rotate(2.5deg) scale(1.03); }
  15% { transform: rotate(-2deg) scale(1.03); }
  20% { transform: rotate(1.5deg) scale(1.02); }
  25% { transform: rotate(-0.5deg) scale(1.01); }
}
@media (prefers-reduced-motion: reduce) {
  .merge-btn.is-nudging { animation: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7), 0 12px 30px rgba(255, 77, 157, 0.32); }
}
.merge-btn:disabled { cursor: default; }
.merge-btn.is-loading .merge-btn-label { visibility: hidden; }
.merge-btn.is-loading .merge-btn-spinner { display: block; }

.merge-btn-spinner {
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  width: 24px; height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- I feel lucky ---------- */
.lucky-btn {
  position: relative;
  display: block;
  width: 100%;
  margin: 12px 0 0;
  padding: 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--yellow);
  color: #1E1533;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(255, 210, 63, 0.32);
  transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease;
}
.lucky-btn:active { transform: scale(0.96); }
.lucky-btn:disabled { cursor: default; opacity: 0.6; }
.lucky-btn.is-loading .lucky-btn-label { visibility: hidden; }
.lucky-btn.is-loading .lucky-btn-spinner { display: block; }

.lucky-btn-spinner {
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(30, 21, 51, 0.25);
  border-top-color: #1E1533;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  min-height: 20px;
  margin: 14px 0 0;
}
.hint.is-error { color: var(--yellow); font-weight: 700; }

.mash-counter {
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 4px 0 0;
}

/* Mash screen fits one screen: no page scroll or rubber-banding. Library still scrolls. */
html:has(body.lock-scroll) { overflow: hidden; height: 100%; }
body.lock-scroll { position: fixed; inset: 0; overflow: hidden; }
body.lock-scroll .app { height: 100dvh; min-height: 0; overflow: hidden; }
/* body is pinned to the edges here, so the root's safe-area padding no longer applies. */
body.lock-scroll .app { padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }
/* iPad landscape (~768px tall) has no spare room for the extra 12px. */
@media (min-height: 761px) and (max-height: 800px) {
  body.lock-scroll .topbar { padding-top: 14px; }
}

/* Short screens (Safari toolbars, iPhone SE): shrink so MASH stays above the tab bar. */
@media (max-height: 760px) {
  .topbar { padding-top: 14px; }
  .avatar-wrap, .topbar-avatar { width: 140px; height: 140px; }
  .topbar-text { margin-top: -44px; }
  .fusion { margin: 16px 0 12px; }
  .slot-wrap { max-width: 150px; }
  .slot-glyph { font-size: clamp(56px, 16vw, 84px); }
  .lucky-btn, .merge-btn { padding: 14px; }
  .lucky-btn { margin-top: 8px; }
  .merge-btn { margin-top: 10px; }
  .hint { margin-top: 10px; }
}
@media (max-height: 620px) {
  .topbar { padding-top: 8px; }
  .avatar-wrap, .topbar-avatar { width: 104px; height: 104px; }
  .topbar-text { margin-top: -34px; padding: 6px 20px; }
  #view-create .wordmark { font-size: 30px; }
  .fusion { margin: 14px 0 8px; }
  .slot-wrap { max-width: 118px; }
  .slot-glyph { font-size: clamp(48px, 13vw, 66px); }
  .lucky-btn, .merge-btn { padding: 11px; font-size: 18px; }
  .hint { margin-top: 6px; }
}

/* iOS ignores orientation locks, so ask phones in landscape to rotate back. */
.rotate-notice { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .rotate-notice {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #150D26;
    color: var(--text);
    font-family: "Fredoka", sans-serif;
    font-size: 20px;
    text-align: center;
  }
  .rotate-notice p { margin: 0; }
  .rotate-notice-icon { font-size: 48px; animation: rotateHint 1.6s ease-in-out infinite; }
}
@keyframes rotateHint {
  0%, 30% { transform: rotate(-90deg); }
  60%, 100% { transform: rotate(0deg); }
}

/* ---------- Result ---------- */
/* Centered popup reveal (uses .sheet-backdrop for the overlay) */
.result-modal {
  width: 100%;
  max-width: 360px;
  margin: 0 16px;
  padding: 24px;             /* consistent all the way around */
  border-radius: 28px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: pop .35s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes pop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.result-frame {
  width: 208px;
  height: 208px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid #fff;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 77, 157, 0.45), rgba(139, 92, 246, 0.28) 45%, transparent 72%),
    var(--surface);
  display: grid;
  place-items: center;
  box-shadow: 0 0 44px rgba(255, 77, 157, 0.35), inset 0 0 30px rgba(139, 92, 246, 0.22);
  animation: resultGlow 2.6s ease-in-out infinite;
}
@keyframes resultGlow {
  0%, 100% { box-shadow: 0 0 32px rgba(255, 77, 157, 0.30), inset 0 0 24px rgba(139, 92, 246, 0.20); }
  50%      { box-shadow: 0 0 60px rgba(255, 77, 157, 0.58), inset 0 0 38px rgba(139, 92, 246, 0.36); }
}

/* 25% bigger (128 -> 160) with a white outline traced around the emoji */
.result-img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  filter:
    drop-shadow(2px 0 0 #fff)   drop-shadow(-2px 0 0 #fff)
    drop-shadow(0 2px 0 #fff)   drop-shadow(0 -2px 0 #fff)
    drop-shadow(1.5px 1.5px 0 #fff)  drop-shadow(-1.5px 1.5px 0 #fff)
    drop-shadow(1.5px -1.5px 0 #fff) drop-shadow(-1.5px -1.5px 0 #fff);
  /* gentle grow + wiggle in on reveal (replays each time the popup opens) */
  animation: emojiReveal .6s ease .14s both;
  transform-origin: center;
}
@keyframes emojiReveal {
  0%   { transform: scale(0.7) rotate(0deg); opacity: 0; }
  45%  { transform: scale(1.1) rotate(-5deg); opacity: 1; }
  65%  { transform: scale(1.04) rotate(4deg); }
  80%  { transform: scale(1.01) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.result-img.is-cat {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .result-frame { animation: none; }
  .result-img { animation: none; }
}

.result-name {
  display: block;
  width: 100%;
  margin: 0 0 16px;                       /* title sits at the top of the modal */
  padding: 4px 6px;
  text-align: center;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(38px, 13vw, 52px);     /* much larger title */
  line-height: 1.05;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 2px dashed transparent;
  border-radius: 8px;
  transition: border-color .15s ease, background .15s ease;
  /* grow + bounce in on reveal (replays each time the popup opens) */
  animation: titlePop .55s cubic-bezier(.2, 1.5, .4, 1) .08s both;
  transform-origin: center;
}
@keyframes titlePop {
  0%   { transform: scale(0.2); opacity: 0; }
  55%  { transform: scale(1.18); opacity: 1; }
  75%  { transform: scale(0.94); }
  90%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .result-name { animation: none; }
}
/* Longer names (>12 chars) get a 20% smaller font so they don't clip. */
.result-name.is-long { font-size: clamp(30px, 10.4vw, 42px); }
.result-name:focus {
  outline: none;
  border-bottom-color: var(--magenta);
  background: rgba(255, 255, 255, 0.04);
}

.result-recipe {
  text-align: center;
  font-size: 26px;
  margin: 8px 0 0;
  color: var(--muted);
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- Buttons ---------- */
.btn {
  flex: 1;
  border: 0;
  border-radius: 14px;
  padding: 13px 10px;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}
.btn:active { transform: scale(0.96); }
.btn-primary   { background: var(--yellow); color: #3A2A00; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-ghost     { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-danger    { background: rgba(255, 107, 107, 0.14); color: var(--danger); }

/* Result popup: pastel red / yellow / green */
.btn-discard { background: #FFB3B3; color: #6B1414; }
.btn-share   { background: #FFE9A3; color: #6B5410; }
.btn-save    { background: #AEE6C4; color: #14563A; }

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 600px) { .gallery { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 380px) { .gallery { grid-template-columns: repeat(2, 1fr); } }

.card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 8px;
  cursor: pointer;
  transition: transform .12s ease, border-color .15s ease;
  animation: pop .3s ease backwards;
  overflow: hidden;
}
.card:active { transform: scale(0.95); }
.card img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.card-name {
  font-family: "Fredoka", sans-serif;
  font-weight: 500;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  margin-top: 4px;
  flex-shrink: 0;
}

/* ---------- Empty state ---------- */
.empty {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 60px;
  color: var(--muted);
}
.empty.is-shown { display: flex; }
.empty-glyph { font-size: 44px; color: var(--yellow); opacity: 0.7; }
.empty-title { font-family: "Fredoka", sans-serif; font-size: 20px; color: var(--text); margin: 14px 0 4px; }
.empty-sub { font-size: 14px; margin: 0; }

/* ---------- Easter egg: Cosmic Rainbow Cat ---------- */
/* ---------- Universal Easter egg overlay (data-driven) ---------- */
.egg-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #12082e 0%, #05010f 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fade .25s ease;
}
.egg-overlay[hidden] { display: none; }
.egg-overlay.bg-fireworks {
  background: radial-gradient(circle at 50% 30%, #2a1a4a 0%, #0a0618 75%);
}

/* starfield */
.egg-bg-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 10px 20px, #fff 99%, transparent),
    radial-gradient(1.5px 1.5px at 90px 50px, #fff 99%, transparent),
    radial-gradient(1px 1px at 130px 100px, #fff 99%, transparent),
    radial-gradient(2px 2px at 50px 130px, #fff 99%, transparent),
    radial-gradient(1px 1px at 30px 90px, #fff 99%, transparent),
    radial-gradient(1.5px 1.5px at 150px 30px, #fff 99%, transparent);
  background-size: 160px 160px;
  animation: eggStars 2.2s linear infinite;
  opacity: 0.85;
}
.egg-bg-stars[hidden] { display: none; }
@keyframes eggStars { to { background-position: -160px 0; } }

/* fireworks */
.egg-bg-fireworks { position: absolute; inset: 0; pointer-events: none; opacity: 0.8; }
.egg-bg-fireworks[hidden] { display: none; }
.fw {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  opacity: 0;
  box-shadow:
    0 -62px 0 0, 44px -44px 0 0, 62px 0 0 0, 44px 44px 0 0,
    0 62px 0 0, -44px 44px 0 0, -62px 0 0 0, -44px -44px 0 0,
    0 -84px 0 0, 60px -60px 0 0, 84px 0 0 0, 60px 60px 0 0,
    0 84px 0 0, -60px 60px 0 0, -84px 0 0 0, -60px -60px 0 0;
  animation: fwBurst 2.4s ease-out infinite;
}
@keyframes fwBurst {
  0%   { transform: scale(0.1); opacity: 0; }
  12%  { opacity: 1; }
  70%  { opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 0; }
}
.fw1 { top: 20%; left: 22%; color: #ff5d8f; animation-delay: 0s;    animation-duration: 2.6s; }
.fw2 { top: 26%; left: 74%; color: #46b6ff; animation-delay: .5s;   animation-duration: 2.2s; }
.fw3 { top: 58%; left: 28%; color: #ffd23f; animation-delay: 1.1s;  animation-duration: 2.8s; }
.fw4 { top: 66%; left: 76%; color: #57e08b; animation-delay: 1.7s;  animation-duration: 2.4s; }
.fw5 { top: 44%; left: 52%; color: #b45aff; animation-delay: .9s;   animation-duration: 3s; }
.fw6 { top: 78%; left: 48%; color: #ff9a2d; animation-delay: 2.1s;  animation-duration: 2.5s; }

/* egg image — two preset styles */
.egg-image {
  position: relative;
  z-index: 1;
  width: clamp(280px, 92vw, 520px);
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}
.egg-image.is-photo {
  width: clamp(280px, 88vw, 460px);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  animation: pop .4s cubic-bezier(.2, 1.3, .4, 1);
}

.egg-caption {
  position: relative;
  z-index: 1;
  margin: 34px 0 0;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: clamp(20px, 6vw, 28px);
  color: #fff;
  text-shadow: 0 0 16px rgba(180, 90, 255, 0.7);
}
.egg-actions {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  display: flex;
  gap: 12px;
}
.egg-close, .egg-save {
  padding: 12px 28px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.egg-save {
  background: rgba(61, 214, 140, 0.25);
  border-color: rgba(61, 214, 140, 0.5);
}

/* --- particle container (shared by confetti, hearts, bubbles, snow, sparkle, disco, rain, aurora) --- */
.egg-bg-particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.egg-bg-particles[hidden] { display: none; }

/* --- confetti: falling colorful rectangles --- */
.bg-confetti { background: radial-gradient(circle at 50% 40%, #1a0a3e 0%, #080218 70%); }
.bg-confetti .pt {
  position: absolute; top: -20px;
  width: 10px; height: 14px; border-radius: 2px;
  animation: confettiFall linear infinite;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 0.9; }
  100% { transform: translateY(calc(100vh + 20px)) rotate(720deg); opacity: 0.2; }
}
.bg-confetti .pt1 { left: 8%;  background: #ff5d8f; animation-duration: 2.8s; }
.bg-confetti .pt2 { left: 22%; background: #46b6ff; animation-duration: 3.4s; animation-delay: .4s; width: 8px; height: 12px; }
.bg-confetti .pt3 { left: 38%; background: #ffd23f; animation-duration: 2.6s; animation-delay: .8s; }
.bg-confetti .pt4 { left: 52%; background: #57e08b; animation-duration: 3.2s; animation-delay: 1.2s; width: 12px; height: 10px; }
.bg-confetti .pt5 { left: 65%; background: #b45aff; animation-duration: 2.9s; animation-delay: .2s; }
.bg-confetti .pt6 { left: 78%; background: #ff9a2d; animation-duration: 3.6s; animation-delay: .6s; width: 8px; height: 16px; }
.bg-confetti .pt7 { left: 90%; background: #ff5d8f; animation-duration: 3.1s; animation-delay: 1s; }
.bg-confetti .pt8 { left: 45%; background: #46b6ff; animation-duration: 2.7s; animation-delay: 1.5s; width: 12px; height: 8px; }

/* --- hearts: floating hearts rising --- */
.bg-hearts { background: radial-gradient(circle at 50% 60%, #3a0a2e 0%, #0a0210 70%); }
.bg-hearts .pt {
  position: absolute; bottom: -30px;
  font-size: 24px; line-height: 1;
  animation: heartFloat ease-in-out infinite;
}
@keyframes heartFloat {
  0%   { transform: translateY(0) scale(.5) rotate(0deg); opacity: 0; }
  10%  { opacity: .7; }
  90%  { opacity: .4; }
  100% { transform: translateY(calc(-100vh - 40px)) scale(1) rotate(15deg); opacity: 0; }
}
.bg-hearts .pt1 { left: 10%; animation-duration: 4s; }
.bg-hearts .pt1::before { content: '❤️'; }
.bg-hearts .pt2 { left: 25%; animation-duration: 5s; animation-delay: .8s; }
.bg-hearts .pt2::before { content: '💖'; }
.bg-hearts .pt3 { left: 40%; animation-duration: 4.5s; animation-delay: 1.5s; }
.bg-hearts .pt3::before { content: '💜'; }
.bg-hearts .pt4 { left: 55%; animation-duration: 3.8s; animation-delay: .3s; }
.bg-hearts .pt4::before { content: '💗'; }
.bg-hearts .pt5 { left: 70%; animation-duration: 4.8s; animation-delay: 2s; }
.bg-hearts .pt5::before { content: '❤️'; }
.bg-hearts .pt6 { left: 85%; animation-duration: 4.2s; animation-delay: 1s; }
.bg-hearts .pt6::before { content: '💕'; }
.bg-hearts .pt7 { left: 15%; animation-duration: 5.2s; animation-delay: 2.5s; }
.bg-hearts .pt7::before { content: '💖'; }
.bg-hearts .pt8 { left: 60%; animation-duration: 3.5s; animation-delay: .5s; }
.bg-hearts .pt8::before { content: '💗'; }

/* --- bubbles: translucent circles rising --- */
.bg-bubbles { background: radial-gradient(circle at 50% 60%, #0a1a3e 0%, #020810 70%); }
.bg-bubbles .pt {
  position: absolute; bottom: -40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.15), transparent);
  animation: bubbleRise ease-in infinite;
}
@keyframes bubbleRise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: .6; }
  100% { transform: translateY(calc(-100vh - 50px)) translateX(30px); opacity: 0; }
}
.bg-bubbles .pt1 { left: 12%; width: 30px; height: 30px; animation-duration: 5s; }
.bg-bubbles .pt2 { left: 28%; width: 20px; height: 20px; animation-duration: 4s;   animation-delay: .7s; }
.bg-bubbles .pt3 { left: 42%; width: 36px; height: 36px; animation-duration: 6s;   animation-delay: 1.4s; }
.bg-bubbles .pt4 { left: 58%; width: 24px; height: 24px; animation-duration: 4.5s; animation-delay: .3s; }
.bg-bubbles .pt5 { left: 72%; width: 28px; height: 28px; animation-duration: 5.5s; animation-delay: 2s; }
.bg-bubbles .pt6 { left: 85%; width: 18px; height: 18px; animation-duration: 3.8s; animation-delay: 1s; }
.bg-bubbles .pt7 { left: 20%; width: 22px; height: 22px; animation-duration: 4.8s; animation-delay: 2.5s; }
.bg-bubbles .pt8 { left: 65%; width: 32px; height: 32px; animation-duration: 5.2s; animation-delay: .5s; }

/* --- snow: gently falling snowflakes --- */
.bg-snow { background: radial-gradient(circle at 50% 30%, #1a2a4a 0%, #060a18 70%); }
.bg-snow .pt {
  position: absolute; top: -10px;
  background: #fff; border-radius: 50%;
  animation: snowFall linear infinite;
}
@keyframes snowFall {
  0%   { transform: translateY(-10px) translateX(0); opacity: .8; }
  50%  { transform: translateY(50vh) translateX(20px); }
  100% { transform: translateY(calc(100vh + 10px)) translateX(-10px); opacity: .3; }
}
.bg-snow .pt1 { left: 5%;  width: 6px; height: 6px; animation-duration: 6s; }
.bg-snow .pt2 { left: 18%; width: 10px; height: 10px; animation-duration: 8s;   animation-delay: 1s; }
.bg-snow .pt3 { left: 32%; width: 5px; height: 5px; animation-duration: 5.5s; animation-delay: 2s; }
.bg-snow .pt4 { left: 48%; width: 8px; height: 8px; animation-duration: 7s;   animation-delay: .5s; }
.bg-snow .pt5 { left: 62%; width: 6px; height: 6px; animation-duration: 6.5s; animation-delay: 3s; }
.bg-snow .pt6 { left: 75%; width: 12px; height: 12px; animation-duration: 9s;   animation-delay: 1.5s; }
.bg-snow .pt7 { left: 88%; width: 7px; height: 7px; animation-duration: 5s;   animation-delay: .8s; }
.bg-snow .pt8 { left: 40%; width: 4px; height: 4px; animation-duration: 7.5s; animation-delay: 2.5s; }

/* --- sparkle: twinkling dots fading in and out --- */
.bg-sparkle { background: radial-gradient(circle at 50% 40%, #12082e 0%, #05010f 70%); }
.bg-sparkle .pt {
  position: absolute;
  width: 4px; height: 4px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 0 6px 2px rgba(255, 255, 255, .6);
  animation: sparklePulse ease-in-out infinite;
}
@keyframes sparklePulse {
  0%, 100% { transform: scale(0); opacity: 0; }
  50%      { transform: scale(1); opacity: 1; }
}
.bg-sparkle .pt1 { top: 15%; left: 20%; animation-duration: 2s; }
.bg-sparkle .pt2 { top: 30%; left: 75%; animation-duration: 2.5s; animation-delay: .5s; box-shadow: 0 0 8px 3px rgba(255,200,100,.6); }
.bg-sparkle .pt3 { top: 55%; left: 35%; animation-duration: 1.8s; animation-delay: 1s; }
.bg-sparkle .pt4 { top: 70%; left: 80%; animation-duration: 2.2s; animation-delay: .3s; box-shadow: 0 0 8px 3px rgba(180,90,255,.6); }
.bg-sparkle .pt5 { top: 25%; left: 50%; animation-duration: 2.8s; animation-delay: 1.5s; }
.bg-sparkle .pt6 { top: 80%; left: 15%; animation-duration: 2s;   animation-delay: .8s; box-shadow: 0 0 8px 3px rgba(100,200,255,.6); }
.bg-sparkle .pt7 { top: 45%; left: 90%; animation-duration: 2.4s; animation-delay: 2s; }
.bg-sparkle .pt8 { top: 65%; left: 55%; animation-duration: 1.6s; animation-delay: .2s; }

/* --- disco: drifting colored light blobs --- */
.bg-disco { background: #0a0010; }
.bg-disco .pt {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  animation: discoMove ease-in-out infinite;
}
@keyframes discoMove {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(30px, -40px) scale(1.1); }
  50%      { transform: translate(-20px, 30px) scale(.9); }
  75%      { transform: translate(40px, 20px) scale(1.05); }
}
.bg-disco .pt1 { top: 10%; left: 10%; width: 140px; height: 140px; background: rgba(255,0,255,.3);  animation-duration: 6s; }
.bg-disco .pt2 { top: 50%; left: 55%; width: 160px; height: 160px; background: rgba(0,255,255,.25); animation-duration: 8s;  animation-delay: 1s; }
.bg-disco .pt3 { top: 70%; left: 25%; width: 120px; height: 120px; background: rgba(255,255,0,.2);  animation-duration: 5s;  animation-delay: 2s; }
.bg-disco .pt4 { top: 25%; left: 70%; width: 130px; height: 130px; background: rgba(255,0,100,.25); animation-duration: 7s;  animation-delay: .5s; }
.bg-disco .pt5 { top: 40%; left: 40%; width: 100px; height: 100px; background: rgba(0,200,100,.2);  animation-duration: 9s;  animation-delay: 3s; }
.bg-disco .pt6 { top: 80%; left: 75%; width: 110px; height: 110px; background: rgba(100,0,255,.25); animation-duration: 6.5s; animation-delay: 1.5s; }
.bg-disco .pt7 { top: 5%;  left: 50%; width: 90px; height: 90px;   background: rgba(255,100,0,.2);  animation-duration: 7.5s; animation-delay: 2.5s; }
.bg-disco .pt8 { top: 60%; left: 5%;  width: 150px; height: 150px; background: rgba(0,100,255,.2);  animation-duration: 8.5s; animation-delay: .8s; }

/* --- rain: falling streaks --- */
.bg-rain { background: linear-gradient(to bottom, #0a1020 0%, #081018 100%); }
.bg-rain .pt {
  position: absolute; top: -30px;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(150,200,255,.5));
  border-radius: 0 0 2px 2px;
  animation: rainDrop linear infinite;
}
@keyframes rainDrop {
  0%   { transform: translateY(-30px); opacity: .7; }
  100% { transform: translateY(calc(100vh + 30px)); opacity: .3; }
}
.bg-rain .pt1 { left: 8%;  height: 28px; animation-duration: .8s; }
.bg-rain .pt2 { left: 22%; height: 22px; animation-duration: .7s; animation-delay: .15s; }
.bg-rain .pt3 { left: 35%; height: 32px; animation-duration: .9s; animation-delay: .35s; }
.bg-rain .pt4 { left: 50%; height: 24px; animation-duration: .65s; animation-delay: .1s; }
.bg-rain .pt5 { left: 63%; height: 30px; animation-duration: .85s; animation-delay: .25s; }
.bg-rain .pt6 { left: 78%; height: 20px; animation-duration: .75s; animation-delay: .45s; }
.bg-rain .pt7 { left: 88%; height: 26px; animation-duration: .6s; animation-delay: .05s; }
.bg-rain .pt8 { left: 42%; height: 18px; animation-duration: .95s; animation-delay: .3s; }

/* --- aurora: shifting color bands --- */
.bg-aurora { background: #020810; }
.bg-aurora .pt {
  position: absolute; top: 0; left: -20%;
  width: 80%; height: 55%;
  border-radius: 0 0 50% 50%;
  filter: blur(60px);
  animation: auroraWave ease-in-out infinite;
}
@keyframes auroraWave {
  0%, 100% { transform: translateX(0) scaleX(1); opacity: .2; }
  50%      { transform: translateX(15%) scaleX(1.3); opacity: .4; }
}
.bg-aurora .pt1 { background: rgba(0,255,128,.35);  animation-duration: 8s; left: -20%; }
.bg-aurora .pt2 { background: rgba(0,128,255,.3);   animation-duration: 10s; animation-delay: 2s; left: 10%; }
.bg-aurora .pt3 { background: rgba(128,0,255,.3);   animation-duration: 7s;  animation-delay: 1s; left: 30%; }
.bg-aurora .pt4 { background: rgba(0,200,200,.25);  animation-duration: 9s;  animation-delay: 3s; left: 50%; }
.bg-aurora .pt5 { background: rgba(80,255,80,.2);   animation-duration: 11s; animation-delay: 4s; left: -10%; top: 10%; }
.bg-aurora .pt6 { background: rgba(0,180,255,.2);   animation-duration: 8.5s; animation-delay: 1.5s; left: 40%; top: 5%; }
.bg-aurora .pt7 { display: none; }
.bg-aurora .pt8 { display: none; }

@media (prefers-reduced-motion: reduce) {
  .egg-bg-stars { animation: none; }
  .fw { animation: none; opacity: 0.5; }
  .pt { animation: none; opacity: 0.5; }
  .egg-image.is-photo { animation: none; }
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(21, 13, 38, 0.4), rgba(21, 13, 38, 0.92));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  max-width: 200px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: color .15s ease;
}
.tab-glyph {
  font-size: 20px;
  line-height: 1;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease;
}
.tab.is-active { color: var(--text); }
.tab.is-active .tab-glyph { color: var(--magenta); transform: scale(1.1); }
.tab-share:active .tab-glyph { transform: scale(0.9); }

/* ---------- Share modal ---------- */
.share-modal {
  width: 100%;
  max-width: 340px;
  margin: 0 16px;
  padding: 28px 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: pop .35s cubic-bezier(.2, 1.3, .4, 1);
  text-align: center;
}
.share-title {
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 22px;
  margin: 0 0 20px;
}
.share-qr {
  display: block;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  width: 200px;
  height: 200px;
}
.share-actions {
  display: flex;
  gap: 10px;
}
.share-close { display: block; width: 100%; margin-top: 10px; padding: 14px 10px; font-size: 14px; }
.share-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  padding: 14px 10px;
}
.share-action-btn:first-child { background: var(--yellow); color: #3A2A00; }
.share-action-btn:last-child  { background: #AEE6C4; color: #14563A; }

/* ---------- Detail sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 6, 20, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  align-items: end;
  animation: fade .2s ease;
}
/* display:grid above would otherwise beat the hidden attribute and leave the
   sheet covering the whole app (it's inset:0, so it eats every tap). */
.sheet-backdrop[hidden] { display: none; }
/* Center the dialog on screen instead of docking it to the bottom. */
.sheet-backdrop.backdrop-center { align-items: center; justify-items: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border-top: 1px solid var(--line);
  padding: 26px 22px calc(26px + env(safe-area-inset-bottom, 0px));
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  animation: sheetUp .3s cubic-bezier(.2, 1, .3, 1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-frame {
  width: 180px; height: 180px;
  margin: 0 auto;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 40%, rgba(139, 92, 246, 0.25), transparent 70%), var(--bg);
  display: grid; place-items: center;
}
.sheet-img { width: 132px; height: 132px; object-fit: contain; }
.sheet-name { font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 26px; text-align: center; margin: 16px 0 2px; }
.sheet-recipe { text-align: center; color: var(--muted); font-size: 22px; margin: 0 0 20px; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-feature { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); flex-basis: 100%; }
.sheet-close {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

/* ---------- Emoji picker ---------- */
.sheet-picker {
  display: flex;
  flex-direction: column;
  max-height: 86dvh;
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.picker-tools {
  display: flex;
  gap: 6px;
}
.picker-zoom-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
}
.picker-zoom-btn:active { background: rgba(255, 255, 255, 0.15); }

.picker-keyboard {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}
.picker-kb-input {
  width: 1px;
  height: 1px;
  border: 0;
  padding: 0;
  font-size: 22px;
  background: transparent;
  color: transparent;
  caret-color: transparent;
}

.picker-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin-top: 6px;
}

.picker-group {
  font-family: "Fredoka", sans-serif;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin: 18px 0 8px;
}
.picker-group:first-child { margin-top: 2px; }

.picker-grid {
  display: grid;
  /* Cells grow with the viewport width so emojis are bigger on tablets. */
  grid-template-columns: repeat(auto-fill, minmax(clamp(46px, 11vw, 88px), 1fr));
  gap: clamp(6px, 1.4vw, 12px);
}

.picker-emoji {
  aspect-ratio: 1;
  min-height: clamp(46px, 11vw, 88px);   /* keeps the tap target thumb-sized */
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  font-size: clamp(26px, 6.5vw, 52px);   /* glyph scales with page width */
  line-height: 1;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease;
}
.picker-emoji:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.13);
}

.picker-size-1 .picker-grid { grid-template-columns: repeat(auto-fill, minmax(28px, 1fr)); gap: 4px; }
.picker-size-1 .picker-emoji { min-height: 28px; font-size: 16px; border-radius: 8px; }
.picker-size-2 .picker-grid { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.picker-size-2 .picker-emoji { min-height: 34px; font-size: 20px; border-radius: 10px; }
.picker-size-3 .picker-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
.picker-size-3 .picker-emoji { min-height: 40px; font-size: 23px; border-radius: 12px; }
.picker-size-5 .picker-grid { grid-template-columns: repeat(auto-fill, minmax(clamp(56px, 14vw, 100px), 1fr)); gap: clamp(7px, 1.6vw, 14px); }
.picker-size-5 .picker-emoji { min-height: clamp(56px, 14vw, 100px); font-size: clamp(32px, 8vw, 62px); }
.picker-size-6 .picker-grid { grid-template-columns: repeat(auto-fill, minmax(clamp(66px, 17vw, 112px), 1fr)); gap: clamp(8px, 1.8vw, 16px); }
.picker-size-6 .picker-emoji { min-height: clamp(66px, 17vw, 112px); font-size: clamp(38px, 9.5vw, 72px); }
.picker-size-7 .picker-grid { grid-template-columns: repeat(auto-fill, minmax(clamp(78px, 20vw, 124px), 1fr)); gap: clamp(9px, 2vw, 18px); }
.picker-size-7 .picker-emoji { min-height: clamp(78px, 20vw, 124px); font-size: clamp(44px, 11vw, 82px); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  z-index: 60;
  background: var(--text);
  color: var(--bg-deep);
  font-weight: 800;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.toast.is-shown { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
