:root {
  --bg: #f3efe6;
  --surface: #fffdf8;
  --ink: #3f302a;
  --muted: #766f68;
  --line: #e2d8ca;
  --sage: #4f6f63;
  --rose: #e8919d;
  --blue: #8db4c7;
  --gold: #d5ad54;
  --mint: #8ec9ae;
  --shadow: 0 18px 45px rgba(72, 54, 44, 0.12);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

/* Chibi nakama art guard: keep tall hair/crowns/wings from being clipped by legacy slots. */
.chibi-companion-slot,
.closet-chibi-slot,
.home-chibi-slot {
  overflow: visible !important;
}

.chibi-companion-slot img,
.closet-chibi-slot img,
.home-chibi-slot img,
.closet-card.chibi-card .closet-art {
  object-fit: contain !important;
  object-position: center center !important;
  overflow: visible !important;
}

/* Mission empty state: avoid a stray blank frame under the filter menu. */
.mission-list.is-empty {
  grid-template-columns: 1fr !important;
  gap: 0 !important;
}

.mission-empty-state {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(222, 203, 160, 0.72);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 229, 143, 0.34), transparent 38%),
    linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(245, 236, 255, 0.78));
  box-shadow: 0 16px 38px rgba(120, 98, 168, 0.13);
}

.mission-empty-state h4 {
  margin: 0;
  color: var(--fantasy-ink, #3d3049);
  font-size: clamp(18px, 4.4vw, 24px);
  line-height: 1.35;
  letter-spacing: 0;
}

.mission-empty-state p {
  margin: 6px 0 0;
  color: var(--muted, #7c7068);
  font-size: clamp(14px, 3.4vw, 16px);
  line-height: 1.6;
}

.mission-empty-star {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff2a8, #f5b4c4 54%, #96d7df);
  box-shadow: 0 8px 0 rgba(94, 74, 135, 0.13), 0 0 24px rgba(255, 226, 102, 0.24);
}

.mission-empty-star::before {
  width: 28px;
  height: 28px;
  background: #fffef7;
  clip-path: polygon(50% 0%, 62% 34%, 98% 35%, 69% 56%, 80% 92%, 50% 70%, 20% 92%, 31% 56%, 2% 35%, 38% 34%);
  content: "";
  filter: drop-shadow(0 2px 4px rgba(124, 88, 48, 0.18));
}

@media (max-width: 560px) {
  .mission-empty-state {
    grid-template-columns: 1fr;
    justify-items: start;
    min-height: 0;
    padding: 16px;
  }

  .mission-empty-star {
    width: 46px;
    height: 46px;
    border-radius: 16px;
  }
}

/* Fantasy UI skin: magical glass, jewel buttons, social-game feedback, and sound controls. */
:root {
  --fantasy-violet: #8f7cc8;
  --fantasy-lavender: #d8c9f2;
  --fantasy-pink: #f0a9bc;
  --fantasy-aqua: #8fcdd7;
  --fantasy-cream: #fff8ec;
  --fantasy-ink: #3c3045;
  --fantasy-line: rgba(158, 126, 190, 0.24);
  --fantasy-glow: 0 22px 58px rgba(122, 100, 172, 0.16), 0 8px 22px rgba(214, 170, 112, 0.12);
  --shadow: var(--fantasy-glow);
}

body {
  color: var(--fantasy-ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 239, 185, 0.54), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(216, 201, 242, 0.5), transparent 26%),
    linear-gradient(135deg, #f7eef5 0%, #fff8eb 42%, #edf8f7 100%);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.95) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(213,173,84,0.46) 0 1px, transparent 2px),
    linear-gradient(120deg, transparent 0 38%, rgba(255,255,255,0.26) 39% 41%, transparent 42% 100%);
  background-size: 86px 86px, 132px 132px, 240px 240px;
  background-position: 0 0, 44px 28px, 0 0;
  animation: pageStarlight 18s linear infinite;
}

.side-rail,
.topbar,
.hero-panel,
.daily-panel,
.summon-panel,
.room-panel,
.closet-preview,
.closet-item-panel,
.parent-layout > section,
.event-strip article,
.reward-card,
.closet-card,
.room-item,
.mission-card {
  border-color: var(--fantasy-line);
  background:
    linear-gradient(145deg, rgba(255, 253, 248, 0.94), rgba(255, 246, 255, 0.76)),
    radial-gradient(circle at 18% 0%, rgba(255, 238, 179, 0.32), transparent 38%);
  box-shadow: var(--fantasy-glow);
}

.side-rail {
  border-right: 1px solid rgba(143, 124, 200, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.9), rgba(247, 236, 255, 0.76)),
    radial-gradient(circle at 50% 0%, rgba(255, 228, 164, 0.36), transparent 42%);
}

/* Onboarding polish for the launch flow. */
.onboarding-shell {
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 226, 102, 0.52), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(240, 169, 188, 0.5), transparent 24%),
    radial-gradient(circle at 50% 80%, rgba(143, 205, 215, 0.42), transparent 30%),
    linear-gradient(135deg, rgba(60, 48, 82, 0.88), rgba(116, 86, 154, 0.68) 42%, rgba(75, 132, 150, 0.72));
}
.onboarding-card {
  border-color: rgba(255, 238, 169, 0.72);
  background:
    radial-gradient(circle at 50% 40%, rgba(255,255,255,0.92), rgba(255,242,173,0.32) 28%, transparent 52%),
    radial-gradient(circle at 10% 16%, rgba(255, 217, 109, 0.38), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(240, 169, 188, 0.34), transparent 28%),
    linear-gradient(145deg, rgba(255,253,250,0.98), rgba(245,235,255,0.93));
  box-shadow: 0 0 0 7px rgba(255,255,255,0.18), 0 34px 110px rgba(39, 25, 67, 0.48);
}
.onboarding-step:first-of-type h1 {
  max-width: 9em;
  background: linear-gradient(100deg, #7a55d1, #e986b0 44%, #d7a13f 74%, #69bdd0);
  background-clip: text;
  color: transparent;
  font-size: clamp(48px, 8.2vw, 92px);
  letter-spacing: 0;
  text-shadow: 0 8px 28px rgba(122, 85, 209, 0.16);
  filter: drop-shadow(0 2px 0 rgba(255,255,255,0.86));
}
.onboarding-step:first-of-type .eyebrow {
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,237,171,0.72));
  box-shadow: 0 12px 28px rgba(122, 85, 209, 0.12);
}
.onboarding-hero {
  width: min(520px, 82vw);
}
.onboarding-hero::before {
  inset: 2% -4%;
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,0.92), rgba(255,235,137,0.5) 34%, transparent 65%),
    conic-gradient(from 20deg, rgba(255,217,109,0.7), rgba(240,169,188,0.52), rgba(143,205,215,0.48), rgba(216,201,242,0.58), rgba(255,217,109,0.7));
  filter: blur(0.2px) saturate(1.16);
}
.onboarding-hero img {
  width: 66%;
  animation: idleFloat 3.4s ease-in-out infinite;
}
.onboarding-feature-grid div,
.chore-picker label,
.base-character-card {
  transform-origin: 50% 80%;
  animation: onboardingCardFloat 5s ease-in-out infinite;
}
.onboarding-feature-grid div:nth-child(2),
.chore-picker label:nth-child(even),
.base-character-choice label:nth-child(2) .base-character-card {
  animation-delay: -1.2s;
}
.onboarding-feature-grid div:nth-child(3),
.chore-picker label:nth-child(3n),
.base-character-choice label:nth-child(3) .base-character-card {
  animation-delay: -2.2s;
}
.base-character-card img {
  max-height: 198px;
  filter: drop-shadow(0 20px 18px rgba(80,60,96,0.14));
}
@keyframes onboardingCardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@media (max-width: 720px) {
  .mission-edit-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }
  .mission-edit-row input {
    grid-column: 2;
  }
  .mission-edit-row input[data-mission-edit="stars"] {
    width: 112px;
  }
}
.brand-mark {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(135deg, #9d80d7, #77c8d3 52%, #f0b0c0);
  box-shadow: 0 10px 0 rgba(94, 74, 135, 0.16), 0 0 24px rgba(255, 226, 102, 0.24);
}
.brand-mark::after {
  position: absolute;
  inset: -30%;
  background: linear-gradient(115deg, transparent 25%, rgba(255,255,255,0.66), transparent 60%);
  content: "";
  transform: translateX(-80%) rotate(12deg);
  animation: jewelSweep 4.8s ease-in-out infinite;
}
.brand p,
.eyebrow {
  color: #7a6689;
}

.nav-item,
.profile-tab,
.segment {
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}
.nav-item.active,
.nav-item:hover,
.profile-tab.active,
.profile-tab:hover,
.segment.active {
  border-color: rgba(143, 124, 200, 0.22);
  background: linear-gradient(135deg, rgba(245, 232, 255, 0.95), rgba(232, 249, 248, 0.86));
  color: #5e4b86;
  box-shadow: 0 10px 24px rgba(127, 106, 174, 0.14);
}
.nav-item::before {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.62);
  color: #9d7bca;
  font-size: 13px;
}
.nav-item[data-view="home"]::before { content: "◇"; }
.nav-item[data-view="missions"]::before { content: "✓"; }
.nav-item[data-view="reward"]::before { content: "✦"; }
.nav-item[data-view="closet"]::before { content: "♡"; }
.nav-item[data-view="rooms"]::before { content: "☾"; }
.nav-item[data-view="parent"]::before { content: "⚙"; }

.wallet span,
.side-status,
.home-stage-copy,
.equip-badge,
.closet-character > span {
  border: 1px solid rgba(255,255,255,0.74);
  background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(255,248,236,0.66));
  box-shadow: 0 14px 34px rgba(112, 90, 145, 0.12);
}
.wallet span { color: #6b5585; }
.wallet b {
  color: #d09442;
  text-shadow: 0 1px 0 #fff;
}

.primary-button,
.secondary-button,
.text-button,
.closet-card button,
.mission-card button,
.reward-dialog menu .primary-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 0;
  transition: transform 160ms ease, box-shadow 180ms ease, filter 180ms ease;
}
.primary-button,
.closet-card button,
.mission-card button,
.reward-dialog menu .primary-button {
  background: linear-gradient(135deg, #7cc8d2 0%, #9b82d6 50%, #f0a5b7 100%);
  color: #fffdf8;
  box-shadow: 0 10px 0 rgba(84, 67, 126, 0.18), 0 18px 36px rgba(142, 124, 200, 0.28);
  text-shadow: 0 1px 0 rgba(65, 45, 83, 0.22);
}
.secondary-button,
.text-button {
  color: #6a5488;
}
.primary-button::before,
.secondary-button::before,
.text-button::before,
.closet-card button::before,
.mission-card button::before {
  position: absolute;
  inset: -70% -35%;
  z-index: -1;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.68) 48%, transparent 58%);
  content: "";
  transform: translateX(-85%) rotate(12deg);
  transition: transform 520ms ease;
}
.primary-button:hover::before,
.secondary-button:hover::before,
.text-button:hover::before,
.closet-card button:hover::before,
.mission-card button:hover::before {
  transform: translateX(85%) rotate(12deg);
}
.primary-button:hover,
.closet-card button:hover,
.mission-card button:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}
button:active,
.magic-pressed {
  transform: translateY(2px) scale(0.985) !important;
}

.mission-card,
.reward-card,
.closet-card,
.room-item,
.event-strip article {
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.mission-card::after,
.reward-card::after,
.closet-card::after,
.room-item::after,
.event-strip article::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.34), transparent);
  content: "";
  opacity: 0;
  transform: translateX(-70%);
  pointer-events: none;
}
.mission-card:hover,
.reward-card:hover,
.closet-card:hover,
.room-item:hover,
.event-strip article:hover {
  border-color: rgba(143, 124, 200, 0.38);
  box-shadow: 0 22px 56px rgba(120, 98, 168, 0.18);
  transform: translateY(-2px);
}
.mission-card:hover::after,
.reward-card:hover::after,
.closet-card:hover::after,
.room-item:hover::after,
.event-strip article:hover::after {
  opacity: 1;
  animation: cardGlint 900ms ease;
}

.view.active {
  animation: viewMagicIn 520ms cubic-bezier(0.2, 0.9, 0.28, 1) both;
}
.view-transitioning .view.active {
  animation: viewMagicIn 620ms cubic-bezier(0.2, 0.9, 0.28, 1) both;
}
.magic-click-ring {
  position: fixed;
  z-index: 80;
  width: var(--ring-size);
  height: var(--ring-size);
  border: 2px solid rgba(255, 232, 140, 0.86);
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.18);
  box-shadow: 0 0 22px rgba(255, 224, 116, 0.44), inset 0 0 22px rgba(255,255,255,0.3);
  animation: magicClickRing 680ms ease-out forwards;
}
.spark-piece {
  box-shadow: 0 0 14px currentColor;
}

.summon-panel {
  background:
    radial-gradient(circle at 50% 43%, rgba(255, 241, 162, 0.34), transparent 36%),
    linear-gradient(155deg, rgba(255, 253, 248, 0.94), rgba(246, 234, 255, 0.78));
}
.treasure-chest {
  animation: machinePulse 2.8s ease-in-out infinite, treasureIdleGlow 3.8s ease-in-out infinite;
}
.treasure-chest.opening {
  animation: chestJump 820ms ease-out, treasureOpenBoom 980ms ease-out;
}
.reward-dialog {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 239, 166, 0.34), transparent 34%),
    linear-gradient(155deg, rgba(255,253,248,0.97), rgba(250,238,255,0.9));
}

/* Decorative polish and mobile breathing room. Keep this block late in the file. */
body {
  position: relative;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 236, 170, 0.68), transparent 22%),
    radial-gradient(circle at 82% 12%, rgba(226, 201, 249, 0.58), transparent 26%),
    radial-gradient(circle at 18% 84%, rgba(143, 205, 215, 0.38), transparent 26%),
    linear-gradient(135deg, #fbedf6 0%, #fff8e8 42%, #edf9f7 100%);
}
body::before {
  z-index: -2;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.94) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255,222,128,0.56) 0 1.5px, transparent 2.5px),
    linear-gradient(135deg, transparent 0 46%, rgba(255,255,255,0.34) 47% 49%, transparent 50%),
    repeating-linear-gradient(135deg, rgba(154,126,204,0.065) 0 1px, transparent 1px 22px);
  background-size: 72px 72px, 118px 118px, 260px 260px, 34px 34px;
  background-position: 0 0, 42px 28px, 0 0, 0 0;
}
body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 8% 26%, rgba(255,255,255,0.74) 0 7px, transparent 8px),
    radial-gradient(circle at 92% 20%, rgba(255,236,158,0.7) 0 8px, transparent 9px),
    radial-gradient(circle at 84% 78%, rgba(240,169,188,0.42) 0 10px, transparent 11px),
    radial-gradient(circle at 14% 72%, rgba(143,205,215,0.46) 0 9px, transparent 10px);
  filter: blur(0.1px);
}
.workspace {
  position: relative;
}
.workspace::before {
  position: fixed;
  right: clamp(18px, 4vw, 54px);
  top: clamp(86px, 13vh, 160px);
  z-index: -1;
  width: clamp(130px, 18vw, 230px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.58);
  border-radius: 42% 58% 52% 48%;
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,0.72) 0 10%, transparent 11%),
    conic-gradient(from 24deg, rgba(255,232,145,0.35), rgba(216,201,242,0.3), rgba(143,205,215,0.24), rgba(240,169,188,0.26), rgba(255,232,145,0.35));
  box-shadow: 0 0 70px rgba(255, 226, 120, 0.22);
  content: "";
  opacity: 0.72;
  animation: auraSpin 28s linear infinite;
}
.topbar {
  min-width: 0;
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.9), rgba(250, 239, 255, 0.78)),
    radial-gradient(circle at 12% 0%, rgba(255, 232, 145, 0.28), transparent 38%);
  box-shadow: 0 18px 44px rgba(112, 90, 145, 0.13);
  backdrop-filter: blur(10px);
}
.topbar > div:first-child {
  min-width: 0;
}
.topbar h2 {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.wallet {
  min-width: min(100%, 310px);
  justify-content: flex-end;
}
.wallet span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
}
.nav-item {
  min-width: 0;
  padding: 0 12px 0 10px;
  border-radius: 14px;
}
.nav-item::before {
  width: 34px;
  height: 34px;
  margin-right: 10px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,0.96) 0 18%, transparent 19%),
    linear-gradient(135deg, #fff4c7 0%, #f3c2d0 48%, #bfe7eb 100%);
  color: #6a5488;
  box-shadow: 0 8px 16px rgba(112, 90, 145, 0.15), inset 0 -4px 8px rgba(117, 78, 142, 0.08);
  font-size: 17px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}
.nav-item::after {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 226, 102, 0.86);
  box-shadow: 0 0 10px rgba(255, 226, 102, 0.54);
  content: "";
  opacity: 0.56;
}
.nav-item[data-view="home"]::before { content: "⌂"; }
.nav-item[data-view="missions"]::before { content: "✧"; }
.nav-item[data-view="reward"]::before { content: "✦"; }
.nav-item[data-view="closet"]::before { content: "♡"; }
.nav-item[data-view="rooms"]::before { content: "☾"; }
.nav-item[data-view="parent"]::before { content: "⚙"; }
.nav-item.active::before,
.nav-item:hover::before {
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,0.98) 0 18%, transparent 19%),
    linear-gradient(135deg, #ffe783 0%, #f1a8bf 46%, #8fd5df 100%);
  transform: translateY(-1px) rotate(-4deg);
}
.side-rail {
  position: sticky;
}
.side-rail::before {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255,255,255,0.48);
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 226, 102, 0.32) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 34%, rgba(143, 205, 215, 0.28) 0 5px, transparent 6px),
    radial-gradient(circle at 46% 82%, rgba(240, 169, 188, 0.28) 0 4px, transparent 5px);
  content: "";
  pointer-events: none;
}
.side-rail > * {
  position: relative;
  z-index: 1;
}
.hero-panel,
.daily-panel,
.summon-panel,
.room-panel,
.closet-preview,
.closet-item-panel,
.parent-layout > section,
.event-strip article,
.mission-card,
.reward-card,
.room-item,
.closet-card {
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255,253,248,0.94), rgba(255,246,255,0.78)),
    radial-gradient(circle at 14% 4%, rgba(255,226,102,0.24), transparent 36%),
    radial-gradient(circle at 92% 18%, rgba(143,205,215,0.16), transparent 34%);
}

@media (max-width: 1080px) {
  .app-shell {
    background:
      linear-gradient(180deg, rgba(255,255,255,0.24), transparent 240px),
      transparent;
  }
  .side-rail {
    position: relative;
    gap: 14px;
    padding-bottom: 14px;
  }
  .nav {
    gap: 10px;
    padding: 2px 2px 8px;
  }
  .nav-item {
    flex: 0 0 132px;
    min-height: 52px;
    padding-right: 24px;
  }
}

@media (max-width: 640px) {
  .workspace,
  .side-rail {
    width: 100%;
    max-width: 100%;
    padding: 12px;
  }
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: auto !important;
    max-width: none !important;
    gap: 12px;
    margin: 0 0 14px;
    padding: 14px;
    overflow: hidden;
  }
  .topbar .eyebrow {
    font-size: 10px;
    line-height: 1.15;
  }
  .topbar h2 {
    font-size: clamp(24px, 8.2vw, 34px);
    line-height: 1.1;
  }
  .wallet {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    gap: 7px;
    line-height: 1.2;
  }
  .wallet span {
    display: inline-flex !important;
    min-width: 0;
    min-height: 34px;
    padding: 5px 6px;
    border: 1px solid rgba(255,255,255,0.74);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(255,248,236,0.72));
    box-shadow: 0 8px 18px rgba(112, 90, 145, 0.1);
    font-size: 12px;
    white-space: nowrap;
  }
  .wallet b {
    margin-right: 2px;
    font-size: 17px;
  }
  .brand {
    align-items: flex-start;
  }
  .brand h1 {
    font-size: 16px;
  }
  .profile-switcher {
    width: 100% !important;
    max-width: 100% !important;
  }
  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    width: 100%;
  }
  .nav-item {
    flex: none;
    min-height: 64px;
    padding: 8px 4px 7px;
    text-align: center;
    font-size: 11px;
    line-height: 1.18;
  }
  .nav-item::before {
    display: grid;
    width: 32px;
    height: 32px;
    margin: 0 auto 4px;
    font-size: 16px;
  }
  .nav-item::after {
    right: 9px;
    top: 8px;
  }
  .screen-title,
  h1, h2, h3, h4,
  .mission-card p,
  .reward-card p,
  .room-item span,
  .closet-card p {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 380px) {
  .wallet {
    gap: 5px;
  }
  .wallet span {
    min-height: 32px;
    padding-inline: 4px;
    font-size: 11px;
  }
  .wallet b {
    font-size: 15px;
  }
  .topbar h2 {
    font-size: clamp(22px, 8vw, 30px);
  }
  .nav-item {
    font-size: 10px;
  }
}

/* Must stay at EOF: final replacement for placeholder event and sound icons. */
.event-strip .event-icon {
  position: relative;
  isolation: isolate;
  overflow: visible;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,0.98) 0 14%, transparent 15%),
    linear-gradient(135deg, #fff1a8 0%, #f6c4d4 54%, #bdebee 100%);
  color: transparent;
  font-size: 0;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(129, 103, 168, 0.14), inset 0 -5px 10px rgba(134, 89, 143, 0.08);
  animation: iconTwinkle 1.8s ease-in-out infinite;
}
.sound-toggle span {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 8px 999px 999px 8px;
  background: linear-gradient(135deg, #8fd5df, #9b82d6 62%, #f0a5b7);
  box-shadow: inset 0 -3px 6px rgba(74, 53, 100, 0.16), 0 0 0 4px rgba(255,255,255,0.48);
}
.sound-toggle span::before {
  position: absolute;
  left: -5px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #fffaf0;
  content: "";
}
.sound-toggle span::after {
  position: absolute;
  right: -12px;
  top: 4px;
  width: 11px;
  height: 13px;
  border: 2px solid #d39a47;
  border-left: 0;
  border-radius: 0 999px 999px 0;
  content: "";
  animation: soundWavePulse 1.8s ease-in-out infinite;
}
.sound-toggle.muted span {
  filter: grayscale(0.8);
  opacity: 0.5;
}

/* Final home cleanup overrides: keep these last. */
.nav-item[data-view="rooms"],
#roomsView,
.side-status,
.event-strip {
  display: none !important;
}
.topbar > div:first-child {
  display: none !important;
}
.wallet span[hidden] {
  display: none !important;
}
@media (max-width: 640px) {
  .menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
  }
  .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    max-height: 0 !important;
    padding: 0 2px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: max-height 240ms ease, opacity 180ms ease, padding 200ms ease;
  }
  body.menu-open .nav {
    max-height: 92px !important;
    padding: 2px 2px 8px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .topbar {
    display: flex !important;
    justify-content: center !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 0 10px !important;
    padding: 10px 12px !important;
  }
  .wallet {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}
/* Absolute EOF override: fixed-size event dialogs without inner scrollbars. */
#comboEventFoundDialog,
#comboEventDialog {
  box-sizing: border-box !important;
  width: min(90vw, 600px) !important;
  max-width: calc(100vw - 40px) !important;
  max-height: none !important;
  margin: auto !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
}
.combo-found-dialog,
.combo-event-dialog {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
}
.combo-found-dialog {
  gap: 10px !important;
  padding: 22px 24px 24px !important;
  border-radius: 28px !important;
}
.combo-found-dialog h3 {
  max-width: 100% !important;
  margin: 0 !important;
  font-size: clamp(34px, 6vw, 50px) !important;
  line-height: 1.02 !important;
  white-space: nowrap !important;
}
.combo-found-title {
  max-width: 100% !important;
  padding: 8px 16px !important;
  font-size: clamp(16px, 3.3vw, 22px) !important;
  white-space: nowrap !important;
}
.combo-found-images {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 12px !important;
}
.combo-found-image-card {
  box-sizing: border-box !important;
  grid-template-rows: 108px auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 0 !important;
  padding: 12px 8px 10px !important;
  border-radius: 20px !important;
}
.combo-found-image-card img {
  max-width: 98px !important;
  max-height: 98px !important;
}
.combo-found-image-card figcaption {
  min-width: 0 !important;
  max-width: 100% !important;
}
.combo-found-image-card small {
  font-size: 12px !important;
}
.combo-found-image-card strong {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  font-size: clamp(15px, 3vw, 19px) !important;
  line-height: 1.25 !important;
}
.combo-found-summary {
  max-width: 100% !important;
  margin: 4px 0 2px !important;
  font-size: clamp(15px, 2.8vw, 20px) !important;
  line-height: 1.55 !important;
  overflow-wrap: anywhere !important;
}
.combo-found-dialog menu,
.combo-event-dialog menu {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: min(400px, 100%) !important;
  max-width: 100% !important;
  gap: 12px !important;
  margin: 0 !important;
  padding: 0 !important;
}
.combo-found-dialog menu button,
.combo-event-dialog menu button {
  min-width: 0 !important;
  width: 100% !important;
}
.combo-event-dialog {
  min-height: 0 !important;
  gap: 10px !important;
  padding: 28px 26px 24px !important;
  border-radius: 28px !important;
}
.combo-event-dialog h3 {
  max-width: 100% !important;
  margin: 0 !important;
  font-size: clamp(30px, 5.4vw, 42px) !important;
  line-height: 1.08 !important;
  overflow-wrap: anywhere !important;
}
.combo-event-stage {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  height: clamp(220px, 44vw, 310px) !important;
  aspect-ratio: auto !important;
  overflow: hidden !important;
}
.combo-talk-box {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  padding: 15px 18px !important;
}
.combo-talk-box p {
  font-size: clamp(16px, 3vw, 20px) !important;
  line-height: 1.55 !important;
}
@media (max-width: 560px), (max-height: 720px) {
  #comboEventFoundDialog,
  #comboEventDialog {
    width: min(92vw, 560px) !important;
    max-width: calc(100vw - 36px) !important;
  }
  .combo-found-dialog {
    gap: 8px !important;
    padding: 18px 18px 20px !important;
  }
  .combo-found-dialog h3 {
    font-size: clamp(30px, 7.6vw, 42px) !important;
  }
  .combo-found-title {
    font-size: clamp(15px, 3.8vw, 20px) !important;
  }
  .combo-found-image-card {
    grid-template-rows: 88px auto !important;
    padding: 10px 7px 9px !important;
  }
  .combo-found-image-card img {
    max-width: 82px !important;
    max-height: 82px !important;
  }
  .combo-found-summary {
    font-size: 15px !important;
    line-height: 1.45 !important;
  }
  .combo-found-dialog menu,
  .combo-event-dialog menu {
    width: min(360px, 100%) !important;
  }
  .combo-event-dialog {
    padding: 26px 18px 20px !important;
  }
  .combo-event-stage {
    height: clamp(190px, 38vh, 260px) !important;
  }
  .combo-talk-box {
    padding: 13px 14px !important;
  }
}

