/* Touch Mommy - layout and look. Mobile-first; see GDD section 17. */
:root {
  --bg: #f6e6da;
  --paper: #fffaf6;
  --ink: #4f3434;
  --ink-soft: #8a6a66;
  --accent: #e2668e;
  --accent-dark: #c24a73;
  --gold: #f2b544;
  --line: #ecd6c8;
  --shadow: 0 2px 10px rgba(120, 70, 60, 0.12);
  --ad-h: 50px;          /* reserved ad height: phone 320x50 */
  --ad-w: 320px;
  --panel-h: clamp(180px, 34%, 360px);  /* bottom sheet height on phones */
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.35 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overflow: hidden;              /* the page itself never scrolls; panels scroll inside */
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; }

/* ---------- App grid: phone portrait (default) ---------- */
#app {
  height: 100vh;
  height: 100dvh;
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: auto minmax(0, 1fr) var(--panel-h) auto;
  grid-template-areas: "hud" "stage" "panel" "ad";
  padding-bottom: env(safe-area-inset-bottom);
}
#hud { grid-area: hud; }
#stage { grid-area: stage; }
#panel { grid-area: panel; }
#panel-left { display: none; }
#ad-slot { grid-area: ad; }

/* ---------- Top bar ---------- */
#hud {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 56px 6px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  z-index: 3;
}
.hud-main { text-align: center; min-width: 0; }
.hud-label { font-size: 13px; color: var(--ink-soft); letter-spacing: 0.02em; }
.hud-label .heart { color: var(--accent); }
.hud-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.hud-value.pop { animation: pop 0.14s ease-out; }
@keyframes pop { 50% { transform: scale(1.06); } }
.hud-rate { font-size: 14px; font-weight: 600; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.icon-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent;
  font-size: 22px;
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:active { background: var(--line); }

/* ---------- Stage ---------- */
#stage {
  position: relative;
  overflow: hidden;
  touch-action: none;            /* no scroll / zoom while touching her */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  outline: none;
  min-height: 0;
}
#stage { background: #f1dfd0; }
/* On very wide + short stages the room cannot fill the sides without cutting her off;
   a soft blurred copy of the room fills that gap instead of plain bands. */
#stage::before {
  content: "";
  position: absolute; inset: -20px;
  background: url("../assets/bg.jpg") center 75% / cover no-repeat;
  background-image: image-set(url("../assets/bg.webp") type("image/webp"), url("../assets/bg.jpg") type("image/jpeg"));
  filter: blur(14px) brightness(0.97);
}
#scene { position: absolute; left: 0; top: 0; }
#scene-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
#mommy {
  position: absolute;
  transform-origin: 50% 100%;
  will-change: transform;
}
.mommy-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(90, 50, 40, 0.18));
}
/* Only ONE picture is ever visible: the smile replaces the normal one, never sits on top of it
   (the two drawings differ slightly, so layering them shows doubled legs/hair). */
.mommy-img.happy { visibility: hidden; }
#mommy.smiling .mommy-img.happy { visibility: visible; }
#mommy.smiling .mommy-img:not(.happy) { visibility: hidden; }
#fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-num {
  position: absolute;
  left: 0; top: 0;
  font-weight: 800;
  font-size: 22px;
  color: #fff;
  text-shadow: 0 0 2px var(--accent-dark), 0 1px 3px var(--accent-dark), 0 0 8px rgba(226, 102, 142, 0.6);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.fx-heart { position: absolute; left: 0; top: 0; width: 18px; height: 18px; opacity: 0; pointer-events: none; }
#hint {
  position: absolute;
  left: 50%; bottom: 12px;
  transform: translateX(-50%);
  background: rgba(255, 250, 246, 0.9);
  color: var(--accent-dark);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: none;
  animation: hint 1.6s ease-in-out infinite;
}
#hint.gone { display: none; }
@keyframes hint { 50% { transform: translateX(-50%) translateY(-4px); } }

