:root {
  --bg-cream: #fff8f2;
  --bg-card: #fffdf9;
  --bg-soft: #fff1f5;
  --ink: #5a403a;
  --ink-soft: #8a6d66;
  --pink: #f48fb1;
  --pink-deep: #d95f8c;
  --pink-light: #ffe4ee;
  --peach: #ffcfb3;
  --lavender: #c8b6ff;
  --lavender-light: #f3ecff;
  --mint: #8fd9be;
  --mint-light: #e4f8f0;
  --gold: #f6c453;
  --gold-light: #fff6d6;
  --border: #f2dce4;
  --shadow-soft: 0 8px 24px rgba(154, 102, 114, 0.13);
  --shadow-btn: 0 4px 0 rgba(191, 118, 138, 0.28);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 15px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, #fff8f2 0%, #fcebf2 52%, #f4eeff 100%);
  color: var(--ink);
  font-family: 'Quicksand', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  overflow: hidden;
  user-select: none;
}

button,
input,
select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* ===== ONBOARDING / ADOPT EGG SCREEN ===== */
.onboarding-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  padding: 18px 14px 32px;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 214, 229, 0.7), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(216, 196, 255, 0.65), transparent 45%),
    linear-gradient(180deg, #fffaf4 0%, #fef0f6 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.onboarding-card {
  width: 100%;
  max-width: 720px;
  background: rgba(255, 253, 249, 0.96);
  border: 3px solid #f7d9e4;
  border-radius: 30px;
  padding: 22px 22px 26px;
  box-shadow: 0 18px 46px rgba(173, 114, 134, 0.18);
  margin: auto 0;
}

.onb-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.onb-logo {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  border: 3px solid #ffd6e5;
  object-fit: cover;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

.onb-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  color: #b84a77;
}

.onb-subtitle {
  margin: 4px 0 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.onb-section {
  margin-top: 16px;
}

.onb-label {
  display: block;
  font-weight: 800;
  font-size: 0.98rem;
  margin-bottom: 8px;
  color: #7c4d5b;
}

.onb-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.soft-input {
  width: 100%;
  padding: 12px 15px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: #fffaf7;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.soft-input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(244, 143, 177, 0.2);
}

.avatar-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.avatar-chip {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: #fffaf7;
  font-size: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.avatar-chip.active {
  border-color: var(--pink-deep);
  background: var(--pink-light);
  transform: scale(1.08);
}

.age-toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.age-card {
  padding: 11px 12px;
  border-radius: 18px;
  border: 2.5px solid var(--border);
  background: #fffaf7;
  text-align: left;
  transition: all 0.18s;
}

.age-card strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink);
  white-space: nowrap;
}

.age-card span {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 3px;
}

.age-card.active {
  border-color: var(--pink-deep);
  background: linear-gradient(135deg, #fff0f6 0%, #f6eeff 100%);
  box-shadow: 0 4px 12px rgba(217, 95, 140, 0.15);
}

.species-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.species-card {
  padding: 12px 8px;
  border-radius: 20px;
  border: 2.5px solid var(--border);
  background: #fffdf9;
  text-align: center;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.species-card:hover {
  transform: translateY(-2px);
}

.species-card.active {
  border-color: var(--pink-deep);
  background: linear-gradient(180deg, #fff5f8 0%, #ffebf2 100%);
  box-shadow: 0 6px 16px rgba(217, 95, 140, 0.2);
}

.species-egg-badge {
  width: 82px;
  height: 82px;
  margin: 0 auto 6px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 2.5px solid rgba(240, 198, 214, 0.9);
  padding: 5px;
  box-shadow: 0 4px 12px rgba(173, 114, 134, 0.14);
}

.species-sprite-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sticker-img-sm {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: inline-block;
  flex-shrink: 0;
}

.sticker-img-md {
  width: 46px;
  height: 46px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.sticker-img-lg {
  width: 66px;
  height: 66px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.mem-back-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  opacity: 0.9;
}

.mem-sticker-img {
  width: 58%;
  height: 58%;
  object-fit: contain;
}

.bowl-sticker-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.ing-sticker-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  margin-bottom: 2px;
}

.species-name {
  font-weight: 800;
  font-size: 0.98rem;
}

.species-trait {
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.3;
}

.btn-soft-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #ff9ebb 0%, #f472a0 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 5px 0 #cf5784, 0 10px 20px rgba(217, 95, 140, 0.24);
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-soft-primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #cf5784;
}

.btn-soft-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: #fff4f8;
  border: 2px solid #f5ccd9;
  color: #9e4869;
  font-weight: 700;
  font-size: 0.95rem;
}

.btn-block {
  width: 100%;
}

.onb-footer {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.link-subtle {
  font-size: 0.88rem;
  font-weight: 700;
  color: #a15c78;
  text-decoration: underline;
  padding: 4px 8px;
}

/* ===== MAIN GAME SCREEN ===== */
.game-screen {
  width: 100%;
  max-width: 1120px;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  gap: 8px;
  overflow: hidden;
}

/* Top Ribbon */
.top-ribbon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 253, 249, 0.92);
  border: 2px solid var(--border);
  border-radius: 22px;
  padding: 7px 12px;
  box-shadow: 0 6px 18px rgba(173, 114, 134, 0.1);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.child-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #ffe8f0 0%, #f3e8ff 100%);
  border: 2px solid #f4c6d7;
  font-weight: 800;
  font-size: 0.92rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.stage-progress-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 110px;
  max-width: 240px;
  flex: 1 1 130px;
}