/* Final mission empty-state override: prevent blank frames below the filter menu. */
.mission-list.is-empty {
  grid-template-columns: 1fr !important;
  gap: 0 !important;
}

.mission-empty-state {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 14px !important;
  width: 100% !important;
  min-height: 116px !important;
  padding: 18px !important;
  border: 1px solid rgba(222, 203, 160, 0.72) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 229, 143, 0.34), transparent 38%),
    linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(245, 236, 255, 0.78)) !important;
  box-shadow: 0 16px 38px rgba(120, 98, 168, 0.13) !important;
}

.mission-empty-state h4 {
  margin: 0 !important;
  color: var(--fantasy-ink, #3d3049) !important;
  font-size: clamp(18px, 4.4vw, 24px) !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
}

.mission-empty-state p {
  margin: 6px 0 0 !important;
  color: var(--muted, #7c7068) !important;
  font-size: clamp(14px, 3.4vw, 16px) !important;
  line-height: 1.6 !important;
}

.mission-empty-star {
  position: relative !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, #fff2a8, #f5b4c4 54%, #96d7df) !important;
  box-shadow: 0 8px 0 rgba(94, 74, 135, 0.13), 0 0 24px rgba(255, 226, 102, 0.24) !important;
}

.mission-empty-star::before {
  width: 28px !important;
  height: 28px !important;
  background: #fffef7 !important;
  clip-path: polygon(50% 0%, 62% 34%, 98% 35%, 69% 56%, 80% 92%, 50% 70%, 20% 92%, 31% 56%, 2% 35%, 38% 34%) !important;
  content: "" !important;
  filter: drop-shadow(0 2px 4px rgba(124, 88, 48, 0.18)) !important;
}

@media (max-width: 560px) {
  .mission-empty-state {
    grid-template-columns: 1fr !important;
    justify-items: start !important;
    min-height: 0 !important;
    padding: 16px !important;
  }

  .mission-empty-star {
    width: 46px !important;
    height: 46px !important;
    border-radius: 16px !important;
  }
}

/* Absolute EOF iPad portrait audit pass. */
@media (min-width: 700px) and (max-width: 980px) and (orientation: portrait) {
  body {
    overflow-x: hidden !important;
  }

  .app-shell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }

  .side-rail {
    position: sticky !important;
    top: 0 !important;
    z-index: 24 !important;
    display: grid !important;
    grid-template-columns: minmax(210px, 0.8fr) minmax(260px, 1fr) !important;
    grid-template-areas:
      "brand profile"
      "nav nav" !important;
    align-items: center !important;
    gap: 10px 14px !important;
    width: 100% !important;
    height: auto !important;
    padding: 12px 22px 14px !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(230, 210, 233, 0.92) !important;
    background: linear-gradient(135deg, rgba(255, 250, 247, 0.94), rgba(248, 241, 255, 0.9)) !important;
    box-shadow: 0 14px 32px rgba(95, 72, 126, 0.1) !important;
  }

  .title-brand {
    grid-area: brand !important;
    justify-content: flex-start !important;
    width: 100% !important;
  }

  .title-brand .title-logo-side {
    width: min(236px, 30vw) !important;
  }

  .profile-switcher {
    grid-area: profile !important;
    width: 100% !important;
    max-width: none !important;
  }

  .profile-tab {
    min-height: 42px !important;
    padding-inline: 12px !important;
    white-space: nowrap !important;
  }

  .menu-toggle {
    display: none !important;
  }

  .nav {
    grid-area: nav !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .nav-item {
    display: grid !important;
    place-items: center !important;
    min-width: 0 !important;
    min-height: 56px !important;
    padding: 5px 6px !important;
    text-align: center !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere !important;
  }

  .workspace {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 14px 22px 88px !important;
    overflow: hidden !important;
  }

  .topbar {
    justify-content: center !important;
    width: 100% !important;
    margin: 0 0 12px !important;
    padding: 8px 10px !important;
  }

  .wallet {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .wallet span {
    min-height: 36px !important;
    padding: 6px 14px !important;
    white-space: nowrap !important;
  }

  .home-layout,
  .reward-layout,
  .parent-layout,
  .room-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .home-stage-panel {
    min-height: clamp(720px, calc(100vh - 250px), 860px) !important;
    border-radius: 22px !important;
  }

  .home-stage-copy {
    left: 18px !important;
    right: 18px !important;
    top: 18px !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    padding: 16px 20px !important;
    border-radius: 18px !important;
  }

  .home-stage-copy h3 {
    font-size: clamp(32px, 5vw, 42px) !important;
    line-height: 1.12 !important;
    white-space: normal !important;
  }

  .home-stage-copy p:last-child {
    font-size: 17px !important;
    line-height: 1.65 !important;
  }

  .home-stage .home-main-character {
    left: 45% !important;
    bottom: 34px !important;
    width: min(58vw, 500px) !important;
    max-width: 62% !important;
    max-height: 72% !important;
  }

  .home-pet-slot,
  .home-chibi-slot {
    right: 22px !important;
    top: auto !important;
    width: 118px !important;
    height: 118px !important;
    padding: 8px !important;
    border-radius: 18px !important;
  }

  .home-pet-slot {
    bottom: 250px !important;
  }

  .home-chibi-slot {
    bottom: 118px !important;
  }

  .home-equip-badge {
    left: 18px !important;
    bottom: 22px !important;
    max-width: calc(100% - 178px) !important;
  }

  .daily-panel {
    padding: 16px !important;
  }

  .mission-list:not(.compact),
  .reward-grid,
  .room-items {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .closet-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .closet-character {
    min-height: clamp(560px, 58vh, 690px) !important;
    aspect-ratio: 4 / 3 !important;
    border-radius: 22px !important;
  }

  .closet-character > .main-character-art {
    width: min(44vw, 390px) !important;
    max-width: 50% !important;
    max-height: 82% !important;
  }

  .closet-pet-slot {
    left: 10% !important;
    bottom: 10% !important;
    width: clamp(148px, 20vw, 180px) !important;
  }

  .closet-chibi-slot {
    right: 10% !important;
    bottom: 11% !important;
    width: clamp(142px, 19vw, 172px) !important;
  }

  .closet-items {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .closet-card {
    grid-template-columns: 50px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .closet-card strong,
  .reward-card h4,
  .mission-card h4 {
    overflow-wrap: anywhere !important;
    line-height: 1.28 !important;
  }

  .summon-panel {
    min-height: 610px !important;
    grid-template-rows: auto minmax(390px, 1fr) auto !important;
  }

  .treasure-machine {
    min-height: 390px !important;
  }

  #rewardDialog,
  #comboEventFoundDialog,
  #comboEventDialog,
  #companionDialog {
    max-width: calc(100vw - 56px) !important;
  }

  .reward-dialog {
    width: min(680px, calc(100vw - 56px)) !important;
    min-height: 560px !important;
  }

  .combo-found-dialog,
  .combo-event-dialog {
    width: min(700px, calc(100vw - 56px)) !important;
  }

  .combo-event-stage {
    height: clamp(300px, 46vw, 410px) !important;
  }

  .combo-talk-box p,
  .combo-found-summary,
  .companion-dialog p {
    overflow-wrap: anywhere !important;
  }

  .onboarding-card {
    width: min(760px, calc(100vw - 44px)) !important;
    min-height: min(1080px, calc(100vh - 32px)) !important;
  }

  .onboarding-step.active {
    align-content: center !important;
  }

  .onboarding-step h2 {
    max-width: 18em !important;
    margin-inline: auto !important;
    text-align: center !important;
  }

  .title-logo-caption {
    max-width: min(600px, 100%) !important;
    margin-inline: auto !important;
    text-align: center !important;
  }
}

/* iPad portrait audit pass: keep the app compact, centered, and readable at tablet portrait widths. */
@media (min-width: 700px) and (max-width: 980px) and (orientation: portrait) {
  body {
    overflow-x: hidden !important;
  }

  .app-shell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }

  .side-rail {
    position: sticky !important;
    top: 0 !important;
    z-index: 24 !important;
    display: grid !important;
    grid-template-columns: minmax(210px, 0.8fr) minmax(260px, 1fr) !important;
    grid-template-areas:
      "brand profile"
      "nav nav" !important;
    align-items: center !important;
    gap: 10px 14px !important;
    width: 100% !important;
    height: auto !important;
    padding: 12px 22px 14px !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(230, 210, 233, 0.92) !important;
    background: linear-gradient(135deg, rgba(255, 250, 247, 0.94), rgba(248, 241, 255, 0.9)) !important;
    box-shadow: 0 14px 32px rgba(95, 72, 126, 0.1) !important;
  }

  .title-brand {
    grid-area: brand !important;
    justify-content: flex-start !important;
    width: 100% !important;
  }

  .title-brand .title-logo-side {
    width: min(236px, 30vw) !important;
  }

  .profile-switcher {
    grid-area: profile !important;
    width: 100% !important;
    max-width: none !important;
  }

  .profile-tab {
    min-height: 42px !important;
    padding-inline: 12px !important;
    white-space: nowrap !important;
  }

  .menu-toggle {
    display: none !important;
  }

  .nav {
    grid-area: nav !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .nav-item {
    display: grid !important;
    place-items: center !important;
    min-width: 0 !important;
    min-height: 56px !important;
    padding: 5px 6px !important;
    text-align: center !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere !important;
  }

  .workspace {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 14px 22px 88px !important;
    overflow: hidden !important;
  }

  .topbar {
    justify-content: center !important;
    width: 100% !important;
    margin: 0 0 12px !important;
    padding: 8px 10px !important;
  }

  .wallet {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .wallet span {
    min-height: 36px !important;
    padding: 6px 14px !important;
    white-space: nowrap !important;
  }

  .home-layout,
  .reward-layout,
  .parent-layout,
  .room-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .home-stage-panel {
    min-height: clamp(720px, calc(100vh - 250px), 860px) !important;
    border-radius: 22px !important;
  }

  .home-stage-copy {
    left: 18px !important;
    right: 18px !important;
    top: 18px !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    padding: 16px 20px !important;
    border-radius: 18px !important;
  }

  .home-stage-copy h3 {
    font-size: clamp(32px, 5vw, 42px) !important;
    line-height: 1.12 !important;
    white-space: normal !important;
  }

  .home-stage-copy p:last-child {
    font-size: 17px !important;
    line-height: 1.65 !important;
  }

  .home-stage .home-main-character {
    left: 45% !important;
    bottom: 34px !important;
    width: min(58vw, 500px) !important;
    max-width: 62% !important;
    max-height: 72% !important;
  }

  .home-pet-slot,
  .home-chibi-slot {
    right: 22px !important;
    top: auto !important;
    width: 118px !important;
    height: 118px !important;
    padding: 8px !important;
    border-radius: 18px !important;
  }

  .home-pet-slot {
    bottom: 250px !important;
  }

  .home-chibi-slot {
    bottom: 118px !important;
  }

  .home-equip-badge {
    left: 18px !important;
    bottom: 22px !important;
    max-width: calc(100% - 178px) !important;
  }

  .daily-panel {
    padding: 16px !important;
  }

  .mission-list:not(.compact),
  .reward-grid,
  .room-items {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .closet-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .closet-character {
    min-height: clamp(560px, 58vh, 690px) !important;
    aspect-ratio: 4 / 3 !important;
    border-radius: 22px !important;
  }

  .closet-character > .main-character-art {
    width: min(44vw, 390px) !important;
    max-width: 50% !important;
    max-height: 82% !important;
  }

  .closet-pet-slot {
    left: 10% !important;
    bottom: 10% !important;
    width: clamp(148px, 20vw, 180px) !important;
  }

  .closet-chibi-slot {
    right: 10% !important;
    bottom: 11% !important;
    width: clamp(142px, 19vw, 172px) !important;
  }

  .closet-items {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .closet-card {
    grid-template-columns: 50px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .closet-card strong,
  .reward-card h4,
  .mission-card h4 {
    overflow-wrap: anywhere !important;
    line-height: 1.28 !important;
  }

  .summon-panel {
    min-height: 610px !important;
    grid-template-rows: auto minmax(390px, 1fr) auto !important;
  }

  .treasure-machine {
    min-height: 390px !important;
  }

  #rewardDialog,
  #comboEventFoundDialog,
  #comboEventDialog,
  #companionDialog {
    max-width: calc(100vw - 56px) !important;
  }

  .reward-dialog {
    width: min(680px, calc(100vw - 56px)) !important;
    min-height: 560px !important;
  }

  .combo-found-dialog,
  .combo-event-dialog {
    width: min(700px, calc(100vw - 56px)) !important;
  }

  .combo-event-stage {
    height: clamp(300px, 46vw, 410px) !important;
  }

  .combo-talk-box p,
  .combo-found-summary,
  .companion-dialog p {
    overflow-wrap: anywhere !important;
  }

  .onboarding-card {
    width: min(760px, calc(100vw - 44px)) !important;
    min-height: min(1080px, calc(100vh - 32px)) !important;
  }

  .onboarding-step.active {
    align-content: center !important;
  }

  .onboarding-step h2 {
    max-width: 18em !important;
    margin-inline: auto !important;
    text-align: center !important;
  }

  .title-logo-caption {
    max-width: min(600px, 100%) !important;
    margin-inline: auto !important;
    text-align: center !important;
  }
}

/* Final chibi art safety: never crop tall hats, crowns, wings, or ribbon effects. */
.reward-art.companion-preview-trigger,
.closet-art.companion-preview-trigger,
.room-art.companion-preview-trigger,
.combo-found-image-card img,
#companionPreviewImage,
#comboEventPet,
#comboEventChibi,
.chibi-companion-slot img,
.closet-chibi-slot img,
.home-chibi-slot img {
  display: block !important;
  object-fit: contain !important;
  object-position: center center !important;
  border-radius: 0 !important;
  background: transparent !important;
  mix-blend-mode: normal !important;
  overflow: visible !important;
}

.reward-prize,
.companion-preview-art,
.combo-found-image-card {
  overflow: visible !important;
}

/* Final reward/event popup alignment: long event titles must wrap and stay centered. */
#rewardDialog {
  box-sizing: border-box !important;
  width: min(94vw, 640px) !important;
  max-width: calc(100vw - 24px) !important;
  margin: auto !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
}

.reward-dialog {
  box-sizing: border-box !important;
  display: grid !important;
  justify-items: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: min(86vh, 760px) !important;
  padding: clamp(26px, 4.2vw, 42px) clamp(18px, 4.4vw, 40px) clamp(24px, 4vw, 36px) !important;
  gap: clamp(14px, 2.4vw, 22px) !important;
  text-align: center !important;
}

.reward-dialog .eyebrow,
.reward-dialog h3,
.reward-dialog p,
.reward-dialog menu,
.reward-dialog .reward-prize {
  justify-self: center !important;
  text-align: center !important;
}

.reward-dialog h3,
.reward-dialog #rewardName {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: min(100%, 13.5em) !important;
  margin: 0 auto !important;
  padding: 0 !important;
  overflow: visible !important;
  color: #160f13 !important;
  font-size: clamp(26px, 5vw, 40px) !important;
  line-height: 1.16 !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  word-break: keep-all !important;
  overflow-wrap: anywhere !important;
  line-break: strict !important;
  text-wrap: balance !important;
}

.reward-dialog.event-reward-dialog h3 {
  max-width: min(100%, 12.5em) !important;
}

.reward-prize,
.reward-prize.star-prize,
.reward-prize.event-star-prize {
  place-self: center !important;
  margin: 0 auto !important;
  transform-origin: center center !important;
}

.reward-dialog #rewardMessage {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: min(100%, 24em) !important;
  margin: 0 auto !important;
  font-size: clamp(16px, 3.2vw, 22px) !important;
  line-height: 1.65 !important;
  white-space: normal !important;
  word-break: keep-all !important;
  overflow-wrap: anywhere !important;
  text-wrap: balance !important;
}

.reward-dialog menu {
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.reward-dialog menu .primary-button {
  justify-self: center !important;
  min-width: min(210px, 70vw) !important;
  margin: 0 auto !important;
}

@media (max-width: 520px) {
  #rewardDialog {
    width: min(94vw, 430px) !important;
    max-width: calc(100vw - 20px) !important;
  }

  .reward-dialog {
    min-height: min(84vh, 680px) !important;
    padding: 24px 18px 22px !important;
    gap: 14px !important;
  }

  .reward-dialog h3,
  .reward-dialog #rewardName {
    max-width: min(100%, 10.5em) !important;
    font-size: clamp(25px, 7.5vw, 34px) !important;
    line-height: 1.18 !important;
  }

  .reward-prize.star-prize,
  .reward-prize.event-star-prize {
    width: min(58vw, 210px) !important;
    height: min(58vw, 210px) !important;
    min-width: 170px !important;
    min-height: 170px !important;
  }
}
/* Chibi nakama art guard: keep tall hair/crowns/wings from being clipped by legacy slots. */
.chibi-companion-slot,
.closet-chibi-slot,
.home-chibi-slot {
  overflow: visible !important;
}

.chibi-companion-slot img,
.closet-chibi-slot img,
.home-chibi-slot img,
.closet-card.chibi-card .closet-art {
  object-fit: contain !important;
  object-position: center center !important;
  overflow: visible !important;
}
/* Final sound toggle fix: keep the icon self-contained so it never overlaps SOUND text. */
.sound-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  min-width: 124px !important;
  min-height: 48px !important;
  padding: 7px 16px 7px 8px !important;
  overflow: visible !important;
  border: 1px solid rgba(255,255,255,0.82) !important;
  border-radius: 999px !important;
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,0.96) 0 12%, transparent 13%),
    linear-gradient(135deg, rgba(255,255,255,0.94), rgba(247,236,255,0.86)) !important;
  color: #705c8f !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  line-height: 1 !important;
  box-shadow: 0 12px 28px rgba(112,90,145,0.16), inset 0 -4px 10px rgba(148,111,176,0.08) !important;
}
.sound-toggle span {
  position: relative !important;
  flex: 0 0 34px !important;
  display: grid !important;
  place-items: center !important;
  width: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  overflow: hidden !important;
  border-radius: 14px !important;
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,0.96) 0 12%, transparent 13%),
    linear-gradient(135deg, #8fd5df 0%, #9b82d6 58%, #f0a5b7 100%) !important;
  box-shadow: inset 0 -4px 8px rgba(74,53,100,0.18), 0 0 0 4px rgba(255,255,255,0.48) !important;
  filter: none !important;
  opacity: 1 !important;
}
.sound-toggle span::before {
  position: static !important;
  width: auto !important;
  height: auto !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #fffaf0 !important;
  content: "♪" !important;
  font-size: 21px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-shadow: 0 2px 0 rgba(101,72,137,0.22) !important;
}
.sound-toggle span::after {
  position: absolute !important;
  right: 5px !important;
  top: 9px !important;
  width: 7px !important;
  height: 12px !important;
  border: 2px solid rgba(255,250,240,0.88) !important;
  border-left: 0 !important;
  border-radius: 0 999px 999px 0 !important;
  content: "" !important;
  animation: soundWavePulse 1.8s ease-in-out infinite !important;
}
.sound-toggle.muted {
  color: #918994 !important;
}
.sound-toggle.muted span {
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,0.88) 0 12%, transparent 13%),
    linear-gradient(135deg, #beb6c4, #a9a0b2) !important;
  box-shadow: inset 0 -4px 8px rgba(74,53,100,0.12), 0 0 0 4px rgba(255,255,255,0.4) !important;
}
.sound-toggle.muted span::after {
  transform: rotate(-45deg) scaleX(1.15) !important;
  border-color: rgba(255,250,240,0.9) !important;
  border-left: 2px solid rgba(255,250,240,0.9) !important;
  border-radius: 999px !important;
  animation: none !important;
}
/* Final combo dialog sizing: prevent mixed old/new rules from creating horizontal overflow. */
#comboEventFoundDialog,
#comboEventDialog {
  width: min(94vw, 620px) !important;
  max-width: calc(100vw - 18px) !important;
  max-height: calc(100dvh - 18px) !important;
  margin: auto !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: transparent !important;
}
.combo-found-dialog,
.combo-event-dialog {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: calc(100dvh - 18px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}
.combo-found-dialog {
  gap: clamp(8px, 2vw, 14px) !important;
  padding: clamp(18px, 4vw, 30px) clamp(16px, 4vw, 30px) !important;
}
.combo-found-dialog h3 {
  max-width: 100% !important;
  font-size: clamp(32px, 7vw, 48px) !important;
  overflow-wrap: anywhere !important;
}
.combo-found-title,
.combo-found-summary {
  box-sizing: border-box !important;
  max-width: 100% !important;
}
.combo-found-images {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: clamp(10px, 2.4vw, 14px) !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
.combo-found-image-card {
  box-sizing: border-box !important;
  grid-template-rows: clamp(96px, 22vw, 132px) auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  padding: 12px 8px 10px !important;
}
.combo-found-image-card img {
  max-width: min(116px, 28vw) !important;
  max-height: min(116px, 28vw) !important;
}
.combo-found-image-card figcaption,
.combo-found-image-card strong {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
}
.combo-found-dialog menu,
.combo-event-dialog menu {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: min(360px, 100%) !important;
  gap: 12px !important;
}
.combo-found-dialog menu button,
.combo-event-dialog menu button {
  min-width: 0 !important;
  width: 100% !important;
}
.combo-event-dialog {
  min-height: 0 !important;
  gap: clamp(10px, 2vw, 14px) !important;
  padding: clamp(28px, 4.2vw, 36px) clamp(16px, 4vw, 28px) clamp(20px, 3.5vw, 26px) !important;
}
.combo-event-dialog h3 {
  max-width: 100% !important;
  font-size: clamp(30px, 6.8vw, 42px) !important;
  overflow-wrap: anywhere !important;
}
.combo-event-stage {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 520px !important;
  min-height: clamp(230px, 50vw, 320px) !important;
  aspect-ratio: 16 / 9 !important;
  overflow: hidden !important;
}
.combo-talk-box {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 520px !important;
}
@media (max-width: 520px) {
  #comboEventFoundDialog,
  #comboEventDialog {
    width: calc(100vw - 10px) !important;
    max-width: calc(100vw - 10px) !important;
    max-height: calc(100dvh - 10px) !important;
  }
  .combo-found-dialog,
  .combo-event-dialog {
    border-radius: 24px !important;
    max-height: calc(100dvh - 10px) !important;
  }
  .combo-found-dialog h3 {
    font-size: clamp(30px, 8.8vw, 42px) !important;
  }
  .combo-found-summary {
    font-size: 15px !important;
    line-height: 1.6 !important;
  }
  .combo-found-images {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .combo-found-image-card {
    grid-template-rows: 96px auto !important;
    border-radius: 18px !important;
  }
  .combo-found-image-card img {
    max-width: 92px !important;
    max-height: 92px !important;
  }
  .combo-event-stage {
    min-height: 220px !important;
  }
  .combo-talk-box {
    min-height: 0 !important;
    padding: 14px !important;
  }
  .combo-talk-box p {
    font-size: 17px !important;
    line-height: 1.55 !important;
  }
}
/* Absolute final sound icon rule: one simple music note, no wave mark. */
.sound-toggle {
  min-width: 124px !important;
  min-height: 48px !important;
  gap: 10px !important;
  padding: 7px 16px 7px 8px !important;
}
.sound-toggle span {
  position: relative !important;
  flex: 0 0 34px !important;
  display: grid !important;
  place-items: center !important;
  width: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  overflow: hidden !important;
  border-radius: 999px !important;
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,0.95) 0 13%, transparent 14%),
    linear-gradient(135deg, #8fd5df 0%, #9b82d6 58%, #f0a5b7 100%) !important;
}
.sound-toggle span::before {
  position: static !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #fffaf0 !important;
  content: "♪" !important;
  font-size: 23px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-shadow: 0 2px 0 rgba(101,72,137,0.22) !important;
}
.sound-toggle span::after,
.sound-toggle.muted span::after {
  display: none !important;
  content: none !important;
  animation: none !important;
}
/* Final home cleanup overrides: keep these last. */
.nav-item[data-view="rooms"],
#roomsView,
.side-status,
.event-strip {
  display: none !important;
}
.topbar > div:first-child {
  display: none !important;
}
.wallet span[hidden] {
  display: none !important;
}
@media (max-width: 640px) {
  .menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
  }
  .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    max-height: 0 !important;
    padding: 0 2px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: max-height 240ms ease, opacity 180ms ease, padding 200ms ease;
  }
  body.menu-open .nav {
    max-height: 92px !important;
    padding: 2px 2px 8px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .topbar {
    display: flex !important;
    justify-content: center !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 0 10px !important;
    padding: 10px 12px !important;
  }
  .wallet {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Final home cleanup overrides: keep these last. */
.nav-item[data-view="rooms"],
#roomsView,
.side-status,
.event-strip {
  display: none !important;
}
.topbar > div:first-child {
  display: none !important;
}
.wallet span[hidden] {
  display: none !important;
}
@media (max-width: 640px) {
  .menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
  }
  .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    max-height: 0 !important;
    padding: 0 2px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: max-height 240ms ease, opacity 180ms ease, padding 200ms ease;
  }
  body.menu-open .nav {
    max-height: 92px !important;
    padding: 2px 2px 8px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .topbar {
    display: flex !important;
    justify-content: center !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 0 10px !important;
    padding: 10px 12px !important;
  }
  .wallet {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Home cleanup: remove room menu, simplify status, and collapse mobile navigation. */
.nav-item[data-view="rooms"],
#roomsView,
.side-status,
.event-strip {
  display: none !important;
}
.menu-toggle {
  display: none;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.94), rgba(255,244,252,0.78)),
    radial-gradient(circle at 16% 18%, rgba(255,226,102,0.36), transparent 36%);
  color: #6b5585;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(112, 90, 145, 0.12);
}
.topbar > div:first-child {
  display: none !important;
}
.topbar {
  justify-content: flex-end;
}
.wallet {
  min-width: 0;
  width: auto;
}
.wallet span[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .app-shell {
    gap: 8px;
  }
  .side-rail {
    gap: 10px;
    padding-bottom: 8px;
  }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-height: 0;
    padding: 0 2px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 240ms ease, opacity 180ms ease, padding 200ms ease;
  }
  body.menu-open .nav {
    max-height: 92px;
    padding: 2px 2px 8px;
    opacity: 1;
    pointer-events: auto;
  }
  .nav-item {
    min-height: 58px;
  }
  .topbar {
    margin-bottom: 10px;
    padding: 10px 12px;
  }
  .wallet {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .home-layout {
    gap: 10px;
  }
  .daily-panel {
    padding: 12px;
  }
}

/* Final title-screen centering pass. */
.onboarding-step:first-of-type.active {
  justify-items: center;
  align-content: center;
  text-align: center;
}
.onboarding-step:first-of-type .title-logo-heading {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: min(100%, 620px) !important;
  margin-inline: auto !important;
  overflow: visible;
}
.onboarding-step:first-of-type .title-logo-large {
  width: min(100%, 560px) !important;
  max-width: calc(100vw - 72px);
  max-height: none;
  margin-inline: auto;
  object-fit: contain;
  transform-origin: 50% 50%;
}
.onboarding-step:first-of-type .onboarding-hero,
.onboarding-step:first-of-type .onboarding-next {
  margin-inline: auto;
}

@media (max-width: 720px) {
  .onboarding-step:first-of-type {
    padding-inline: clamp(22px, 5vw, 34px);
  }
  .onboarding-step:first-of-type .title-logo-heading {
    max-width: 100% !important;
  }
  .onboarding-step:first-of-type .title-logo-large {
    width: min(100%, 500px) !important;
    max-width: calc(100vw - 76px);
  }
  .onboarding-step:first-of-type .onboarding-hero {
    width: min(390px, 78vw);
  }
}

@media (max-width: 430px) {
  .onboarding-step:first-of-type {
    padding-inline: 20px;
  }
  .onboarding-step:first-of-type .title-logo-large {
    width: min(100%, 360px) !important;
    max-width: calc(100vw - 64px);
  }
  .onboarding-step:first-of-type .onboarding-hero {
    width: min(330px, 82vw);
  }
}

/* Final mobile typography and compact side brand polish. */
.title-brand {
  gap: 0 !important;
}
.title-brand .brand-mark,
.title-brand p {
  display: none !important;
}
.title-brand > div {
  min-width: 0;
}
.title-brand .title-logo-side {
  content: url("./assets/ui/otetsudai-title-logo-v1.svg?v=3");
  display: block;
  width: min(238px, 58vw);
  max-width: 100%;
  height: auto;
}

.onboarding-step h2,
.section-header h3,
.screen-title h2,
.reward-dialog h3,
.combo-found-title,
.combo-event-title,
.companion-dialog h3 {
  word-break: keep-all;
  overflow-wrap: normal;
  line-break: strict;
  text-wrap: balance;
}

@media (max-width: 720px) {
  .onboarding-step h2 {
    max-width: min(100%, 15em);
    font-size: clamp(24px, 6.8vw, 32px);
    line-height: 1.18;
  }
  .onboarding-step.active {
    gap: 18px;
  }
  .section-header h3,
  .screen-title h2,
  .reward-dialog h3,
  .combo-found-title,
  .combo-event-title,
  .companion-dialog h3 {
    max-width: 100%;
    line-height: 1.22;
  }
  .title-brand {
    justify-content: center;
    width: 100%;
  }
  .title-brand .title-logo-side {
    width: min(230px, 64vw);
  }
}

@media (max-width: 430px) {
  .onboarding-step h2 {
    max-width: 13.5em;
    font-size: clamp(22px, 6.2vw, 27px);
  }
  .onboarding-note,
  .onboarding-lead,
  .pin-dialog p {
    max-width: 100%;
    font-size: 14px;
    line-height: 1.75;
  }
}

/* Final star polish: cute reward stars instead of plain glyphs. */
.reward-prize.star-prize {
  position: relative;
  overflow: visible;
  width: min(42vw, 252px);
  height: min(42vw, 252px);
  min-width: 196px;
  min-height: 196px;
  border: 1px solid rgba(255,255,255,0.86);
  background:
    radial-gradient(circle at 50% 52%, rgba(255,255,255,0.92) 0 16%, transparent 17%),
    radial-gradient(circle at 50% 50%, #ffe88f 0 42%, rgba(255, 232, 143, 0.46) 58%, transparent 72%),
    conic-gradient(from 18deg, rgba(255,216,107,0), rgba(255,216,107,0.38), rgba(240,169,188,0.22), rgba(143,205,215,0.3), rgba(255,216,107,0));
  box-shadow: 0 22px 60px rgba(220, 166, 69, 0.22), inset 0 0 0 8px rgba(255,255,255,0.16);
}
.reward-dialog.event-reward-dialog {
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 238, 123, 0.36), transparent 38%),
    radial-gradient(circle at 8% 12%, rgba(143, 205, 215, 0.24), transparent 30%),
    radial-gradient(circle at 92% 14%, rgba(240, 169, 188, 0.28), transparent 30%),
    linear-gradient(145deg, rgba(255,253,248,0.98), rgba(249,238,255,0.96));
}
.cute-star-prize {
  position: relative;
  display: grid;
  place-items: center;
  width: 172px;
  height: 172px;
  animation: cuteStarEntrance 840ms cubic-bezier(0.17, 1.35, 0.27, 1) both, cuteStarFloat 2.4s ease-in-out 900ms infinite;
}
.cute-star-orbit {
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.8), transparent 30%, rgba(143,205,215,0.58), transparent 60%, rgba(240,169,188,0.52), transparent);
  mask: radial-gradient(circle, transparent 61%, #000 63%, #000 67%, transparent 69%);
  animation: cuteStarOrbit 4.8s linear infinite;
}
.cute-star-main {
  position: absolute;
  width: 128px;
  height: 128px;
  background:
    radial-gradient(circle at 38% 30%, rgba(255,255,255,0.96) 0 9%, transparent 10%),
    linear-gradient(145deg, #fff7a8 0%, #ffd65f 54%, #ff9ebb 100%);
  clip-path: polygon(50% 0%, 62% 33%, 97% 35%, 69% 56%, 79% 91%, 50% 70%, 21% 91%, 31% 56%, 3% 35%, 38% 33%);
  filter: drop-shadow(0 16px 14px rgba(126, 86, 78, 0.2));
  animation: cuteStarWiggle 1.8s ease-in-out infinite;
}
.cute-star-main::after {
  position: absolute;
  inset: 10px;
  background: linear-gradient(160deg, rgba(255,255,255,0.58), transparent 42%);
  clip-path: inherit;
  content: "";
}
.cute-star-face {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 34px;
  transform: translate(-50%, -36%);
  z-index: 2;
}
.cute-star-face::before {
  position: absolute;
  left: 9px;
  top: 6px;
  width: 8px;
  height: 12px;
  border-radius: 999px;
  background: #6f4a45;
  box-shadow: 28px 0 0 #6f4a45;
  content: "";
}
.cute-star-face::after {
  position: absolute;
  left: 22px;
  top: 20px;
  width: 12px;
  height: 7px;
  border-bottom: 3px solid #7b504b;
  border-radius: 0 0 999px 999px;
  content: "";
}
.cute-star-sparkle {
  position: absolute;
  width: var(--spark-size, 22px);
  height: var(--spark-size, 22px);
  background: var(--spark-color, #fff6a9);
  clip-path: polygon(50% 0%, 62% 34%, 98% 36%, 68% 56%, 78% 92%, 50% 72%, 22% 92%, 32% 56%, 2% 36%, 38% 34%);
  filter: drop-shadow(0 0 8px rgba(255, 222, 99, 0.55));
  animation: cuteSparkleTwinkle 1.45s ease-in-out infinite;
}
.cute-star-sparkle.s1 { --spark-size: 24px; left: 8px; top: 18px; }
.cute-star-sparkle.s2 { --spark-size: 18px; --spark-color: #bff0ec; right: 10px; top: 26px; animation-delay: -0.4s; }
.cute-star-sparkle.s3 { --spark-size: 16px; --spark-color: #f5a9c2; left: 18px; bottom: 22px; animation-delay: -0.8s; }
.cute-star-sparkle.s4 { --spark-size: 20px; right: 24px; bottom: 8px; animation-delay: -1.1s; }
.cute-star-count {
  position: absolute;
  right: 8px;
  bottom: 18px;
  z-index: 3;
  min-width: 54px;
  padding: 7px 12px;
  border: 2px solid rgba(255,255,255,0.88);
  border-radius: 999px;
  background: linear-gradient(135deg, #fffaf0, #ffe49e 60%, #f7b4ca);
  color: #805234;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(126, 86, 78, 0.14);
  transform: rotate(-5deg);
}
.wallet span:nth-child(2)::before,
.mission-rewards .chip.rare::before {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 4px;
  background: linear-gradient(145deg, #fff7a8, #ffd65f 56%, #ff9ebb);
  clip-path: polygon(50% 0%, 62% 33%, 97% 35%, 69% 56%, 79% 91%, 50% 70%, 21% 91%, 31% 56%, 3% 35%, 38% 33%);
  filter: drop-shadow(0 2px 2px rgba(126, 86, 78, 0.14));
  content: "";
}
.wallet span:nth-child(2),
.mission-rewards .chip.rare {
  background: linear-gradient(135deg, rgba(255, 250, 227, 0.95), rgba(255, 229, 158, 0.78), rgba(248, 191, 211, 0.52));
  color: #8a5d24;
}
.title-logo-caption {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(92vw, 720px);
  margin: -10px auto 8px !important;
  padding: 11px 22px 12px;
  border: 2px solid rgba(255,255,255,0.82);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,243,218,0.72)),
    radial-gradient(circle at 12% 0%, rgba(255,216,107,0.28), transparent 32%);
  color: #6f548d;
  font-size: clamp(16px, 2.6vw, 24px);
  font-weight: 900;
  line-height: 1.35;
  box-shadow: 0 16px 30px rgba(112, 90, 145, 0.12);
}
.title-logo-caption::before,
.title-logo-caption::after {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin: 0 10px;
  background: linear-gradient(145deg, #fff7a8, #ffd65f 56%, #ff9ebb);
  clip-path: polygon(50% 0%, 62% 33%, 97% 35%, 69% 56%, 79% 91%, 50% 70%, 21% 91%, 31% 56%, 3% 35%, 38% 33%);
  content: "";
  animation: cuteSparkleTwinkle 1.6s ease-in-out infinite;
}
.title-logo-large {
  width: min(96vw, 760px);
  max-height: 248px;
}
.title-brand h1 {
  width: min(240px, 46vw);
}
@keyframes cuteStarEntrance {
  0% { opacity: 0; transform: scale(0.35) rotate(-18deg); }
  60% { opacity: 1; transform: scale(1.12) rotate(7deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes cuteStarFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}
@keyframes cuteStarWiggle {
  0%, 100% { transform: rotate(-2deg) scale(1); }
  50% { transform: rotate(2deg) scale(1.035); }
}
@keyframes cuteStarOrbit {
  to { transform: rotate(360deg); }
}
@keyframes cuteSparkleTwinkle {
  0%, 100% { opacity: 0.55; transform: scale(0.78) rotate(-8deg); }
  50% { opacity: 1; transform: scale(1.18) rotate(10deg); }
}
@media (max-width: 640px) {
  .reward-prize.star-prize {
    min-width: 180px;
    min-height: 180px;
  }
  .cute-star-prize {
    width: 148px;
    height: 148px;
  }
  .cute-star-main {
    width: 112px;
    height: 112px;
  }
  .title-logo-caption {
    border-radius: 22px;
    font-size: 15px;
  }
}

.title-logo-caption {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.title-logo-heading {
  display: grid;
  place-items: center;
  max-width: min(92vw, 760px) !important;
  margin: 0 auto 8px !important;
  background: none !important;
  color: inherit !important;
  text-shadow: none !important;
  filter: none !important;
}
.title-logo {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.title-logo-large {
  width: min(92vw, 680px);
  max-height: 172px;
  filter: drop-shadow(0 18px 28px rgba(122, 85, 209, 0.18));
  animation: titleLogoFloat 4s ease-in-out infinite;
}
.title-brand {
  align-items: center;
}
.title-brand h1 {
  display: block;
  width: min(210px, 42vw);
  margin: 0;
  line-height: 0;
}
.title-logo-side {
  width: 100%;
  filter: drop-shadow(0 7px 12px rgba(122, 85, 209, 0.12));
}
.title-brand .brand-mark {
  flex: 0 0 auto;
}
@keyframes titleLogoFloat {
  0%, 100% { transform: translateY(0) rotate(-0.2deg); }
  50% { transform: translateY(-5px) rotate(0.3deg); }
}
@media (max-width: 640px) {
  .title-logo-large {
    width: min(94vw, 520px);
  }
  .title-brand h1 {
    width: min(190px, 64vw);
  }
}

/* Must stay last: override older placeholder icon rules. */
.event-strip .event-icon {
  position: relative;
  isolation: isolate;
  overflow: visible;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,0.98) 0 14%, transparent 15%),
    linear-gradient(135deg, #fff1a8 0%, #f6c4d4 54%, #bdebee 100%);
  color: transparent;
  font-size: 0;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(129, 103, 168, 0.14), inset 0 -5px 10px rgba(134, 89, 143, 0.08);
  animation: iconTwinkle 1.8s ease-in-out infinite;
}
.sound-toggle span {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 8px 999px 999px 8px;
  background: linear-gradient(135deg, #8fd5df, #9b82d6 62%, #f0a5b7);
  box-shadow: inset 0 -3px 6px rgba(74, 53, 100, 0.16), 0 0 0 4px rgba(255,255,255,0.48);
}
.sound-toggle span::before {
  position: absolute;
  left: -5px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #fffaf0;
  content: "";
}
.sound-toggle span::after {
  position: absolute;
  right: -12px;
  top: 4px;
  width: 11px;
  height: 13px;
  border: 2px solid #d39a47;
  border-left: 0;
  border-radius: 0 999px 999px 0;
  content: "";
  animation: soundWavePulse 1.8s ease-in-out infinite;
}
.sound-toggle.muted span {
  filter: grayscale(0.8);
  opacity: 0.5;
}

/* Final fantasy-icon pass: replace placeholder glyphs with drawn, app-specific icons. */
.event-icon {
  position: relative;
  isolation: isolate;
  overflow: visible;
  flex: 0 0 auto;
  font-size: 0 !important;
  border: 1px solid rgba(255,255,255,0.78);
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,0.98) 0 14%, transparent 15%),
    linear-gradient(135deg, #fff1a8 0%, #f6c4d4 54%, #bdebee 100%);
  box-shadow: 0 10px 22px rgba(129, 103, 168, 0.14), inset 0 -5px 10px rgba(134, 89, 143, 0.08);
}
.event-icon::before,
.event-icon::after {
  position: absolute;
  content: "";
}
.event-strip article:nth-child(1) .event-icon::before {
  left: 8px;
  top: 15px;
  width: 18px;
  height: 12px;
  border: 2px solid #8b6546;
  border-radius: 4px 4px 6px 6px;
  background: linear-gradient(180deg, #d79a54, #a96443);
  box-shadow: inset 0 4px 0 rgba(255,239,175,0.5);
}
.event-strip article:nth-child(1) .event-icon::after {
  left: 9px;
  top: 8px;
  width: 16px;
  height: 12px;
  border: 2px solid #8b6546;
  border-bottom: 0;
  border-radius: 14px 14px 3px 3px;
  background: linear-gradient(180deg, #f2c36e, #bb7b45);
  transform-origin: 18% 100%;
  animation: tinyChestLid 2.2s ease-in-out infinite;
}
.event-strip article:nth-child(2) .event-icon::before {
  left: 11px;
  top: 7px;
  width: 9px;
  height: 20px;
  border-right: 3px solid #7b5ba9;
  border-top: 3px solid #7b5ba9;
  border-radius: 0 8px 0 0;
  transform: rotate(8deg);
}
.event-strip article:nth-child(2) .event-icon::after {
  left: 8px;
  top: 22px;
  width: 10px;
  height: 8px;
  border-radius: 50%;
  background: #f19ab4;
  box-shadow: 12px -14px 0 -3px #ffd86b;
  animation: tinyMusicBounce 1.8s ease-in-out infinite;
}
.event-strip article:nth-child(3) .event-icon::before {
  left: 8px;
  top: 15px;
  width: 18px;
  height: 13px;
  border: 2px solid #6d8d84;
  border-radius: 4px;
  background: linear-gradient(135deg, #fffaf1, #dff6ef);
}
.event-strip article:nth-child(3) .event-icon::after {
  left: 7px;
  top: 8px;
  width: 20px;
  height: 17px;
  background: linear-gradient(135deg, #f3a9bd, #8fd5df);
  clip-path: polygon(50% 0, 98% 43%, 84% 43%, 84% 94%, 16% 94%, 16% 43%, 2% 43%);
  opacity: 0.92;
  animation: tinyRoomFloat 2.4s ease-in-out infinite;
}

.sound-toggle {
  gap: 9px;
}
.sound-toggle span {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 8px 999px 999px 8px;
  background: linear-gradient(135deg, #8fd5df, #9b82d6 62%, #f0a5b7);
  box-shadow: inset 0 -3px 6px rgba(74, 53, 100, 0.16), 0 0 0 4px rgba(255,255,255,0.48);
}
.sound-toggle span::before {
  position: absolute;
  left: -5px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #fffaf0;
  content: "";
}
.sound-toggle span::after {
  position: absolute;
  right: -12px;
  top: 4px;
  width: 11px;
  height: 13px;
  border: 2px solid #d39a47;
  border-left: 0;
  border-radius: 0 999px 999px 0;
  content: "";
  animation: soundWavePulse 1.8s ease-in-out infinite;
}

#comboEventFoundDialog::backdrop {
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 239, 156, 0.46), transparent 30%),
    rgba(37, 28, 51, 0.42);
  backdrop-filter: blur(8px);
}
.combo-found-dialog {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  width: min(92vw, 560px);
  gap: 14px;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid rgba(255, 231, 145, 0.78);
  border-radius: 30px;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 246, 184, 0.72), transparent 28%),
    radial-gradient(circle at 12% 18%, rgba(240, 169, 188, 0.28), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(143, 205, 215, 0.34), transparent 26%),
    linear-gradient(145deg, rgba(255,253,248,0.98), rgba(248,238,255,0.95));
  box-shadow: 0 0 0 8px rgba(255,255,255,0.22), 0 34px 110px rgba(52, 34, 78, 0.38);
  animation: comboFoundPop 520ms cubic-bezier(0.2, 1.28, 0.3, 1) both;
}
.combo-found-dialog::before,
.combo-found-dialog::after {
  position: absolute;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  content: "";
}
.combo-found-dialog::before {
  background: conic-gradient(from 8deg, rgba(255,232,112,0), rgba(255,232,112,0.46), rgba(240,169,188,0.25), rgba(143,205,215,0.36), rgba(255,232,112,0));
  filter: blur(2px);
  animation: auraSpin 8s linear infinite;
}
.combo-found-dialog::after {
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.96) 0 3px, transparent 4px),
    radial-gradient(circle, rgba(255,222,99,0.92) 0 4px, transparent 5px),
    radial-gradient(circle, rgba(240,169,188,0.64) 0 3px, transparent 4px);
  background-size: 96px 96px, 132px 132px, 156px 156px;
  animation: eventFoundSparkle 2.4s linear infinite;
}
.combo-found-dialog > * {
  position: relative;
  z-index: 1;
}
.combo-found-dialog h3 {
  margin: 0;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.04;
  color: #463053;
  text-shadow: 0 3px 0 rgba(255,255,255,0.9);
}
.combo-found-title {
  margin: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  color: #765aa0;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(112, 90, 145, 0.12);
}
.combo-found-summary {
  max-width: 34em;
  margin: 0;
  color: #66586d;
  line-height: 1.65;
}
.combo-found-images {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}
.combo-found-image-card {
  display: grid;
  grid-template-rows: 132px auto;
  justify-items: center;
  align-items: center;
  width: min(42vw, 158px);
  min-width: 124px;
  margin: 0;
  padding: 12px 10px 10px;
  border: 1px solid rgba(255,255,255,0.82);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 238, 153, 0.42), transparent 58%),
    linear-gradient(145deg, rgba(255,255,255,0.82), rgba(255,247,236,0.68));
  box-shadow: 0 18px 34px rgba(112, 90, 145, 0.15);
  animation: comboFoundItemFloat 3s ease-in-out infinite;
}
.combo-found-image-card:nth-child(2) { animation-delay: -0.8s; }
.combo-found-image-card:nth-child(3) { animation-delay: -1.4s; }
.combo-found-image-card img {
  max-width: 112px;
  max-height: 118px;
  object-fit: contain;
  filter: drop-shadow(0 14px 12px rgba(70, 48, 70, 0.16));
}
.combo-found-image-card figcaption {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.combo-found-image-card small {
  color: #9a7aa8;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.combo-found-image-card strong {
  max-width: 132px;
  overflow-wrap: anywhere;
  color: #3f3048;
  font-size: 14px;
}
.combo-found-dialog menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
}

@keyframes tinyChestLid {
  0%, 72%, 100% { transform: rotate(0deg) translateY(0); }
  84% { transform: rotate(-16deg) translateY(-2px); }
}
@keyframes tinyMusicBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes tinyRoomFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2px) rotate(-3deg); }
}
@keyframes soundWavePulse {
  0%, 100% { opacity: 0.34; transform: scaleX(0.76); }
  50% { opacity: 1; transform: scaleX(1); }
}
@keyframes comboFoundPop {
  from { opacity: 0; transform: translateY(18px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes eventFoundSparkle {
  from { background-position: 0 0, 34px 20px, 80px 30px; opacity: 0.74; }
  to { background-position: 80px 96px, -34px 132px, 20px 186px; opacity: 1; }
}
@keyframes comboFoundItemFloat {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50% { transform: translateY(-7px) rotate(0.6deg); }
}

@media (max-width: 520px) {
  .combo-found-dialog {
    width: min(94vw, 420px);
    border-radius: 24px;
  }
  .combo-found-images {
    gap: 9px;
  }
  .combo-found-image-card {
    grid-template-rows: 104px auto;
    min-width: 112px;
    width: calc(50% - 8px);
  }
  .combo-found-image-card img {
    max-width: 94px;
    max-height: 96px;
  }
}

/* Combination conversation events. */
.combo-event-banner {
  position: absolute;
  left: clamp(18px, 3vw, 34px);
  right: clamp(18px, 3vw, 34px);
  bottom: clamp(18px, 3vw, 34px);
  z-index: 12;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 76px;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 22px;
  padding: 12px 16px;
  background:
    radial-gradient(circle at 12% 22%, rgba(255, 226, 102, 0.44), transparent 38%),
    linear-gradient(135deg, rgba(255,253,248,0.92), rgba(248,232,255,0.82));
  color: #3c3045;
  box-shadow: 0 18px 48px rgba(112, 90, 145, 0.18), inset 0 0 0 1px rgba(213,173,84,0.16);
  text-align: left;
  cursor: pointer;
  animation: comboEventFloat 3.6s ease-in-out infinite;
}
.combo-event-banner[hidden] {
  display: none;
}
.combo-event-banner::after {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background:
    linear-gradient(115deg, transparent 20%, rgba(255,255,255,0.58), transparent 66%);
  content: "";
  opacity: 0.56;
  pointer-events: none;
  transform: translateX(-45%);
  animation: jewelSweep 4.4s ease-in-out infinite;
}
.combo-event-banner.is-new {
  box-shadow: 0 18px 48px rgba(112, 90, 145, 0.18), 0 0 28px rgba(255, 226, 102, 0.34);
}
.combo-event-badge {
  display: grid;
  place-items: center;
  min-width: 74px;
  min-height: 46px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe783, #f0a9bc 52%, #8fcdd7);
  color: #fffdf8;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(65,45,83,0.2);
  box-shadow: 0 10px 22px rgba(142, 124, 200, 0.22);
}
.combo-event-banner strong {
  display: block;
  overflow: hidden;
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.combo-event-banner small {
  display: block;
  overflow: hidden;
  color: #6f6473;
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#comboEventDialog {
  width: min(620px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}
#comboEventDialog::backdrop {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 226, 102, 0.24), transparent 34%),
    rgba(44, 34, 48, 0.48);
  backdrop-filter: blur(7px);
}
.combo-event-dialog {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  overflow: hidden;
  min-height: 620px;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 28px;
  padding: 36px 28px 26px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 239, 166, 0.34), transparent 34%),
    linear-gradient(155deg, rgba(255,253,248,0.98), rgba(247,237,255,0.92));
  box-shadow: 0 34px 90px rgba(43,33,50,0.28);
  text-align: center;
}
.combo-event-dialog::before {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(213, 173, 84, 0.38);
  border-radius: 22px;
  content: "";
  pointer-events: none;
}
.combo-event-dialog::after {
  position: absolute;
  inset: -24%;
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,0.9) 0 5px, transparent 6px),
    radial-gradient(circle at 78% 18%, rgba(255,226,102,0.78) 0 6px, transparent 7px),
    radial-gradient(circle at 86% 76%, rgba(143,205,215,0.56) 0 6px, transparent 7px),
    linear-gradient(115deg, transparent 24%, rgba(255,255,255,0.44), transparent 68%);
  content: "";
  opacity: 0.68;
  pointer-events: none;
  animation: rewardDialogTwinkle 4s ease-in-out infinite;
}
.combo-event-dialog > * {
  position: relative;
  z-index: 1;
}
.combo-event-dialog h3 {
  max-width: 14em;
  margin: 0;
  font-size: clamp(28px, 6vw, 42px);
  line-height: 1.08;
}
.combo-event-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  justify-items: center;
  width: min(430px, 86vw);
  min-height: 210px;
}
.combo-event-aura {
  position: absolute;
  inset: 4% 8%;
  border-radius: 46% 54% 52% 48%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.88), rgba(255,226,102,0.28) 42%, transparent 72%),
    conic-gradient(from 12deg, rgba(255,217,109,0.4), rgba(240,169,188,0.32), rgba(143,205,215,0.28), rgba(216,201,242,0.34), rgba(255,217,109,0.4));
  animation: auraSpin 18s linear infinite;
}
#comboEventPet,
#comboEventChibi {
  position: relative;
  z-index: 2;
  width: min(178px, 38vw);
  height: min(178px, 38vw);
  object-fit: contain;
  filter: drop-shadow(0 16px 16px rgba(63,48,42,0.16));
}
#comboEventPet {
  transform: translateX(10px);
  animation: companionPreviewFloat 3.6s ease-in-out infinite;
}
#comboEventChibi {
  transform: translateX(-10px);
  animation: companionPreviewFloat 3.9s ease-in-out infinite reverse;
}
.combo-talk-box {
  display: grid;
  gap: 8px;
  width: min(470px, 100%);
  min-height: 116px;
  border: 1px solid rgba(158,126,190,0.22);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 16px 38px rgba(112,90,145,0.12);
  text-align: left;
}
.combo-talk-box strong {
  color: #8a6bb8;
  font-size: 15px;
}
.combo-talk-box p {
  margin: 0;
  color: #3c3045;
  font-size: clamp(17px, 3vw, 21px);
  font-weight: 900;
  line-height: 1.65;
}
.combo-event-reward {
  min-height: 1.4em;
  margin: 0;
  color: #b58728;
  font-weight: 900;
}
.combo-event-dialog menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
}
.combo-event-dialog menu button {
  min-width: 128px;
  border-radius: 14px;
}
@keyframes comboEventFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@media (max-width: 640px) {
  .combo-event-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    grid-template-columns: 1fr;
    min-height: 96px;
  }
  .combo-event-badge {
    width: fit-content;
    min-height: 32px;
  }
  .combo-event-banner strong,
  .combo-event-banner small {
    white-space: normal;
  }
  .combo-event-dialog {
    min-height: 560px;
    padding: 34px 18px 22px;
  }
  .combo-event-stage {
    min-height: 180px;
  }
}