/* ---------- Panels ---------- */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
#tabbar {
  display: flex;
  gap: 4px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.tab {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.panel-title { margin: 0; padding: 12px 14px 8px; font-size: 17px; color: var(--accent-dark); border-bottom: 1px solid var(--line); }
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
}
.tab-body { display: none; }
.tab-body.shown { display: block; }
body.wide #tabbar .tab[data-tab="helpers"] { display: none; }
.placeholder-card {
  display: flex; gap: 12px; align-items: center;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
.ph-icon { font-size: 30px; }

/* ---------- Advertisement (reserved, visually separate) ---------- */
#ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0 6px;
  margin-top: 10px;              /* gap so a thumb on the panel never lands on the ad */
  background: #efe3da;
  border-top: 1px solid var(--line);
}
html.in-site #ad-slot { display: none; }   /* inside a website's player: the website shows the ads */
.ad-label { font-size: 10px; color: #a8948b; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; }
#ad-container {
  width: var(--ad-w);
  max-width: 100%;
  height: var(--ad-h);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.5);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(60, 35, 35, 0.4);
  z-index: 50;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  width: 100%; max-width: 360px;
  background: var(--paper);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(60, 30, 30, 0.3);
  display: flex; flex-direction: column; gap: 10px;
  text-align: center;
}
.modal-card h2 { margin: 0; color: var(--accent-dark); }
.muted { color: var(--ink-soft); margin: 0; font-size: 13px; }
.small { font-size: 11px; }
.btn {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--line);
  font-weight: 700;
  cursor: pointer;
}
.btn.danger { background: #f7d4d4; color: #a33; }
.btn:active { filter: brightness(0.95); }

/* ---------- Small phones ---------- */
@media (max-width: 360px) {
  .hud-value { font-size: 26px; }
  #hud { padding-left: 48px; padding-right: 48px; }
}

/* ---------- Tablets ---------- */
@media (min-width: 600px) {
  :root { --ad-w: 468px; --ad-h: 60px; }
}

/* ---------- Phone / small-tablet landscape: stage left, panel right ---------- */
@media (orientation: landscape) and (max-height: 600px) {
  :root { --ad-h: 50px; --ad-w: 320px; }
  #app {
    grid-template-columns: minmax(0, 1fr) minmax(322px, 42%);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "hud hud" "stage panel" "stage ad";
  }
  #hud { padding-top: 2px; padding-bottom: 2px; }
  .hud-value { font-size: 24px; }
  #panel { border-top: 0; border-left: 1px solid var(--line); }
  #ad-slot { margin-top: 0; border-left: 1px solid var(--line); }
}

/* ---------- Tablet landscape / small laptop: stage left, panel right, ad full width ---------- */
@media (orientation: landscape) and (min-height: 601px) and (max-width: 1279px) {
  :root { --ad-w: 728px; --ad-h: 90px; }
  #app {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 40%);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "hud panel" "stage panel" "ad ad";
  }
  #panel { border-top: 0; border-left: 1px solid var(--line); }
  #ad-slot { margin-top: 0; }
}

/* ---------- Desktop: three columns ---------- */
@media (min-width: 1280px) and (min-height: 601px) {
  :root { --ad-w: 468px; --ad-h: 60px; }
  #app {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(300px, 360px);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "left hud right" "left stage right" "left ad right";
  }
  #panel-left { display: flex; grid-area: left; border-top: 0; border-right: 1px solid var(--line); }
  #panel { grid-area: right; border-top: 0; border-left: 1px solid var(--line); }
  #ad-slot { margin-top: 0; }
  .hud-value { font-size: 36px; }
  body { background: #ecd9cb; }
}

/* Big desktop: the centre column is wide enough for the 728 x 90 leaderboard */
@media (min-width: 1500px) and (min-height: 601px) {
  :root { --ad-w: 728px; --ad-h: 90px; }
}

/* Tablet portrait: slightly shorter bottom sheet so the room + Mommy fill the stage edge to edge */
@media (min-width: 600px) and (orientation: portrait) {
  :root { --panel-h: clamp(180px, 30%, 360px); }
}

/* ---------- Touch info (stage, top-left) ---------- */
#touch-info {
  position: absolute; left: 8px; top: 8px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  pointer-events: none;
  z-index: 2;
}
#touch-info span {
  background: rgba(255, 250, 246, 0.88);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px; font-weight: 700;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
#info-streak { display: none; color: var(--accent-dark) !important; }
#info-streak.show { display: inline-block; }

