/* Skin Science for Kids — game pages */

/* ---------- games hub ---------- */
.game-hub { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.hub-card {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text);
  background: var(--white); border: 2px solid var(--ink); border-radius: 24px; overflow: hidden;
  box-shadow: 6px 6px 0 var(--ink); transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 0.2s;
}
.hub-card:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--ink); color: var(--text); }
.hub-card:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.hub-art { height: 170px; display: flex; align-items: center; justify-content: center; border-bottom: 2px solid var(--ink); }
.hub-art svg { width: 120px; height: 120px; }
.hub-card:hover .hub-art svg { animation: hub-wiggle 0.6s ease; }
@keyframes hub-wiggle { 25% { transform: rotate(-8deg) scale(1.06); } 60% { transform: rotate(6deg); } }
.hub-body { padding: 4px 22px 22px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.hub-body h2 { font-size: 1.6rem; margin: 0; }
.hub-body p { margin: 0; font-size: 0.95rem; }
.hub-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }
.hub-tags span { font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--purple-soft); color: var(--ink); }
.hub-play { font-weight: 700; color: var(--purple); margin-top: 6px; }

/* ---------- shared game frame ---------- */
.game-wrap { background: var(--white); border: 2px solid var(--ink); border-radius: 26px; padding: 22px; box-shadow: 6px 6px 0 var(--ink); }
.hud { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.hud .pill { background: var(--purple-soft); color: var(--ink); font-weight: 700; font-size: 0.92rem; padding: 6px 14px; border-radius: 999px; }
.hud .pill b { font-family: var(--display); font-weight: 800; font-size: 1.05rem; }
.hud .spacer { flex: 1; }
.hearts { display: inline-flex; gap: 3px; }
.hearts svg { width: 22px; height: 22px; transition: transform 0.3s, opacity 0.3s; }
.hearts svg.lost { opacity: 0.2; transform: scale(0.7); }
.timer-bar { height: 10px; border-radius: 6px; background: var(--purple-soft); overflow: hidden; margin-bottom: 16px; }
.timer-bar div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--pink), var(--purple)); transition: width 0.25s linear; }

.game-msg { min-height: 1.6em; font-weight: 700; color: var(--ink); margin: 12px 0 0; }
.game-msg.good { color: var(--green-ink); }
.game-msg.bad { color: var(--pink-ink); }