/* Combo event scene backgrounds and character motions. */
.combo-event-list {
  display: none;
  width: min(500px, 100%);
  gap: 12px;
}
.combo-list-mode .combo-event-list {
  display: grid;
}
.combo-list-mode .combo-event-stage,
.combo-list-mode .combo-talk-box,
.combo-list-mode .combo-event-reward {
  display: none;
}
.combo-event-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 12px;
  width: 100%;
  border: 1px solid rgba(158,126,190,0.22);
  border-radius: 18px;
  padding: 14px 16px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.92), rgba(247,236,255,0.86)),
    radial-gradient(circle at 10% 0%, rgba(255,226,102,0.22), transparent 36%);
  color: #3c3045;
  box-shadow: 0 14px 30px rgba(112,90,145,0.12);
  text-align: left;
}
.combo-event-choice-status {
  grid-row: span 2;
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(232,244,235,0.96);
  color: #527a6b;
  font-size: 12px;
  font-weight: 900;
}
.combo-event-choice strong {
  font-size: 17px;
}
.combo-event-choice small {
  color: #6f6473;
  font-size: 13px;
  line-height: 1.35;
}
.combo-event-stage {
  overflow: hidden;
  min-height: 300px;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255,255,255,0.76);
  border-radius: 24px;
  background: #dff4ff;
  box-shadow: inset 0 0 0 1px rgba(213,173,84,0.22), 0 18px 42px rgba(112,90,145,0.15);
}
.combo-event-aura {
  display: none;
}
.combo-event-bg,
.combo-event-sunbeam {
  position: absolute;
  inset: 0;
}
.combo-event-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.combo-event-sunbeam {
  background:
    radial-gradient(circle at 50% 78%, rgba(255,255,255,0.42), transparent 34%),
    linear-gradient(115deg, rgba(255,246,193,0.28), transparent 48%, rgba(255,255,255,0.16));
  pointer-events: none;
}
#comboEventPet,
#comboEventChibi {
  width: min(190px, 35vw);
  height: min(190px, 35vw);
  animation: none;
}
.combo-motion-bob {
  animation: comboMotionBob 2.4s ease-in-out infinite !important;
}
.combo-motion-nod {
  animation: comboMotionNod 1.8s ease-in-out infinite !important;
}
.combo-motion-happy {
  animation: comboMotionHappy 1.2s ease-in-out infinite !important;
}
.combo-motion-sleepy {
  animation: comboMotionSleepy 3.4s ease-in-out infinite !important;
}
.combo-motion-surprise {
  animation: comboMotionSurprise 0.72s cubic-bezier(.2,1.6,.35,1) both !important;
}
.combo-motion-alert {
  animation: comboMotionAlert 1.1s ease-in-out infinite !important;
}
@keyframes comboMotionBob {
  0%, 100% { translate: 0 0; rotate: -1deg; }
  50% { translate: 0 -8px; rotate: 1.5deg; }
}
@keyframes comboMotionNod {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  38% { translate: 0 4px; rotate: 2deg; }
  70% { translate: 0 -3px; rotate: -1deg; }
}
@keyframes comboMotionHappy {
  0%, 100% { translate: 0 0; rotate: -2deg; }
  32% { translate: 0 -12px; rotate: 3deg; }
  64% { translate: 0 -4px; rotate: -3deg; }
}
@keyframes comboMotionSleepy {
  0%, 100% { translate: 0 0; rotate: -1deg; scale: 1; }
  50% { translate: 0 -5px; rotate: 1deg; scale: 0.985; }
}
@keyframes comboMotionSurprise {
  0% { translate: 0 0; scale: 1; rotate: 0deg; }
  35% { translate: 0 -22px; scale: 1.12; rotate: -4deg; }
  70% { translate: 0 4px; scale: 0.96; rotate: 3deg; }
  100% { translate: 0 0; scale: 1; rotate: 0deg; }
}
@keyframes comboMotionAlert {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  25% { translate: 4px -4px; rotate: 3deg; }
  50% { translate: -4px -3px; rotate: -2deg; }
  75% { translate: 2px -5px; rotate: 2deg; }
}
@media (max-width: 640px) {
  .combo-event-stage {
    min-height: 230px;
  }
  #comboEventPet,
  #comboEventChibi {
    width: min(150px, 39vw);
    height: min(150px, 39vw);
  }
}