/* ---------- Helpers shop ---------- */
.buybar {
  position: sticky; top: -10px; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  margin: -10px -10px 8px; padding: 5px 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.buybar-label { font-weight: 700; color: var(--ink-soft); font-size: 13px; }
.seg { display: inline-flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button {
  min-width: 56px; min-height: 38px;
  border: 0; border-radius: 9px;
  background: transparent;
  font-weight: 800; color: var(--ink-soft);
  cursor: pointer;
}
.seg button.on { background: #fff; color: var(--accent-dark); box-shadow: 0 1px 4px rgba(120, 70, 60, 0.18); }

.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  grid-template-areas: "icon main buy" "level level level";
  column-gap: 10px; row-gap: 6px;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card-icon { grid-area: icon; width: 48px; height: 48px; }
.card-main { grid-area: main; min-width: 0; }
.card-top { display: flex; align-items: baseline; gap: 6px; }
.card-name { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-owned { font-weight: 800; color: var(--accent-dark); font-size: 14px; font-variant-numeric: tabular-nums; }
.card-rule { font-size: 12px; color: var(--ink-soft); line-height: 1.25; margin-top: 1px; }
.card-prod { font-size: 12px; font-weight: 700; color: #7a5a55; margin-top: 2px; font-variant-numeric: tabular-nums; }

.buy-btn, .lv-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 92px; min-height: 48px;
  padding: 4px 10px;
  border: 0; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-weight: 800; line-height: 1.15;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--accent-dark);
}
.buy-btn { grid-area: buy; }
.up-row .up-btn { grid-area: auto; }
.buy-n, .lv-btn-n { font-size: 12px; opacity: 0.95; }
.buy-cost, .lv-btn-cost { font-size: 14px; font-variant-numeric: tabular-nums; }
.buy-btn:active:not(:disabled), .lv-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.buy-btn:disabled, .lv-btn:disabled { background: #e7d9d0; color: #a58f86; box-shadow: none; cursor: default; }

.card-level {
  grid-area: level;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-soft);
  border-top: 1px dashed var(--line);
  padding-top: 5px;
  min-height: 22px;
}
.lv-stars { color: var(--gold); letter-spacing: 1px; font-size: 12px; white-space: nowrap; }
.lv-text { flex: 1; min-width: 0; }
.lv-btn { display: none; min-height: 44px; background: var(--gold); box-shadow: 0 2px 0 #c98f1f; color: #5a3b12; }
.lv-btn.show { display: flex; }
.card.level-ready { border-color: var(--gold); }
.card.level-ready .lv-text { color: #9a6a12; font-weight: 700; }
.card.leveled { animation: leveled 0.6s ease-out; }
@keyframes leveled { 30% { transform: scale(1.02); box-shadow: 0 0 0 4px rgba(242, 181, 68, 0.5); } }

.card.mystery { grid-template-areas: "icon main main"; background: #fbf7f4; border-style: dashed; }
.card.mystery .card-name { color: #b8a69b; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.25s linear; }

.fly-icon { position: fixed; z-index: 40; pointer-events: none; }

@media (max-width: 360px) {
  .card { grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 8px; padding: 7px 8px; }
  .card-icon { width: 40px; height: 40px; }
  .buy-btn { min-width: 84px; }
}

/* ---------- Tabs ---------- */
.tab { position: relative; }
.tab .dot {
  display: none;
  position: absolute; top: 8px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #e8475f;
}
.tab.has-dot .dot { display: block; }
.section-note { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }

/* ---------- Upgrades ---------- */
.up-list { display: flex; flex-direction: column; gap: 8px; }
.up-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  column-gap: 10px; align-items: center;
  padding: 8px 10px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.up-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fde3ea; color: var(--accent); font-size: 20px;
}
.up-name { font-weight: 800; }
.up-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.25; }
.up-row.owned { background: #fbf7f4; }
.up-row.owned .up-icon { background: var(--accent); color: #fff; }
.up-row.owned .up-btn:disabled { background: #e3f1dc; color: #5f8a50; }
.up-next { margin-top: 10px; text-align: center; }

/* ---------- Trophies ---------- */
.tr-head { font-size: 14px; margin-bottom: 8px; }
.accent { color: var(--accent-dark); font-weight: 700; }
.tr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.tr {
  display: flex; gap: 8px; align-items: center;
  padding: 7px 8px;
  border: 1px dashed var(--line); border-radius: 12px;
  background: #fbf7f4;
}
.tr-icon { font-size: 20px; filter: grayscale(1); opacity: 0.35; }
.tr-name { font-weight: 800; font-size: 13px; color: #a8948b; }
.tr-desc { font-size: 11px; color: var(--ink-soft); line-height: 1.2; }
.tr.got { border-style: solid; border-color: #f1d49a; background: #fffaf0; }
.tr.got .tr-icon { filter: none; opacity: 1; }
.tr.got .tr-name { color: var(--ink); }

/* ---------- Toasts ---------- */
#toasts {
  position: absolute; left: 50%; bottom: 8px;
  transform: translateX(-50%);
  width: min(340px, calc(100% - 16px));
  display: flex; flex-direction: column; gap: 6px;
  z-index: 45; pointer-events: none;
}
.toast {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 12px;
  background: rgba(255, 250, 246, 0.97);
  border: 1px solid #f1d49a; border-radius: 14px;
  box-shadow: 0 6px 18px rgba(90, 50, 40, 0.18);
  animation: toastIn 0.3s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }
.toast-icon { font-size: 22px; }
.toast-text { display: flex; flex-direction: column; line-height: 1.2; }
.toast-text small { color: var(--ink-soft); font-size: 12px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(0.97); } }

/* ---------- Welcome back ---------- */
.welcome-card { animation: cardUp 0.35s ease-out; }
@keyframes cardUp { from { opacity: 0; transform: translateY(30px); } }
.welcome-face {
  width: 96px; height: 96px; margin: -54px auto 0;
  border-radius: 50%; border: 4px solid #fff;
  background: #f6e1d6 no-repeat;
  background-size: 360%;              /* zoom onto her face */
  background-position: 49% 16%;
  box-shadow: 0 4px 14px rgba(90, 50, 40, 0.25);
}
.welcome-card { margin-top: 40px; }
.welcome-line { margin: 0; font-style: italic; color: var(--accent-dark); }
.welcome-amount { font-size: 34px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-dark); font-size: 17px; }

/* ---------- Speech bubble ---------- */
#bubble {
  position: absolute; left: 0; top: 0;
  display: none;
  width: max-content;
  padding: 9px 13px;
  background: #fff;
  border: 2px solid #f3b6c9;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(90, 50, 40, 0.18);
  color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1.3;
  pointer-events: none;            /* touches go straight through to Mommy */
  z-index: 3;
  transform-origin: center;
}
#bubble.show { display: block; }
#bubble.small { font-size: 13px; padding: 7px 10px; }
.bubble-tail {
  position: absolute;
  width: 12px; height: 12px;
  background: #fff;
  border: 2px solid #f3b6c9;
  transform: translate(-50%, -50%) rotate(45deg);
}
#bubble.side-right .bubble-tail { left: 0; border-top: 0; border-right: 0; }
#bubble.side-left .bubble-tail { left: 100%; border-bottom: 0; border-left: 0; }
#bubble.side-below .bubble-tail { top: 0; border-bottom: 0; border-right: 0; }

/* ---------- Helper numbers ---------- */
.helper-num {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; gap: 3px;
  padding: 2px 7px 2px 3px;
  border-radius: 999px;
  background: rgba(255, 250, 246, 0.88);
  box-shadow: 0 2px 6px rgba(90, 50, 40, 0.16);
  font-size: 13px; font-weight: 800;
  color: #9c2f58;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.hn-icon { width: 18px; height: 18px; display: inline-block; }

/* ---------- Sound ---------- */
.icon-btn.left { right: auto; left: 8px; }
.setting-row { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 8px; text-align: left; font-weight: 700; font-size: 14px; }
.setting-row input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }
.setting-v { font-size: 12px; color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }
.setting-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.blush {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 105, 150, 0.85), rgba(255, 105, 150, 0));
  pointer-events: none;
  opacity: 0;
}

/* ---------- 4 tabs fit on any phone ---------- */
#tabbar .tab { flex: 1 1 0; min-width: 0; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) { #tabbar .tab { font-size: 13px; } }

/* ---------- Wardrobe ---------- */
.wd-head { font-size: 14px; margin-bottom: 8px; }
.wd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.wd {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  padding: 6px;
  background: #fff; border: 2px solid var(--line); border-radius: 14px;
  text-align: left; cursor: pointer;
}
.wd-pic {
  aspect-ratio: 3 / 4; width: 100%;
  border-radius: 10px;
  background: #f6e9e1 no-repeat;
  background-size: 175% auto;          /* head to waist */
  background-position: 50% 9%;
}
.wd-name { font-weight: 800; font-size: 13px; line-height: 1.15; }
.wd-sub { font-size: 11px; color: var(--ink-soft); line-height: 1.2; }
.wd .progress { display: none; margin-top: 2px; }
.wd.locked { cursor: default; background: #fbf7f4; border-style: dashed; }
.wd.locked .wd-pic { background-color: transparent; filter: brightness(0); opacity: 0.2; }   /* a silhouette teaser (only her shape goes dark) */
.wd.locked .wd-name { color: #a8948b; }
.wd.locked .progress { display: block; }
.wd.worn { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(226, 102, 142, 0.18); }
.wd.worn .wd-sub { color: var(--accent-dark); font-weight: 700; }
.wd-foot { margin-top: 10px; }
.wd-foot .btn { width: 100%; }

/* ---------- New outfit card ---------- */
.unlock-card { animation: cardUp 0.35s ease-out; overflow: hidden; }
.unlock-ribbon {
  margin: -18px -18px 4px; padding: 10px;
  background: linear-gradient(90deg, #f7b6cb, #ffd98a, #f7b6cb);
  font-weight: 800; color: #6b3450; letter-spacing: 0.03em;
}
.unlock-pic {
  width: 170px; height: 220px; margin: 0 auto;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, #fff6e8, #f6dfe7) no-repeat;
  background-size: 175% auto; background-position: 50% 9%;
  box-shadow: 0 4px 14px rgba(90, 50, 40, 0.18);
}
#unlock-pic { background-color: #fbe9ee; }
.unlock-card h2 { font-size: 22px; }

/* ---------- Finale ---------- */
.thanks-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.thanks-stats div { display: flex; flex-direction: column; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.thanks-stats span { font-size: 11px; color: var(--ink-soft); }
.thanks-stats b { font-size: 16px; font-variant-numeric: tabular-nums; }
#finale-stars { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s; z-index: 1;
  background: radial-gradient(ellipse at 50% 30%, rgba(120, 90, 200, 0.18), rgba(40, 20, 80, 0.25)); }
#finale-stars.on { opacity: 1; }
#finale-stars i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #fff8c8; box-shadow: 0 0 8px 2px rgba(255, 240, 170, 0.9);
  animation: twinkle 1.8s ease-in-out infinite;
}
@keyframes twinkle { 50% { transform: scale(0.3); opacity: 0.3; } }

/* ---------- Outfit change flash ---------- */
.outfit-flash {
  position: absolute; pointer-events: none;
  border-radius: 45%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.85) 60%, rgba(255, 255, 255, 0));
  opacity: 0;
}

/* ---------- Phase 7 polish ---------- */
html, body { overscroll-behavior: none; }              /* no pull-to-refresh / bounce while playing */
#app { -webkit-user-select: none; user-select: none; }  /* rapid taps never select text */
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, .tab:focus-visible, #stage:focus-visible { outline: 3px solid rgba(226, 102, 142, 0.55); outline-offset: 2px; }

/* the room fades in when ready */
#scene, #finale-stars { opacity: 0; transition: opacity 0.5s ease-out; }
#stage.ready #scene { opacity: 1; }
#stage.ready #finale-stars.on { opacity: 1; }
#loading {
  position: absolute; left: 50%; top: 45%;
  transform: translate(-50%, -50%);
  font-size: 40px; color: var(--accent);
  animation: beat 0.9s ease-in-out infinite;
  pointer-events: none;
}
#stage.ready #loading { display: none; }
@keyframes beat { 50% { transform: translate(-50%, -50%) scale(1.25); } }

/* tab switch: content eases in */
.tab-body.shown { animation: tabIn 0.18s ease-out; }
@keyframes tabIn { from { opacity: 0; } }

/* streak milestone ring */
.streak-ring {
  position: absolute; left: 0; top: 0;
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 4px solid rgba(255, 150, 190, 0.9);
  box-shadow: 0 0 16px rgba(255, 120, 170, 0.6);
  pointer-events: none;
}

/* a button that just became affordable glows once */
.buy-btn.ready-glow { animation: readyGlow 0.9s ease-out; }
@keyframes readyGlow { 0% { box-shadow: 0 2px 0 var(--accent-dark), 0 0 0 0 rgba(226, 102, 142, 0.7); }
  100% { box-shadow: 0 2px 0 var(--accent-dark), 0 0 0 12px rgba(226, 102, 142, 0); } }

/* people who ask their system for less motion get less motion */
@media (prefers-reduced-motion: reduce) {
  #hint, #loading, .tab-body.shown, .buy-btn.ready-glow, #finale-stars i { animation: none !important; }
}
/* phone held sideways: the side panel is narrow, so the 4 tab names get slightly smaller text */
@media (orientation: landscape) and (max-height: 600px) {
  #tabbar { padding-left: 4px; padding-right: 4px; gap: 2px; }
  #tabbar .tab { font-size: 13px; padding: 0 2px; }
}
