/* ============================================================
   🧪 Slime Lab — styles
   Big, rounded, candy-colored and touch-friendly for kids.
   ============================================================ */

:root {
  --pink: #ff7ad9;
  --pink-deep: #e84bbd;
  --purple: #9b5de5;
  --blue: #4cc9f0;
  --yellow: #ffd166;
  --green: #06d6a0;
  --ink: #3a2a4d;
  --panel: rgba(255, 255, 255, 0.92);
  --shadow: 0 8px 0 rgba(0, 0, 0, 0.12);
  --radius: 22px;
  --font: "Baloo 2", "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: var(--app-bg, linear-gradient(160deg, #ffe3f7 0%, #e6e0ff 50%, #d9f7ff 100%));
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ---------- Screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ---------- Home ---------- */
.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
.logo {
  font-size: clamp(28px, 7vw, 44px);
  margin: 0;
  text-shadow: 0 3px 0 #fff, 0 6px 0 rgba(0,0,0,0.08);
}
.gem-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.home-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 30px;
}
.big-play-btn {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--pink), var(--pink-deep));
  color: #fff;
  font-family: var(--font);
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 800;
  padding: 26px;
  margin: 10px 0 24px;
  cursor: pointer;
  box-shadow: 0 10px 0 var(--pink-deep), 0 14px 18px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform .08s;
}
.big-play-btn:active { transform: translateY(6px); box-shadow: 0 4px 0 var(--pink-deep); }
.big-play-emoji { font-size: 48px; }

.chest-section h2 { font-size: 26px; margin: 6px 0 14px; }
.chest-count { color: var(--purple); font-size: 20px; }
.chest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
}
.chest-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 18px;
  opacity: .7;
  padding: 30px 10px;
}
.chest-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 10px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s;
}
.chest-card:active { transform: scale(.95); }
.chest-card canvas { width: 100%; height: auto; border-radius: 12px; display: block; }
.chest-card .name { font-size: 14px; font-weight: 700; margin-top: 6px; }

/* ---------- Lab ---------- */
#lab-screen { background: var(--lab-bg, transparent); }
#slime-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.texture-tag {
  position: absolute;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  padding: 4px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

/* Corner & header buttons */
.corner-btn {
  position: absolute;
  z-index: 5;
  border: none;
  background: var(--panel);
  border-radius: 18px;
  padding: 10px 14px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform .08s;
}
.corner-btn:active { transform: scale(.92); }
.corner-btn .btn-emoji { font-size: 26px; }
.corner-btn .btn-label { font-size: 12px; }
.top-left { top: 14px; left: 14px; }
.top-center { top: 14px; left: 50%; transform: translateX(-50%); }
.top-center:active { transform: translateX(-50%) scale(.92); }
.top-right { top: 14px; right: 14px; }