/* Treasure rarity charge: closed chest changes color before opening. */
.treasure-chest.charging {
  --charge-time: 920ms;
  --charge-lid:
    radial-gradient(circle at 50% 12%, rgba(255,255,255,0.9), transparent 13%),
    linear-gradient(115deg, #f6d56f 0%, #9ed5a7 36%, #fff1a8 58%, #d89150 100%);
  --charge-body:
    linear-gradient(115deg, #d88d51 0%, #9ed5a7 36%, #ffe78a 58%, #8d5d42 100%);
  --charge-aura: rgba(151, 215, 163, 0.7);
  --charge-ring: rgba(255, 236, 148, 0.66);
  filter: drop-shadow(0 28px 24px rgba(63, 48, 42, 0.18)) drop-shadow(0 0 24px var(--charge-aura));
  animation: treasureChargeBounce var(--charge-time) ease-in-out forwards;
}
.treasure-chest.charging.rarity-sr {
  --charge-time: 1320ms;
  --charge-lid:
    radial-gradient(circle at 50% 12%, rgba(255,255,255,0.96), transparent 13%),
    linear-gradient(115deg, #8fd5df 0%, #a78bdc 32%, #f3c2d0 58%, #6fa6d6 100%);
  --charge-body:
    linear-gradient(115deg, #579fc0 0%, #9b82d6 34%, #f0a5b7 62%, #5c6fc0 100%);
  --charge-aura: rgba(167, 139, 220, 0.82);
  --charge-ring: rgba(143, 213, 223, 0.72);
}
.treasure-chest.charging.rarity-ssr {
  --charge-time: 1780ms;
  --charge-lid:
    radial-gradient(circle at 50% 12%, rgba(255,255,255,1), transparent 13%),
    linear-gradient(115deg, #fff17a 0%, #ff9cbd 20%, #a78bdc 40%, #7fd8e1 60%, #9ee4a7 78%, #fff17a 100%);
  --charge-body:
    linear-gradient(115deg, #f5a95f 0%, #ff86b0 22%, #8c80e8 44%, #65cbd8 64%, #95dc83 82%, #ffd95d 100%);
  --charge-aura: rgba(255, 226, 102, 0.9);
  --charge-ring: rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 28px 24px rgba(63, 48, 42, 0.18)) drop-shadow(0 0 42px rgba(255, 226, 102, 0.88)) saturate(1.24);
}
.treasure-chest.charging::before,
.treasure-chest.charging::after {
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
  content: "";
  transform: translate(-50%, -50%);
}
.treasure-chest.charging::before {
  z-index: 0;
  width: 128%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255,255,255,0.82) 0 12%, var(--charge-aura) 28%, transparent 66%),
    conic-gradient(from 0deg, transparent, var(--charge-ring), transparent 18%, var(--charge-aura), transparent 44%, var(--charge-ring), transparent 74%);
  filter: blur(1px);
  animation: treasureChargeAura var(--charge-time) ease-in-out forwards;
}
.treasure-chest.charging::after {
  z-index: 6;
  width: 115%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 30%, rgba(255,255,255,0.96) 0 4px, transparent 5px),
    radial-gradient(circle at 72% 24%, rgba(255,255,255,0.9) 0 3px, transparent 4px),
    radial-gradient(circle at 60% 76%, var(--charge-ring) 0 5px, transparent 6px),
    linear-gradient(120deg, transparent 24%, rgba(255,255,255,0.82) 48%, transparent 70%);
  mix-blend-mode: screen;
  opacity: 0;
  animation: treasureChargeSparkle var(--charge-time) ease-in-out forwards;
}
.treasure-chest.charging .treasure-lid {
  background: var(--charge-lid);
  background-size: 240% 240%;
  animation: treasureGradientCharge var(--charge-time) ease-in-out forwards;
}
.treasure-chest.charging .treasure-lid::before {
  background: linear-gradient(115deg, rgba(255,255,255,0.88), var(--charge-aura), #b58258);
  background-size: 220% 220%;
  animation: treasureGradientCharge var(--charge-time) ease-in-out forwards;
}
.treasure-chest.charging .treasure-body {
  background:
    linear-gradient(90deg, transparent 14%, rgba(255,255,255,0.7) 14% 22%, transparent 22% 48%, rgba(255,255,255,0.34) 48% 52%, transparent 52% 78%, rgba(255,255,255,0.7) 78% 86%, transparent 86%),
    var(--charge-body);
  background-size: 100% 100%, 240% 240%;
  animation: treasureGradientCharge var(--charge-time) ease-in-out forwards;
}
.treasure-chest.charging .treasure-lock {
  background: linear-gradient(135deg, #fffdf0, var(--charge-ring), #d5ad54);
  box-shadow: 0 0 26px var(--charge-aura), 0 0 44px rgba(255,255,255,0.36);
}
.treasure-chest.charging.rarity-ssr .treasure-lock {
  animation: treasureGemRainbow 560ms linear infinite;
}
.treasure-chest.charging.rarity-ssr .treasure-lid,
.treasure-chest.charging.rarity-ssr .treasure-body {
  animation: treasureGradientCharge var(--charge-time) ease-in-out forwards, treasureSSRChromatic 520ms ease-in-out infinite;
}
.summon-panel.treasure-charge::before {
  background:
    radial-gradient(circle at 50% 58%, rgba(255,255,255,0.92), var(--charge-panel, rgba(255,236,148,0.28)) 28%, transparent 66%);
  animation: treasureChargePanel var(--charge-panel-time, 920ms) ease-in-out forwards;
}
.summon-panel.treasure-charge::after {
  background:
    conic-gradient(from 0deg, transparent, var(--charge-panel, rgba(255,236,148,0.42)), transparent 18%, rgba(255,255,255,0.54), transparent 38%),
    linear-gradient(115deg, transparent 18%, rgba(255,255,255,0.7) 46%, transparent 78%);
  animation: treasureChargeDissolve var(--charge-panel-time, 920ms) ease-in-out forwards;
}
.summon-panel.treasure-charge-r {
  --charge-panel: rgba(151, 215, 163, 0.42);
  --charge-panel-time: 920ms;
}
.summon-panel.treasure-charge-sr {
  --charge-panel: rgba(167, 139, 220, 0.54);
  --charge-panel-time: 1320ms;
}
.summon-panel.treasure-charge-ssr {
  --charge-panel: rgba(255, 172, 201, 0.62);
  --charge-panel-time: 1780ms;
}
.summon-panel.treasure-charge-sr .treasure-rays {
  background: conic-gradient(from 12deg, rgba(143,213,223,0), rgba(143,213,223,0.7), rgba(167,139,220,0), rgba(240,169,188,0.48), rgba(143,213,223,0));
}
.summon-panel.treasure-charge-ssr .treasure-rays {
  background: conic-gradient(from 12deg, #fff17a00, rgba(255,241,122,0.86), rgba(255,156,189,0.54), rgba(167,139,220,0.62), rgba(127,216,225,0.6), rgba(149,220,131,0.5), #fff17a00);
  filter: blur(0.5px) saturate(1.28);
}
@keyframes treasureChargeBounce {
  0% { transform: translateY(0) scale(1); }
  18% { transform: translateY(-3px) scale(1.015); }
  42% { transform: translateY(2px) scale(0.994); }
  68% { transform: translateY(-5px) scale(1.026); }
  100% { transform: translateY(0) scale(1.01); }
}
@keyframes treasureGradientCharge {
  0% { background-position: 0% 50%; }
  48% { background-position: 100% 50%; }
  100% { background-position: 50% 50%; }
}
@keyframes treasureChargeAura {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.72) rotate(0deg); }
  30% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.96) rotate(80deg); }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1.14) rotate(220deg); }
  100% { opacity: 0.58; transform: translate(-50%, -50%) scale(1.24) rotate(320deg); }
}
@keyframes treasureChargeSparkle {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8) rotate(-8deg); }
  38% { opacity: 0.66; transform: translate(-50%, -50%) scale(1) rotate(8deg); }
  76% { opacity: 0.92; transform: translate(-50%, -50%) scale(1.08) rotate(20deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.18) rotate(32deg); }
}
@keyframes treasureChargePanel {
  0% { opacity: 0; transform: scale(0.86); }
  44% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0.18; transform: scale(1.08); }
}
@keyframes treasureChargeDissolve {
  0% { opacity: 0; transform: translateX(-18%) scale(0.94); }
  48% { opacity: 0.44; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(16%) scale(1.08); }
}
@keyframes treasureGemRainbow {
  0%, 100% { filter: hue-rotate(0deg) brightness(1.04); }
  50% { filter: hue-rotate(80deg) brightness(1.18); }
}
@keyframes treasureSSRChromatic {
  0%, 100% { filter: saturate(1.08) brightness(1); }
  50% { filter: saturate(1.28) brightness(1.08); }
}

/* Onboarding flow. */
[hidden] {
  display: none !important;
}
.onboarding-active .app-shell {
  filter: blur(10px) saturate(0.82);
  pointer-events: none;
  user-select: none;
}
.onboarding-shell {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 34px);
  overflow: auto;
  background:
    radial-gradient(circle at 16% 14%, rgba(255, 236, 158, 0.62), transparent 26%),
    radial-gradient(circle at 84% 16%, rgba(216, 201, 242, 0.62), transparent 28%),
    radial-gradient(circle at 50% 90%, rgba(143, 205, 215, 0.42), transparent 34%),
    rgba(59, 46, 71, 0.34);
  backdrop-filter: blur(12px);
}
.onboarding-card,
.pin-dialog {
  position: relative;
  width: min(920px, 100%);
  min-height: min(720px, calc(100vh - 42px));
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 28px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 240, 164, 0.34), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(240, 169, 188, 0.22), transparent 28%),
    linear-gradient(145deg, rgba(255,253,248,0.97), rgba(248,237,255,0.92));
  box-shadow: 0 32px 90px rgba(50, 36, 64, 0.28), inset 0 0 0 1px rgba(213,173,84,0.18);
}
.onboarding-card::before,
.pin-dialog::before {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(213, 173, 84, 0.34);
  border-radius: 22px;
  content: "";
  pointer-events: none;
}
.onboarding-sparkles,
.onboarding-card::after {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  content: "";
}
.onboarding-sparkles {
  background:
    radial-gradient(circle at 20% 24%, rgba(255,255,255,0.95) 0 5px, transparent 6px),
    radial-gradient(circle at 76% 22%, rgba(255,226,102,0.8) 0 6px, transparent 7px),
    radial-gradient(circle at 88% 72%, rgba(143,205,215,0.68) 0 5px, transparent 6px),
    radial-gradient(circle at 12% 76%, rgba(240,169,188,0.6) 0 7px, transparent 8px);
  animation: rewardDialogTwinkle 4.4s ease-in-out infinite;
}
.onboarding-card::after {
  background:
    linear-gradient(115deg, transparent 16%, rgba(255,255,255,0.42) 46%, transparent 70%);
  opacity: 0.56;
  transform: translateX(-68%) rotate(8deg);
  animation: jewelSweep 5.6s ease-in-out infinite;
}
.onboarding-progress {
  position: absolute;
  left: 50%;
  top: 24px;
  z-index: 4;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}
.onboarding-progress span {
  width: 34px;
  height: 8px;
  border-radius: 999px;
  background: rgba(117, 96, 139, 0.18);
  transition: width 220ms ease, background 220ms ease, box-shadow 220ms ease;
}
.onboarding-progress span.active {
  width: 48px;
  background: linear-gradient(90deg, #ffd96d, #f0a9bc, #8fcdd7);
  box-shadow: 0 0 18px rgba(255, 226, 102, 0.38);
}
.onboarding-step {
  position: relative;
  z-index: 3;
  display: none;
  min-height: inherit;
  padding: clamp(62px, 8vw, 86px) clamp(24px, 5vw, 64px) clamp(28px, 5vw, 54px);
}
.onboarding-step.active {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 20px;
  animation: viewMagicIn 520ms cubic-bezier(0.2, 0.9, 0.28, 1) both;
}
.onboarding-step h1,
.onboarding-step h2,
.pin-dialog h3 {
  max-width: 11em;
  margin: 0;
  color: #3c3045;
  font-size: clamp(34px, 7vw, 68px);
  line-height: 1.04;
  text-align: center;
}
.onboarding-step h2,
.pin-dialog h3 {
  font-size: clamp(28px, 5vw, 48px);
}
.onboarding-step h2 > span {
  display: inline-block;
}
.onboarding-lead,
.onboarding-note,
.pin-dialog p {
  max-width: 34em;
  margin: 0;
  color: #6f6473;
  font-size: clamp(15px, 2.4vw, 20px);
  line-height: 1.9;
  text-align: center;
}
.onboarding-hero {
  position: relative;
  display: grid;
  place-items: center;
  width: min(430px, 72vw);
  aspect-ratio: 1.25;
}
.onboarding-hero::before {
  position: absolute;
  inset: 11% 4%;
  border-radius: 45% 55% 58% 42%;
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,0.86), rgba(255,232,145,0.34) 44%, transparent 72%),
    conic-gradient(from 20deg, rgba(255,217,109,0.46), rgba(240,169,188,0.36), rgba(143,205,215,0.32), rgba(216,201,242,0.38), rgba(255,217,109,0.46));
  content: "";
  animation: auraSpin 18s linear infinite;
}
.onboarding-hero img {
  position: relative;
  z-index: 2;
  width: 58%;
  max-height: 94%;
  object-fit: contain;
  filter: drop-shadow(0 24px 20px rgba(63,48,42,0.16));
  animation: idleFloat 4s ease-in-out infinite;
}
.onboarding-hero span {
  position: absolute;
  right: 8%;
  bottom: 14%;
  z-index: 3;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  color: #8a6bb8;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(112,90,145,0.16);
}
.onboarding-feature-grid,
.chore-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(760px, 100%);
  gap: 14px;
}
.onboarding-feature-grid div,
.chore-picker label,
.color-choice label {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(158,126,190,0.2);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.86), rgba(255,247,238,0.68));
  box-shadow: 0 14px 34px rgba(112,90,145,0.1);
}
.onboarding-feature-grid div {
  padding: 18px;
}
.onboarding-feature-grid strong {
  color: #5e4b86;
  font-size: 18px;
}
.onboarding-feature-grid span,
.chore-picker span {
  color: #6f6473;
  line-height: 1.55;
}
.onboarding-field {
  display: grid;
  width: min(560px, 100%);
  min-width: 0;
  gap: 8px;
  color: #6f6473;
  font-weight: 900;
}
.onboarding-field input,
.custom-chore-row input,
.pin-dialog input {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 54px;
  border: 1px solid rgba(158,126,190,0.24);
  border-radius: 16px;
  padding: 0 16px;
  background: rgba(255,255,255,0.82);
  color: #3c3045;
  font: inherit;
  font-weight: 900;
  box-shadow: inset 0 2px 8px rgba(80,60,96,0.06);
}

.onboarding-field input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.2;
}
.color-choice {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.base-character-choice {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(820px, 100%);
  gap: 14px;
}
.base-character-choice label {
  min-width: 0;
  cursor: pointer;
}
.base-character-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.base-character-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 310px;
  border: 1px solid rgba(158,126,190,0.22);
  border-radius: 20px;
  padding: 14px 12px 16px;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 226, 102, 0.26), transparent 36%),
    linear-gradient(145deg, rgba(255,255,255,0.9), rgba(255,247,238,0.72));
  box-shadow: 0 16px 34px rgba(112,90,145,0.12);
  text-align: center;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.base-character-card img {
  width: min(180px, 52vw);
  height: 190px;
  object-fit: contain;
  filter: drop-shadow(0 16px 16px rgba(63,48,42,0.14));
  animation: idleFloat 4.4s ease-in-out infinite;
}
.base-character-card strong {
  color: #3c3045;
  font-size: 17px;
  line-height: 1.3;
}
.base-character-card small {
  color: #6f6473;
  font-weight: 800;
  line-height: 1.45;
}
.base-character-choice input:checked + .base-character-card {
  border-color: rgba(255, 210, 91, 0.9);
  box-shadow: 0 20px 46px rgba(240,169,188,0.2), 0 0 0 4px rgba(255, 226, 102, 0.34);
  transform: translateY(-4px);
}
.base-character-choice input:checked + .base-character-card::after {
  position: absolute;
  right: 12px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd96d, #f0a9bc);
  color: white;
  font-weight: 900;
  content: "✓";
  box-shadow: 0 8px 18px rgba(240,169,188,0.24);
}
.color-choice label,
.chore-picker label {
  cursor: pointer;
  padding: 12px;
}
.color-choice input,
.chore-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.color-swatch {
  display: block;
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255,255,255,0.92);
  border-radius: 50%;
  box-shadow: 0 8px 16px rgba(112,90,145,0.14);
}
.color-swatch.pink,
.avatar-dot.pink { background: #f0a9bc; }
.color-swatch.aqua,
.avatar-dot.aqua { background: #8fcdd7; }
.color-swatch.violet,
.avatar-dot.violet { background: #9b82d6; }
.color-swatch.mint,
.avatar-dot.mint { background: #8ec9ae; }
.color-choice input:checked + .color-swatch,
.chore-picker input:checked + span {
  outline: 3px solid rgba(255, 226, 102, 0.74);
  outline-offset: 3px;
}
.chore-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.chore-picker label {
  display: flex;
  align-items: center;
  min-height: 58px;
  font-weight: 900;
}
.custom-chore-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(760px, 100%);
  gap: 12px;
}
.pin-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(560px, 100%);
  gap: 12px;
}
.onboarding-actions,
.pin-dialog menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 0;
  padding: 0;
}
.onboarding-actions button,
.onboarding-step > .primary-button {
  min-width: 150px;
  border-radius: 16px;
}
.onboarding-error {
  min-height: 1.4em;
  margin: 0;
  color: #ba4f66;
  font-weight: 900;
  text-align: center;
}
#parentPinDialog {
  width: min(420px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}
#parentPinDialog::backdrop {
  background: rgba(44, 34, 48, 0.42);
  backdrop-filter: blur(6px);
}
.pin-dialog {
  display: grid;
  justify-items: center;
  min-height: 0;
  padding: 34px 26px 28px;
  text-align: center;
}
.pin-dialog input {
  width: min(220px, 100%);
  text-align: center;
  letter-spacing: 0.4em;
  font-size: 24px;
}
.avatar-dot.hina {
  background: var(--child-theme, var(--rose));
}
.mission-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.mission-edit-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 0.9fr) minmax(0, 1.1fr) 88px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(158,126,190,0.2);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,0.86), rgba(255,247,238,0.66));
}
.mission-edit-row span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff4c7, #d8c9f2);
  color: #6a5488;
  font-weight: 900;
}
.mission-edit-row input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(158,126,190,0.22);
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255,255,255,0.84);
  color: #3c3045;
  font: inherit;
  font-weight: 800;
}
.parent-mission-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.parent-data-tools {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(232, 145, 157, 0.26);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 226, 102, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(255,248,246,0.9), rgba(255,242,247,0.72));
}
.parent-data-tools h4 {
  margin: 0;
  color: #7e4b62;
  font-size: 16px;
}
.parent-data-tools p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.danger-button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: linear-gradient(135deg, #b85f6d, #e8919d);
  color: #fffdf8;
  font-weight: 900;
  box-shadow: 0 8px 0 rgba(126, 75, 98, 0.16);
}
@media (max-width: 720px) {
  .onboarding-shell {
    align-items: start;
    padding: 10px;
  }
  .onboarding-card {
    min-height: calc(100vh - 20px);
    border-radius: 22px;
  }
  .onboarding-step {
    padding: 58px 18px 24px;
  }
  .onboarding-feature-grid,
  .base-character-choice,
  .chore-picker,
  .color-choice,
  .custom-chore-row,
  .pin-pair {
    grid-template-columns: 1fr;
  }
  .base-character-card {
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    min-height: 150px;
    text-align: left;
  }
  .base-character-card img {
    grid-row: span 2;
    width: 112px;
    height: 128px;
  }
  .onboarding-hero {
    width: min(340px, 82vw);
  }
  .onboarding-hero img {
    width: 68%;
  }
  .onboarding-progress span {
    width: 24px;
  }
  .onboarding-progress span.active {
    width: 34px;
  }
  .mission-edit-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }
  .mission-edit-row input:last-child {
    grid-column: 2;
  }
}