.stage-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #8a5668;
  gap: 6px;
}

.exp-track {
  height: 9px;
  background: #f8e5ec;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid #f1cbd8;
}

.exp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff9ebb 0%, #ffd166 55%, #b8a3ff 100%);
  border-radius: 99px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--gold-light);
  border: 2px solid #f6d475;
  font-weight: 900;
  font-size: 0.95rem;
  color: #8f6011;
  white-space: nowrap;
  flex-shrink: 0;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-pill-btn {
  height: 36px;
  min-width: 36px;
  padding: 0 9px;
  border-radius: 13px;
  background: #fff7fa;
  border: 1.8px solid var(--border);
  font-size: 0.85rem;
  font-weight: 800;
  color: #7c4d5b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.12s, background 0.15s;
}

.icon-pill-btn.is-off {
  opacity: 0.52;
  background: #f3ecee;
}

.lang-switch {
  display: inline-flex;
  background: #fff1f5;
  border: 1.8px solid var(--border);
  border-radius: 13px;
  padding: 2px;
}

.lang-btn {
  padding: 4px 7px;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #8c6371;
}

.lang-btn.active {
  background: #ffffff;
  color: #c94e7c;
  box-shadow: 0 2px 6px rgba(173, 114, 134, 0.16);
}

/* Main Living Canvas Stage */
.stage-frame {
  flex: 1 1 auto;
  min-height: 220px;
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  border: 3px solid rgba(255, 253, 249, 0.95);
  box-shadow: 0 12px 32px rgba(154, 102, 114, 0.18);
  background: #fff4ec;
}

#petCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
  cursor: pointer;
}

/* Speech Bubble Overlay */
.speech-bubble {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(86%, 520px);
  background: rgba(255, 253, 249, 0.94);
  border: 2.5px solid #f5ccd9;
  border-radius: 22px;
  padding: 9px 16px;
  box-shadow: 0 8px 20px rgba(138, 92, 105, 0.16);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
  text-align: left;
  transition: transform 0.2s;
}

.speech-bubble:active {
  transform: translateX(-50%) scale(0.97);
}

.speech-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #624148;
  line-height: 1.38;
}

.speech-speaker {
  font-size: 1.05rem;
  flex-shrink: 0;
}

/* Gentle Status Pills tucked on left */
.status-column {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 4;
  pointer-events: none;
}

.stat-chip {
  background: rgba(255, 253, 249, 0.88);
  border: 1.8px solid rgba(244, 206, 219, 0.92);
  border-radius: 14px;
  padding: 5px 9px;
  width: 112px;
  box-shadow: 0 4px 12px rgba(138, 92, 105, 0.12);
}

.stat-chip-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 3px;
  white-space: nowrap;
  gap: 4px;
}

.stat-mini-bar {
  height: 6px;
  border-radius: 99px;
  background: #f5e6ec;
  overflow: hidden;
}

.stat-mini-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.35s ease;
}