/* Columns */
.left-column { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); z-index: 5; }
.right-column { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); z-index: 5; }
.round-btn {
  border: none;
  border-radius: 50%;
  width: 76px;
  height: 76px;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 7px 0 rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform .08s;
}
.round-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.add-btn { background: linear-gradient(180deg, var(--green), #04a97f); color: #fff; font-size: 48px; font-weight: 800; line-height: 1; }
.trade-btn { background: linear-gradient(180deg, var(--yellow), #f0a500); color: var(--ink); }
.trade-btn .btn-emoji { font-size: 30px; }
.round-label { font-size: 13px; font-weight: 800; }

.save-btn {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--blue), #2196c4);
  color: #fff;
  font-family: var(--font);
  font-weight: 800;
  font-size: 22px;
  padding: 16px 40px;
  cursor: pointer;
  box-shadow: 0 8px 0 #2196c4, 0 12px 16px rgba(0,0,0,0.18);
  z-index: 5;
  white-space: nowrap;
}
.save-btn:active { transform: translateX(-50%) translateY(5px); box-shadow: 0 3px 0 #2196c4; }

/* ---------- Mix & Draw shared header ---------- */
.mix-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 5;
}
.mix-top h2 { margin: 0; font-size: 22px; }
.text-btn {
  border: none;
  background: #f0eaff;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 17px;
  padding: 10px 18px;
  color: var(--purple);
  cursor: pointer;
}
.text-btn.done { background: var(--green); color: #fff; }
.text-btn:active { transform: scale(.93); }

/* ---------- Mixing ---------- */
#mix-canvas, #draw-canvas {
  flex: 1;
  width: 100%;
  touch-action: none;
  display: block;
}
.paint-shelf {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
  background: rgba(255,255,255,0.55);
  justify-content: center;
}
.paint-bottle {
  flex: 0 0 auto;
  width: 50px;
  height: 64px;
  border: none;
  border-radius: 10px 10px 14px 14px;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow);
  transition: transform .08s;
}
.paint-bottle::before {
  content: "";
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 12px;
  background: #fff;
  border-radius: 4px;
}
.paint-bottle:active { transform: translateY(4px) scale(.95); }
.mix-tools {
  background: var(--panel);
  padding: 10px;
  text-align: center;
}
.mix-hint { font-weight: 800; display: block; margin-bottom: 8px; }
.tool-picker, .draw-colors, .pencil-case { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tool-chip, .brush-chip {
  border: 3px solid transparent;
  background: #f0eaff;
  border-radius: 14px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 16px;
  padding: 8px 14px;
  cursor: pointer;
}
.tool-chip.active, .brush-chip.active { border-color: var(--purple); background: #fff; }
.tool-chip:active, .brush-chip:active { transform: scale(.93); }

/* ---------- Draw ---------- */
.pencil-case { padding: 10px; background: rgba(255,255,255,0.55); overflow-x: auto; }
.brush-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; }
.brush-chip .brush-emoji { font-size: 24px; }
.brush-chip .brush-name { font-size: 11px; }
/* Brush size slider */
.brush-size {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.55);
}
.brush-size .size-label { font-weight: 800; font-size: 14px; opacity: .8; }
.brush-size .size-end { color: var(--purple); line-height: 1; }
.brush-size .size-end.small { font-size: 10px; }
.brush-size .size-end.big { font-size: 20px; }
.size-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--pink));
  outline: none;
  cursor: pointer;
}
.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--purple);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.size-slider::-moz-range-thumb {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--purple);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.size-preview {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.size-dot {
  display: block;
  background: var(--ink);
  border-radius: 50%;
  transition: width .08s, height .08s;
}

.draw-colors { padding: 10px; background: var(--panel); }
.draw-swatch {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.draw-swatch.active { outline: 3px solid var(--purple); outline-offset: 2px; }

/* ============================================================
   Overlays / popups
   ============================================================ */
#overlay-host { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(58, 42, 77, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--panel);
  width: 100%;
  max-width: 640px;
  border-radius: 28px 28px 0 0;
  padding: 18px 18px 28px;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
  animation: slideup .25s cubic-bezier(.2,.9,.3,1.2);
  max-height: 88vh;
  overflow-y: auto;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet h3 { margin: 4px 0 14px; font-size: 24px; text-align: center; }
.sheet-row-label { font-weight: 800; margin: 12px 0 8px; font-size: 16px; opacity: .8; }

.swatch-row, .charm-row, .texture-row, .menu-2 {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.menu-2 { gap: 16px; }
.menu-big-btn {
  flex: 1 1 0;
  min-width: 130px;
  border: none;
  border-radius: 20px;
  padding: 22px 14px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 20px;
  cursor: pointer;
  color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.menu-big-btn .mb-emoji { font-size: 40px; }
.menu-big-btn:active { transform: scale(.95); }
.menu-big-btn.left { background: linear-gradient(180deg, var(--purple), #7b3fd0); }
.menu-big-btn.right { background: linear-gradient(180deg, var(--blue), #2196c4); }

.color-swatch {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .08s;
}
.color-swatch:active { transform: scale(.88); }
.color-swatch.selected { outline: 4px solid var(--ink); outline-offset: 2px; }

.charm-btn {
  width: 60px; height: 60px;
  border: none;
  border-radius: 16px;
  background: #fff;
  font-size: 34px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .08s;
}
.charm-btn:active { transform: scale(.88); }

/* Textures */
.texture-card {
  width: 130px;
  border: none;
  border-radius: 18px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform .08s;
}
.texture-card:active { transform: scale(.95); }
.texture-card .tex-preview {
  width: 100%; height: 80px;
  border-radius: 12px;
}
.texture-card .tex-name { font-weight: 800; margin-top: 8px; font-size: 15px; }
.texture-card.locked .tex-preview, .texture-card.locked .tex-name { filter: blur(2px) grayscale(.7) brightness(1.1); opacity: .8; }
.texture-card .lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.texture-card.shake { animation: shake .4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-2deg); }
  40% { transform: translateX(7px) rotate(2deg); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.texture-card.selected { outline: 4px solid var(--purple); outline-offset: -2px; }

/* Color wheel */
.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
#wheel-canvas { border-radius: 50%; box-shadow: var(--shadow); touch-action: none; cursor: crosshair; }
.wheel-preview {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 5px solid #fff;
  box-shadow: var(--shadow);
}

/* Trade */
.trade-stage { text-align: center; }
.trade-players { display: flex; align-items: center; justify-content: space-around; gap: 10px; margin: 10px 0 18px; }
.trade-slot { flex: 1; }
.trade-slot canvas { width: 120px; height: 120px; }
.trade-slot .slot-name { font-weight: 800; margin-top: 6px; }
.trade-vs { font-size: 30px; }
.trade-status { font-size: 18px; font-weight: 800; min-height: 26px; margin-bottom: 12px; }
.trade-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  border: none;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 18px;
  padding: 14px 26px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn:active { transform: scale(.94); }
.btn.primary { background: var(--green); color: #fff; }
.btn.warn { background: #ff6b6b; color: #fff; }
.btn.ghost { background: #f0eaff; color: var(--purple); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.picker-strip { display: flex; gap: 10px; overflow-x: auto; padding: 6px 0; }
.picker-strip .chest-card { flex: 0 0 100px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 999px;
  z-index: 100;
  box-shadow: var(--shadow);
  animation: pop .3s, fade .3s 1.7s reverse;
  pointer-events: none;
}
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

.confetti {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  font-size: 24px;
  animation: fall 1.4s linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}

/* ============================================================
   v3 additions: home buttons, play screen, shop, charms, names
   ============================================================ */

/* Home top-right cluster */
.home-top-right { display: flex; align-items: center; gap: 10px; }
.play-slime-btn {
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--green), #04a97f);
  color: #fff;
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.play-slime-btn:active { transform: scale(.93); }

/* Home action row (Background / Trade / Shop) */
.home-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.home-action {
  border: none;
  border-radius: 18px;
  padding: 16px 8px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.home-action:active { transform: scale(.94); }
.home-action .ha-emoji { font-size: 30px; }
.home-action.bg { background: linear-gradient(180deg, var(--purple), #7b3fd0); }
.home-action.trade { background: linear-gradient(180deg, var(--yellow), #f0a500); color: var(--ink); }
.home-action.shop { background: linear-gradient(180deg, var(--pink), var(--pink-deep)); }

/* Play screen */
#play-canvas { flex: 1; width: 100%; touch-action: none; display: block; }
.play-hint {
  text-align: center;
  font-weight: 800;
  padding: 10px;
  margin: 0;
  background: var(--panel);
}
#play-name { pointer-events: none; }

/* Charm art buttons (replace emoji) */
.charm-art { width: 42px; height: 42px; display: block; }
.charm-lock { font-size: 26px; }

/* Color wheel swatch in the Add menu */
.wheel-swatch {
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: conic-gradient(#ff4d4d,#ff9f1c,#ffd23f,#3ddc84,#4cc9f0,#9b5de5,#ff7ad9,#ff4d4d);
}
.wheel-swatch.locked-swatch { background: #ddd; }

/* Custom paint bottle (color wheel) */
.paint-custom {
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: conic-gradient(#ff4d4d,#ffd23f,#3ddc84,#4cc9f0,#9b5de5,#ff7ad9,#ff4d4d) !important;
}

/* Name input */
.name-input {
  width: 90%;
  max-width: 320px;
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  padding: 12px 16px;
  border: 3px solid var(--purple);
  border-radius: 16px;
  margin: 6px auto 14px;
  display: block;
  color: var(--ink);
  background: #fff;
  outline: none;
}

/* Shop */
.shop-gems { text-align: center; font-size: 20px; font-weight: 800; margin: 0 0 8px; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  margin-bottom: 6px;
}
.shop-card {
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .08s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.shop-card:active { transform: scale(.95); }
.shop-card.owned { opacity: .65; cursor: default; }
.shop-face {
  width: 100%;
  height: 56px;
  border-radius: 12px;
  background-size: cover;
}
.shop-face.emoji { display: flex; align-items: center; justify-content: center; font-size: 34px; background: #f0eaff; }
.shop-face-img { width: 56px; height: 56px; }
.shop-name { font-weight: 800; font-size: 13px; line-height: 1.1; }
.shop-sub { font-size: 10px; opacity: .7; line-height: 1.1; }
.shop-price { font-weight: 800; font-size: 13px; color: var(--purple); }
.shop-card.owned .shop-price { color: var(--green); }

/* ============================================================
   v4: settings panel, themes, toggles, accessibility
   ============================================================ */
.icon-btn {
  border: none;
  background: var(--panel);
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.icon-btn:active { transform: scale(.9); }

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}
.settings-row > span:first-child { font-weight: 800; min-width: 70px; }

/* Toggle pill */
.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: #eee;
  border-radius: 999px;
  padding: 8px 16px 8px 8px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.toggle-knob {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform .15s;
}
.toggle-pill.on { background: var(--green); color: #fff; }
.toggle-pill.on .toggle-knob { transform: translateX(4px); }

/* Theme swatches */
.theme-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.theme-swatch {
  width: 84px; height: 60px;
  border-radius: 14px;
  border: 3px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.theme-swatch.active { border-color: var(--ink); }
.theme-name {
  background: rgba(255,255,255,0.8);
  font-size: 12px;
  font-weight: 800;
  width: 100%;
  text-align: center;
  padding: 2px 0;
}

/* Big-buttons accessibility mode */
body.big-buttons .round-btn { width: 92px; height: 92px; }
body.big-buttons .save-btn { font-size: 26px; padding: 20px 48px; }
body.big-buttons .btn { font-size: 21px; padding: 16px 30px; }
body.big-buttons .home-action { font-size: 19px; padding: 22px 8px; }
body.big-buttons .corner-btn { padding: 14px 18px; }
body.big-buttons .charm-btn { width: 70px; height: 70px; }

/* v5: pick chips (size / effect / scent / swirl) */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 4px; }
.pick-chip {
  border: 3px solid transparent;
  background: #f0eaff;
  border-radius: 14px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--ink);
}
.pick-chip.active { border-color: var(--purple); background: #fff; }
.pick-chip:active { transform: scale(.93); }

/* v6: play-mode toolbar */
.play-tools {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px;
  background: rgba(255,255,255,0.55);
}

/* v7: rewards, levels, badges, challenge, wheel */
.home-action.rewards { background: linear-gradient(180deg, #ffd23f, #f0a500); color: var(--ink); position: relative; }
.home-action.has-reward::after {
  content: "";
  position: absolute; top: 8px; right: 8px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #ff3b3b; border: 2px solid #fff;
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.3);} }

.level-box { text-align: center; margin-bottom: 12px; }
.level-num { font-weight: 800; font-size: 20px; }
.level-bar { background: #e6def7; border-radius: 999px; height: 18px; overflow: hidden; margin: 6px 0; }
.level-fill { background: linear-gradient(90deg, var(--green), var(--blue)); height: 100%; border-radius: 999px; transition: width .4s; }
.level-xp { font-size: 13px; opacity: .7; }

.big-reward { width: 100%; font-size: 20px; margin-bottom: 6px; }

.challenge-box {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow);
}
.challenge-box.done { opacity: .6; }
.challenge-emoji { font-size: 28px; }
.challenge-text { flex: 1; font-weight: 800; }
.challenge-reward { font-weight: 800; color: var(--purple); }

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

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; }
.badge { background: #f0eaff; border-radius: 14px; padding: 10px 4px; text-align: center; opacity: .5; }
.badge.earned { background: #fff; opacity: 1; box-shadow: var(--shadow); }
.badge-emoji { font-size: 30px; }
.badge-name { font-size: 11px; font-weight: 800; margin-top: 2px; }

.wheel-canvas-prize { touch-action: none; }

/* v8: shop extras — wishlist, legendary, chest themes */
.shop-card { position: relative; }
.wish-heart {
  position: absolute; top: 4px; right: 4px;
  border: none; background: transparent; font-size: 18px;
  cursor: pointer; line-height: 1; padding: 2px;
  z-index: 2;
}
.wish-heart:active { transform: scale(1.3); }
.legendary-face {
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  background: linear-gradient(135deg,#ffd23f,#ff7ad9,#9b5de5);
}
.shop-card.active-theme { outline: 3px solid var(--green); }
.wishlist-bar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: #fff0fa; border-radius: 14px; padding: 8px 12px; margin-bottom: 6px;
  font-weight: 800; font-size: 13px;
}
.wishlist-chip { background: #fff; border-radius: 999px; padding: 3px 10px; box-shadow: var(--shadow); font-size: 12px; }

/* v9: slime pet + helper */
.pet-area {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border-radius: 20px;
  padding: 14px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  position: relative;
  flex-wrap: wrap;
}
.pet-stage { width: 110px; height: 110px; flex: 0 0 auto; }
#pet-canvas { width: 100%; height: 100%; touch-action: none; cursor: pointer; }
.pet-info { flex: 1; min-width: 130px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pet-name { font-weight: 800; font-size: 20px; cursor: pointer; }
.pet-name::after { content: " ✏️"; font-size: 13px; opacity: .5; }
.pet-happy { width: 100%; max-width: 160px; height: 14px; background: #e6def7; border-radius: 999px; overflow: hidden; }
.pet-happy-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--yellow)); width: 80%; transition: width .4s; }
.pet-mood { font-weight: 800; font-size: 14px; }
.pet-area.no-pet .pet-stage,
.pet-area.no-pet .pet-happy,
.pet-area.no-pet .pet-mood { display: none; }
.helper {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.helper-face { font-size: 26px; flex: 0 0 auto; }
.helper-bubble {
  background: #fff;
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  position: relative;
}

/* v10: friends, ratings, gallery */
.friend-card {
  flex: 0 0 90px; border: none; background: #fff; border-radius: 14px;
  padding: 10px 6px; cursor: pointer; box-shadow: var(--shadow); text-align: center;
}
.friend-card:active { transform: scale(.95); }
.friend-emoji { font-size: 30px; }
.friend-stars { font-size: 12px; color: var(--purple); font-weight: 800; }
.friend-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.friend-info { flex: 1; }
.btn.small { padding: 8px 14px; font-size: 20px; }
.star-rate { display: flex; gap: 4px; justify-content: center; margin: 6px 0 12px; }
.star-btn { border: none; background: transparent; font-size: 34px; cursor: pointer; color: #ffb800; line-height: 1; }
.star-btn:active { transform: scale(1.2); }
.gallery-section h2 { font-size: 24px; margin: 6px 0 12px; }
.gallery-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.gallery-card { flex: 0 0 110px; border: 3px solid #ffd23f; }

/* v11: mini-games */
.home-action.games { background: linear-gradient(180deg, #4cc9f0, #2196c4); }
#game-canvas { flex: 1; width: 100%; touch-action: none; display: block; }
.game-tools { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 8px; background: var(--panel); }
.games-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-card {
  border: none; background: #fff; border-radius: 18px; padding: 16px 10px;
  cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column;
  align-items: center; gap: 4px; font-family: var(--font);
}
.game-card:active { transform: scale(.95); }
.game-emoji { font-size: 38px; }
.game-name { font-weight: 800; font-size: 15px; }
.game-desc { font-size: 11px; opacity: .7; text-align: center; }

/* v12: undo button + disabled corner button */
.top-right2 { top: 14px; right: 92px; }
.corner-btn:disabled { opacity: .4; }