/* Final priority for rarity-specific treasure effects. */
body.treasure-opening-sr .app-shell {
  animation: treasureStageShake 1250ms cubic-bezier(0.22, 1, 0.36, 1);
}
body.treasure-opening-ssr .app-shell {
  animation: treasureStageShakeSSR 1750ms cubic-bezier(0.22, 1, 0.36, 1);
}
body .summon-panel.treasure-flash.treasure-flash-sr::before,
body .summon-panel.treasure-flash.treasure-flash-sr::after {
  animation-duration: 1500ms !important;
}
body .summon-panel.treasure-flash.treasure-flash-sr::after {
  background:
    radial-gradient(circle at 30% 34%, rgba(255,255,255,0.98) 0 5px, transparent 6px),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,0.94) 0 4px, transparent 5px),
    radial-gradient(circle at 62% 72%, rgba(255,232,133,0.98) 0 5px, transparent 6px),
    radial-gradient(circle at 42% 62%, rgba(216,201,242,0.78) 0 7px, transparent 8px),
    linear-gradient(115deg, transparent 16%, rgba(255,255,255,0.92) 45%, transparent 74%);
}
body .summon-panel.treasure-flash.treasure-flash-ssr::before,
body .summon-panel.treasure-flash.treasure-flash-ssr::after {
  animation-duration: 2200ms !important;
}
body .summon-panel.treasure-flash.treasure-flash-ssr::before {
  background:
    radial-gradient(circle at 50% 54%, rgba(255,255,255,1), rgba(255,242,157,0.96) 12%, rgba(240,169,188,0.52) 28%, rgba(143,205,215,0.28) 44%, transparent 70%);
}
body .summon-panel.treasure-flash.treasure-flash-ssr::after {
  background:
    conic-gradient(from 0deg, transparent, rgba(255,255,255,0.88), transparent 9%, rgba(255,226,102,0.82), transparent 18%, rgba(143,205,215,0.62), transparent 31%, rgba(240,169,188,0.64), transparent 48%, rgba(216,201,242,0.72), transparent 68%),
    linear-gradient(115deg, transparent 8%, rgba(255,255,255,0.96) 48%, transparent 86%);
}

/* Rarity-specific treasure opening effects. */
.treasure-chest.rarity-sr {
  filter: drop-shadow(0 28px 24px rgba(63, 48, 42, 0.18)) drop-shadow(0 0 28px rgba(216, 201, 242, 0.72));
}
.treasure-chest.rarity-ssr {
  filter: drop-shadow(0 28px 24px rgba(63, 48, 42, 0.18)) drop-shadow(0 0 48px rgba(255, 226, 102, 0.88)) saturate(1.16);
}
.treasure-flash-sr::before {
  animation-duration: 1500ms !important;
}
.treasure-flash-sr::after {
  animation-duration: 1500ms !important;
  background:
    radial-gradient(circle at 30% 34%, rgba(255,255,255,0.98) 0 5px, transparent 6px),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,0.94) 0 4px, transparent 5px),
    radial-gradient(circle at 62% 72%, rgba(255,232,133,0.98) 0 5px, transparent 6px),
    radial-gradient(circle at 42% 62%, rgba(216,201,242,0.78) 0 7px, transparent 8px),
    linear-gradient(115deg, transparent 16%, rgba(255,255,255,0.92) 45%, transparent 74%);
}
.treasure-flash-ssr::before {
  animation-duration: 2200ms !important;
  background:
    radial-gradient(circle at 50% 54%, rgba(255,255,255,1), rgba(255,242,157,0.96) 12%, rgba(240,169,188,0.52) 28%, rgba(143,205,215,0.28) 44%, transparent 70%);
}
.treasure-flash-ssr::after {
  animation-duration: 2200ms !important;
  background:
    conic-gradient(from 0deg, transparent, rgba(255,255,255,0.88), transparent 9%, rgba(255,226,102,0.82), transparent 18%, rgba(143,205,215,0.62), transparent 31%, rgba(240,169,188,0.64), transparent 48%, rgba(216,201,242,0.72), transparent 68%),
    linear-gradient(115deg, transparent 8%, rgba(255,255,255,0.96) 48%, transparent 86%);
}
.treasure-opening-sr .app-shell {
  animation: treasureStageShake 1250ms cubic-bezier(0.22, 1, 0.36, 1);
}
.treasure-opening-ssr .app-shell {
  animation: treasureStageShakeSSR 1750ms cubic-bezier(0.22, 1, 0.36, 1);
}
.treasure-open-effect.rarity-sr {
  z-index: 130;
}
.treasure-open-effect.rarity-ssr {
  z-index: 150;
}
.treasure-open-effect.rarity-sr::before {
  background:
    radial-gradient(circle at var(--cx) var(--cy), rgba(255,255,255,1) 0 11%, rgba(255,244,181,0.94) 18%, rgba(216,201,242,0.52) 36%, transparent 66%),
    linear-gradient(115deg, transparent 0 24%, rgba(255,255,255,0.78) 44%, transparent 66% 100%);
  animation-duration: 1700ms;
}
.treasure-open-effect.rarity-ssr::before {
  background:
    radial-gradient(circle at var(--cx) var(--cy), rgba(255,255,255,1) 0 16%, rgba(255,244,181,0.96) 24%, rgba(240,169,188,0.62) 38%, rgba(143,205,215,0.36) 52%, transparent 76%),
    linear-gradient(90deg, rgba(255,255,255,0.26), transparent 18% 82%, rgba(255,255,255,0.26)),
    linear-gradient(115deg, transparent 0 14%, rgba(255,255,255,0.92) 46%, transparent 78% 100%);
  animation-duration: 2350ms;
}
.treasure-open-effect.rarity-sr .treasure-open-shine {
  width: min(138vw, 1240px);
  animation-duration: 1800ms;
}
.treasure-open-effect.rarity-ssr .treasure-open-shine {
  width: min(178vw, 1680px);
  background:
    conic-gradient(from 0deg, transparent, rgba(255,255,255,0.98), transparent 7%, rgba(255,226,102,0.96), transparent 16%, rgba(143,205,215,0.72), transparent 30%, rgba(240,169,188,0.78), transparent 46%, rgba(216,201,242,0.82), transparent 64%, rgba(255,226,102,0.86), transparent 82%),
    radial-gradient(circle, rgba(255,255,255,1), rgba(255,240,164,0.66) 24%, rgba(240,169,188,0.28) 44%, transparent 68%);
  animation: treasureSSRShineBlast 2350ms ease-out forwards;
}
.treasure-open-effect.rarity-sr .treasure-open-ray {
  height: 7px;
  box-shadow: 0 0 16px rgba(255, 226, 102, 0.42);
}
.treasure-open-effect.rarity-ssr .treasure-open-ray {
  width: min(62vw, 720px);
  height: 9px;
  background: linear-gradient(90deg, rgba(255,255,255,1), rgba(255,224,104,0.96), rgba(240,169,188,0.72), transparent);
  box-shadow: 0 0 22px rgba(255, 226, 102, 0.58);
}
.treasure-open-effect.rarity-sr .treasure-open-ring {
  border-color: rgba(216, 201, 242, 0.92);
  box-shadow: 0 0 32px rgba(216, 201, 242, 0.72), inset 0 0 20px rgba(255,255,255,0.42);
}
.treasure-open-effect.rarity-ssr .treasure-open-ring {
  border-width: 4px;
  border-color: rgba(255, 238, 158, 0.98);
  box-shadow: 0 0 42px rgba(255, 226, 102, 0.78), inset 0 0 28px rgba(255,255,255,0.5);
  animation-duration: 1680ms;
}
.treasure-open-sigil {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: min(58vw, 420px);
  aspect-ratio: 1;
  border: 3px solid rgba(255, 238, 158, 0.9);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.24) rotate(0deg);
  box-shadow: 0 0 34px rgba(255, 226, 102, 0.42), inset 0 0 26px rgba(255,255,255,0.36);
  pointer-events: none;
}
.treasure-open-effect.rarity-sr .treasure-open-sigil {
  animation: treasureSigilBurst 1600ms ease-out forwards;
}
.treasure-open-effect.rarity-ssr .treasure-open-sigil {
  width: min(84vw, 680px);
  border-width: 5px;
  background:
    radial-gradient(circle, transparent 0 48%, rgba(255,255,255,0.24) 49% 51%, transparent 52%),
    conic-gradient(from 0deg, rgba(255,226,102,0.16), transparent 12%, rgba(143,205,215,0.16), transparent 24%, rgba(240,169,188,0.18), transparent 38%, rgba(216,201,242,0.18), transparent 52%);
  animation: treasureSSRSigil 2350ms ease-out forwards;
}
.treasure-open-effect.rarity-ssr .treasure-open-sigil::before,
.treasure-open-effect.rarity-ssr .treasure-open-sigil::after {
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(255,255,255,0.72);
  border-radius: 22%;
  content: "";
  transform: rotate(45deg);
}
.treasure-open-effect.rarity-ssr .treasure-open-sigil::after {
  inset: 25%;
  border-radius: 50%;
  transform: rotate(0deg);
}
.treasure-open-effect.rarity-sr .treasure-open-star::before,
.treasure-open-effect.rarity-sr .treasure-open-star::after {
  background: rgba(216, 201, 242, 0.96);
  box-shadow: 0 0 18px rgba(216, 201, 242, 0.7);
}
.treasure-open-effect.rarity-ssr .treasure-open-star::before,
.treasure-open-effect.rarity-ssr .treasure-open-star::after {
  background: rgba(255, 244, 181, 1);
  box-shadow: 0 0 24px rgba(255, 226, 102, 0.8);
}
@keyframes treasureStageShakeSSR {
  0%, 100% { transform: translate3d(0,0,0) scale(1); }
  8% { transform: translate3d(-10px, 5px, 0) scale(1.004); }
  18% { transform: translate3d(12px, -7px, 0) scale(1.008); }
  31% { transform: translate3d(-8px, -5px, 0) scale(1.006); }
  48% { transform: translate3d(7px, 6px, 0) scale(1.004); }
  68% { transform: translate3d(-4px, 2px, 0) scale(1.002); }
}
@keyframes treasureSigilBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.22) rotate(0deg); }
  24% { opacity: 0.92; transform: translate(-50%, -50%) scale(1) rotate(80deg); }
  78% { opacity: 0.42; transform: translate(-50%, -50%) scale(1.32) rotate(190deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5) rotate(250deg); }
}
@keyframes treasureSSRSigil {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.16) rotate(0deg); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(0.92) rotate(90deg); }
  64% { opacity: 0.88; transform: translate(-50%, -50%) scale(1.18) rotate(260deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.45) rotate(420deg); }
}
@keyframes treasureSSRShineBlast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.12) rotate(0deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(0.84) rotate(72deg); }
  58% { opacity: 0.92; transform: translate(-50%, -50%) scale(1.22) rotate(210deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.56) rotate(360deg); }
}

/* Keep this at EOF: older layout rules disable pointer events on companion slots. */
.pet-companion-slot,
.chibi-companion-slot,
.pet-companion-slot img,
.chibi-companion-slot img,
.companion-preview-trigger {
  pointer-events: auto;
  cursor: zoom-in;
}

/* Interaction overrides must stay last because older layout rules disable pointer events on companions. */
.pet-companion-slot,
.chibi-companion-slot,
.pet-companion-slot img,
.chibi-companion-slot img,
.companion-preview-trigger {
  pointer-events: auto;
  cursor: zoom-in;
}

.pet-companion-slot,
.chibi-companion-slot {
  pointer-events: auto;
  cursor: zoom-in;
}
.pet-companion-slot[hidden],
.chibi-companion-slot[hidden] {
  display: none !important;
}
.pet-companion-slot:focus-visible,
.chibi-companion-slot:focus-visible,
.companion-preview-trigger:focus-visible {
  outline: 3px solid rgba(255, 232, 140, 0.96);
  outline-offset: 4px;
}
.companion-preview-trigger {
  cursor: zoom-in;
  transition: transform 180ms ease, filter 180ms ease;
}
.companion-preview-trigger:hover {
  filter: drop-shadow(0 0 16px rgba(255, 226, 102, 0.38)) saturate(1.05);
  transform: translateY(-2px) scale(1.03);
}

#companionDialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}
#companionDialog::backdrop {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 236, 168, 0.26), transparent 34%),
    rgba(44, 34, 48, 0.42);
  backdrop-filter: blur(8px);
}
.companion-dialog {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 560px;
  padding: 34px 28px 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 39%, rgba(255, 242, 176, 0.45), transparent 33%),
    linear-gradient(155deg, rgba(255,253,248,0.98), rgba(247,238,255,0.94));
  box-shadow: 0 34px 100px rgba(42,32,48,0.34);
  color: var(--fantasy-ink);
  text-align: center;
}
.companion-dialog::before {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(213, 173, 84, 0.38);
  border-radius: 20px;
  content: "";
  pointer-events: none;
}
.companion-dialog::after {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 24% 24%, rgba(255,255,255,0.9) 0 4px, transparent 5px),
    radial-gradient(circle at 78% 25%, rgba(255,226,102,0.86) 0 5px, transparent 6px),
    radial-gradient(circle at 22% 78%, rgba(142,201,174,0.56) 0 4px, transparent 5px),
    radial-gradient(circle at 76% 76%, rgba(232,145,157,0.52) 0 4px, transparent 5px);
  content: "";
  pointer-events: none;
  animation: rewardDialogTwinkle 4s ease-in-out infinite;
}
.companion-dialog > * {
  position: relative;
  z-index: 1;
}
.companion-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(143, 124, 200, 0.2);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.88);
  color: #6a5488;
  font-size: 22px;
  font-weight: 900;
}
.companion-dialog h3 {
  margin: 0;
  font-size: clamp(26px, 6vw, 38px);
  line-height: 1.12;
}
.companion-preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: min(330px, 74vw);
  aspect-ratio: 1 / 1;
  margin: 4px 0 6px;
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 58%, rgba(255, 245, 190, 0.82), rgba(255, 245, 190, 0.22) 45%, transparent 70%),
    linear-gradient(145deg, rgba(255,255,255,0.78), rgba(244,235,255,0.62));
  box-shadow: inset 0 0 28px rgba(255,255,255,0.62), 0 22px 60px rgba(112, 90, 145, 0.18);
}
#companionPreviewImage {
  position: relative;
  z-index: 2;
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 18px 18px rgba(63,48,42,0.16));
  animation: companionPreviewFloat 3.8s ease-in-out infinite;
}
.companion-preview-sparkles {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 18% 26%, rgba(255,255,255,0.92) 0 4px, transparent 5px),
    radial-gradient(circle at 76% 22%, rgba(255,226,102,0.84) 0 5px, transparent 6px),
    radial-gradient(circle at 22% 78%, rgba(142,201,174,0.64) 0 4px, transparent 5px),
    radial-gradient(circle at 80% 76%, rgba(232,145,157,0.58) 0 4px, transparent 5px);
  animation: companionPreviewSparkle 4.2s ease-in-out infinite;
}
#companionPreviewHint {
  max-width: 24em;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.treasure-opening .app-shell {
  animation: treasureStageShake 920ms cubic-bezier(0.22, 1, 0.36, 1);
}
.treasure-open-effect {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow: hidden;
  pointer-events: none;
}
.treasure-open-effect::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at var(--cx) var(--cy), rgba(255,255,255,1) 0 9%, rgba(255,244,181,0.92) 14%, rgba(255,244,181,0.34) 31%, transparent 58%),
    linear-gradient(115deg, transparent 0 34%, rgba(255,255,255,0.64) 44%, transparent 58% 100%);
  content: "";
  mix-blend-mode: screen;
  animation: treasureScreenBloom 1260ms ease-out forwards;
}
.treasure-open-shine {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: min(118vw, 1020px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, transparent, rgba(255,231,133,0.94), transparent 8%, rgba(255,255,255,0.84), transparent 18%, rgba(142,201,174,0.48), transparent 34%, rgba(232,145,157,0.42), transparent 52%, rgba(255,231,133,0.76), transparent 72%),
    radial-gradient(circle, rgba(255,255,255,0.98), rgba(255,240,164,0.52) 22%, transparent 58%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.22) rotate(0deg);
  animation: treasureShineBlast 1300ms ease-out forwards;
}
.treasure-open-ring {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: 120px;
  height: 120px;
  border: 3px solid rgba(255, 236, 148, 0.95);
  border-radius: 50%;
  box-shadow: 0 0 26px rgba(255, 226, 102, 0.58), inset 0 0 18px rgba(255,255,255,0.38);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.24);
  animation: treasureRingBurst 1180ms ease-out var(--delay) forwards;
}
.treasure-open-ray {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: min(42vw, 420px);
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.98), rgba(255,224,104,0.86), transparent);
  opacity: 0;
  transform: rotate(var(--angle)) scaleX(0);
  transform-origin: 0 50%;
  animation: treasureRayBurst 980ms ease-out var(--delay) forwards;
}
.treasure-open-star {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: var(--size);
  height: var(--size);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.2);
  animation: treasureStarScatter 1220ms ease-out var(--delay) forwards;
}
.treasure-open-star::before,
.treasure-open-star::after {
  position: absolute;
  inset: 43% 0;
  border-radius: 999px;
  background: rgba(255, 239, 166, 0.96);
  box-shadow: 0 0 16px rgba(255, 226, 102, 0.64);
  content: "";
}
.treasure-open-star::after {
  transform: rotate(90deg);
}

@keyframes companionPreviewFloat {
  0%, 100% { transform: translateY(0) rotate(-0.2deg); }
  50% { transform: translateY(-9px) rotate(0.26deg); }
}
@keyframes companionPreviewSparkle {
  0%, 100% { opacity: 0.54; transform: rotate(0deg) scale(1); }
  48% { opacity: 1; transform: rotate(5deg) scale(1.04); }
}
@keyframes treasureStageShake {
  0%, 100% { transform: translate3d(0,0,0); }
  12% { transform: translate3d(-7px, 4px, 0); }
  24% { transform: translate3d(8px, -5px, 0); }
  38% { transform: translate3d(-5px, -3px, 0); }
  52% { transform: translate3d(5px, 4px, 0); }
  70% { transform: translate3d(-2px, 1px, 0); }
}
@keyframes treasureScreenBloom {
  0% { opacity: 0; filter: blur(0); }
  22% { opacity: 1; filter: blur(0); }
  58% { opacity: 0.74; filter: blur(2px); }
  100% { opacity: 0; filter: blur(8px); }
}
@keyframes treasureShineBlast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.18) rotate(0deg); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(0.86) rotate(40deg); }
  64% { opacity: 0.82; transform: translate(-50%, -50%) scale(1.15) rotate(148deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.36) rotate(220deg); }
}
@keyframes treasureRingBurst {
  0% { opacity: 0.96; transform: translate(-50%, -50%) scale(0.2); }
  78% { opacity: 0.36; transform: translate(-50%, -50%) scale(4.8); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(5.6); }
}
@keyframes treasureRayBurst {
  0% { opacity: 0; transform: rotate(var(--angle)) scaleX(0); }
  28% { opacity: 1; transform: rotate(var(--angle)) scaleX(1); }
  100% { opacity: 0; transform: rotate(var(--angle)) scaleX(1.15) translateX(90px); }
}
@keyframes treasureStarScatter {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(0.16); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(420deg) scale(0.82); }
}

@media (max-width: 640px) {
  .companion-dialog {
    min-height: 500px;
    padding: 30px 20px 24px;
  }
  .companion-preview-frame {
    width: min(290px, 76vw);
    border-radius: 22px;
  }
}

.sound-toggle {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(245,235,255,0.76));
  color: #6b548a;
  box-shadow: 0 14px 34px rgba(112, 90, 145, 0.16);
  font-size: 12px;
  font-weight: 900;
}
.sound-toggle span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8fcdd7, #f0a9bc);
  box-shadow: 0 0 12px rgba(143, 124, 200, 0.45);
}
.sound-toggle.muted {
  opacity: 0.62;
}
.sound-toggle.muted span {
  background: #b9b0ba;
  box-shadow: none;
}

@keyframes pageStarlight {
  from { background-position: 0 0, 44px 28px, 0 0; }
  to { background-position: 86px 86px, 176px 160px, 240px 240px; }
}
@keyframes jewelSweep {
  0%, 42% { transform: translateX(-85%) rotate(12deg); }
  58%, 100% { transform: translateX(85%) rotate(12deg); }
}
@keyframes cardGlint {
  from { transform: translateX(-75%); }
  to { transform: translateX(75%); }
}
@keyframes viewMagicIn {
  from { opacity: 0; transform: translateY(12px) scale(0.992); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes magicClickRing {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(0.18); }
  74% { opacity: 0.42; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.22); }
}
@keyframes treasureIdleGlow {
  0%, 100% { filter: drop-shadow(0 28px 24px rgba(63, 48, 42, 0.18)) drop-shadow(0 0 0 rgba(255, 232, 135, 0)); }
  50% { filter: drop-shadow(0 28px 24px rgba(63, 48, 42, 0.18)) drop-shadow(0 0 24px rgba(255, 232, 135, 0.42)); }
}
@keyframes treasureOpenBoom {
  0% { filter: brightness(1) drop-shadow(0 0 0 rgba(255, 232, 135, 0)); }
  45% { filter: brightness(1.18) drop-shadow(0 0 34px rgba(255, 232, 135, 0.72)); }
  100% { filter: brightness(1) drop-shadow(0 0 12px rgba(255, 232, 135, 0.16)); }
}

@media (max-width: 640px) {
  .sound-toggle {
    top: auto;
    right: 12px;
    bottom: 12px;
    min-height: 34px;
    padding: 0 11px;
  }
  .nav-item::before {
    margin-right: 5px;
  }
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 16%, rgba(142, 201, 174, 0.32), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(232, 145, 157, 0.28), transparent 24%),
    radial-gradient(circle at 70% 88%, rgba(141, 180, 199, 0.32), transparent 30%),
    var(--bg);
  color: var(--ink);
}
button { cursor: pointer; font: inherit; }

.spark-layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden; }
.spark-piece { position: absolute; width: 10px; height: 10px; border-radius: 3px; animation: popFall 920ms ease-out forwards; }

.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.side-rail {
  position: sticky; top: 0; display: flex; flex-direction: column; gap: 20px; height: 100vh;
  padding: 22px; border-right: 2px solid rgba(63, 48, 42, 0.08);
  background: rgba(255, 250, 240, 0.86); backdrop-filter: blur(14px);
}
.brand, .topbar, .section-header, .wallet, .profile-switcher, .nav { display: flex; align-items: center; }
.brand { gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px;
  background: var(--sage); color: #fffaf0; font-weight: 900; box-shadow: 0 8px 0 rgba(63, 48, 42, 0.16);
}
.brand p, .eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: 0; text-transform: uppercase; }
.brand h1, .topbar h2, .section-header h3, .hero-copy h3, .summon-panel h3, .closet-preview h3, .reward-dialog h3 { margin: 0; letter-spacing: 0; }
.brand h1 { font-size: 18px; line-height: 1.12; }
.profile-switcher { gap: 8px; }
.profile-tab, .nav-item, .segment, .text-button { border: 0; background: transparent; color: var(--muted); }
.profile-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; border-radius: 8px; font-weight: 900;
}
.profile-tab.active, .nav-item.active, .nav-item:hover { background: #edf5ea; color: #425f3d; }
.avatar-dot { width: 12px; height: 12px; border-radius: 50%; }
.avatar-dot.hina { background: var(--rose); }
.avatar-dot.mio { background: var(--blue); }
.nav { align-items: stretch; flex-direction: column; gap: 7px; }
.nav-item { min-height: 42px; border-radius: 8px; padding: 0 12px; text-align: left; font-weight: 900; }
.side-status { margin-top: auto; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: rgba(255, 253, 248, 0.86); }
.side-status p { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.side-status strong { display: block; margin-bottom: 10px; }
.tiny-meter { height: 8px; overflow: hidden; border-radius: 999px; background: #e8dfd1; }
.tiny-meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--gold)); transition: width 300ms ease; }

