:root {
  --eazo-safe-area-top: max(56px, env(safe-area-inset-top, 0px));
  --eazo-safe-area-bottom: max(34px, env(safe-area-inset-bottom, 0px));
  --neo-blue: #0030D8;
  --neo-pink: #FF2DB2;
  --neo-purple: #8A2BFF;
  --neo-cyan: #00E5FF;
  --neo-lime: #A8FF00;
  --neo-yellow: #FFE600;
  --baby-pink: #FFD6F2;
  --mint: #CCFFF2;
  --lav: #E0CCFF;
  --cream: #FFF8E8;
  --ink: #171735;
  --soft-ink: #56507a;
  --card: rgba(255, 255, 255, .86);
  --shadow: 0 16px 38px rgba(57, 35, 138, .18);
  --line: rgba(0, 48, 216, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  font-family: ui-rounded, "Avenir Next", "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 45, 178, .20), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(0, 229, 255, .22), transparent 22%),
    linear-gradient(135deg, #fff 0%, #fff3fc 34%, #eef8ff 68%, #fff 100%);
}
body.night {
  background:
    radial-gradient(circle at 16% 12%, rgba(138, 43, 255, .30), transparent 26%),
    radial-gradient(circle at 86% 20%, rgba(0, 48, 216, .30), transparent 24%),
    linear-gradient(135deg, #241a45 0%, #2d1e52 40%, #1f1740 100%);
  color: #f4eeff;
}
body.night .instruction,
body.night .mood-bubble,
body.night .calendar,
body.night .closet,
body.night .piece,
body.night .tab { filter: brightness(.94); }

button { font: inherit; }

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

.app-container {
  min-height: 100svh;
  padding-top: var(--eazo-safe-area-top);
  padding-bottom: var(--eazo-safe-area-bottom);
  position: relative;
  isolation: isolate;
}

.sparkles {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .75;
  background-image:
    radial-gradient(circle, var(--neo-pink) 0 2px, transparent 3px),
    radial-gradient(circle, var(--neo-cyan) 0 2px, transparent 3px),
    radial-gradient(circle, var(--neo-lime) 0 2px, transparent 3px);
  background-size: 78px 90px, 106px 88px, 128px 116px;
  animation: floatDots 9s ease-in-out infinite alternate;
}
@keyframes floatDots { from { transform: translateY(0); } to { transform: translateY(-18px); } }

.shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 10px 12px 0;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo-pop {
  width: 38px; height: 38px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--neo-blue), var(--neo-purple) 50%, var(--neo-pink));
  color: #fff; font-weight: 1000; transform: rotate(-5deg);
  box-shadow: 0 10px 18px rgba(0, 48, 216, .24), inset 0 -4px 0 rgba(0, 0, 0, .14);
}
h1 { margin: 0; font-size: clamp(1.15rem, 4vw, 1.8rem); letter-spacing: -.04em; line-height: .95; overflow-wrap: anywhere; }
.badge-row { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.streak-badge {
  border: 2px solid rgba(255, 255, 255, .75);
  border-radius: 999px; padding: 8px 12px;
  color: #fff; font-weight: 1000; font-size: .88rem;
  background: linear-gradient(90deg, var(--neo-blue), var(--neo-pink));
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255, 255, 255, .45);
  white-space: nowrap;
}
.lang-toggle {
  min-height: 44px; min-width: 78px; border: 0; border-radius: 999px;
  background: #fff; color: var(--neo-blue); font-weight: 1000; cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 48, 216, .16);
}

.game-card {
  border: 3px solid #fff;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .35)),
    linear-gradient(135deg, #ffe9fa, #eafcff 62%, #fffbe8);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.game-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .20;
  background:
    linear-gradient(90deg, rgba(0, 48, 216, .10) 1px, transparent 1px),
    linear-gradient(rgba(0, 48, 216, .08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(#000, transparent 76%);
}

.main-grid {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(102px, 126px);
  gap: 8px;
  padding: 10px;
  min-width: 0;
}

.room {
  min-width: 0;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, .84), transparent 38%),
    linear-gradient(180deg, #fff8ef 0 63%, #ffc7e9 63% 100%);
  border: 2px solid rgba(255, 255, 255, .85);
  position: relative;
  min-height: 390px;
  overflow: hidden;
  box-shadow: inset 0 -7px 0 rgba(255, 45, 178, .12);
}
body.night .room {
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 214, 130, .30), transparent 42%),
    linear-gradient(180deg, #3a2b63 0 63%, #52306a 63% 100%);
  box-shadow: inset 0 -7px 0 rgba(138, 43, 255, .22), inset 0 0 60px rgba(255, 200, 120, .10);
}

.wall-star { position: absolute; color: var(--neo-pink); font-weight: 1000; animation: twinkle 1.6s ease-in-out infinite alternate; }
.wall-star.s1 { left: 12px; top: 78px; font-size: 22px; }
.wall-star.s2 { right: 14px; top: 95px; color: var(--neo-cyan); animation-delay: .3s; }
@keyframes twinkle { to { transform: scale(1.24) rotate(8deg); opacity: .65; } }

/* Streak-unlocked room items */
.room-item { position: absolute; opacity: 0; transform: scale(.4); transition: opacity .5s ease, transform .5s cubic-bezier(.2, 1.3, .3, 1); pointer-events: none; }
.room-item.shown { opacity: 1; transform: scale(1); }

.poster {
  right: 16px; top: 128px; width: 46px; height: 54px; border-radius: 12px;
  background: linear-gradient(135deg, var(--neo-blue), var(--neo-pink));
  transform: rotate(5deg); border: 3px solid #fff; box-shadow: 0 8px 14px rgba(0, 48, 216, .16);
}
.poster.shown { transform: rotate(5deg) scale(1); }
.poster::after { content: "♡"; color: #fff; font-size: 22px; position: absolute; inset: 0; display: grid; place-items: center; }

.lights { left: 0; right: 0; top: 4px; height: 26px; display: flex; justify-content: space-around; align-items: flex-start; }
.lights span {
  width: 9px; height: 9px; border-radius: 50%; margin-top: 6px;
  box-shadow: 0 0 8px 2px currentColor;
  animation: bulbGlow 2.4s ease-in-out infinite;
}
.lights span:nth-child(1) { color: var(--neo-pink); animation-delay: 0s; }
.lights span:nth-child(2) { color: var(--neo-cyan); animation-delay: .3s; }
.lights span:nth-child(3) { color: var(--neo-yellow); animation-delay: .6s; }
.lights span:nth-child(4) { color: var(--neo-lime); animation-delay: .9s; }
.lights span:nth-child(5) { color: var(--neo-purple); animation-delay: 1.2s; }
.lights span:nth-child(6) { color: var(--neo-pink); animation-delay: 1.5s; }
.lights::before {
  content: ""; position: absolute; left: 4px; right: 4px; top: 4px; height: 12px;
  border-bottom: 2px solid rgba(0, 48, 216, .25); border-radius: 0 0 50% 50%;
}
@keyframes bulbGlow { 50% { opacity: .45; } }

.plant2 { left: 14px; bottom: 6px; width: 30px; height: 34px; }
.plant2 .pot { position: absolute; bottom: 0; left: 6px; width: 18px; height: 13px; border-radius: 3px 3px 8px 8px; background: #b06be0; }
.plant2 .leaf { position: absolute; background: var(--neo-lime); border-radius: 90% 10% 90% 10%; transform-origin: bottom center; }
.plant2 .leaf.a { width: 11px; height: 20px; left: 8px; bottom: 9px; transform: rotate(-24deg); background: #38d86f; }
.plant2 .leaf.b { width: 12px; height: 22px; left: 13px; bottom: 10px; transform: rotate(24deg); }

.trophy { right: 14px; bottom: 4px; font-size: 26px; filter: drop-shadow(0 3px 0 rgba(0, 48, 216, .18)); }

.window {
  position: absolute; left: 12px; top: 12px; width: 92px; height: 74px;
  background: linear-gradient(180deg, #a6f3ff, #fff);
  border: 4px solid #fff; border-radius: 22px;
  box-shadow: 0 8px 0 rgba(0, 48, 216, .08);
  overflow: hidden;
}
body.night .window { background: linear-gradient(180deg, #1b2352, #3a2b63); }
body.night .window::after {
  content: "★ ☆ ✦"; position: absolute; top: 6px; left: 8px; color: #ffe08a;
  font-size: 10px; letter-spacing: 3px; opacity: .8;
}
.weather { position: absolute; left: 10px; top: 9px; font-size: 25px; filter: drop-shadow(0 3px 0 rgba(255, 255, 255, .7)); }

/* Growing plant with stages */
.plant { position: absolute; right: 9px; bottom: 6px; width: 30px; height: 42px; transform-origin: bottom center; transition: transform .6s cubic-bezier(.2, 1.3, .3, 1); }
.plant .pot { position: absolute; bottom: 0; left: 5px; width: 19px; height: 14px; border-radius: 3px 3px 8px 8px; background: #ff9b2f; }
.plant .leaf { position: absolute; background: #38d86f; border-radius: 90% 10% 90% 10%; transform-origin: bottom center; transition: all .5s ease; }
.plant .l1 { width: 12px; height: 22px; left: 8px; bottom: 10px; transform: rotate(-26deg); }
.plant .l2 { width: 13px; height: 24px; left: 13px; bottom: 11px; transform: rotate(25deg); background: var(--neo-lime); }
.plant .flower { position: absolute; top: 1px; left: 9px; color: var(--neo-pink); font-weight: 1000; opacity: 0; transition: opacity .5s ease; transform-origin: center; }
/* stage 0 = seed/no sprout */
.plant[data-stage="0"] .l1, .plant[data-stage="0"] .l2 { transform: scale(0); }
.plant[data-stage="1"] .l1 { transform: rotate(-26deg) scale(.55); }
.plant[data-stage="1"] .l2 { transform: rotate(25deg) scale(.55); }
.plant[data-stage="2"] .l1 { transform: rotate(-26deg) scale(.8); }
.plant[data-stage="2"] .l2 { transform: rotate(25deg) scale(.8); }
.plant[data-stage="3"] .flower { opacity: 1; animation: twinkle 2s ease-in-out infinite alternate; }
.plant.droop { transform: rotate(6deg) skewX(4deg); filter: saturate(.6) brightness(.92); }
.plant.droop .l1 { transform: rotate(-14deg) scaleY(.82); }
.plant.droop .l2 { transform: rotate(38deg) scaleY(.82); }

.character-zone {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%);
  width: min(76%, 245px); max-width: 245px; aspect-ratio: 1 / 1.35;
  display: grid; place-items: center;
}
.char-wrap { width: 100%; height: 100%; animation: breathe 2.6s ease-in-out infinite; filter: drop-shadow(0 18px 12px rgba(106, 65, 128, .18)); }
.char-wrap.pop { animation: land .38s ease, breathe 2.6s ease-in-out .38s infinite; }
.char-wrap.shiver { animation: shiver .3s linear infinite, breathe 2.6s ease-in-out infinite; }
.char-wrap.fan { animation: fan 1.2s ease-in-out infinite, breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translateY(-3px) scale(1.015); } }
@keyframes land { 0% { transform: scale(.92) translateY(8px); } 60% { transform: scale(1.06) translateY(-4px); } 100% { transform: scale(1); } }
@keyframes shiver { 0%, 100% { transform: translateX(-1.5px); } 50% { transform: translateX(1.5px); } }
@keyframes fan { 50% { transform: rotate(1.5deg); } }
.blink { animation: blink 4s infinite; transform-origin: center; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }

.instruction {
  position: absolute; left: 10px; right: 10px; bottom: 66px;
  margin: 0; text-align: center; color: var(--soft-ink); font-weight: 850;
  font-size: clamp(.72rem, 2.7vw, .88rem); line-height: 1.25;
  background: rgba(255, 255, 255, .78); border: 2px solid #fff; border-radius: 18px;
  padding: 8px 10px;
}
.wear-area { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 8px; align-items: center; }
.mood-bubble {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 18px;
  background: rgba(255, 255, 255, .84); border: 2px solid #fff; font-weight: 1000; font-size: .76rem; color: var(--neo-blue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.primary-btn {
  min-height: 48px; min-width: 112px; border: 0; border-radius: 18px; cursor: pointer; flex-shrink: 0;
  background: linear-gradient(90deg, var(--neo-pink), #ffb000 56%, var(--neo-yellow));
  color: #fff; font-weight: 1000; letter-spacing: .03em;
  box-shadow: 0 10px 0 #c31885, 0 16px 24px rgba(255, 45, 178, .28), inset 0 3px 0 rgba(255, 255, 255, .48);
  transform: translateY(-3px);
}
.primary-btn:active { transform: translateY(2px); box-shadow: 0 5px 0 #c31885, 0 10px 18px rgba(255, 45, 178, .22), inset 0 2px 0 rgba(255, 255, 255, .35); }
.primary-btn:disabled { cursor: not-allowed; color: rgba(86, 80, 122, .56); background: #eee8f7; box-shadow: inset 0 -4px 0 rgba(86, 80, 122, .12); transform: none; }

.closet {
  min-width: 0;
  border-radius: 24px;
  padding: 8px;
  background: rgba(255, 255, 255, .82);
  border: 2px solid rgba(255, 255, 255, .95);
  box-shadow: inset 0 0 0 2px rgba(255, 45, 178, .06);
  display: flex; flex-direction: column; gap: 8px; min-height: 0;
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tab {
  min-height: 44px; border: 0; border-radius: 15px; cursor: pointer;
  background: #fff; color: var(--neo-blue); font-size: .72rem; font-weight: 1000;
  box-shadow: 0 5px 0 rgba(0, 48, 216, .12), inset 0 2px 0 rgba(255, 255, 255, .5);
}
.tab.active { color: #fff; background: linear-gradient(135deg, var(--neo-blue), var(--neo-purple)); box-shadow: 0 5px 0 rgba(0, 48, 216, .35), 0 8px 16px rgba(0, 48, 216, .14); }
.pieces { display: grid; gap: 7px; overflow: auto; max-height: 256px; padding: 2px 1px 6px; -webkit-overflow-scrolling: touch; }
.piece {
  min-height: 58px; border: 2px solid #fff; border-radius: 18px; cursor: pointer;
  background: linear-gradient(135deg, #fff, #fff2fb);
  display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 5px; align-items: center;
  padding: 6px 5px; color: var(--ink); text-align: left; font-weight: 1000;
  box-shadow: 0 8px 13px rgba(138, 43, 255, .11);
  transition: transform .18s ease;
}
.piece.selected { background: linear-gradient(135deg, var(--neo-cyan), #fff, var(--baby-pink)); border-color: var(--neo-pink); transform: rotate(-1deg) scale(1.02); }
.piece-name { font-size: .68rem; line-height: 1.05; overflow-wrap: anywhere; display: block; }
.piece-warm { font-size: .62rem; color: var(--soft-ink); margin-top: 2px; display: block; }
.mini-svg { width: 38px; height: 38px; filter: drop-shadow(0 3px 0 rgba(0, 48, 216, .12)); }

.calendar {
  position: relative; z-index: 1;
  margin: 0 10px 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .84);
  border: 2px solid #fff;
  padding: 8px;
  box-shadow: inset 0 -4px 0 rgba(0, 229, 255, .08);
}
.calendar-title { margin: 0 0 7px; font-size: .72rem; color: var(--neo-blue); font-weight: 1000; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.strip::-webkit-scrollbar { display: none; }
.empty-note {
  min-height: 54px; min-width: 100%; display: grid; place-items: center; border-radius: 16px;
  background: linear-gradient(90deg, rgba(255, 45, 178, .09), rgba(0, 229, 255, .12));
  color: var(--soft-ink); font-weight: 900; font-size: .84rem; text-align: center; padding: 0 8px;
}
.day-mini {
  border: 0; min-width: 56px; min-height: 74px; border-radius: 16px; background: #fff; cursor: pointer;
  display: grid; justify-items: center; align-content: center; gap: 2px; flex-shrink: 0;
  box-shadow: 0 7px 12px rgba(0, 48, 216, .10); color: var(--soft-ink); font-size: .6rem; font-weight: 1000;
  padding: 4px 2px;
}
.day-mini.today { outline: 3px solid var(--neo-pink); outline-offset: -1px; }
.tiny-person { width: 32px; height: 38px; }

/* Diary overlay */
.diary {
  position: fixed; inset: 0; z-index: 10;
  display: none; place-items: end center;
  padding: calc(var(--eazo-safe-area-top) + 6px) 12px calc(var(--eazo-safe-area-bottom) + 6px);
  background: rgba(23, 23, 53, .32);
  backdrop-filter: blur(5px);
}
.diary.show { display: grid; }
.page {
  position: relative;
  width: min(100%, 430px);
  max-height: calc(100svh - var(--eazo-safe-area-top) - var(--eazo-safe-area-bottom) - 12px);
  overflow: auto; -webkit-overflow-scrolling: touch;
  border-radius: 30px 30px 24px 24px;
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 45, 178, .16), transparent 22%),
    radial-gradient(circle at 92% 16%, rgba(0, 229, 255, .20), transparent 26%),
    #fffef8;
  border: 4px solid #fff;
  box-shadow: 0 26px 58px rgba(0, 48, 216, .30);
  padding: 14px;
  transform-origin: top center;
  animation: pagePop .42s cubic-bezier(.2, 1.2, .2, 1);
}
@keyframes pagePop { from { transform: rotateX(-68deg) translateY(-30px) scale(.9); opacity: .25; } to { transform: none; opacity: 1; } }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; padding-right: 34px; }
.page h2 { margin: 0; font-size: 1.2rem; line-height: 1; color: var(--neo-blue); letter-spacing: -.03em; }
.date-pill { border-radius: 999px; background: var(--baby-pink); color: var(--neo-blue); padding: 8px 10px; font-weight: 1000; font-size: .78rem; white-space: nowrap; }
.result-badge { display: inline-block; }
.result-stage {
  border-radius: 24px; border: 2px dashed rgba(255, 45, 178, .45); background: linear-gradient(180deg, #fff, #f2fdff);
  min-height: 210px; display: grid; place-items: center; margin: 8px 0;
}
.result-stage .char-wrap { width: 172px; height: 226px; animation: breathe 2.6s ease-in-out infinite; }
.caption { margin: 8px 0; color: var(--soft-ink); font-weight: 900; line-height: 1.3; }
.last-seven-title { margin: 6px 0 4px; font-size: .68rem; font-weight: 1000; color: var(--neo-blue); }
.last-seven { display: flex; gap: 7px; overflow-x: auto; padding: 7px; border-radius: 18px; background: rgba(0, 229, 255, .10); scrollbar-width: none; }
.last-seven::-webkit-scrollbar { display: none; }
.actions { display: grid; grid-template-columns: 1.3fr .8fr .9fr; gap: 8px; margin-top: 10px; }
.action {
  min-height: 46px; border: 0; border-radius: 16px; cursor: pointer; font-weight: 1000;
  background: #fff; color: var(--neo-blue); box-shadow: 0 7px 0 rgba(0, 48, 216, .12);
  display: grid; place-items: center; gap: 0; line-height: 1.05; padding: 4px;
}
.action small { font-size: .56rem; font-weight: 800; opacity: .85; }
.action-primary { color: #fff; background: linear-gradient(90deg, var(--neo-blue), var(--neo-purple)); box-shadow: 0 7px 0 rgba(0, 24, 216, .35); }
.page-close {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 12px;
  background: #fff; color: var(--neo-blue); font-weight: 1000; cursor: pointer; box-shadow: 0 5px 0 rgba(0, 48, 216, .12);
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--eazo-safe-area-bottom) + 10px); transform: translateX(-50%) translateY(120px);
  z-index: 20; background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 14px; font-weight: 900;
  transition: transform .25s ease; pointer-events: none; max-width: min(90vw, 420px); text-align: center; font-size: .82rem;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (min-width: 720px) {
  .shell { padding-inline: 18px; }
  .main-grid { grid-template-columns: minmax(0, 1fr) 180px; gap: 12px; padding: 14px; }
  .room { min-height: 475px; }
  .closet { padding: 10px; }
  .tabs { grid-template-columns: repeat(4, 1fr); }
  .pieces { max-height: 346px; grid-template-columns: 1fr; }
  .piece-name { font-size: .78rem; }
  .instruction { font-size: .92rem; }
}
@media (max-width: 360px) {
  .main-grid { grid-template-columns: minmax(0, 1fr) 96px; gap: 6px; padding: 8px; }
  .room { min-height: 372px; }
  .pieces { max-height: 240px; }
  .piece { grid-template-columns: 30px minmax(0, 1fr); min-height: 54px; padding: 5px 4px; }
  .mini-svg { width: 30px; height: 30px; }
  .piece-name { font-size: .62rem; }
  .instruction { bottom: 64px; padding: 7px; }
  .primary-btn { min-width: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
