:root {
  /* palette — playful candy pastels */
  --bg: #fff0f6;
  --ink: #3a2b3a;
  --ink-soft: #927e92;
  --line: rgba(150, 90, 130, 0.14);
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #fffafc;
  --accent: #ff5fa2;        /* candy pink */
  --accent-2: #9b6cff;      /* violet */
  --accent-3: #ff9ec4;      /* bubblegum */
  --mint: #66e0c2;
  --peach: #ffc07a;
  --good: #43c08a;
  --warn: #f0ad3c;
  --grad: linear-gradient(125deg, var(--accent) 0%, var(--accent-2) 100%);
  --grad-soft: linear-gradient(125deg, #ffdcec 0%, #e7dcff 100%);
  --grad-fun: linear-gradient(125deg, #ff7eb6 0%, #9b6cff 55%, #66e0c2 120%);
  --shadow: 0 14px 40px rgba(200, 70, 140, 0.16);
  --shadow-sm: 0 6px 18px rgba(200, 70, 140, 0.12);
  --radius: 24px;
  --radius-sm: 16px;
  --maxw: 720px;
  --display: "Fredoka", "Plus Jakarta Sans", sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: "Plus Jakarta Sans", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, .display { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }

.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-3); color: #fff; }

/* ---------- animated aurora backdrop ---------- */
.aurora {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background: linear-gradient(180deg, #fff1f7 0%, var(--bg) 50%, #f1ecff 100%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.6; will-change: transform; }
.blob.b1 { width: 46vmax; height: 46vmax; left: -10vmax; top: -12vmax; background: #ffb0d2; animation: drift1 22s ease-in-out infinite; }
.blob.b2 { width: 40vmax; height: 40vmax; right: -12vmax; top: 10vmax; background: #c9b6ff; animation: drift2 26s ease-in-out infinite; }
.blob.b3 { width: 38vmax; height: 38vmax; left: 20vmax; bottom: -16vmax; background: #a8f0dd; animation: drift3 30s ease-in-out infinite; }
@keyframes drift1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(6vmax,4vmax) scale(1.1); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-5vmax,6vmax) scale(1.05); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(4vmax,-5vmax) scale(1.12); } }

/* ---------- very subtle floating layer ---------- */
.floaties { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.floatie {
  position: absolute; bottom: -8vh; font-size: 1.5rem; opacity: 0;
  will-change: transform, opacity; animation: floatUp linear forwards;
}
@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  12% { opacity: 0.16; }
  88% { opacity: 0.16; }
  100% { transform: translateY(-118vh) rotate(40deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .floatie { animation: none !important; }
  .floaties { display: none; }
  .view, .view > *, .card, .msg, .photo { animation: none !important; }
}

/* ---------- Login ---------- */
#login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--card); backdrop-filter: blur(20px) saturate(1.5);
  border: 2px solid rgba(255,255,255,0.7); border-radius: 30px;
  box-shadow: var(--shadow); padding: 38px 28px;
  animation: popIn .55s var(--spring);
}
.login-card h1 { margin: 0 0 4px; font-size: 2.4rem; font-weight: 700; }
.login-card h1 .names {
  background: var(--grad-fun); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.login-card p, .login-card .sub { margin: 0 0 24px; color: var(--ink-soft); font-size: 0.98rem; }
.who { display: flex; gap: 12px; margin-bottom: 18px; }
.who button {
  flex: 1; padding: 18px 8px; border: 2px solid var(--line); border-radius: 20px;
  background: rgba(255,255,255,0.6); font-size: 0.95rem; font-weight: 600; color: var(--ink-soft);
  transition: transform .2s var(--spring), border-color .18s, background .18s;
}
.who button .big { font-size: 2.1rem; display: block; margin-bottom: 4px; transition: transform .25s var(--spring); }
.who button.sel { border-color: transparent; color: var(--ink); background: var(--grad-soft); box-shadow: var(--shadow-sm); }
.who button.sel .big { transform: scale(1.2) rotate(-6deg); }
.who button:active { transform: scale(0.96); }

input, textarea, select {
  font-family: inherit; font-size: 1rem; color: var(--ink);
  background: rgba(255,255,255,0.9); border: 2px solid var(--line); border-radius: 16px;
  padding: 13px 14px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #c2adc0; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(155,108,255,0.16);
}

.btn {
  background: var(--grad); color: #fff; border: none; border-radius: 16px;
  padding: 14px 18px; font-size: 1rem; font-weight: 700; width: 100%;
  box-shadow: 0 8px 20px rgba(255,95,162,0.34); transition: transform .18s var(--spring), box-shadow .2s, filter .2s;
}
.btn:hover { filter: brightness(1.05); box-shadow: 0 12px 28px rgba(255,95,162,0.44); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.96); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.ghost {
  background: rgba(255,255,255,0.8); color: var(--ink-soft); box-shadow: var(--shadow-sm);
  width: auto; padding: 10px 16px; font-weight: 700;
}
.err { color: var(--accent); font-size: 0.9rem; min-height: 1.2em; margin: 12px 0 0; font-weight: 700; }

/* ---------- App shell ---------- */
#app { max-width: var(--maxw); margin: 0 auto; padding: 0 18px 80px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 6px 14px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, var(--bg) 60%, rgba(255,240,246,0));
}
.topbar .title { font-family: var(--display); font-weight: 700; font-size: 1.6rem; }
.topbar .who-chip { color: var(--ink-soft); font-size: 0.88rem; }
.topbar .who-chip b { color: var(--ink); }
.topbar .who-chip button { background: none; border: none; color: var(--accent); font-weight: 700; padding: 0; }

/* springy view entrance + child stagger */
.view { animation: viewIn .4s var(--spring); }
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }
.view > * { animation: popIn .5s var(--spring) both; }
.view > *:nth-child(1) { animation-delay: .02s; }
.view > *:nth-child(2) { animation-delay: .08s; }
.view > *:nth-child(3) { animation-delay: .14s; }
.view > *:nth-child(4) { animation-delay: .20s; }
.view > *:nth-child(5) { animation-delay: .26s; }
.view > *:nth-child(n+6) { animation-delay: .30s; }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); backdrop-filter: blur(14px) saturate(1.3);
  border: 2px solid rgba(255,255,255,0.65); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px; margin-bottom: 16px;
}
h2.section { font-family: var(--display); font-size: 1.3rem; margin: 18px 6px 12px; font-weight: 600; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- countdown to next visit ---------- */
.countdown {
  width: 100%; display: block; text-align: center; border: none; cursor: pointer;
  border-radius: 26px; padding: 24px 20px; color: #fff; background: var(--grad-fun);
  box-shadow: 0 14px 34px rgba(255,95,162,0.34); transition: transform .2s var(--spring), box-shadow .2s;
}
.countdown:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(255,95,162,0.42); }
.countdown:active { transform: scale(0.99); }
.countdown.empty, .countdown.past {
  background: var(--card); color: var(--ink); cursor: default;
  border: 2px solid rgba(255,255,255,0.65); box-shadow: var(--shadow-sm); backdrop-filter: blur(14px);
}
.cd-title { font-weight: 700; font-size: 0.92rem; opacity: 0.95; letter-spacing: .02em; }
.cd-days { margin-top: 6px; font-family: var(--display); font-size: 1.4rem; }
.cd-days .cd-num { font-size: 3rem; font-weight: 700; vertical-align: -2px; }
.cd-big { font-family: var(--display); font-size: 1.8rem; font-weight: 700; }
.cd-hint { margin-top: 8px; font-size: 0.74rem; opacity: 0.85; }
.cd-sub { margin: 8px 0 12px; color: var(--ink-soft); font-size: 0.9rem; }
.cd-edit {
  display: inline-block; margin-top: 12px; background: rgba(255,255,255,0.85); color: var(--accent);
  border: none; border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 0.85rem; box-shadow: var(--shadow-sm);
}
.countdown.empty .cd-edit, .countdown.past .cd-edit { background: var(--grad); color: #fff; }
.cd-editrow { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.cd-editrow input { width: auto; }

/* ---------- streak chip ---------- */
.streak {
  font-family: "Plus Jakarta Sans", sans-serif; font-size: 0.8rem; font-weight: 700;
  color: var(--accent); background: #fff; border: 1.5px solid var(--line);
  padding: 1px 9px; border-radius: 999px; vertical-align: middle; margin-left: 4px;
}

/* ---------- deep questions ---------- */
.deepq { text-align: center; }
.deepq-q { font-family: var(--display); font-size: 1.25rem; line-height: 1.4; margin: 6px 0 16px; }
.deepq .btn { display: inline-block; }

/* ---------- bucket list ---------- */
.bucket-add { display: flex; gap: 8px; margin-bottom: 6px; }
.bucket-add input { flex: 1; }
.bucket-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line);
  animation: popIn .35s var(--spring) both;
}
.bucket-row:last-child { border-bottom: none; }
.bucket-check {
  width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--accent);
  background: #fff; color: #fff; font-size: 0.85rem; display: grid; place-items: center; transition: background .15s, transform .12s var(--spring);
}
.bucket-row.done .bucket-check { background: var(--good); border-color: var(--good); }
.bucket-check:active { transform: scale(0.88); }
.bucket-text { flex: 1; word-break: break-word; }
.bucket-row.done .bucket-text { text-decoration: line-through; color: var(--ink-soft); }
.bucket-del {
  width: 26px; height: 26px; flex: none; border: none; border-radius: 50%; background: transparent;
  color: var(--ink-soft); font-size: 0.9rem; opacity: 0.6; transition: opacity .15s, color .15s, transform .12s var(--spring);
}
.bucket-del:hover { opacity: 1; color: var(--accent); }
.bucket-del:active { transform: scale(0.85); }

/* ---------- daily note hero ---------- */
.daily-hero {
  position: relative; border-radius: 26px; padding: 20px 20px 22px; margin-bottom: 14px;
  background: linear-gradient(135deg, #fffaff, #fff2f8);
  border: 2px solid rgba(255,255,255,0.8); box-shadow: var(--shadow);
}
.daily-hero .badge {
  display: inline-flex; align-items: center; gap: 6px; background: var(--grad);
  color: #fff; font-size: 0.7rem; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.daily-hero .from { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; }
.daily-hero .from .ava {
  font-size: 1.5rem; width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  background: var(--grad-soft); border-radius: 50%; box-shadow: var(--shadow-sm);
}
.daily-hero .from .who { font-weight: 700; }
.daily-hero .from .when { color: var(--ink-soft); font-size: 0.78rem; }
.daily-hero .note { font-family: var(--display); font-size: 1.35rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.daily-hero.empty { text-align: center; }
.daily-hero.empty .note { font-family: inherit; font-size: 1rem; color: var(--ink-soft); }

/* composer locked state */
.composer textarea { resize: vertical; min-height: 70px; margin-bottom: 10px; border-radius: 18px; }
.locked {
  display: grid; gap: 4px; justify-items: center; text-align: center; padding: 8px 4px;
}
.locked .big { font-size: 1.8rem; }
.locked .lk-title { font-weight: 700; }
.locked .lk-sub { color: var(--ink-soft); font-size: 0.85rem; }

.earlier-toggle {
  background: none; border: none; color: var(--accent); font-weight: 700; font-size: 0.9rem;
  padding: 6px; margin: 2px auto 8px; display: block;
}

/* ---------- Messages feed ---------- */
.msg { display: flex; gap: 12px; margin-bottom: 14px; align-items: flex-end; animation: popIn .4s var(--spring) both; }
.msg .ava {
  font-size: 1.4rem; width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  background: var(--grad-soft); border-radius: 50%; box-shadow: var(--shadow-sm);
}
.msg .bubble {
  background: var(--card-solid); border: 2px solid var(--line); border-radius: 22px 22px 22px 7px;
  padding: 12px 16px; max-width: 78%; box-shadow: var(--shadow-sm);
}
.msg .meta { color: var(--ink-soft); font-size: 0.74rem; margin-bottom: 3px; font-weight: 700; }
.msg .text { white-space: pre-wrap; word-break: break-word; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--grad); color: #fff; border-radius: 22px 22px 7px 22px; border-color: transparent; }
.msg.mine .meta { color: rgba(255,255,255,0.85); }
.msg.mine .ava { background: linear-gradient(120deg,#fff,#ffe3ec); }

/* ---------- Photos ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo {
  position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 1;
  background: var(--grad-soft); box-shadow: var(--shadow-sm); transition: transform .2s var(--spring);
  animation: popIn .4s var(--spring) both;
}
.photo:hover { transform: translateY(-4px) scale(1.02) rotate(-1deg); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px;
  background: linear-gradient(transparent, rgba(40,10,30,.6)); color: #fff; font-size: 0.78rem; font-weight: 600;
}
.photo-del {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: none; border-radius: 50%;
  background: rgba(58,43,58,0.6); backdrop-filter: blur(4px); color: #fff; font-size: 0.95rem; line-height: 1;
  display: grid; place-items: center; opacity: 0; transition: opacity .2s, transform .12s var(--spring);
}
.photo:hover .photo-del { opacity: 1; }
.photo-del:hover { background: var(--accent); }
.photo-del:active { transform: scale(0.88); }
@media (hover: none) { .photo-del { opacity: 1; } }

/* ---------- album card (home) ---------- */
.album-card {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  border: 2px solid rgba(255,255,255,0.65); border-radius: var(--radius); background: var(--card);
  backdrop-filter: blur(14px); padding: 14px; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--spring), box-shadow .2s;
}
.album-card:hover { transform: translateY(-3px) scale(1.01); box-shadow: var(--shadow); }
.album-card .cover {
  width: 74px; height: 74px; border-radius: 20px; overflow: hidden; flex: none;
  background: var(--grad-soft); display: grid; place-items: center; font-size: 1.9rem;
}
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.album-card .ac-text { flex: 1; display: grid; gap: 2px; }
.album-card .ac-text b { font-family: var(--display); font-size: 1.2rem; }
.album-card .ac-text .muted { font-size: 0.84rem; }
.album-card .ac-arrow { font-size: 1.3rem; color: var(--accent); }

/* ---------- portal CTA ---------- */
.portal-cta {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  border: none; border-radius: var(--radius); background: var(--grad-fun); color: #fff;
  padding: 18px 20px; box-shadow: 0 12px 28px rgba(255,95,162,0.34);
  transition: transform .2s var(--spring), box-shadow .2s;
}
.portal-cta:hover { transform: translateY(-3px) scale(1.01); box-shadow: 0 16px 34px rgba(255,95,162,0.44); }
.portal-cta .pc-emoji { font-size: 2.1rem; }
.portal-cta .pc-text { flex: 1; display: grid; }
.portal-cta .pc-text b { font-family: var(--display); font-size: 1.2rem; }
.portal-cta .pc-text .muted { color: rgba(255,255,255,0.9); font-size: 0.82rem; }
.portal-cta .pc-arrow { font-size: 1.4rem; }

/* ---------- Leaderboard ---------- */
.lb-title { font-family: var(--display); font-size: 1.35rem; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lb-row:last-child { border-bottom: none; }
.lb-row .ava {
  font-size: 1.6rem; width: 52px; height: 52px; flex: none; display: grid; place-items: center;
  background: var(--grad-soft); border-radius: 50%; box-shadow: var(--shadow-sm);
}
.lb-row .name { flex: 1; font-weight: 700; }
.lb-row .pts { font-family: var(--display); font-weight: 700; font-size: 1.8rem; }
.lb-row.top .pts { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb-row .lead { color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.lb-bar { height: 7px; border-radius: 999px; background: var(--line); margin-top: 6px; overflow: hidden; }
.lb-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--grad-fun); transition: width .7s var(--spring); }

.game-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.game-card {
  text-align: left; border: 2px solid rgba(255,255,255,0.65); background: var(--card);
  backdrop-filter: blur(14px); border-radius: 22px; padding: 18px; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--spring), box-shadow .2s; position: relative; overflow: hidden;
  animation: popIn .45s var(--spring) both;
}
.game-card:hover { transform: translateY(-5px) rotate(-1.5deg) scale(1.02); box-shadow: var(--shadow); }
.game-card:active { transform: scale(0.97); }
.game-card .emoji { font-size: 2.1rem; }
.game-card .gname { font-family: var(--display); font-weight: 600; font-size: 1.12rem; margin-top: 8px; }
.game-card .gdesc { color: var(--ink-soft); font-size: 0.82rem; }
.game-card.played { opacity: 0.55; }
.game-card.played .gdesc { color: var(--accent); font-weight: 600; }

/* ---------- Memory game (3D flip) ---------- */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: min(360px, 100%); margin: 0 auto; }
.tile { aspect-ratio: 1; border: none; background: none; padding: 0; perspective: 700px; position: relative; }
.tile-inner { display: block; position: absolute; inset: 0; transition: transform .45s var(--spring); transform-style: preserve-3d; }
.tile.up .tile-inner, .tile.done .tile-inner { transform: rotateY(180deg); }
.tile-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; place-items: center; border-radius: 18px; font-size: 2rem;
}
.tile-back { background: var(--grad-fun); color: rgba(255,255,255,0.95); box-shadow: var(--shadow-sm); }
.tile-front { background: var(--card-solid); border: 2px solid var(--line); transform: rotateY(180deg); }
.tile.done .tile-front { background: #e6fbf2; border-color: #b8ecd8; animation: matched .45s var(--spring); }
@keyframes matched { 0% { transform: rotateY(180deg) scale(1); } 50% { transform: rotateY(180deg) scale(1.16); } 100% { transform: rotateY(180deg) scale(1); } }

.hud { display: flex; justify-content: center; gap: 28px; margin: 14px 0 18px; color: var(--ink-soft); font-weight: 600; }
.hud b { color: var(--ink); font-family: var(--display); font-size: 1.15rem; }

/* ---------- Wordle ---------- */
.wordle-grid { display: grid; gap: 7px; justify-content: center; margin: 12px 0 20px; }
.wordle-row { display: grid; grid-auto-flow: column; gap: 7px; }
.wcell {
  width: clamp(44px, 15vw, 54px); aspect-ratio: 1; display: grid; place-items: center;
  font-size: clamp(1.3rem, 5vw, 1.7rem); font-weight: 700;
  border: 2px solid var(--line); border-radius: 14px; text-transform: uppercase; background: rgba(255,255,255,0.75);
  font-family: var(--display); transition: transform .15s var(--spring);
}
.wcell.filled { border-color: var(--accent-2); transform: scale(1.06); }
.wcell.correct { background: var(--good); border-color: var(--good); color: #fff; }
.wcell.present { background: var(--warn); border-color: var(--warn); color: #fff; }
.wcell.absent  { background: #c4bac6; border-color: #c4bac6; color: #fff; }
.keyboard { display: grid; gap: 7px; max-width: 500px; margin: 0 auto; }
.krow { display: flex; gap: 6px; justify-content: center; }
.key {
  flex: 1; min-width: 0; padding: 14px 4px; border: none; border-radius: 12px;
  background: rgba(255,255,255,0.9); box-shadow: var(--shadow-sm);
  font-weight: 700; font-size: 0.85rem; text-transform: uppercase; color: var(--ink);
  transition: transform .12s var(--spring), background .2s;
}
.key:active { transform: scale(0.9); }
.key.wide { flex: 1.7; font-size: 1rem; }
.key.correct { background: var(--good); color: #fff; }
.key.present { background: var(--warn); color: #fff; }
.key.absent { background: #c4bac6; color: #fff; }

/* ---------- Guess the Date ---------- */
.gd-photo { width: 100%; max-height: 340px; object-fit: contain; border-radius: 18px; background: #2a1626; }
.gd-controls { margin-top: 14px; display: grid; gap: 12px; }

/* ---------- canvas games ---------- */
.canvas-wrap { display: grid; place-items: center; margin: 8px 0 14px; }
canvas { border-radius: 18px; background: rgba(255,255,255,0.6); box-shadow: var(--shadow-sm); touch-action: none; max-width: 100%; }
.dpad { display: grid; justify-content: center; gap: 8px; margin: 6px 0 8px; }
.dpad button {
  width: 64px; height: 52px; border: none; border-radius: 14px; background: rgba(255,255,255,0.9);
  box-shadow: var(--shadow-sm); font-size: 1.2rem; color: var(--ink); margin: 0 auto;
  transition: transform .12s var(--spring), background .2s;
}
.dpad button:active { transform: scale(0.9); background: var(--grad-soft); }
.dpad-mid { display: flex; gap: 56px; justify-content: center; }

/* ---------- 2048 ---------- */
.g2048 { position: relative; width: min(360px, 100%); margin: 0 auto; touch-action: none; }
.g-bg {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px;
  background: rgba(180,150,180,0.22); padding: 9px; border-radius: 18px;
}
.g-cell { aspect-ratio: 1; border-radius: 12px; background: rgba(255,255,255,0.45); }
.g-tiles { position: absolute; inset: 0; pointer-events: none; }
.g-tile {
  position: absolute; top: 0; left: 0;
  transition: transform .12s ease; will-change: transform;
}
.g-tile > span {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 12px;
  font-family: var(--display); font-weight: 700; font-size: 1.7rem;
}
.g-tile.spawn > span { animation: pop2048 .16s var(--spring); }
.g-tile.merge > span { animation: merge2048 .18s var(--spring); }
@keyframes pop2048 { from { transform: scale(0.5); opacity: .4; } to { transform: scale(1); opacity: 1; } }
@keyframes merge2048 { 0% { transform: scale(1); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }

.gift-note {
  text-align: center; margin: 14px auto 0; max-width: 340px; padding: 9px 14px; border-radius: 14px;
  background: rgba(255,255,255,0.5); color: var(--ink-soft); font-size: 0.86rem; font-weight: 600;
}
.gift-note.hit {
  background: var(--grad-soft); color: var(--accent);
  animation: pop2048 .3s var(--spring);
}

/* ---------- flappy ---------- */
.flappy-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255,255,255,0.35); backdrop-filter: blur(3px); border-radius: 18px;
}
.flappy-overlay.hidden { display: none; }
.flappy-overlay .inner { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 18px; }
.flappy-preview {
  width: 88px; height: 88px; border-radius: 50%; overflow: hidden;
  background: var(--grad-soft); display: grid; place-items: center; font-size: 2.6rem;
  box-shadow: var(--shadow-sm); border: 3px solid #fff;
}
.flappy-preview img { width: 100%; height: 100%; object-fit: cover; }
#uploadLbl { cursor: pointer; }

/* ---------- photo sliding puzzle ---------- */
.slide-wrap { position: relative; display: grid; place-items: center; margin: 8px 0; }
.slide-board { display: grid; gap: 4px; background: rgba(180,150,180,0.25); padding: 4px; border-radius: 16px; touch-action: manipulation; }
.slide-tile {
  border-radius: 10px; background-repeat: no-repeat; background-color: rgba(255,255,255,0.5);
  cursor: pointer; transition: transform .1s var(--spring); aspect-ratio: 1;
}
.slide-tile:active { transform: scale(0.94); }
.slide-tile.gap { background: transparent; cursor: default; box-shadow: inset 0 0 0 2px var(--line); }
.slide-thumb {
  position: absolute; right: 6px; bottom: 6px; width: 64px; height: 64px; object-fit: cover;
  border-radius: 12px; border: 2px solid #fff; box-shadow: var(--shadow); opacity: 0.92;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(10px) scale(.9);
  background: rgba(58,43,58,0.95); backdrop-filter: blur(8px); color: #fff;
  padding: 12px 20px; border-radius: 999px; font-size: 0.92rem; font-weight: 700;
  box-shadow: var(--shadow); z-index: 50; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .3s var(--spring);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