.workspace { min-width: 0; overflow: hidden; padding: 24px clamp(16px, 3vw, 40px) 42px; }
.topbar { justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.topbar h2 { font-size: clamp(26px, 4vw, 42px); line-height: 1.05; }
.wallet { gap: 10px; flex-wrap: wrap; }
.wallet span { min-height: 38px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: rgba(255, 253, 248, 0.92); box-shadow: 0 8px 18px rgba(72, 54, 44, 0.08); font-weight: 800; }
.wallet b { margin-right: 4px; font-size: 20px; }
.view { display: none; }
.view.active { display: block; }

.home-layout, .reward-layout, .room-layout, .parent-layout { display: grid; grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.25fr); gap: 16px; }
.home-layout { grid-template-columns: minmax(560px, 1.42fr) minmax(300px, 0.88fr); align-items: stretch; }
.closet-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.hero-panel, .daily-panel, .summon-panel, .room-panel, .closet-preview, .closet-item-panel, .parent-layout > section, .event-strip article, .reward-card, .closet-card, .room-item, .mission-card {
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 253, 248, 0.92); box-shadow: var(--shadow);
}
.hero-panel, .daily-panel, .summon-panel, .closet-preview, .closet-item-panel, .room-panel, .parent-layout > section { padding: 18px; }
.hero-panel { position: relative; min-height: 520px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 14px; overflow: hidden; }
.hero-panel::before { position: absolute; inset: 12px; border: 2px dashed rgba(130, 152, 120, 0.24); border-radius: 8px; content: ""; pointer-events: none; }
.home-stage-panel {
  min-height: clamp(640px, calc(100vh - 148px), 860px);
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f8f0e3;
}
.home-stage-panel::before { display: none; }
.home-stage-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 48% 42%, rgba(255, 239, 174, 0.32), transparent 34%),
    linear-gradient(180deg, rgba(255, 252, 245, 0.52), rgba(246, 232, 210, 0.88));
}
.hero-copy { position: relative; z-index: 2; }
.home-stage-copy {
  position: absolute;
  left: clamp(18px, 3vw, 34px);
  top: clamp(16px, 2.8vw, 30px);
  z-index: 8;
  max-width: min(48%, 420px);
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 14px 30px rgba(72, 54, 44, 0.1);
  backdrop-filter: blur(8px);
}
.hero-copy h3 { font-size: clamp(26px, 4vw, 40px); }
.hero-copy p:last-child, .summon-panel p, .parent-note { color: var(--muted); line-height: 1.7; }
.character-stage { position: relative; display: grid; place-items: center; min-height: 320px; }
.home-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 100%;
  overflow: hidden;
}
.home-room {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  filter: saturate(0.84) brightness(1.08);
  transform: scale(1.04);
}
.home-glow {
  position: absolute;
  left: 20%;
  right: 9%;
  bottom: 8%;
  z-index: 1;
  height: 54%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 58%, rgba(255, 242, 180, 0.46), rgba(255, 242, 180, 0.13) 44%, transparent 70%);
  filter: blur(2px);
}
.character-stage > .main-character-art, .closet-character > .main-character-art { position: relative; z-index: 2; width: min(92%, 420px); filter: drop-shadow(0 20px 20px rgba(63, 48, 42, 0.14)); animation: idleFloat 2.4s ease-in-out infinite; }
.home-stage .home-main-character {
  position: absolute;
  left: 46%;
  bottom: 3%;
  z-index: 3;
  width: min(61vh, 560px);
  max-width: 52%;
  max-height: 86%;
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 24px rgba(63, 48, 42, 0.17));
  animation: homeCharacterFloat 4.2s ease-in-out infinite;
}
.aura {
  position: absolute; width: min(88%, 430px); aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(from 40deg, rgba(213, 173, 84, 0.18), rgba(232, 145, 157, 0.22), rgba(142, 201, 174, 0.18), rgba(141, 180, 199, 0.2), rgba(213, 173, 84, 0.18));
  animation: auraSpin 8s linear infinite;
}
.equip-badge, .closet-character > span {
  position: absolute; z-index: 3; right: 12%; bottom: 18%; min-height: 32px; border-radius: 999px;
  padding: 7px 12px; background: #fff; box-shadow: var(--shadow); color: #77572a; font-size: 13px; font-weight: 900;
}
.home-equip-badge {
  left: clamp(18px, 3vw, 34px);
  right: auto;
  bottom: clamp(18px, 3vw, 34px);
  z-index: 8;
  max-width: calc(100% - 240px);
  background: rgba(255, 253, 248, 0.88);
}
.chibi-companion-slot {
  position: absolute;
  right: 8%;
  bottom: 19%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: clamp(86px, 18vw, 132px);
  aspect-ratio: 1 / 1;
  pointer-events: none;
}
.home-chibi-slot {
  right: clamp(16px, 3.2vw, 42px);
  top: clamp(142px, 19vh, 190px);
  bottom: auto;
  z-index: 5;
  width: clamp(108px, 10.5vw, 132px);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: rgba(255, 250, 239, 0.62);
  box-shadow: 0 16px 34px rgba(72, 54, 44, 0.13);
  backdrop-filter: blur(5px);
}
.home-pet-slot {
  right: clamp(16px, 3.2vw, 42px);
  top: clamp(18px, 4vh, 44px);
  bottom: auto;
  left: auto;
  z-index: 6;
  width: clamp(108px, 10.5vw, 132px);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: rgba(255, 250, 239, 0.62);
  box-shadow: 0 16px 34px rgba(72, 54, 44, 0.13);
  backdrop-filter: blur(5px);
}
.closet-chibi-slot {
  right: clamp(8%, 14vw, 18%);
  bottom: 8%;
  z-index: 5;
  width: clamp(180px, 13vw, 250px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.chibi-companion-slot img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 10px 14px rgba(63, 48, 42, 0.13));
  transform-origin: 50% 86%;
  animation: chibiSoftBob 3.6s ease-in-out infinite;
  will-change: transform;
}
.home-chibi-slot img,
.home-pet-slot img { border-radius: 14px; }
.chibi-companion-slot[data-motion="tiny-hop"] img { animation-name: chibiTinyHop; animation-duration: 2.8s; }
.chibi-companion-slot[data-motion="float"] img,
.chibi-companion-slot[data-motion="angel-float"] img { animation-name: chibiFloat; animation-duration: 4.6s; }
.chibi-companion-slot[data-motion="dance"] img,
.chibi-companion-slot[data-motion="music-sway"] img { animation-name: chibiDance; animation-duration: 3.4s; }
.chibi-companion-slot[data-motion="royal-float"] img { animation-name: chibiRoyalFloat; animation-duration: 4.8s; }
.chibi-companion-slot[data-motion="panda-baby-bob"] img { animation-name: chibiPandaBob; animation-duration: 3.9s; }
.chibi-companion-sparkles {
  position: absolute;
  inset: -16%;
  z-index: 1;
  pointer-events: none;
}
.chibi-companion-sparkles span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.24);
  animation: chibiTwinkle 3.6s ease-in-out var(--d) infinite;
}
.chibi-companion-sparkles span::before,
.chibi-companion-sparkles span::after {
  content: "";
  position: absolute;
  inset: 43% 0;
  border-radius: 999px;
  background: rgba(255, 226, 102, 0.9);
  box-shadow: 0 0 12px rgba(255, 216, 82, 0.42);
}
.chibi-companion-sparkles span::after { transform: rotate(90deg); }
.pet-companion-slot {
  position: absolute;
  left: 5%;
  bottom: 15%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: clamp(104px, 14vw, 142px);
  aspect-ratio: 1 / 1;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  background: rgba(255, 250, 239, 0.62);
  box-shadow: 0 14px 30px rgba(72, 54, 44, 0.12);
  backdrop-filter: blur(5px);
  pointer-events: none;
}
.pet-companion-slot img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 10px 14px rgba(63, 48, 42, 0.13));
  transform-origin: 50% 86%;
  animation: petSoftBob 3.6s ease-in-out infinite;
  will-change: transform;
}
.pet-companion-slot[data-motion="tiny-hop"] img { animation-name: chibiTinyHop; animation-duration: 2.8s; }
.pet-companion-slot[data-motion="float"] img,
.pet-companion-slot[data-motion="wing-bob"] img { animation-name: chibiFloat; animation-duration: 4.6s; }
.pet-companion-slot[data-motion="waddle"] img,
.pet-companion-slot[data-motion="tail-wag"] img { animation-name: petWaddle; animation-duration: 3.2s; }
.pet-companion-slot[data-motion="sleepy-bob"] img,
.pet-companion-slot[data-motion="nibble"] img { animation-name: petSleepy; animation-duration: 4.2s; }
.pet-companion-slot[data-motion="curious-look"] img,
.pet-companion-slot[data-motion="tail-sway"] img,
.pet-companion-slot[data-motion="brush-wave"] img { animation-name: petCurious; animation-duration: 3.8s; }
.pet-companion-slot[data-motion="sparkle-step"] img,
.pet-companion-slot[data-motion="proud-blink"] img { animation-name: petProud; animation-duration: 4.1s; }
.pet-companion-sparkles {
  position: absolute;
  inset: -16%;
  z-index: 1;
  pointer-events: none;
}
.pet-companion-sparkles span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.24);
  animation: chibiTwinkle 3.6s ease-in-out var(--d) infinite;
}
.pet-companion-sparkles span::before,
.pet-companion-sparkles span::after {
  content: "";
  position: absolute;
  inset: 43% 0;
  border-radius: 999px;
  background: rgba(255, 226, 102, 0.9);
  box-shadow: 0 0 12px rgba(255, 216, 82, 0.42);
}
.pet-companion-sparkles span::after { transform: rotate(90deg); }
.primary-button, .secondary-button, .text-button { min-height: 42px; border-radius: 8px; font-weight: 900; }
.primary-button { border: 0; padding: 0 16px; background: var(--sage); color: #fffaf0; box-shadow: 0 8px 0 rgba(63, 48, 42, 0.18); }
.primary-button:disabled { background: #bdb6ac; box-shadow: none; cursor: default; }
.secondary-button { border: 1px solid var(--line); padding: 0 14px; background: #fff; color: var(--ink); }
.text-button { min-height: 34px; padding: 0; font-size: 14px; color: #55704f; }
.section-header { justify-content: space-between; gap: 14px; margin-bottom: 14px; }

.mission-list, .reward-grid, .closet-grid, .room-items, .setting-list { display: grid; gap: 12px; }
.sub-header { margin-top: 18px; }
.mission-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mission-list.compact { grid-template-columns: 1fr; }
.mission-card { position: relative; overflow: hidden; padding: 15px; background: #fffdf8; }
.mission-card.done { background: #f4fbef; }
.mission-card.flash::after { position: absolute; inset: -60%; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,0.78) 50%, transparent 65%); content: ""; animation: shineSweep 740ms ease-out; }
.mission-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.mission-card h4, .reward-card h4, .room-item strong { margin: 0; font-size: 17px; }
.mission-card p, .reward-card p, .room-item span, .toggle-row small { color: var(--muted); font-size: 13px; line-height: 1.55; }
.mission-rewards { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; border-radius: 999px; padding: 0 9px; background: #edf5ea; color: #4b6746; font-size: 12px; font-weight: 900; white-space: nowrap; }
.chip.rare { background: #fff3cf; color: #8c6220; }
.chip.done { background: #ecf9f3; color: #36735f; }
.mission-button { width: 100%; min-height: 42px; border: 0; border-radius: 8px; background: var(--ink); color: #fffaf0; font-weight: 900; }
.mission-button:disabled { background: #d9ead2; color: #55704f; }

.event-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.event-strip article { min-height: 112px; padding: 14px; }
.event-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; margin-bottom: 8px; background: #fff0c9; color: #8c6220; font-weight: 900; animation: iconTwinkle 1.8s ease-in-out infinite; }
.event-strip strong, .event-strip p { display: block; margin: 0; }
.event-strip p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 3px; background: #f8f1e6; }
.segment { min-height: 32px; border-radius: 6px; padding: 0 12px; font-size: 13px; font-weight: 900; }
.segment.active { background: #fff; color: var(--ink); box-shadow: 0 6px 18px rgba(63,48,42,0.1); }

.summon-panel, .room-panel { min-height: 510px; }
.closet-preview { min-height: 0; }
.summon-panel { position: relative; display: grid; grid-template-rows: auto minmax(360px, 1fr) auto; gap: 18px; overflow: hidden; }
.summon-panel .primary-button { position: relative; z-index: 6; }
.treasure-machine { position: relative; z-index: 1; display: grid; place-items: center; align-self: stretch; min-height: 360px; overflow: hidden; pointer-events: none; }
.treasure-rays { position: absolute; width: min(88%, 330px); aspect-ratio: 1; border-radius: 50%; background: conic-gradient(from 12deg, rgba(213,173,84,0), rgba(213,173,84,0.28), rgba(213,173,84,0), rgba(142,201,174,0.2), rgba(213,173,84,0)); opacity: 0.7; animation: auraSpin 9s linear infinite; }
.treasure-chest { position: relative; width: min(78%, 320px); height: 210px; animation: machinePulse 2.8s ease-in-out infinite; pointer-events: none; }
.treasure-lid, .treasure-body, .treasure-lock, .treasure-glow { position: absolute; left: 50%; transform: translateX(-50%); }
.treasure-lid { z-index: 3; top: 36px; width: 84%; height: 74px; border: 5px solid #5d4036; border-radius: 52px 52px 14px 14px; background: linear-gradient(90deg, transparent 22%, rgba(255,246,188,0.55) 22% 30%, transparent 30% 70%, rgba(255,246,188,0.55) 70% 78%, transparent 78%), linear-gradient(180deg, #d9a44f, #aa6a38); box-shadow: inset 0 -10px 0 rgba(75,49,38,0.15); transform-origin: 50% 92%; }
.treasure-body { z-index: 2; bottom: 22px; width: 92%; height: 112px; border: 5px solid #5d4036; border-radius: 12px 12px 24px 24px; background: linear-gradient(90deg, transparent 18%, rgba(255,246,188,0.52) 18% 27%, transparent 27% 73%, rgba(255,246,188,0.52) 73% 82%, transparent 82%), linear-gradient(180deg, #c78245, #8e5639); box-shadow: 0 16px 0 rgba(63,48,42,0.12), inset 0 -14px 0 rgba(63,48,42,0.13); }
.treasure-lock { z-index: 4; top: 102px; width: 54px; height: 62px; border: 4px solid #5d4036; border-radius: 10px; background: linear-gradient(180deg, #fff1a8, var(--gold)); }
.treasure-lock::after { position: absolute; left: 50%; top: 18px; width: 10px; height: 18px; border-radius: 999px; background: #6a4a32; content: ""; transform: translateX(-50%); }
.treasure-glow { z-index: 1; top: 82px; width: 62%; height: 60px; border-radius: 50%; background: radial-gradient(circle, rgba(255,242,157,0.92), rgba(255,242,157,0)); opacity: 0; filter: blur(2px); }
.treasure-chest.opening { animation: chestJump 820ms ease-out; }
.treasure-chest.opening .treasure-lid { animation: lidOpen 820ms cubic-bezier(0.2,1.2,0.28,1) forwards; }
.treasure-chest.opening .treasure-glow { animation: glowOpen 820ms ease-out forwards; }

.reward-grid, .closet-grid, .room-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reward-card, .room-item { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: center; padding: 14px; }
.reward-icon, .room-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 8px; background: #fff0c9; font-size: 28px; }
.reward-art, .room-art, .closet-art {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff8ec;
  mix-blend-mode: multiply;
}
.closet-character { position: relative; display: grid; place-items: center; min-height: 400px; margin-top: 12px; overflow: hidden; border-radius: 8px; background: repeating-linear-gradient(7deg, rgba(63,48,42,0.025) 0 2px, transparent 2px 8px), #f6ecdc; }
.closet-preview { position: relative; align-self: start; overflow: hidden; padding: 0; }
.closet-preview > .eyebrow,
.closet-preview > h3 {
  position: absolute;
  left: clamp(18px, 2.6vw, 32px);
  z-index: 8;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: 0 10px 26px rgba(72, 54, 44, 0.1);
  backdrop-filter: blur(8px);
}
.closet-preview > .eyebrow { top: clamp(18px, 2.2vw, 28px); }
.closet-preview > h3 {
  top: clamp(52px, 5.4vw, 70px);
  font-size: clamp(24px, 3.3vw, 40px);
  line-height: 1.05;
}
.closet-character {
  min-height: clamp(620px, calc(100vh - 170px), 820px);
  margin-top: 0;
  aspect-ratio: 16 / 9;
  background: #f7ecdc;
}
.closet-room {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.74;
  filter: saturate(0.82) brightness(1.08);
  transform: scale(1.05);
}
.closet-glow {
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 8%;
  z-index: 1;
  height: 58%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 242, 180, 0.42), rgba(255, 242, 180, 0.14) 42%, transparent 72%);
}
.closet-character > .main-character-art {
  position: absolute;
  left: 50%;
  bottom: 4%;
  z-index: 4;
  width: min(32vw, 430px);
  max-width: 38%;
  max-height: 84%;
  object-fit: contain;
  transform: translateX(-50%);
  animation: closetCharacterFloat 4.2s ease-in-out infinite;
}
.closet-character > span {
  left: clamp(18px, 2.6vw, 32px);
  right: auto;
  bottom: clamp(18px, 2.6vw, 32px);
  z-index: 8;
  background: rgba(255, 253, 248, 0.86);
}
.closet-pet-slot {
  left: clamp(8%, 14vw, 18%);
  bottom: 8%;
  z-index: 5;
  width: clamp(190px, 14vw, 270px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.closet-pet-slot img,
.closet-chibi-slot img {
  border-radius: 0;
  background: transparent !important;
  filter: drop-shadow(0 14px 18px rgba(63, 48, 42, 0.14));
  mix-blend-mode: normal !important;
  opacity: 1;
}
.closet-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}
.closet-item-panel {
  min-width: 0;
}
.closet-item-panel .closet-grid {
  grid-template-columns: 1fr;
}
.closet-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; }
.closet-card.chibi-card,
.closet-card.pet-card { grid-template-columns: 54px minmax(0, 1fr) auto; }
.closet-card.chibi-card .closet-art { width: 54px; height: 54px; }
.closet-card.locked { opacity: 0.55; }
.closet-card:has(button:disabled):not(.locked) {
  border-color: rgba(213, 173, 84, 0.72);
  box-shadow: 0 0 0 3px rgba(245, 197, 99, 0.22), var(--shadow);
}
.closet-card button { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-weight: 900; }
.room-items.muted { opacity: 0.78; }
.balance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.balance-grid article { min-height: 116px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; }
.balance-grid strong { font-size: 38px; }
.reward-dialog { display: grid; justify-items: center; gap: 12px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; box-shadow: 0 30px 90px rgba(42,32,28,0.25); text-align: center; }
.reward-prize { display: grid; place-items: center; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, #fff8d8, #f5d986); font-size: 72px; animation: prizePop 650ms cubic-bezier(0.2,1.4,0.3,1) both; }
.reward-prize img { width: 118px; height: 118px; object-fit: contain; border-radius: 18px; mix-blend-mode: multiply; }
.reward-dialog menu { margin: 0; padding: 0; }
.burst { animation: rewardBurst 740ms ease-out; }

@keyframes idleFloat { 0%, 100% { transform: translateY(0) rotate(-0.4deg); } 50% { transform: translateY(-8px) rotate(0.5deg); } }
@keyframes homeCharacterFloat { 0%, 100% { transform: translateX(-50%) translateY(0) rotate(-0.12deg); } 50% { transform: translateX(-50%) translateY(-9px) rotate(0.2deg); } }
@keyframes closetCharacterFloat { 0%, 100% { transform: translateX(-50%) translateY(0) rotate(-0.1deg); } 50% { transform: translateX(-50%) translateY(-8px) rotate(0.18deg); } }
@keyframes auraSpin { to { transform: rotate(360deg); } }
@keyframes iconTwinkle { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.1) rotate(8deg); } }
@keyframes machinePulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes chestJump { 0%, 100% { transform: translateY(0) scale(1); } 32% { transform: translateY(-12px) scale(1.02); } 56% { transform: translateY(4px) scale(0.99); } }
@keyframes lidOpen { 0% { transform: translateX(-50%) rotate(0deg); } 42% { transform: translateX(-50%) translateY(-18px) rotate(-10deg); } 100% { transform: translateX(-50%) translateY(-40px) rotate(-24deg); } }
@keyframes glowOpen { 0% { opacity: 0; transform: translateX(-50%) scale(0.6); } 45% { opacity: 1; transform: translateX(-50%) scale(1.24); } 100% { opacity: 0.42; transform: translateX(-50%) scale(1.05); } }
@keyframes shineSweep { from { transform: translateX(-40%) rotate(8deg); } to { transform: translateX(40%) rotate(8deg); } }
@keyframes prizePop { from { opacity: 0; transform: scale(0.45) rotate(-12deg); } to { opacity: 1; transform: scale(1) rotate(0deg); } }
@keyframes rewardBurst { 0% { transform: scale(1); filter: brightness(1); } 45% { transform: scale(1.03); filter: brightness(1.12); } 100% { transform: scale(1); filter: brightness(1); } }
@keyframes popFall { from { opacity: 1; transform: translate3d(0,0,0) rotate(0deg) scale(1); } to { opacity: 0; transform: translate3d(var(--dx), var(--dy), 0) rotate(240deg) scale(0.5); } }
@keyframes chibiSoftBob { 0%, 100% { transform: translateY(0) rotate(-0.2deg); } 50% { transform: translateY(-7px) rotate(0.24deg); } }
@keyframes chibiTinyHop { 0%, 100% { transform: translateY(0) scaleX(1) scaleY(1); } 34% { transform: translateY(-12px) scaleX(0.985) scaleY(1.015); } 62% { transform: translateY(2px) scaleX(1.018) scaleY(0.982); } }
@keyframes chibiFloat { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-13px) rotate(1.2deg); } }
@keyframes chibiDance { 0%, 100% { transform: translateY(0) rotate(-1.1deg); } 35% { transform: translate(3px, -6px) rotate(1.3deg); } 68% { transform: translate(-2px, -2px) rotate(-0.5deg); } }
@keyframes chibiRoyalFloat { 0%, 100% { transform: translateY(0) rotate(-0.35deg) scale(1); filter: drop-shadow(0 10px 14px rgba(63, 48, 42, 0.13)) saturate(1); } 42% { transform: translateY(-11px) rotate(0.5deg) scale(1.01); filter: drop-shadow(0 14px 18px rgba(63, 48, 42, 0.16)) saturate(1.06); } }
@keyframes chibiPandaBob { 0%, 100% { transform: translateY(0) rotate(-0.1deg) scale(1); } 42% { transform: translateY(-6px) rotate(0.14deg) scale(1.006); } 58% { transform: translateY(-4px) rotate(0.08deg) scaleX(1.012) scaleY(0.99); } }
@keyframes chibiTwinkle { 0%, 100% { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(0.24); } 45% { opacity: 0.92; transform: translate(-50%, -50%) rotate(45deg) scale(1); } 72% { opacity: 0.34; transform: translate(-50%, -58%) rotate(45deg) scale(0.72); } }
@keyframes petSoftBob { 0%, 100% { transform: translateY(0) rotate(-0.2deg); } 50% { transform: translateY(-7px) rotate(0.24deg); } }
@keyframes petWaddle { 0%, 100% { transform: translateY(0) rotate(-1.1deg); } 33% { transform: translate(3px, -5px) rotate(1.4deg); } 66% { transform: translate(-2px, -2px) rotate(-0.7deg); } }
@keyframes petSleepy { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(5px) scaleY(0.992); } }
@keyframes petCurious { 0%, 100% { transform: translateY(0) rotate(-0.4deg); } 42% { transform: translateY(-6px) rotate(1.2deg); } 70% { transform: translateY(-2px) rotate(0.2deg); } }
@keyframes petProud { 0%, 100% { transform: translateY(0) rotate(-0.16deg) scale(1); } 42% { transform: translateY(-7px) rotate(0.18deg) scale(1.006); } 58% { transform: translateY(-5px) rotate(0.12deg) scaleX(1.012) scaleY(0.988); } }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; max-width: 100vw; overflow-x: hidden; }
  .side-rail { position: static; width: 100%; max-width: 100vw; height: auto; overflow: hidden; }
  .nav { flex-direction: row; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: 0 0 116px; }
  .home-layout, .reward-layout, .closet-layout, .room-layout, .parent-layout, .event-strip, .mission-list, .reward-grid, .closet-grid, .room-items, .closet-items { grid-template-columns: 1fr; }
  .home-stage-panel { min-height: 760px; }
  .home-stage .home-main-character { left: 39%; width: min(64vh, 520px); max-width: 52%; }
  .home-chibi-slot { right: 18px; top: 154px; bottom: auto; width: 116px; }
  .closet-preview { position: static; }
  .closet-character { min-height: 620px; aspect-ratio: 4 / 3; }
  .closet-character > .main-character-art { width: min(46vw, 420px); max-width: 54%; }
  .closet-pet-slot { left: 6%; bottom: 10%; width: clamp(142px, 19vw, 190px); }
  .closet-chibi-slot { right: 6%; bottom: 11%; width: clamp(136px, 18vw, 180px); }
}

@media (max-width: 640px) {
  .workspace, .side-rail { width: 100vw; max-width: 100vw; padding: 16px; }
  .topbar, .profile-switcher, .wallet, .segmented { width: calc(100vw - 32px) !important; max-width: calc(100vw - 32px) !important; }
  .topbar, .section-header { align-items: flex-start; flex-direction: column; }
  .hero-panel, .summon-panel, .room-panel { min-height: auto; }
  .closet-preview { min-height: 0; }
  .home-stage-panel { min-height: 680px; }
  .home-stage-copy {
    left: 14px;
    right: 14px;
    top: 14px;
    max-width: none;
  }
  .home-stage .home-main-character {
    left: 39%;
    bottom: 72px;
    width: min(78vw, 390px);
    max-width: 72%;
    max-height: 70%;
  }
  .home-chibi-slot {
    right: 14px;
    top: 166px;
    bottom: auto;
    width: 92px;
    padding: 6px;
    border-radius: 14px;
  }
  .home-equip-badge {
    left: 14px;
    bottom: 72px;
    max-width: 58%;
  }
  .profile-switcher { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wallet { display: block !important; line-height: 1.9; }
  .wallet span { display: inline; min-height: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 0 10px 0 0; white-space: normal; font-size: 12px; }
  .wallet b { font-size: 18px; }
  .segment { flex: 1; }
  .character-stage { min-height: 290px; }
  .closet-character { min-height: 520px; aspect-ratio: 3 / 4; }
  .character-stage > .main-character-art { width: min(88%, 300px); }
  .home-stage .home-main-character {
    left: 39%;
    bottom: 72px;
    width: min(78vw, 390px);
    max-width: 72%;
    max-height: 70%;
  }
  .chibi-companion-slot { right: 4%; bottom: 20%; width: 86px; }
  .home-chibi-slot { right: 14px; top: 166px; bottom: auto; width: 92px; }
  .closet-character > .main-character-art { width: min(76%, 330px); max-width: 76%; max-height: 78%; }
  .closet-chibi-slot { right: 4%; bottom: 15%; width: 104px; }
  .closet-pet-slot { left: 4%; bottom: 14%; width: 112px; }
  .closet-preview > h3 { max-width: calc(100% - 28px); }
}

@media (prefers-reduced-motion: reduce) {
  .chibi-companion-slot img,
  .chibi-companion-sparkles span,
  .pet-companion-slot img,
  .pet-companion-sparkles span {
    animation: none !important;
  }
}

/* Refinements for the gacha-like reward flow and compact closet browsing. */
.home-stage-copy {
  display: block;
  width: min(560px, calc(100% - 260px));
  align-items: center;
  max-width: calc(100% - 260px);
  min-height: 136px;
  padding: 18px clamp(20px, 3vw, 32px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.9), rgba(255, 247, 232, 0.72));
}
.home-stage-copy h3 {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow-wrap: normal;
  line-height: 1.15;
  font-size: clamp(30px, 3.1vw, 40px);
}
.home-stage-copy p:last-child {
  min-width: 0;
  max-width: 100%;
  margin: 14px 0 0;
  overflow-wrap: anywhere;
}
.home-chibi-slot {
  right: clamp(22px, 3.8vw, 56px);
  top: clamp(178px, 23vh, 240px);
}
.home-pet-slot {
  left: auto;
  right: clamp(22px, 3.8vw, 56px);
  top: clamp(42px, 8vh, 86px);
  bottom: auto;
  z-index: 6;
  width: clamp(108px, 10.5vw, 132px);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: rgba(255, 250, 239, 0.62);
  box-shadow: 0 16px 34px rgba(72, 54, 44, 0.13);
  backdrop-filter: blur(5px);
}

.summon-panel {
  min-height: clamp(700px, calc(100vh - 160px), 860px);
  grid-template-rows: auto minmax(430px, 1fr) auto;
  gap: 20px;
  padding-bottom: 26px;
}
.summon-panel .primary-button {
  position: relative;
  z-index: 9;
}
.treasure-machine {
  min-height: clamp(430px, 52vh, 560px);
  overflow: hidden;
  pointer-events: none;
}

.treasure-machine::before,
.treasure-machine::after {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}
.treasure-machine::before {
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 247, 190, 0.84), transparent 28%),
    conic-gradient(from 0deg, transparent, rgba(255, 225, 112, 0.42), transparent 23%, rgba(159, 207, 214, 0.26), transparent 52%, rgba(232, 145, 157, 0.3), transparent 76%);
  filter: blur(1px);
  opacity: 0.9;
  animation: auraSpin 11s linear infinite;
}
.treasure-machine::after {
  inset: 25%;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.96) 0 3px, transparent 4px),
    radial-gradient(circle at 78% 26%, rgba(255,238,158,0.94) 0 4px, transparent 5px),
    radial-gradient(circle at 30% 78%, rgba(255,255,255,0.9) 0 3px, transparent 4px),
    radial-gradient(circle at 72% 76%, rgba(255,224,117,0.9) 0 3px, transparent 4px);
  animation: treasureDust 3.4s ease-in-out infinite;
}
.treasure-rays {
  width: min(92%, 390px);
  max-height: calc(100% - 18px);
  background: conic-gradient(from 12deg, rgba(213,173,84,0), rgba(255,234,153,0.62), rgba(213,173,84,0), rgba(142,201,174,0.34), rgba(213,173,84,0));
  filter: blur(0.5px);
  pointer-events: none;
}
.treasure-chest {
  width: min(82%, 340px);
  height: 230px;
  filter: drop-shadow(0 28px 24px rgba(63, 48, 42, 0.18));
  pointer-events: none;
}
.treasure-lid {
  top: 42px;
  width: 88%;
  height: 84px;
  border: 4px solid #6d4939;
  border-radius: 70px 70px 18px 18px;
  background:
    radial-gradient(circle at 50% 12%, rgba(255,255,255,0.78), transparent 12%),
    linear-gradient(90deg, transparent 16%, rgba(255,246,188,0.64) 16% 24%, transparent 24% 46%, rgba(142,201,174,0.3) 46% 54%, transparent 54% 76%, rgba(255,246,188,0.64) 76% 84%, transparent 84%),
    linear-gradient(180deg, #f2be68 0%, #cf7d48 58%, #8e503b 100%);
  box-shadow: inset 0 -12px 0 rgba(80, 50, 40, 0.16), 0 8px 0 rgba(72, 54, 44, 0.14);
}
.treasure-lid::before {
  position: absolute;
  left: 50%;
  top: -24px;
  width: 78px;
  height: 52px;
  border: 4px solid #6d4939;
  border-bottom: 0;
  border-radius: 70px 70px 0 0;
  background: linear-gradient(180deg, #e9d6a8, #b58258);
  content: "";
  transform: translateX(-50%);
}
.treasure-lid::after {
  position: absolute;
  left: 50%;
  top: 17px;
  width: 42px;
  height: 42px;
  border: 3px solid rgba(93, 64, 54, 0.9);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 38%, #eff8ff 0 20%, #8db4c7 21% 48%, #4f6f63 49% 100%);
  box-shadow: 0 0 18px rgba(255, 240, 164, 0.72);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}
.treasure-body {
  bottom: 18px;
  width: 96%;
  height: 120px;
  border: 4px solid #6d4939;
  border-radius: 18px 18px 34px 34px;
  background:
    linear-gradient(90deg, transparent 14%, rgba(255,246,188,0.62) 14% 22%, transparent 22% 48%, rgba(255,240,164,0.28) 48% 52%, transparent 52% 78%, rgba(255,246,188,0.62) 78% 86%, transparent 86%),
    linear-gradient(180deg, #d88d51 0%, #a85e43 58%, #714133 100%);
  box-shadow: 0 18px 0 rgba(63,48,42,0.12), inset 0 -15px 0 rgba(63,48,42,0.15);
}
.treasure-body::before {
  position: absolute;
  left: 0;
  right: 0;
  top: 42px;
  height: 14px;
  border-top: 3px solid #6d4939;
  border-bottom: 3px solid #6d4939;
  background: linear-gradient(90deg, #e8d7a1, #fff0a9, #d5ad54);
  content: "";
}
.treasure-body::after {
  position: absolute;
  inset: 18px 18px auto;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 240, 164, 0.44), transparent);
  content: "";
}
.treasure-lock {
  top: 112px;
  width: 62px;
  height: 64px;
  border: 4px solid #6d4939;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff5bf, #d5ad54 68%, #a66d30);
  box-shadow: 0 0 16px rgba(255, 230, 118, 0.54);
}
.treasure-lock::after {
  top: 19px;
  width: 12px;
  height: 22px;
}
.treasure-glow {
  top: 94px;
  width: 78%;
  height: 92px;
  background: radial-gradient(circle, rgba(255,255,255,1) 0 10%, rgba(255,242,157,0.92) 24%, rgba(255,210,95,0) 72%);
  filter: blur(4px);
}
.summon-panel::before,
.summon-panel::after {
  position: absolute;
  inset: 0;
  z-index: 8;
  content: "";
  pointer-events: none;
  opacity: 0;
}
.summon-panel::before {
  background:
    radial-gradient(circle at 50% 54%, rgba(255,255,255,0.98), rgba(255,242,157,0.86) 16%, rgba(255,242,157,0.18) 36%, transparent 66%);
  mix-blend-mode: screen;
}
.summon-panel::after {
  background:
    radial-gradient(circle at 30% 34%, rgba(255,255,255,0.95) 0 4px, transparent 5px),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,0.9) 0 3px, transparent 4px),
    radial-gradient(circle at 62% 72%, rgba(255,232,133,0.95) 0 4px, transparent 5px),
    linear-gradient(115deg, transparent 24%, rgba(255,255,255,0.86) 48%, transparent 72%);
}
.summon-panel.treasure-flash::before { animation: treasureWhiteout 1050ms ease-out; }
.summon-panel.treasure-flash::after { animation: treasureDissolve 1050ms ease-out; }
.treasure-chest.opening .treasure-lid { animation: lidOpen 900ms cubic-bezier(0.2,1.28,0.28,1) forwards; }
.treasure-chest.opening .treasure-glow { animation: glowOpen 980ms ease-out forwards; }

#rewardDialog {
  width: min(430px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  border-radius: 20px;
  background: transparent;
}
#rewardDialog::backdrop {
  background: rgba(45, 35, 31, 0.34);
  backdrop-filter: blur(5px);
}
.reward-dialog {
  position: relative;
  overflow: hidden;
  gap: 16px;
  min-height: 520px;
  padding: 34px 30px 30px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 240, 164, 0.4), transparent 28%),
    linear-gradient(180deg, #fffdf8 0%, #fff8ec 58%, #f4eadc 100%);
  box-shadow: 0 34px 100px rgba(42,32,28,0.32);
}
.reward-dialog::before {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(213, 173, 84, 0.42);
  border-radius: 16px;
  content: "";
  pointer-events: none;
}
.reward-dialog::after {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 28% 22%, rgba(255,255,255,0.9) 0 4px, transparent 5px),
    radial-gradient(circle at 72% 26%, rgba(255,226,102,0.9) 0 5px, transparent 6px),
    radial-gradient(circle at 22% 78%, rgba(142,201,174,0.58) 0 4px, transparent 5px),
    radial-gradient(circle at 78% 76%, rgba(232,145,157,0.52) 0 4px, transparent 5px);
  content: "";
  pointer-events: none;
  animation: rewardDialogTwinkle 4s ease-in-out infinite;
}
.reward-dialog > * { position: relative; z-index: 1; }
.reward-dialog .eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #edf5ea;
  color: #4f6f63;
}
.reward-dialog h3 {
  font-size: clamp(24px, 6vw, 34px);
}
.reward-prize {
  width: 176px;
  height: 176px;
  border: 1px solid rgba(255,255,255,0.7);
  background:
    radial-gradient(circle at 50% 38%, #fff 0 9%, transparent 10%),
    radial-gradient(circle, #fff9db 0 24%, #ffe8a0 25% 58%, #d5ad54 100%);
  box-shadow: inset 0 -16px 30px rgba(172, 112, 42, 0.14), 0 18px 42px rgba(213, 173, 84, 0.24);
  color: #3f302a;
  animation: prizePop 650ms cubic-bezier(0.2,1.4,0.3,1) both, prizeGlow 2.8s ease-in-out infinite;
}
.reward-prize img {
  width: 136px;
  height: 136px;
  display: block;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  mix-blend-mode: normal;
}
.daily-chest-prize {
  position: relative;
  display: block;
  width: 132px;
  height: 118px;
  filter: drop-shadow(0 14px 12px rgba(80, 58, 45, 0.2));
}
.daily-chest-prize > span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.daily-chest-lid {
  top: 9px;
  z-index: 3;
  width: 112px;
  height: 48px;
  border: 4px solid #674638;
  border-radius: 42px 42px 11px 11px;
  background:
    linear-gradient(90deg, transparent 17%, rgba(255, 239, 172, 0.72) 17% 26%, transparent 26% 72%, rgba(255, 239, 172, 0.72) 72% 81%, transparent 81%),
    linear-gradient(180deg, #f1b762, #c97645 62%, #884e3b);
}
.daily-chest-body {
  bottom: 10px;
  z-index: 2;
  width: 124px;
  height: 62px;
  border: 4px solid #674638;
  border-radius: 12px 12px 22px 22px;
  background:
    linear-gradient(90deg, transparent 16%, rgba(255, 239, 172, 0.68) 16% 25%, transparent 25% 47%, rgba(255, 232, 141, 0.36) 47% 53%, transparent 53% 75%, rgba(255, 239, 172, 0.68) 75% 84%, transparent 84%),
    linear-gradient(180deg, #d98b51, #a95f44 60%, #744234);
}
.daily-chest-body::before {
  position: absolute;
  inset: 25px 0 auto;
  height: 10px;
  border-top: 3px solid #674638;
  border-bottom: 3px solid #674638;
  background: linear-gradient(90deg, #e9d9a4, #fff0a9, #d5ad54);
  content: "";
}
.daily-chest-lock {
  top: 55px;
  z-index: 4;
  width: 38px;
  height: 42px;
  border: 4px solid #674638;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff4b9, #d5ad54 68%, #a66d30);
}
.daily-chest-lock::after {
  position: absolute;
  left: 50%;
  top: 12px;
  width: 8px;
  height: 15px;
  border-radius: 999px;
  background: #674638;
  content: "";
  transform: translateX(-50%);
}
.daily-chest-shine {
  top: 0;
  z-index: 5;
  width: 118px;
  height: 88px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.92) 0 5px, transparent 6px),
    radial-gradient(circle at 72% 66%, rgba(255, 232, 122, 0.9) 0 4px, transparent 5px);
  pointer-events: none;
}
.reward-dialog menu .primary-button {
  min-width: 128px;
  border-radius: 14px;
}

.closet-pet-slot { left: clamp(16%, 22vw, 27%); }
.closet-chibi-slot { right: clamp(16%, 22vw, 27%); }

@keyframes treasureDust {
  0%, 100% { opacity: 0.46; transform: translateY(0) rotate(0deg); }
  50% { opacity: 1; transform: translateY(-8px) rotate(8deg); }
}
@keyframes treasureWhiteout {
  0% { opacity: 0; transform: scale(0.72); }
  34% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.22); }
}
@keyframes treasureDissolve {
  0% { opacity: 0; transform: translateX(-18%) scale(0.9); }
  36% { opacity: 0.92; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(18%) scale(1.06); }
}
@keyframes rewardDialogTwinkle {
  0%, 100% { opacity: 0.52; transform: rotate(0deg) scale(1); }
  50% { opacity: 1; transform: rotate(4deg) scale(1.02); }
}
@keyframes prizeGlow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 226, 102, 0)); }
  50% { filter: drop-shadow(0 0 18px rgba(255, 226, 102, 0.52)); }
}

