/* =========================================================
   Word Wiggle: Magic Worlds — Storybook Gouache Edition CSS
   Preserves Word Wiggle's beloved glossy bubbles & painted ambiance
   ========================================================= */

:root {
  color-scheme: dark;
  --cream: #fff9e6;
  --ink: #142d3c;
  --world-bg: url("assets/bg/dollhouse.webp");
  --world-tint: #4a2146;
  --world-shadow: #3e1237;
  --b1: #ffe0f2; --b1e: #f78cc4;
  --b2: #ccf7f0; --b2e: #5ed6c8;
  --b3: #fff0c2; --b3e: #f7c552;
  --b4: #eedcff; --b4e: #be8ef5;
  font: 16px/1.4 "Fredoka", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 260px; background: #0d2233; overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
[hidden] { display: none !important; }

/* ================= STAGE & PAINTED WORLD BACKDROP ================= */

.stage {
  position: relative;
  isolation: isolate;
  height: 100vh;
  height: 100dvh;
  min-height: 320px;
  overflow: hidden;
  color: var(--cream);
  background: var(--world-tint);
  transition: background-color 0.55s ease;
}

.stage:fullscreen { width: 100%; height: 100%; min-height: 0; }

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 14, 30, 0.48), transparent 27%, transparent 70%, rgba(10, 14, 30, 0.62)),
    var(--world-bg) center / cover no-repeat;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.stage.camera-live::before {
  opacity: 0.38;
}

/* Cover-fit mirrored webcam — never stretches or squishes! */
.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: -2;
}

.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

/* ================= TOP HUD ================= */

.hud {
  position: absolute;
  inset: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) auto max(14px, env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  z-index: 6;
  pointer-events: none;
}

.hud-left,
.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cream);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  font-size: 1.18rem;
  font-weight: 700;
  white-space: nowrap;
}