.overlay {
  position: absolute; inset: 0; z-index: 5; border-radius: inherit;
  background: rgba(248, 246, 253, 0.94); display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.overlay[hidden] { display: none; }
.overlay-inner { max-width: 30rem; display: flex; flex-direction: column; gap: 12px; align-items: center; animation: score-pop 0.5s cubic-bezier(0.25, 1.5, 0.4, 1); }
.overlay h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.3rem); }
.overlay p { margin: 0; }
.stars { display: flex; gap: 6px; }
.stars svg { width: 44px; height: 44px; fill: #e5def7; stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.stars svg.on { fill: var(--yellow); animation: score-pop 0.5s cubic-bezier(0.25, 1.6, 0.4, 1) both; }
.stars svg.on:nth-child(2) { animation-delay: 0.15s; }
.stars svg.on:nth-child(3) { animation-delay: 0.3s; }
@keyframes score-pop { from { transform: scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }

.big-btn { min-height: 54px; padding: 0 30px; font-size: 1.1rem; border-radius: 14px; }

/* ---------- Trigger Detective ---------- */
.td-stage { position: relative; border-radius: 22px; }
.td-case { display: flex; justify-content: center; margin: 8px 0 22px; min-height: 230px; }
.clue {
  width: min(320px, 100%); background: var(--white); border: 2.5px solid var(--ink); border-radius: 22px;
  padding: 20px; text-align: center; box-shadow: 0 16px 30px -20px rgba(42, 31, 92, 0.6);
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: grab; touch-action: none; user-select: none;
  animation: clue-in 0.45s cubic-bezier(0.25, 1.4, 0.4, 1);
  position: relative;
}
.clue.dragging { cursor: grabbing; box-shadow: 0 26px 40px -18px rgba(42, 31, 92, 0.6); z-index: 10; transition: none; }
.clue.snap-back { transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1); }
.clue .clue-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; color: var(--pink-ink); text-transform: uppercase; }
.clue svg { width: 96px; height: 96px; }
.clue h3 { font-size: 1.35rem; margin: 0; }
.clue.fly-out { animation: clue-out 0.4s ease-in forwards; }
.clue.shake { animation: shake 0.45s; }
@keyframes clue-in { from { transform: translateY(-30px) rotate(-6deg) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes clue-out { to { transform: translateY(40px) scale(0.5); opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-10px) rotate(-2deg); } 40%, 80% { transform: translateX(10px) rotate(2deg); } }

.bins { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.bin {
  border: 2.5px dashed var(--ink); border-radius: 20px; padding: 16px 12px; text-align: center; cursor: pointer;
  background: var(--white); font: inherit; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1), background 0.2s;
}
.bin svg { width: 46px; height: 46px; }
.bin strong { font-family: var(--display); font-weight: 800; font-size: 1.1rem; line-height: 1.15; }
.bin small { font-size: 0.78rem; color: var(--muted); }
.bin:hover, .bin.over { transform: translateY(-4px) scale(1.03); }
.bin-flare { background: #fff1e6; }
.bin-help { background: var(--green-soft); }
.bin-myth { background: var(--pink-soft); }
.bin.over { border-style: solid; box-shadow: 0 0 0 5px rgba(91, 63, 196, 0.2); }
.bin .count { font-size: 0.8rem; font-weight: 700; background: var(--white); border-radius: 999px; padding: 2px 10px; border: 1.5px solid var(--line); }
.bin.gulp { animation: gulp 0.4s ease; }
@keyframes gulp { 40% { transform: scale(1.1); } }

.explain-box {
  margin-top: 16px; border-radius: 16px; padding: 14px 18px; background: var(--purple-soft); color: var(--ink);
  display: flex; gap: 12px; align-items: flex-start; animation: clue-in 0.35s ease;
}
.explain-box.good { background: var(--green-soft); }
.explain-box.bad { background: var(--pink-soft); }
.explain-box p { margin: 0; font-size: 0.95rem; }
.explain-box strong { font-family: var(--display); }

.case-file { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; text-align: left; }
.case-file div { background: var(--white); border-radius: 14px; padding: 12px 14px; border: 1.5px solid var(--line); }
.case-file h3 { font-size: 1rem; margin-bottom: 6px; }
.case-file ul { margin: 0; padding-left: 18px; font-size: 0.88rem; }

/* ---------- Immune Team Defender ---------- */
.id-stage { position: relative; border-radius: 20px; overflow: hidden; border: 2px solid var(--ink); background: #fde9e2; touch-action: none; }
.id-stage canvas { display: block; width: 100%; height: auto; cursor: none; }
.meter { display: inline-flex; align-items: center; gap: 8px; }
.meter .track { width: 120px; height: 12px; border-radius: 6px; background: var(--white); border: 1.5px solid var(--ink); overflow: hidden; }
.meter .fill { height: 100%; width: 0; background: var(--pink); transition: width 0.2s; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend svg { width: 30px; height: 30px; }
.mode-tag { font-family: var(--display); font-weight: 800; color: var(--white); background: var(--purple); padding: 4px 12px; border-radius: 10px; font-size: 0.95rem; }
.mode-tag.over { background: var(--pink-ink); }

/* ---------- Vaccine Lab ---------- */
.level-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.level-tabs button {
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 2px solid var(--ink); background: var(--white);
  font: 600 0.95rem var(--body); color: var(--ink); cursor: pointer; display: inline-flex; gap: 8px; align-items: center;
}
.level-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.level-tabs button:disabled { opacity: 0.45; cursor: not-allowed; }
.level-tabs .mini-stars { color: var(--yellow); letter-spacing: 1px; font-size: 0.9rem; }

.vl-stage { position: relative; border-radius: 22px; }
.lab { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.bottle-svg { width: 100%; max-width: 250px; display: block; margin: 0 auto; overflow: visible; }
.bottle-svg .liquid { transition: height 0.6s cubic-bezier(0.3, 1.2, 0.5, 1), y 0.6s cubic-bezier(0.3, 1.2, 0.5, 1); }
.bottle-svg.bubbling .bubble { animation: bubble-up 1.6s ease-in infinite; }
.bottle-svg .bubble { opacity: 0; }
@keyframes bubble-up { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 0.9; } 100% { transform: translateY(-120px); opacity: 0; } }
.bottle-svg.yuck { animation: shake 0.45s; }
.bottle-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: 0.85rem; font-weight: 600; }
.bottle-list li { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); }
.bottle-list li i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1.5px solid var(--ink); background: var(--white); }
.bottle-list li.got { color: var(--ink); }

.ing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ing {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px; border-radius: 16px;
  border: 2px solid var(--ink); background: var(--white); cursor: pointer; font: inherit; color: var(--ink);
  transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1), background 0.2s, opacity 0.3s;
}
.ing:hover { background: var(--purple-soft); box-shadow: 0 4px 0 var(--ink); }
.ing svg { width: 44px; height: 44px; flex: 0 0 44px; }
.ing b { display: block; font-size: 0.95rem; line-height: 1.25; }
.ing small { display: block; font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.ing.used { opacity: 0.35; pointer-events: none; transform: scale(0.95); }
.ing.wrong { background: var(--pink-soft); animation: shake 0.45s; }

.steps-pool { display: grid; gap: 10px; }
.step-card {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; border-radius: 14px;
  border: 2px solid var(--ink); background: var(--white); cursor: pointer; font: 600 0.98rem var(--body); color: var(--ink);
  transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1), background 0.2s;
}
.step-card:hover { background: var(--purple-soft); box-shadow: inset 6px 0 0 var(--purple); }
.step-card.wrong { background: var(--pink-soft); animation: shake 0.45s; }
.step-card svg { width: 34px; height: 34px; flex: 0 0 34px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: t; }
.timeline li {
  counter-increment: t; margin: 0; min-height: 50px; border-radius: 14px; border: 2px dashed #b9addf;
  display: flex; align-items: center; gap: 12px; padding: 8px 14px; font-weight: 600; color: var(--muted); font-size: 0.92rem;
}
.timeline li::before {
  content: counter(t); width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background: var(--purple-soft); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800;
}
.timeline li.done { border: 2px solid #7cc5a0; background: var(--green-soft); color: var(--green-ink); animation: score-pop 0.4s cubic-bezier(0.25, 1.6, 0.4, 1); }
.timeline li.done::before { background: #2f8a5b; color: var(--white); }

.train-field { position: relative; height: 340px; border-radius: 20px; border: 2px solid var(--ink); overflow: hidden; background: radial-gradient(circle at 30% 30%, #fff 0, #fde9e2 70%); touch-action: manipulation; }
.germ-btn {
  position: absolute; width: 64px; height: 64px; border: 0; background: none; padding: 0; cursor: crosshair;
  animation: germ-wobble 1.2s ease-in-out infinite; transition: transform 0.15s;
}
.germ-btn svg { width: 100%; height: 100%; overflow: visible; }
.germ-btn:active { transform: scale(0.85); }
.germ-btn.pop { animation: germ-pop 0.35s ease-out forwards; pointer-events: none; }
.germ-btn .hp { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); display: flex; gap: 3px; }
.germ-btn .hp i { width: 9px; height: 9px; border-radius: 50%; background: var(--pink-ink); border: 1.5px solid var(--white); }
@keyframes germ-wobble { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.06); } }
@keyframes germ-pop { to { transform: scale(1.7); opacity: 0; } }
.train-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.train-compare div { border-radius: 14px; padding: 12px 16px; background: var(--purple-soft); }
.train-compare b { font-family: var(--display); font-size: 1.6rem; color: var(--ink); display: block; }
.train-compare span { font-size: 0.85rem; font-weight: 600; }

.vl-learn { margin-top: 18px; padding: 16px 18px; border-radius: 16px; background: #fff6dc; color: var(--ink); }
.vl-learn p { margin: 0; font-size: 0.95rem; }

@media (max-width: 820px) {
  .game-hub, .bins, .case-file, .lab, .ing-grid, .train-compare { grid-template-columns: minmax(0, 1fr); }
  .bins { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .bin { padding: 12px 6px; }
  .bin small { display: none; }
  .bin strong { font-size: 0.92rem; }
  .bin svg { width: 34px; height: 34px; }
  .game-wrap { padding: 16px; box-shadow: 4px 4px 0 var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  .clue, .germ-btn, .bubble { animation: none !important; }
}

/* overlays that hold long results sit in the page flow */
.overlay.static { position: relative; inset: auto; background: transparent; padding: 8px 0; }
.td-stage.done .td-case, .td-stage.done .bins, .td-stage.done #td-explain { display: none; }
.td-stage { min-height: 380px; }
@media (max-width: 820px) {
  .id-stage .overlay { position: relative; inset: auto; border-radius: 0; border-bottom: 2px solid var(--ink); }
  .id-stage .overlay[hidden] { display: none; }
  .vl-stage .overlay { align-items: flex-start; overflow: auto; }
}

[hidden] { display: none !important; }

/* ---------- Cellie in the games ---------- */
.overlay-inner > [data-cellie] { margin-bottom: -4px; }
.explain-box > [data-cellie] { margin: -6px 0 -6px -4px; }
.explain-box > div { min-width: 0; }
.vl-react { display: flex; align-items: center; gap: 10px; min-height: 64px; margin-top: 8px; }
.vl-react .game-msg { margin: 0; }
.page-hero .games-cellie { position: absolute; right: max(24px, calc((100% - 1080px) / 2)); bottom: 0; display: flex; align-items: flex-end; gap: 10px; z-index: 1; }
.games-cellie .cellie-bubble { max-width: 230px; margin: 0 0 80px; }
@media (max-width: 960px) {
  .page-hero .games-cellie { position: static; justify-content: flex-start; margin: 16px 0 0; }
  .games-cellie .cellie-bubble { margin-bottom: 50px; }
  .games-cellie .cellie-svg { width: 110px; height: 110px; }
}