@media (max-width: 1080px) {
  .closet-preview { position: relative; }
  .home-stage-copy {
    display: block;
    width: min(560px, calc(100% - 32px));
    max-width: min(560px, calc(100% - 32px));
    min-height: 108px;
  }
  .home-stage-copy h3 { white-space: normal; }
  .home-stage-copy p:last-child { max-width: 100%; margin-top: 12px; }
  .home-pet-slot {
    right: 18px;
    top: 154px;
    bottom: auto;
    left: auto;
    width: 116px;
    height: 116px;
    aspect-ratio: 1 / 1;
    padding: 8px;
  }
  .home-chibi-slot {
    right: 18px;
    top: 286px;
    bottom: auto;
    width: 116px;
    height: 116px;
    aspect-ratio: 1 / 1;
    padding: 8px;
  }
  .closet-pet-slot { left: 13%; bottom: 10%; width: clamp(150px, 20vw, 200px); }
  .closet-chibi-slot { right: 13%; bottom: 11%; width: clamp(144px, 19vw, 190px); }
}

@media (min-width: 1081px) and (max-width: 1320px) {
  .home-stage-copy {
    display: block;
    width: min(520px, calc(100% - 240px));
    max-width: calc(100% - 240px);
    min-height: 112px;
  }
  .home-stage-copy h3 {
    white-space: nowrap;
    font-size: clamp(28px, 3vw, 36px);
  }
  .home-stage-copy p:last-child {
    max-width: 100%;
    margin-top: 12px;
  }
}

@media (max-width: 640px) {
  .closet-preview { position: relative; }
  .home-stage-copy {
    display: block;
    width: auto;
    min-height: 0;
    max-width: none;
    padding: 14px 16px;
    border-radius: 14px;
  }
  .home-stage-copy h3 { white-space: normal; }
  .home-stage-copy p:last-child { margin-top: 12px; }
  .home-chibi-slot {
    right: 14px;
    top: auto;
    bottom: 156px;
    width: 92px;
    height: 92px;
    aspect-ratio: 1 / 1;
    padding: 6px;
    border-radius: 14px;
  }
  .home-pet-slot {
    right: 14px;
    top: auto;
    bottom: 258px;
    left: auto;
    width: 92px;
    height: 92px;
    aspect-ratio: 1 / 1;
    padding: 6px;
    border-radius: 14px;
  }
  .closet-pet-slot { left: 11%; bottom: 13%; width: 130px; }
  .closet-chibi-slot { right: 11%; bottom: 14%; width: 122px; }
  .closet-item-panel {
    padding: 0;
    overflow: hidden;
  }
  .closet-item-panel > .section-header {
    position: relative;
    min-height: 62px;
    margin: 0;
    padding: 14px 48px 14px 16px;
    cursor: pointer;
  }
  .closet-item-panel > .section-header::after {
    position: absolute;
    right: 16px;
    top: 50%;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #edf5ea;
    color: #4f6f63;
    content: "+";
    font-weight: 900;
    transform: translateY(-50%);
  }
  .closet-item-panel.open > .section-header::after {
    content: "-";
  }
  .closet-item-panel .closet-grid {
    max-height: 0;
    overflow: hidden;
    padding: 0 14px;
    opacity: 0;
    transition: max-height 260ms ease, opacity 180ms ease, padding 220ms ease;
  }
  .closet-item-panel.open .closet-grid {
    max-height: 860px;
    overflow: auto;
    padding: 0 14px 14px;
    opacity: 1;
  }
  .closet-card {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    padding: 12px;
  }
  .reward-dialog {
    min-height: 480px;
    padding: 30px 22px 26px;
  }
  .reward-prize {
    width: 158px;
    height: 158px;
  }
}

/* Final fantasy overrides kept at the end so the app skin wins over legacy rules. */
.pet-companion-slot,
.chibi-companion-slot,
.pet-companion-slot img,
.chibi-companion-slot img,
.companion-preview-trigger {
  pointer-events: auto;
  cursor: zoom-in;
}
body {
  color: var(--fantasy-ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 239, 185, 0.54), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(216, 201, 242, 0.5), transparent 26%),
    linear-gradient(135deg, #f7eef5 0%, #fff8eb 42%, #edf8f7 100%);
}
.side-rail,
.topbar,
.hero-panel,
.daily-panel,
.summon-panel,
.room-panel,
.closet-preview,
.closet-item-panel,
.parent-layout > section,
.event-strip article,
.reward-card,
.closet-card,
.room-item,
.mission-card {
  border-color: var(--fantasy-line);
  background:
    linear-gradient(145deg, rgba(255, 253, 248, 0.94), rgba(255, 246, 255, 0.76)),
    radial-gradient(circle at 18% 0%, rgba(255, 238, 179, 0.32), transparent 38%);
  box-shadow: var(--fantasy-glow);
}
.side-rail {
  border-right: 1px solid rgba(143, 124, 200, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.9), rgba(247, 236, 255, 0.76)),
    radial-gradient(circle at 50% 0%, rgba(255, 228, 164, 0.36), transparent 42%);
}
.brand-mark {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(135deg, #9d80d7, #77c8d3 52%, #f0b0c0);
  box-shadow: 0 10px 0 rgba(94, 74, 135, 0.16), 0 0 24px rgba(255, 226, 102, 0.24);
}
.nav-item.active,
.nav-item:hover,
.profile-tab.active,
.profile-tab:hover,
.segment.active {
  border-color: rgba(143, 124, 200, 0.22);
  background: linear-gradient(135deg, rgba(245, 232, 255, 0.95), rgba(232, 249, 248, 0.86));
  color: #5e4b86;
  box-shadow: 0 10px 24px rgba(127, 106, 174, 0.14);
}
.primary-button,
.closet-card button,
.mission-card button,
.reward-dialog menu .primary-button {
  background: linear-gradient(135deg, #7cc8d2 0%, #9b82d6 50%, #f0a5b7 100%);
  color: #fffdf8;
  box-shadow: 0 10px 0 rgba(84, 67, 126, 0.18), 0 18px 36px rgba(142, 124, 200, 0.28);
  text-shadow: 0 1px 0 rgba(65, 45, 83, 0.22);
}
.primary-button,
.secondary-button,
.text-button,
.closet-card button,
.mission-card button,
.reward-dialog menu .primary-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 180ms ease, filter 180ms ease;
}
.mission-card:hover,
.reward-card:hover,
.closet-card:hover,
.room-item:hover,
.event-strip article:hover {
  border-color: rgba(143, 124, 200, 0.38);
  box-shadow: 0 22px 56px rgba(120, 98, 168, 0.18);
  transform: translateY(-2px);
}
.summon-panel {
  background:
    radial-gradient(circle at 50% 43%, rgba(255, 241, 162, 0.34), transparent 36%),
    linear-gradient(155deg, rgba(255, 253, 248, 0.94), rgba(246, 234, 255, 0.78));
}
.reward-dialog {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 239, 166, 0.34), transparent 34%),
    linear-gradient(155deg, rgba(255,253,248,0.97), rgba(250,238,255,0.9));
}
/* Final mobile/decorative overrides. This must remain at the end of the file. */
body {
  position: relative;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 236, 170, 0.68), transparent 22%),
    radial-gradient(circle at 82% 12%, rgba(226, 201, 249, 0.58), transparent 26%),
    radial-gradient(circle at 18% 84%, rgba(143, 205, 215, 0.38), transparent 26%),
    linear-gradient(135deg, #fbedf6 0%, #fff8e8 42%, #edf9f7 100%);
}
body::before {
  z-index: -2;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.94) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255,222,128,0.56) 0 1.5px, transparent 2.5px),
    linear-gradient(135deg, transparent 0 46%, rgba(255,255,255,0.34) 47% 49%, transparent 50%),
    repeating-linear-gradient(135deg, rgba(154,126,204,0.065) 0 1px, transparent 1px 22px);
  background-size: 72px 72px, 118px 118px, 260px 260px, 34px 34px;
  background-position: 0 0, 42px 28px, 0 0, 0 0;
}
body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 8% 26%, rgba(255,255,255,0.74) 0 7px, transparent 8px),
    radial-gradient(circle at 92% 20%, rgba(255,236,158,0.7) 0 8px, transparent 9px),
    radial-gradient(circle at 84% 78%, rgba(240,169,188,0.42) 0 10px, transparent 11px),
    radial-gradient(circle at 14% 72%, rgba(143,205,215,0.46) 0 9px, transparent 10px);
}
.workspace {
  position: relative;
}
.workspace::before {
  position: fixed;
  right: clamp(18px, 4vw, 54px);
  top: clamp(86px, 13vh, 160px);
  z-index: -1;
  width: clamp(130px, 18vw, 230px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.58);
  border-radius: 42% 58% 52% 48%;
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,0.72) 0 10%, transparent 11%),
    conic-gradient(from 24deg, rgba(255,232,145,0.35), rgba(216,201,242,0.3), rgba(143,205,215,0.24), rgba(240,169,188,0.26), rgba(255,232,145,0.35));
  box-shadow: 0 0 70px rgba(255, 226, 120, 0.22);
  content: "";
  opacity: 0.72;
  animation: auraSpin 28s linear infinite;
}
.topbar {
  min-width: 0;
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.9), rgba(250, 239, 255, 0.78)),
    radial-gradient(circle at 12% 0%, rgba(255, 232, 145, 0.28), transparent 38%);
  box-shadow: 0 18px 44px rgba(112, 90, 145, 0.13);
  backdrop-filter: blur(10px);
}
.topbar > div:first-child {
  min-width: 0;
}
.topbar h2 {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.wallet {
  min-width: min(100%, 310px);
  justify-content: flex-end;
}
.wallet span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
}
.nav-item {
  min-width: 0;
  padding: 0 12px 0 10px;
  border-radius: 14px;
}
.nav-item::before {
  width: 34px;
  height: 34px;
  margin-right: 10px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,0.96) 0 18%, transparent 19%),
    linear-gradient(135deg, #fff4c7 0%, #f3c2d0 48%, #bfe7eb 100%);
  color: #6a5488;
  box-shadow: 0 8px 16px rgba(112, 90, 145, 0.15), inset 0 -4px 8px rgba(117, 78, 142, 0.08);
  font-size: 17px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}