.brand i {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffd875;
  color: #193b4c;
  font-style: normal;
  text-shadow: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.control {
  min-height: 38px;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(14, 34, 52, 0.86);
  backdrop-filter: blur(6px);
  color: #fafff9;
  font-weight: 700;
  font-size: 0.86rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.16s ease, transform 0.14s ease;
}

.control:hover { background: rgba(34, 84, 114, 0.94); }
.control:active { transform: scale(0.96); }
.control:disabled { cursor: wait; opacity: 0.7; }
.control[aria-pressed="true"].toggle { background: #b7f2dc; color: #153b40; border-color: #fff; }
.control.icon-only { padding: 6px 11px; font-size: 1.05rem; }
.control.world-btn { background: rgba(45, 22, 62, 0.88); border-color: rgba(255, 226, 150, 0.65); }
.control.world-btn:hover { background: rgba(74, 34, 98, 0.96); }
.control.album-btn { background: rgba(54, 34, 16, 0.85); border-color: rgba(255, 224, 130, 0.6); color: #fff2b8; }
.control .caret { opacity: 0.75; font-size: 0.75rem; }

.level-strip {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(14, 34, 52, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
}

.level-strip .control {
  min-height: 30px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  font-size: 0.8rem;
}

.level-strip .control[aria-pressed="true"] {
  background: #ffdf88;
  color: #24333d;
}

.level-strip .control:hover:not([aria-pressed="true"]) {
  background: rgba(255, 255, 255, 0.16);
}

/* ================= CENTER PROMPT & GOUACHE PORTRAIT ================= */

.prompt {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -48%);
  width: min(52vw, 560px);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: clamp(6px, 1.3vh, 14px);
  pointer-events: none;
  z-index: 3;
}

.stage[data-bubbles="3"] .prompt {
  transform: translate(-50%, -35%);
}

.level-tag {
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(12, 26, 42, 0.68);
  border: 1px solid rgba(255, 240, 190, 0.4);
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffe8a3;
  letter-spacing: 0.02em;
}

.prompt h1,
.finish h2 {
  font-size: clamp(1.7rem, min(4.6vw, 6.4vh), 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: #fff8d9;
  text-shadow: 0 4px 0 var(--world-shadow), 0 8px 24px rgba(0, 0, 0, 0.55);
  font-weight: 700;
  text-wrap: balance;
}

.portrait {
  position: relative;
  width: clamp(135px, min(30vw, 39vh), 330px);
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  border: clamp(5px, 0.6vw, 9px) solid var(--rim, #ffe4ae);
  background: var(--rim, #ffc5aa);
  box-shadow: 0 0 0 6px rgba(255, 242, 191, 0.2), 0 0 46px rgba(255, 220, 155, 0.45), 0 18px 38px rgba(0, 0, 0, 0.45);
  isolation: isolate;
  pointer-events: auto;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stage[data-bubbles="3"] .portrait {
  width: clamp(118px, min(25vw, 31vh), 260px);
}

.portrait:hover {
  transform: scale(1.03);
}

.portrait img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  clip-path: circle(50%);
}

.portrait-speaker {
  position: absolute;
  right: 6%;
  bottom: 4%;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(15, 32, 50, 0.82);
  border: 2px solid #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  opacity: 0.85;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.portrait:hover .portrait-speaker {
  transform: scale(1.12);
  opacity: 1;
}

.portrait.arriving {
  animation: arrive 0.44s both cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes arrive {
  from { transform: scale(0.75) rotate(-6deg); opacity: 0.25; }
  72% { transform: scale(1.04) rotate(2deg); }
  to { transform: none; opacity: 1; }
}

.sparkles { position: absolute; inset: 0; pointer-events: none; }
.spark {
  position: absolute;
  top: 49%;
  left: 49%;
  color: #fff6aa;
  text-shadow: 0 0 10px #ffaa50;
  font-weight: 900;
  font-size: clamp(1.2rem, 3.6vw, 2.8rem);
  animation: splash 900ms cubic-bezier(0.12, 0.65, 0.28, 1) both;
}

@keyframes splash {
  from { transform: translate(-50%, -50%) scale(0.14); opacity: 0; }
  32% { opacity: 1; }
  to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--turn)) scale(0.75); opacity: 0; }
}

.feedback {
  min-height: 1.5em;
  font-weight: 700;
  font-size: clamp(0.95rem, 2.4vw, 1.55rem);
  color: #eefef8;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.72);
  text-wrap: balance;
}

.feedback[data-tone="right"] { color: #fff2a0; }
.feedback[data-tone="wrong"] { color: #ffd9a0; }

.collection {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.collection span {
  width: clamp(20px, 3vw, 32px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(12, 34, 54, 0.8);
  color: #abc7cd;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease;
}

.collection .filled {
  background: #fee196;
  color: #4f3e22;
  border-color: #fff4b8;
  box-shadow: 0 0 14px rgba(255, 230, 148, 0.75);
  transform: scale(1.12);
}

/* ================= GLOSSY WORD BUBBLES (2, 3, OR 4 MODES) ================= */

.corner-play {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.bubble {
  --bubble: var(--b1);
  --bubble-edge: var(--b1e);
  --fill: 0%;
  position: absolute;
  isolation: isolate;
  pointer-events: auto;
  aspect-ratio: 1;
  width: clamp(114px, min(20vw, 24vh), 208px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  display: grid;
  place-items: center;
  align-content: center;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: 0 1px rgba(255, 255, 255, 0.75);
  font-size: clamp(1.65rem, min(4.6vw, 5.8vh), 3.7rem);
  touch-action: manipulation;
  transition: transform 0.16s ease, opacity 0.25s ease;
}

.bubble:nth-child(2) { --bubble: var(--b2); --bubble-edge: var(--b2e); }
.bubble:nth-child(3) { --bubble: var(--b3); --bubble-edge: var(--b3e); }
.bubble:nth-child(4) { --bubble: var(--b4); --bubble-edge: var(--b4e); }

/* 4-Bubble Classic Layout (Word Wiggle corners) */
.stage[data-bubbles="4"] .bubble:nth-child(odd) { left: max(4.5%, env(safe-area-inset-left)); }
.stage[data-bubbles="4"] .bubble:nth-child(even) { right: max(4.5%, env(safe-area-inset-right)); }
.stage[data-bubbles="4"] .bubble:nth-child(-n+2) { top: max(13%, 66px); }
.stage[data-bubbles="4"] .bubble:nth-child(n+3) { bottom: max(8.5%, env(safe-area-inset-bottom)); }

/* 2-Bubble Easy Toddler Layout (Big Left & Right at arm height) */
.stage[data-bubbles="2"] .bubble {
  width: clamp(150px, min(25vw, 31vh), 260px);
  font-size: clamp(2.1rem, min(5.4vw, 6.8vh), 4.3rem);
  top: 52%;
  transform: translateY(-50%);
}
.stage[data-bubbles="2"] .bubble:nth-child(1) { left: max(4%, env(safe-area-inset-left)); }
.stage[data-bubbles="2"] .bubble:nth-child(2) { right: max(4%, env(safe-area-inset-right)); }

/* 3-Bubble Rainbow Arc Layout (Left, Top-Center, Right) */
.stage[data-bubbles="3"] .bubble {
  width: clamp(128px, min(21vw, 25vh), 218px);
}
.stage[data-bubbles="3"] .bubble:nth-child(1) { left: max(4.5%, env(safe-area-inset-left)); top: 55%; transform: translateY(-50%); }
.stage[data-bubbles="3"] .bubble:nth-child(2) { left: 50%; top: max(10%, 62px); transform: translateX(-50%); }
.stage[data-bubbles="3"] .bubble:nth-child(3) { right: max(4.5%, env(safe-area-inset-right)); top: 55%; transform: translateY(-50%); }

.bubble::before,
.bubble::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
}

.bubble::before {
  inset: 0;
  background:
    radial-gradient(ellipse at 31% 22%, #fff 0%, transparent 25%),
    radial-gradient(ellipse at 45% 38%, var(--bubble) 25%, var(--bubble-edge) 100%);
  border: 3px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.12),
    0 0 28px color-mix(in srgb, var(--bubble-edge), transparent 42%),
    inset 0 -9px 16px rgba(32, 58, 108, 0.2),
    0 10px 0 -4px rgba(2, 22, 54, 0.4);
}

.bubble::after {
  inset: -8px;
  background: conic-gradient(#fff7c9 var(--fill), transparent var(--fill));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}

.camera-live .bubble::before { opacity: 0.88; }

.bubble:hover:not([aria-disabled="true"])::before,
.bubble[data-hover="true"]::before {
  border-color: #fff;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.28), 0 0 36px var(--bubble-edge);
}

.bubble-label {
  max-width: 86%;
  line-height: 1.04;
  word-break: keep-all;
}

.bubble.med-word { font-size: clamp(1.28rem, min(3.5vw, 4.5vh), 2.85rem); }
.bubble.long-word { font-size: clamp(1.05rem, min(2.8vw, 3.6vh), 2.3rem); letter-spacing: -0.02em; }

.bubble-key {
  margin-top: 0.35em;
  font: 800 0.76rem/1 "Nunito", system-ui, sans-serif;
  color: rgba(25, 52, 68, 0.65);
  letter-spacing: 0;
}

.bubble[data-result="wrong"] {
  opacity: 0.45;
  animation: shake 0.38s ease-out;
}

.bubble[data-result="right"] {
  animation: pop 0.76s ease-in-out forwards;
}

.bubble[data-result="right"]::after {
  background: none;
  border: 6px solid #fff;
  mask: none;
  -webkit-mask: none;
}

@keyframes shake {
  25%, 75% { margin-left: -10px; }
  50% { margin-left: 10px; }
}

@keyframes pop {
  30% { scale: 0.88; }
  62% { scale: 1.18; opacity: 1; }
  100% { scale: 1.38; opacity: 0.1; }
}

.hint {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(50vw, 470px);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 700;
  color: #eafbf4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  z-index: 5;
}

.hint[data-notice="true"] {
  background: rgba(16, 45, 64, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  padding: 6px 12px;
}

/* ================= DANCE PARTY HUD ================= */

.dance-hud {
  position: absolute;
  top: max(68px, 11vh);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.dance-pill {
  background: rgba(20, 14, 42, 0.84);
  border: 2px solid rgba(255, 232, 150, 0.85);
  border-radius: 22px;
  padding: 10px 24px;
  text-align: center;
  min-width: min(86vw, 440px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

#danceTitle {
  display: block;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  color: #fff2a6;
  margin-bottom: 8px;
}

.dance-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

#danceFill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff78c4, #ffe066, #6ee8ff);
}

.dance-score {
  background: rgba(255, 230, 130, 0.94);
  color: #291d42;
  padding: 4px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ================= 8-STICKER FINISH SCREEN ================= */

.finish {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(14, 16, 36, 0.58);
  backdrop-filter: blur(4px);
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: clamp(10px, 2.2vh, 22px);
  padding: 66px 18px 28px;
}

.finish p {
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  color: #e9fff5;
  font-weight: 700;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.65);
}

.mastery-line {
  font-size: 0.98rem !important;
  color: #ffe8a3 !important;
}

.stickers {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(8px, 1.4vw, 16px);
  max-width: min(94vw, 1020px);
}

.sticker {
  display: grid;
  justify-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: clamp(0.84rem, 1.8vw, 1.18rem);
  cursor: pointer;
  background: transparent;
  border: 0;
  color: #fff9e6;
  padding: 0;
  transition: transform 0.16s ease;
}

.sticker:hover { transform: scale(1.08); }

.sticker img {
  width: clamp(54px, min(10vw, 15vh), 116px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #ffefbc;
  box-shadow: 0 0 20px rgba(253, 234, 176, 0.4);
}

.finish-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.again {
  min-height: 48px;
  background: #fee28d;
  color: #1d3944;
  border: 0;
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 1.08rem;
  font-weight: 700;
  box-shadow: 0 5px 0 #9b6b32;
  transition: transform 0.14s ease, background 0.16s ease;
}

.again:hover { background: #fff1ba; transform: translateY(-2px); }
.again.dance-cta { background: linear-gradient(135deg, #ff73c0, #ffb86b); color: #2b1033; box-shadow: 0 5px 0 #8a2e63; }
.again.next-lvl { background: linear-gradient(135deg, #8af2d6, #74ccff); color: #0e2e3d; box-shadow: 0 5px 0 #1f6b7d; }

/* ================= MODALS (WORLDS, STICKER BOOK, PARENT DRAWER) ================= */

.modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 12, 24, 0.68);
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  z-index: 1;
  background: #142238;
  border: 2px solid rgba(255, 242, 195, 0.35);
  border-radius: 26px;
  color: #fff9ec;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  font-family: "Nunito", system-ui, sans-serif;
}

.modal-wide { width: min(94vw, 860px); }

.modal-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(92vw, 370px);
  max-height: 100%;
  border-radius: 22px 0 0 22px;
  border-right: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.modal-header h2 {
  font-family: "Fredoka", sans-serif;
  font-size: 1.35rem;
  color: #ffeaa0;
}

.modal-sub {
  font-size: 0.85rem;
  color: #b9d5e8;
  margin-top: 2px;
}

.close-x {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.close-x:hover { background: rgba(255, 255, 255, 0.22); }

.modal-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
}

.section-title {
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
  color: #9be8ff;
  margin: 0 0 10px;
}

/* World Cards */
.world-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.world-tile {
  position: relative;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  min-height: 92px;
  padding: 12px;
  text-align: left;
  color: #fff;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  transition: transform 0.15s ease, border-color 0.18s ease;
}

.world-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 14, 28, 0.25) 0%, rgba(10, 14, 28, 0.82) 100%);
}

.world-tile > * { position: relative; z-index: 1; }
.world-tile:hover { transform: translateY(-2px); border-color: rgba(255, 240, 175, 0.75); }
.world-tile.active { border-color: #ffe075; box-shadow: 0 0 0 3px rgba(255, 224, 117, 0.35); }
.world-tile .wt-title { font-family: "Fredoka", sans-serif; font-size: 1.05rem; font-weight: 700; }
.world-tile .wt-sub { font-size: 0.76rem; color: #d5ecff; }

/* Level Cards */
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.level-tile {
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.level-tile:hover { background: rgba(255, 255, 255, 0.12); }
.level-tile.active { border-color: #ffe075; background: rgba(255, 224, 117, 0.16); }
.level-tile .lt-num { font-family: "Fredoka", sans-serif; font-size: 0.96rem; color: #ffe388; }
.level-tile .lt-name { font-size: 0.82rem; font-weight: 800; line-height: 1.2; }
.level-tile .lt-desc { font-size: 0.72rem; color: #b5cfe3; line-height: 1.25; }
.level-tile .lt-prog { margin-top: auto; font-size: 0.74rem; color: #8af2d6; font-weight: 800; padding-top: 4px; }

/* Sticker Book Album */
.album-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.album-tabs button {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #d9eeff;
  font-size: 0.82rem;
  font-weight: 800;
}

.album-tabs button.active {
  background: #ffe075;
  color: #1c2c3b;
  border-color: #fff;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.album-item {
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 8px 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.album-item.earned:hover {
  transform: translateY(-3px);
  border-color: #ffe075;
}

.album-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #ffe4a3;
}

.album-item.locked img {
  filter: brightness(0.16) saturate(0.2);
  opacity: 0.55;
  border-color: rgba(255, 255, 255, 0.2);
}

.album-item .ai-word {
  font-family: "Fredoka", sans-serif;
  font-size: 0.9rem;
}

.album-item.locked .ai-word {
  color: rgba(255, 255, 255, 0.4);
}

/* Parent Drawer Controls */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.setting-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-block label { font-size: 0.9rem; font-weight: 800; color: #e6f5ff; }
.setting-block small { font-size: 0.76rem; color: #9fc0d8; line-height: 1.3; }

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.seg button {
  padding: 8px 6px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #d6ecff;
  font-size: 0.82rem;
  font-weight: 800;
}

.seg button.active {
  background: #ffe075;
  color: #1c2c3b;
  border-color: #fff;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #e6f5ff;
  cursor: pointer;
}

.toggle-row input { width: 20px; height: 20px; accent-color: #ff85c0; cursor: pointer; }

.slider-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 800;
}

.slider-row span { color: #ffe075; }
input[type="range"] { width: 100%; accent-color: #ff85c0; cursor: pointer; }

.settings-stack hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin: 2px 0;
}

.drawer-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-btn {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

.drawer-btn:hover { background: rgba(255, 255, 255, 0.16); }
.drawer-btn.primary { background: linear-gradient(135deg, #ff73c0, #9d6eff); border: 0; }
.drawer-btn.danger { color: #ffadb8; border-color: rgba(255, 130, 145, 0.35); }

/* ================= RESPONSIVE ================= */

@media (max-width: 860px) {
  .brand span { display: none; }
  .level-strip { display: none; }
  .world-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stickers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 640px) and (orientation: portrait) {
  .hud { flex-wrap: wrap; justify-content: center; }
  .bubble { width: clamp(88px, 25vw, 132px); font-size: clamp(1.35rem, 6vw, 2.1rem); }
  .portrait { width: clamp(120px, min(42vw, 25vh), 210px); }
  .stage[data-bubbles="4"] .bubble:nth-child(-n+2) { top: max(16%, 94px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sparkles { display: none; }
}