.fill-full { background: #ff9ebb; }
.fill-clean { background: #7dd3fc; }
.fill-happy { background: #fbbf24; }
.fill-energy { background: #c4b5fd; }

/* Right Stage Floating Pill (Storybook / Garden Back / Pet Name Tag) */
.stage-right-pills {
  position: absolute;
  right: 12px;
  top: 66px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
}

.stage-pill {
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  background: rgba(255, 253, 249, 0.92);
  border: 2px solid #f4c6d7;
  font-size: 0.84rem;
  font-weight: 800;
  color: #8c4564;
  box-shadow: 0 6px 14px rgba(138, 92, 105, 0.14);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pet-nameplate {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 253, 249, 0.9);
  border: 2px solid #f3ccd9;
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  font-size: 0.84rem;
  font-weight: 800;
  color: #7d4c59;
  pointer-events: none;
  z-index: 4;
  white-space: nowrap;
}

/* Floating Feed Tray Popup above Care Bar */
.feed-tray {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(94%, 520px);
  background: rgba(255, 253, 249, 0.97);
  border: 2.5px solid #f6c6d6;
  border-radius: 22px;
  padding: 10px 12px;
  box-shadow: 0 12px 28px rgba(138, 92, 105, 0.22);
  z-index: 12;
}

.feed-tray-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 800;
  font-size: 0.9rem;
  color: #9e4869;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.feed-item-btn {
  padding: 8px 6px;
  border-radius: 16px;
  background: #fff5f8;
  border: 2px solid #f6d5e0;
  text-align: center;
  transition: transform 0.12s;
}

.feed-item-btn:active {
  transform: scale(0.95);
}

.feed-item-btn .f-emoji {
  display: block;
  font-size: 1.65rem;
}

.feed-item-btn .f-name {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 2px;
}

.feed-item-btn .f-cost {
  display: block;
  font-size: 0.72rem;
  color: #9c6a12;
  font-weight: 700;
}

/* Bottom Care Strip & Navigation Bar */
.bottom-dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.care-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.care-strip.egg-mode {
  grid-template-columns: 1fr;
}

.care-strip.garden-mode {
  grid-template-columns: repeat(5, 1fr);
}

.care-btn {
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fff2f6 100%);
  border: 2.2px solid #f4c8d7;
  box-shadow: var(--shadow-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 0.96rem;
  font-weight: 800;
  color: #7d4558;
  transition: transform 0.1s, box-shadow 0.1s;
}

.care-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(191, 118, 138, 0.28);
}

.care-btn .c-ico {
  font-size: 1.35rem;
}

.care-btn.egg-cta {
  background: linear-gradient(135deg, #ffd166 0%, #ff9ebb 100%);
  border-color: #f6b36b;
  color: #5a343b;
  font-size: 1.08rem;
}

.nav-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  background: rgba(255, 253, 249, 0.94);
  border: 2px solid var(--border);
  border-radius: 22px;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(154, 102, 114, 0.12);
}

.nav-tab {
  min-height: 52px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #8c6673;
  position: relative;
  transition: background 0.15s, color 0.15s;
}

.nav-tab .n-ico {
  font-size: 1.3rem;
}

.nav-tab.active {
  background: linear-gradient(135deg, #ffe3ee 0%, #efe6ff 100%);
  color: #b84270;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #ff6b9d;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===== STORYBOOK MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(94, 67, 79, 0.42);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-sheet {
  width: 100%;
  max-width: 680px;
  max-height: 88dvh;
  background: #fffdf9;
  border: 3px solid #f5d2df;
  border-radius: 28px;
  box-shadow: 0 22px 54px rgba(94, 67, 79, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fff1f6 0%, #f5eeff 100%);
  border-bottom: 2px solid #f3dce5;
}

.modal-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 900;
  color: #a6416c;
}

.modal-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #f2cad9;
  font-size: 1.15rem;
  font-weight: 900;
  color: #9e4869;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px 22px;
}

/* ===== HABITS & 7-DAY CALENDAR ===== */
.habit-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.summary-pill {
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  background: #fff3f8;
  border: 1.8px solid #f5cddc;
  font-size: 0.86rem;
  font-weight: 800;
  color: #8f4763;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.day-cell {
  padding: 8px 4px;
  border-radius: 14px;
  background: #fff9f5;
  border: 1.8px solid #f2e0e6;
  text-align: center;
}

.day-cell.today {
  border-color: var(--pink-deep);
  background: #fff0f6;
}

.day-name {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.day-stamp {
  font-size: 1.25rem;
  margin-top: 2px;
}

.habit-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.habit-card {
  padding: 12px;
  border-radius: 20px;
  border: 2.2px solid #f2d9e2;
  background: #fffaf8;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: transform 0.14s, background 0.2s, border-color 0.2s;
}

.habit-card:active {
  transform: scale(0.97);
}

.habit-card.is-done {
  background: linear-gradient(135deg, #ebfbf3 0%, #f5fff9 100%);
  border-color: #8fd9be;
}

.habit-ico {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #ffffff;
  border: 2px solid #f4d6e0;
  font-size: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.habit-info {
  flex: 1;
  min-width: 0;
}

.habit-info strong {
  display: block;
  font-size: 0.96rem;
}

.habit-info small {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.habit-reward {
  font-size: 0.74rem;
  font-weight: 800;
  color: #b57715;
  margin-top: 4px;
}

.habit-check-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid #e6b8c8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.habit-card.is-done .habit-check-circle {
  background: #52c496;
  border-color: #3da87d;
  color: #fff;
}

/* ===== WARDROBE & DECOR ===== */
.subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.subtab-btn {
  flex: 1;
  padding: 10px;
  border-radius: 16px;
  background: #fff4f8;
  border: 2px solid #f3d2de;
  font-weight: 800;
  color: #8f4f68;
}

.subtab-btn.active {
  background: linear-gradient(135deg, #ff9ebb 0%, #c8b6ff 100%);
  color: #fff;
  border-color: transparent;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.shop-card {
  padding: 12px 8px;
  border-radius: 20px;
  border: 2.2px solid #f2dae2;
  background: #fffbf9;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.shop-card.is-equipped {
  border-color: var(--pink-deep);
  background: linear-gradient(180deg, #fff2f7 0%, #ffe6f0 100%);
}

.shop-emoji {
  font-size: 2rem;
}

.shop-name {
  font-weight: 800;
  font-size: 0.9rem;
}

.shop-status {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  background: #fff3d6;
  color: #9c6a12;
}

.shop-card.is-unlocked .shop-status {
  background: #e9f8f1;
  color: #2f8564;
}

.shop-card.is-equipped .shop-status {
  background: #f472a0;
  color: #ffffff;
}

/* ===== MINI-GAMES ===== */
.mg-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.mg-launcher {
  padding: 18px 14px;
  border-radius: 24px;
  border: 2.5px solid #f2d5e0;
  background: linear-gradient(180deg, #fff9fc 0%, #fff2f7 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mg-launcher .mg-big-ico {
  font-size: 2.8rem;
}

.mg-launcher strong {
  font-size: 1.06rem;
  color: #a6416c;
}

.mg-launcher p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.mg-header-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.mg-badge {
  padding: 6px 12px;
  border-radius: 99px;
  background: #fff4f8;
  border: 1.8px solid #f4ccda;
  font-size: 0.85rem;
}

.mg-tip {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
}

.memory-grid {
  display: grid;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}

.memory-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.memory-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.mem-card {
  aspect-ratio: 1 / 1.05;
  border-radius: 18px;
  border: 2.5px solid #f2cad8;
  background: linear-gradient(135deg, #ffe2ee 0%, #ebe1ff 100%);
  padding: 0;
  overflow: hidden;
  transition: transform 0.16s;
}

.mem-card.is-matched {
  border-color: #79d2ae;
  transform: scale(0.97);
}

.mem-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
}

.mem-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.mem-back {
  font-size: 1.8rem;
}

.mem-front {
  display: none;
}

.mem-card.is-open .mem-back { display: none; }
.mem-card.is-open .mem-front { display: flex; }

.mem-emoji { font-size: 2.1rem; }
.mem-label { font-size: 0.78rem; font-weight: 800; color: var(--ink); }

/* Bakery Game */
.bakery-order-card {
  background: linear-gradient(135deg, #fff5eb 0%, #fff0f6 100%);
  border: 2.2px solid #f7cfbd;
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.bakery-order-text {
  font-size: 1rem;
  font-weight: 800;
  color: #7c404b;
}

.btn-mini-voice {
  padding: 7px 12px;
  border-radius: 99px;
  background: #ffffff;
  border: 2px solid #f4c6d7;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.bakery-bowl {
  min-height: 76px;
  border-radius: 22px;
  background: #fff9f2;
  border: 2.5px dashed #ebb9cb;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.bowl-placeholder {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.bowl-item {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #f4ccd9;
  font-size: 1.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bakery-ing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.ing-btn {
  padding: 10px 6px;
  border-radius: 18px;
  background: #fffdf9;
  border: 2px solid #f2d4df;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ing-emoji { font-size: 1.75rem; }
.ing-name { font-size: 0.78rem; font-weight: 800; }
.ing-count { font-size: 0.72rem; color: #b84a77; font-weight: 800; }

.bakery-feedback {
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff6dc;
  border: 1.8px solid #f5d682;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.bakery-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ===== GARDEN / STORIES / PROFILES / PARENT ===== */
.garden-code-banner {
  background: linear-gradient(135deg, #fff1f6 0%, #f1ebff 100%);
  border: 2.2px solid #ecd0e0;
  border-radius: 20px;
  padding: 14px;
  text-align: center;
  margin-bottom: 14px;
}

.big-code {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #c24278;
  margin: 4px 0;
}

.input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.sample-garden-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 14px;
}

.sample-garden-btn {
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff8fb;
  border: 2px solid #f2d2df;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: left;
  color: #82445d;
}

.visit-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.visit-item {
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff9f6;
  border: 1.8px solid #f3dce4;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.story-card {
  padding: 14px;
  border-radius: 20px;
  border: 2px solid #f2dae2;
  background: #fffaf7;
  margin-bottom: 10px;
}

.story-card.locked {
  opacity: 0.56;
  background: #f8f2f5;
}

.story-card h4 {
  margin: 0 0 6px;
  color: #b44673;
}

.story-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
}

.profile-switch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.profile-row-btn {
  padding: 12px 14px;
  border-radius: 20px;
  border: 2.2px solid #f2d5e0;
  background: #fffaf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.profile-row-btn.active {
  border-color: var(--pink-deep);
  background: #fff0f6;
}

.parent-box {
  padding: 14px;
  border-radius: 20px;
  border: 2px solid #f2dce4;
  background: #fffaf8;
  margin-bottom: 12px;
}

.parent-box h4 {
  margin: 0 0 8px;
  color: #9e4869;
}

.form-hint {
  font-size: 0.84rem;
  color: #8f4c68;
  margin-top: 6px;
  font-weight: 700;
}

.form-error {
  padding: 9px 12px;
  border-radius: 12px;
  background: #ffe6ec;
  color: #b53057;
  font-size: 0.86rem;
  font-weight: 800;
  margin-top: 8px;
}

.toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: rgba(94, 59, 73, 0.93);
  color: #fffdf9;
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(90, 56, 70, 0.28);
  max-width: 90%;
  text-align: center;
}

/* ===== RESPONSIVE MOBILE OPTIMIZATION (<= 640px) ===== */
@media (max-width: 640px) {
  .hide-xs {
    display: none;
  }

  .onb-row,
  .habit-list,
  .mg-picker-grid,
  .sample-garden-list {
    grid-template-columns: 1fr;
  }

  .species-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bakery-ing-grid,
  .feed-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .game-screen {
    padding: 6px 8px max(8px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .top-ribbon {
    flex-wrap: wrap;
    padding: 6px 8px;
    border-radius: 18px;
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }

  .top-left {
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    gap: 6px;
  }

  .child-pill {
    padding: 4px 10px;
    font-size: 0.84rem;
    max-width: 58%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .coin-pill {
    padding: 4px 10px;
    font-size: 0.86rem;
    margin-left: auto;
  }

  .stage-progress-box {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .top-controls {
    width: 100%;
    justify-content: space-between;
  }

  .icon-pill-btn {
    height: 32px;
    min-width: 34px;
    padding: 0 8px;
    font-size: 0.8rem;
  }

  .stage-frame {
    min-height: 180px;
  }

  .status-column {
    left: 6px;
    gap: 4px;
  }

  .stat-chip {
    width: 72px;
    padding: 4px 6px;
  }

  .stat-chip-head {
    font-size: 0.65rem;
  }

  .care-btn {
    min-height: 46px;
    padding: 6px 4px;
    font-size: 0.82rem;
    gap: 4px;
    flex-direction: column;
  }

  .care-btn .c-ico {
    font-size: 1.2rem;
  }

  .care-strip.garden-mode {
    grid-template-columns: repeat(3, 1fr);
  }

  .speech-text {
    font-size: 0.84rem;
  }

  .nav-tab {
    min-height: 48px;
    font-size: 0.72rem;
  }
}