.nav-item::after {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 226, 102, 0.86);
  box-shadow: 0 0 10px rgba(255, 226, 102, 0.54);
  content: "";
  opacity: 0.56;
}
.nav-item[data-view="home"]::before { content: "⌂"; }
.nav-item[data-view="missions"]::before { content: "✧"; }
.nav-item[data-view="reward"]::before { content: "✦"; }
.nav-item[data-view="closet"]::before { content: "♡"; }
.nav-item[data-view="rooms"]::before { content: "☾"; }
.nav-item[data-view="parent"]::before { content: "⚙"; }
.nav-item.active::before,
.nav-item:hover::before {
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,0.98) 0 18%, transparent 19%),
    linear-gradient(135deg, #ffe783 0%, #f1a8bf 46%, #8fd5df 100%);
  transform: translateY(-1px) rotate(-4deg);
}
.side-rail {
  position: sticky;
}
.side-rail::before {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255,255,255,0.48);
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 226, 102, 0.32) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 34%, rgba(143, 205, 215, 0.28) 0 5px, transparent 6px),
    radial-gradient(circle at 46% 82%, rgba(240, 169, 188, 0.28) 0 4px, transparent 5px);
  content: "";
  pointer-events: none;
}
.side-rail > * {
  position: relative;
  z-index: 1;
}
.hero-panel,
.daily-panel,
.summon-panel,
.room-panel,
.closet-preview,
.closet-item-panel,
.parent-layout > section,
.event-strip article,
.mission-card,
.reward-card,
.room-item,
.closet-card {
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255,253,248,0.94), rgba(255,246,255,0.78)),
    radial-gradient(circle at 14% 4%, rgba(255,226,102,0.24), transparent 36%),
    radial-gradient(circle at 92% 18%, rgba(143,205,215,0.16), transparent 34%);
}
@media (max-width: 1080px) {
  .app-shell {
    background:
      linear-gradient(180deg, rgba(255,255,255,0.24), transparent 240px),
      transparent;
  }
  .side-rail {
    position: relative;
    gap: 14px;
    padding-bottom: 14px;
  }
  .nav {
    gap: 10px;
    padding: 2px 2px 8px;
  }
  .nav-item {
    flex: 0 0 132px;
    min-height: 52px;
    padding-right: 24px;
  }
}
@media (max-width: 640px) {
  .workspace,
  .side-rail {
    width: 100%;
    max-width: 100%;
    padding: 12px;
  }
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: auto !important;
    max-width: none !important;
    gap: 12px;
    margin: 0 0 14px;
    padding: 14px;
    overflow: hidden;
  }
  .topbar .eyebrow {
    font-size: 10px;
    line-height: 1.15;
  }
  .topbar h2 {
    font-size: clamp(24px, 8.2vw, 34px);
    line-height: 1.1;
  }
  .wallet {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    gap: 7px;
    line-height: 1.2;
  }
  .wallet span {
    display: inline-flex !important;
    min-width: 0;
    min-height: 34px;
    padding: 5px 6px;
    border: 1px solid rgba(255,255,255,0.74);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(255,248,236,0.72));
    box-shadow: 0 8px 18px rgba(112, 90, 145, 0.1);
    font-size: 12px;
    white-space: nowrap;
  }
  .wallet b {
    margin-right: 2px;
    font-size: 17px;
  }
  .brand {
    align-items: flex-start;
  }
  .brand h1 {
    font-size: 16px;
  }
  .profile-switcher {
    width: 100% !important;
    max-width: 100% !important;
  }
  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    width: 100%;
  }
  .nav-item {
    flex: none;
    min-height: 64px;
    padding: 8px 4px 7px;
    text-align: center;
    font-size: 11px;
    line-height: 1.18;
  }
  .nav-item::before {
    display: grid;
    width: 32px;
    height: 32px;
    margin: 0 auto 4px;
    font-size: 16px;
  }
  .nav-item::after {
    right: 9px;
    top: 8px;
  }
  h1, h2, h3, h4,
  .mission-card p,
  .reward-card p,
  .room-item span,
  .closet-card p {
    overflow-wrap: anywhere;
  }
}
@media (max-width: 380px) {
  .wallet {
    gap: 5px;
  }
  .wallet span {
    min-height: 32px;
    padding-inline: 4px;
    font-size: 11px;
  }
  .wallet b {
    font-size: 15px;
  }
  .topbar h2 {
    font-size: clamp(22px, 8vw, 30px);
  }
  .nav-item {
    font-size: 10px;
  }
}
/* Must stay at EOF: final replacement for placeholder event and sound icons. */
.event-strip .event-icon {
  position: relative;
  isolation: isolate;
  overflow: visible;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,0.98) 0 14%, transparent 15%),
    linear-gradient(135deg, #fff1a8 0%, #f6c4d4 54%, #bdebee 100%);
  color: transparent;
  font-size: 0;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(129, 103, 168, 0.14), inset 0 -5px 10px rgba(134, 89, 143, 0.08);
  animation: iconTwinkle 1.8s ease-in-out infinite;
}
.sound-toggle span {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 8px 999px 999px 8px;
  background: linear-gradient(135deg, #8fd5df, #9b82d6 62%, #f0a5b7);
  box-shadow: inset 0 -3px 6px rgba(74, 53, 100, 0.16), 0 0 0 4px rgba(255,255,255,0.48);
}
.sound-toggle span::before {
  position: absolute;
  left: -5px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #fffaf0;
  content: "";
}
.sound-toggle span::after {
  position: absolute;
  right: -12px;
  top: 4px;
  width: 11px;
  height: 13px;
  border: 2px solid #d39a47;
  border-left: 0;
  border-radius: 0 999px 999px 0;
  content: "";
  animation: soundWavePulse 1.8s ease-in-out infinite;
}
.sound-toggle.muted span {
  filter: grayscale(0.8);
  opacity: 0.5;
}
/* Final home cleanup overrides: true EOF priority. */
.nav-item[data-view="rooms"],
#roomsView,
.side-status,
.event-strip {
  display: none !important;
}
.topbar > div:first-child {
  display: none !important;
}
.wallet span[hidden] {
  display: none !important;
}
@media (max-width: 640px) {
  .menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
  }
  .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    max-height: 0 !important;
    padding: 0 2px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: max-height 240ms ease, opacity 180ms ease, padding 200ms ease;
  }
  body.menu-open .nav {
    max-height: 92px !important;
    padding: 2px 2px 8px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .topbar {
    display: flex !important;
    justify-content: center !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 0 10px !important;
    padding: 10px 12px !important;
  }
  .wallet {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}
/* Absolute EOF override: fixed-size event dialogs without inner scrollbars. */
#comboEventFoundDialog,
#comboEventDialog {
  box-sizing: border-box !important;
  width: min(90vw, 600px) !important;
  max-width: calc(100vw - 40px) !important;
  max-height: none !important;
  margin: auto !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
}
.combo-found-dialog,
.combo-event-dialog {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
}
.combo-found-dialog {
  gap: 10px !important;
  padding: 22px 24px 24px !important;
  border-radius: 28px !important;
}
.combo-found-dialog h3 {
  max-width: 100% !important;
  margin: 0 !important;
  font-size: clamp(34px, 6vw, 50px) !important;
  line-height: 1.02 !important;
  white-space: nowrap !important;
}
.combo-found-title {
  max-width: 100% !important;
  padding: 8px 16px !important;
  font-size: clamp(16px, 3.3vw, 22px) !important;
  white-space: nowrap !important;
}
.combo-found-images {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 12px !important;
}
.combo-found-image-card {
  box-sizing: border-box !important;
  grid-template-rows: 108px auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 0 !important;
  padding: 12px 8px 10px !important;
  border-radius: 20px !important;
}
.combo-found-image-card img {
  max-width: 98px !important;
  max-height: 98px !important;
}
.combo-found-image-card figcaption {
  min-width: 0 !important;
  max-width: 100% !important;
}
.combo-found-image-card small {
  font-size: 12px !important;
}
.combo-found-image-card strong {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  font-size: clamp(15px, 3vw, 19px) !important;
  line-height: 1.25 !important;
}
.combo-found-summary {
  max-width: 100% !important;
  margin: 4px 0 2px !important;
  font-size: clamp(15px, 2.8vw, 20px) !important;
  line-height: 1.55 !important;
  overflow-wrap: anywhere !important;
}
.combo-found-dialog menu,
.combo-event-dialog menu {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: min(400px, 100%) !important;
  max-width: 100% !important;
  gap: 12px !important;
  margin: 0 !important;
  padding: 0 !important;
}
.combo-found-dialog menu button,
.combo-event-dialog menu button {
  min-width: 0 !important;
  width: 100% !important;
}
.combo-event-dialog {
  min-height: 0 !important;
  gap: 10px !important;
  padding: 28px 26px 24px !important;
  border-radius: 28px !important;
}
.combo-event-dialog h3 {
  max-width: 100% !important;
  margin: 0 !important;
  font-size: clamp(30px, 5.4vw, 42px) !important;
  line-height: 1.08 !important;
  overflow-wrap: anywhere !important;
}
.combo-event-stage {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  height: clamp(220px, 44vw, 310px) !important;
  aspect-ratio: auto !important;
  overflow: hidden !important;
}
.combo-talk-box {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  padding: 15px 18px !important;
}
.combo-talk-box p {
  font-size: clamp(16px, 3vw, 20px) !important;
  line-height: 1.55 !important;
}
@media (max-width: 560px), (max-height: 720px) {
  #comboEventFoundDialog,
  #comboEventDialog {
    width: min(92vw, 560px) !important;
    max-width: calc(100vw - 36px) !important;
  }
  .combo-found-dialog {
    gap: 8px !important;
    padding: 18px 18px 20px !important;
  }
  .combo-found-dialog h3 {
    font-size: clamp(30px, 7.6vw, 42px) !important;
  }
  .combo-found-title {
    font-size: clamp(15px, 3.8vw, 20px) !important;
  }
  .combo-found-image-card {
    grid-template-rows: 88px auto !important;
    padding: 10px 7px 9px !important;
  }
  .combo-found-image-card img {
    max-width: 82px !important;
    max-height: 82px !important;
  }
  .combo-found-summary {
    font-size: 15px !important;
    line-height: 1.45 !important;
  }
  .combo-found-dialog menu,
  .combo-event-dialog menu {
    width: min(360px, 100%) !important;
  }
  .combo-event-dialog {
    padding: 26px 18px 20px !important;
  }
  .combo-event-stage {
    height: clamp(190px, 38vh, 260px) !important;
  }
  .combo-talk-box {
    padding: 13px 14px !important;
  }
}
/* Final mission empty-state override: prevent blank frames below the filter menu. */
.mission-list.is-empty {
  grid-template-columns: 1fr !important;
  gap: 0 !important;
}

.mission-empty-state {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 14px !important;
  width: 100% !important;
  min-height: 116px !important;
  padding: 18px !important;
  border: 1px solid rgba(222, 203, 160, 0.72) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 229, 143, 0.34), transparent 38%),
    linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(245, 236, 255, 0.78)) !important;
  box-shadow: 0 16px 38px rgba(120, 98, 168, 0.13) !important;
}

.mission-empty-state h4 {
  margin: 0 !important;
  color: var(--fantasy-ink, #3d3049) !important;
  font-size: clamp(18px, 4.4vw, 24px) !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
}

.mission-empty-state p {
  margin: 6px 0 0 !important;
  color: var(--muted, #7c7068) !important;
  font-size: clamp(14px, 3.4vw, 16px) !important;
  line-height: 1.6 !important;
}

.mission-empty-star {
  position: relative !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, #fff2a8, #f5b4c4 54%, #96d7df) !important;
  box-shadow: 0 8px 0 rgba(94, 74, 135, 0.13), 0 0 24px rgba(255, 226, 102, 0.24) !important;
}

.mission-empty-star::before {
  width: 28px !important;
  height: 28px !important;
  background: #fffef7 !important;
  clip-path: polygon(50% 0%, 62% 34%, 98% 35%, 69% 56%, 80% 92%, 50% 70%, 20% 92%, 31% 56%, 2% 35%, 38% 34%) !important;
  content: "" !important;
  filter: drop-shadow(0 2px 4px rgba(124, 88, 48, 0.18)) !important;
}

@media (max-width: 560px) {
  .mission-empty-state {
    grid-template-columns: 1fr !important;
    justify-items: start !important;
    min-height: 0 !important;
    padding: 16px !important;
  }

  .mission-empty-star {
    width: 46px !important;
    height: 46px !important;
    border-radius: 16px !important;
  }
}
/* True EOF marker for iPad portrait audit overrides. */
@media (min-width: 700px) and (max-width: 980px) and (orientation: portrait) {
  body {
    overflow-x: hidden !important;
  }

  .app-shell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }

  .side-rail {
    position: sticky !important;
    top: 0 !important;
    z-index: 24 !important;
    display: grid !important;
    grid-template-columns: minmax(210px, 0.8fr) minmax(260px, 1fr) !important;
    grid-template-areas:
      "brand profile"
      "nav nav" !important;
    align-items: center !important;
    gap: 10px 14px !important;
    width: 100% !important;
    height: auto !important;
    padding: 12px 22px 14px !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(230, 210, 233, 0.92) !important;
    background: linear-gradient(135deg, rgba(255, 250, 247, 0.94), rgba(248, 241, 255, 0.9)) !important;
    box-shadow: 0 14px 32px rgba(95, 72, 126, 0.1) !important;
  }

  .title-brand {
    grid-area: brand !important;
    justify-content: flex-start !important;
    width: 100% !important;
  }

  .title-brand .title-logo-side {
    width: min(236px, 30vw) !important;
  }

  .profile-switcher {
    grid-area: profile !important;
    width: 100% !important;
    max-width: none !important;
  }

  .profile-tab {
    min-height: 42px !important;
    padding-inline: 12px !important;
    white-space: nowrap !important;
  }

  .menu-toggle {
    display: none !important;
  }

  .nav {
    grid-area: nav !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .nav-item {
    display: grid !important;
    place-items: center !important;
    min-width: 0 !important;
    min-height: 56px !important;
    padding: 5px 6px !important;
    text-align: center !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere !important;
  }

  .workspace {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 14px 22px 88px !important;
    overflow: hidden !important;
  }

  .topbar {
    justify-content: center !important;
    width: 100% !important;
    margin: 0 0 12px !important;
    padding: 8px 10px !important;
  }

  .wallet {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .wallet span {
    min-height: 36px !important;
    padding: 6px 14px !important;
    white-space: nowrap !important;
  }

  .home-layout,
  .reward-layout,
  .parent-layout,
  .room-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .home-stage-panel {
    min-height: clamp(720px, calc(100vh - 250px), 860px) !important;
    border-radius: 22px !important;
  }

  .home-stage-copy {
    left: 18px !important;
    right: 18px !important;
    top: 18px !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    padding: 16px 20px !important;
    border-radius: 18px !important;
  }

  .home-stage-copy h3 {
    font-size: clamp(32px, 5vw, 42px) !important;
    line-height: 1.12 !important;
    white-space: normal !important;
  }

  .home-stage-copy p:last-child {
    font-size: 17px !important;
    line-height: 1.65 !important;
  }

  .home-stage .home-main-character {
    left: 45% !important;
    bottom: 34px !important;
    width: min(58vw, 500px) !important;
    max-width: 62% !important;
    max-height: 72% !important;
  }

  .home-pet-slot,
  .home-chibi-slot {
    right: 22px !important;
    top: auto !important;
    width: 118px !important;
    height: 118px !important;
    padding: 8px !important;
    border-radius: 18px !important;
  }

  .home-pet-slot {
    bottom: 250px !important;
  }

  .home-chibi-slot {
    bottom: 118px !important;
  }

  .home-equip-badge {
    left: 18px !important;
    bottom: 22px !important;
    max-width: calc(100% - 178px) !important;
  }

  .daily-panel {
    padding: 16px !important;
  }

  .mission-list:not(.compact),
  .reward-grid,
  .room-items {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .closet-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .closet-character {
    min-height: clamp(560px, 58vh, 690px) !important;
    aspect-ratio: 4 / 3 !important;
    border-radius: 22px !important;
  }

  .closet-character > .main-character-art {
    width: min(44vw, 390px) !important;
    max-width: 50% !important;
    max-height: 82% !important;
  }

  .closet-pet-slot {
    left: 10% !important;
    bottom: 10% !important;
    width: clamp(148px, 20vw, 180px) !important;
  }

  .closet-chibi-slot {
    right: 10% !important;
    bottom: 11% !important;
    width: clamp(142px, 19vw, 172px) !important;
  }

  .closet-items {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .closet-card {
    grid-template-columns: 50px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .closet-card strong,
  .reward-card h4,
  .mission-card h4 {
    overflow-wrap: anywhere !important;
    line-height: 1.28 !important;
  }

  .summon-panel {
    min-height: 610px !important;
    grid-template-rows: auto minmax(390px, 1fr) auto !important;
  }

  .treasure-machine {
    min-height: 390px !important;
  }

  #rewardDialog,
  #comboEventFoundDialog,
  #comboEventDialog,
  #companionDialog {
    max-width: calc(100vw - 56px) !important;
  }

  .reward-dialog {
    width: min(680px, calc(100vw - 56px)) !important;
    min-height: 560px !important;
  }

  .combo-found-dialog,
  .combo-event-dialog {
    width: min(700px, calc(100vw - 56px)) !important;
  }

  .combo-event-stage {
    height: clamp(300px, 46vw, 410px) !important;
  }

  .combo-talk-box p,
  .combo-found-summary,
  .companion-dialog p {
    overflow-wrap: anywhere !important;
  }

  .onboarding-card {
    width: min(760px, calc(100vw - 44px)) !important;
    min-height: min(1080px, calc(100vh - 32px)) !important;
  }

  .onboarding-step.active {
    align-content: center !important;
  }

  .onboarding-step h2 {
    max-width: 18em !important;
    margin-inline: auto !important;
    text-align: center !important;
  }

  .title-logo-caption {
    max-width: min(600px, 100%) !important;
    margin-inline: auto !important;
    text-align: center !important;
  }
}

/* Parent/chore management refinement. Keep after iPad overrides. */
.title-brand {
  display: none !important;
}

.side-rail {
  padding-top: clamp(14px, 2vw, 22px);
}

@media (min-width: 700px) and (max-width: 980px) and (orientation: portrait) {
  .side-rail {
    grid-template-areas:
      "profile profile"
      "nav nav" !important;
  }

  .profile-switcher {
    grid-area: profile !important;
  }
}

.chore-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  max-height: min(46vh, 430px);
  overflow: auto;
  padding: 4px 6px 8px 4px;
}

.chore-picker label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 64px;
  align-items: center;
  gap: 8px;
}

.chore-picker span {
  line-height: 1.35;
}

.chore-picker em,
.custom-chore-item em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe58a, #f3b0ca 58%, #a8dce5);
  color: #5b466f;
  font-style: normal;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(112, 90, 145, 0.14), inset 0 1px 0 rgba(255,255,255,0.82);
  white-space: nowrap;
}

.custom-chore-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(92px, 0.42fr) auto;
  align-items: stretch;
}

.custom-chore-stars {
  display: grid;
  gap: 4px;
  align-items: center;
  min-width: 92px;
  color: #6f6473;
  font-size: 12px;
  font-weight: 900;
}

.custom-chore-stars select {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(158,126,190,0.24);
  border-radius: 16px;
  padding: 0 12px;
  background: rgba(255,255,255,0.88);
  color: #3c3045;
  font: inherit;
  font-weight: 900;
  box-shadow: inset 0 2px 8px rgba(80,60,96,0.06);
}

#addCustomChore {
  min-width: 92px;
  min-height: 54px;
  align-self: end;
}

.custom-chore-list {
  display: grid;
  width: min(760px, 100%);
  gap: 8px;
}

.custom-chore-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(158,126,190,0.2);
  border-radius: 18px;
  padding: 10px 12px;
  background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(255,247,238,0.7));
  box-shadow: 0 12px 26px rgba(112,90,145,0.1);
}

.custom-chore-item strong,
.custom-chore-item span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.custom-chore-item span {
  margin-top: 2px;
  color: #7b6f80;
  font-size: 13px;
  font-weight: 800;
}

.setting-list .toggle-row {
  min-height: 64px;
  align-items: center;
}

.setting-list .toggle-row small {
  display: none;
}

@media (max-width: 640px) {
  .chore-picker {
    grid-template-columns: 1fr;
    max-height: 42vh;
  }

  .custom-chore-row {
    grid-template-columns: 1fr;
  }

  #addCustomChore {
    width: 100%;
  }

  .custom-chore-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .custom-chore-item button {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

/* Title screen: use the generated ribbon logo and a decorated start button. */
.onboarding-step:first-of-type .title-logo-heading {
  width: min(100%, 860px) !important;
  max-width: min(94vw, 860px) !important;
  margin: 0 auto !important;
  filter: drop-shadow(0 20px 28px rgba(93, 47, 106, 0.2));
}

.onboarding-step:first-of-type .title-logo-ribbon {
  display: block;
  width: min(100%, 760px) !important;
  max-width: min(92vw, 760px) !important;
  height: auto !important;
  margin-inline: auto !important;
  object-fit: contain;
}

.onboarding-step:first-of-type .title-logo-caption {
  display: none !important;
}

.title-start-button {
  position: relative;
  isolation: isolate;
  min-width: 220px;
  min-height: 70px;
  padding: 0 46px;
  border: 3px solid rgba(255, 236, 166, 0.95) !important;
  border-radius: 999px !important;
  background:
    radial-gradient(circle at 20% 18%, rgba(255,255,255,0.96) 0 8px, transparent 9px),
    linear-gradient(135deg, #ff6ea9 0%, #b567d8 46%, #34b8ff 100%) !important;
  color: #fff !important;
  box-shadow:
    0 14px 0 rgba(86, 57, 127, 0.22),
    0 22px 46px rgba(235, 101, 170, 0.28),
    inset 0 -8px 14px rgba(89, 47, 126, 0.2),
    inset 0 5px 12px rgba(255, 255, 255, 0.4) !important;
  overflow: visible;
  text-shadow: 0 3px 0 rgba(90, 56, 132, 0.28);
}

.title-start-button span {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  font-size: clamp(22px, 4.8vw, 30px);
  font-weight: 1000;
}

.title-start-button::before,
.title-start-button::after {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 3px solid rgba(255, 241, 188, 0.94);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,0.98) 0 8px, transparent 9px),
    linear-gradient(135deg, #ffe06f, #f888b8 52%, #80dded);
  color: #fff;
  font-size: 25px;
  text-shadow: 0 2px 0 rgba(99, 66, 132, 0.25);
  box-shadow: 0 12px 24px rgba(112, 90, 145, 0.18);
  content: "★";
}

.title-start-button::before {
  left: -26px;
  top: 50%;
  transform: translateY(-50%) rotate(-12deg);
}

.title-start-button::after {
  right: -26px;
  top: 50%;
  transform: translateY(-50%) rotate(12deg);
  content: "◆";
}

.title-start-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 16px 0 rgba(86, 57, 127, 0.2),
    0 28px 54px rgba(235, 101, 170, 0.32),
    inset 0 -8px 14px rgba(89, 47, 126, 0.2),
    inset 0 5px 12px rgba(255, 255, 255, 0.44) !important;
}

@media (max-width: 720px) {
  .onboarding-step:first-of-type .title-logo-heading {
    max-width: min(96vw, 680px) !important;
  }

  .onboarding-step:first-of-type .title-logo-ribbon {
    width: min(100%, 620px) !important;
    max-width: calc(100vw - 34px) !important;
  }

  .title-start-button {
    min-width: 196px;
    min-height: 64px;
    padding-inline: 38px;
  }

  .title-start-button::before,
  .title-start-button::after {
    width: 44px;
    height: 44px;
    font-size: 21px;
  }

  .title-start-button::before {
    left: -18px;
  }

  .title-start-button::after {
    right: -18px;
  }
}

/* Final onboarding fantasy scene and parent mission labels. */
.onboarding-shell {
  isolation: isolate;
  background:
    radial-gradient(circle at 16% 13%, rgba(255, 238, 154, 0.68), transparent 23%),
    radial-gradient(circle at 83% 16%, rgba(248, 147, 190, 0.5), transparent 24%),
    radial-gradient(circle at 22% 88%, rgba(116, 210, 224, 0.44), transparent 28%),
    linear-gradient(180deg, rgba(55, 38, 78, 0.34), rgba(74, 53, 102, 0.46)),
    url("./assets/rooms/room-starry-magic.png") center / cover no-repeat !important;
}

.onboarding-shell::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.72) 0 4px, transparent 5px),
    radial-gradient(circle at 78% 18%, rgba(255,230,119,0.72) 0 5px, transparent 6px),
    radial-gradient(circle at 88% 72%, rgba(154,225,228,0.54) 0 6px, transparent 7px),
    radial-gradient(circle at 12% 78%, rgba(255,151,194,0.48) 0 5px, transparent 6px),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 24px);
  content: "";
  animation: rewardDialogTwinkle 4.8s ease-in-out infinite;
}

.onboarding-card {
  background:
    radial-gradient(circle at 50% 34%, rgba(255,255,255,0.9), rgba(255,246,205,0.42) 30%, transparent 52%),
    radial-gradient(circle at 8% 12%, rgba(255,224,107,0.36), transparent 28%),
    radial-gradient(circle at 92% 16%, rgba(255,167,206,0.32), transparent 29%),
    linear-gradient(145deg, rgba(255,253,250,0.92), rgba(250,240,255,0.86)),
    url("./assets/rooms/room-starry-magic.png") center / cover no-repeat !important;
  box-shadow:
    0 0 0 7px rgba(255,255,255,0.2),
    0 34px 110px rgba(39, 25, 67, 0.5),
    inset 0 0 0 1px rgba(255, 241, 186, 0.38) !important;
}

.onboarding-step:not(:first-of-type)::before {
  position: absolute;
  inset: clamp(54px, 7vw, 78px) clamp(16px, 4vw, 50px) clamp(22px, 4vw, 42px);
  z-index: -1;
  border: 1px solid rgba(255, 225, 147, 0.32);
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,0.72), transparent 30%),
    linear-gradient(145deg, rgba(255,255,255,0.54), rgba(255,246,255,0.3));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.68);
  content: "";
  pointer-events: none;
}

.mission-edit-row {
  grid-template-columns: 38px minmax(180px, 0.95fr) minmax(220px, 1.2fr) minmax(96px, 0.36fr) !important;
  align-items: end !important;
  gap: 12px !important;
  padding: 14px !important;
}

.mission-edit-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.mission-edit-field small {
  color: #7d6f7f;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.02em;
}

.mission-edit-field input {
  width: 100%;
}

.mission-edit-stars input {
  text-align: center;
}

@media (max-width: 860px) {
  .mission-edit-row {
    grid-template-columns: 34px minmax(0, 1fr) minmax(90px, 0.38fr) !important;
  }

  .mission-edit-field:nth-of-type(2) {
    grid-column: 2 / -1;
  }
}

@media (max-width: 560px) {
  .mission-edit-row {
    grid-template-columns: 32px minmax(0, 1fr) !important;
  }

  .mission-edit-row > span {
    grid-row: 1 / span 3;
    align-self: start;
  }

  .mission-edit-field,
  .mission-edit-field:nth-of-type(2) {
    grid-column: 2;
  }
}
