:root {
  --bg: #0f1225;
  --bg2: #1a1f3a;
  --card: #232a4a;
  --text: #f4f6ff;
  --muted: #a8b0d0;
  --primary: #5B8DEF;
  --primary-dark: #3d6fd4;
  --accent: #FFD166;
  --success: #06D6A0;
  --danger: #EF476F;
  --purple: #7B6CF6;
  --radius: 20px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  font-size: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: linear-gradient(160deg, #0f1225 0%, #1a1440 50%, #0f1225 100%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

#app { max-width: 720px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }

.screen { display: none; padding: 1rem 1.25rem 2rem; animation: fadeIn .35s ease; }
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: .75rem;
}

.logo {
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.logo-sub { color: var(--muted); font-weight: 700; font-size: .85rem; margin-left: .25rem; }

.hero, .summary-card, .parent-panel {
  text-align: center;
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
  box-shadow: var(--shadow);
}

.robot-hero { margin-bottom: .5rem; }
.robot-celebrate { font-size: 3.5rem; margin-bottom: .5rem; }

h1 { font-size: 1.85rem; font-weight: 900; margin-bottom: .5rem; line-height: 1.2; }
h2 { font-size: 1.15rem; font-weight: 800; margin: 1.25rem 0 .75rem; color: var(--accent); }

.tagline { color: var(--muted); line-height: 1.45; margin-bottom: 1.25rem; }
.muted { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.stat-chip {
  background: var(--bg2);
  border-radius: 999px;
  padding: .45rem .9rem;
  font-weight: 800;
  font-size: .9rem;
}

.btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .choice-btn {
  font-family: inherit;
  font-weight: 800;
  border: none;
  cursor: pointer;
  border-radius: 16px;
  transition: transform .12s, filter .12s, background .12s;
}
.btn-primary:hover, .btn-secondary:hover, .choice-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn-primary:active, .btn-secondary:active, .choice-btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white;
  box-shadow: 0 4px 0 var(--primary-dark);
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--bg2);
  color: var(--text);
  border: 2px solid var(--primary);
  margin-top: .75rem;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: .4rem .8rem;
  font-size: .9rem;
}
.btn-ghost:hover { color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
  margin-top: 1.5rem;
  padding: .5rem 1rem;
}

.btn-xl { font-size: 1.25rem; padding: 1rem 1.75rem; width: 100%; max-width: 360px; }
.btn-lg { font-size: 1.1rem; padding: .85rem 1.5rem; min-width: 160px; }
.btn-sm { font-size: .85rem; }

.session-bar { flex-wrap: wrap; }
.progress-wrap { flex: 1; min-width: 160px; }
.progress-label { font-weight: 800; font-size: .85rem; margin-bottom: .35rem; color: var(--muted); }
.progress-track {
  height: 12px;
  background: var(--bg2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--success), var(--accent));
  border-radius: 999px;
  transition: width .3s ease;
}
.session-rewards {
  display: flex;
  gap: .75rem;
  font-weight: 800;
  font-size: 1rem;
}

.question-area {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.skill-badge {
  display: inline-block;
  background: var(--bg2);
  color: var(--accent);
  font-weight: 800;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .35rem .75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.question-prompt {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 1.25rem;
}

.question-visual {
  margin: 0 auto 1.25rem;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
}

.question-visual svg {
  max-width: 100%;
  height: auto;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
}

.answer-area {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  align-items: stretch;
  max-width: 420px;
  margin: 0 auto 1rem;
}

.choice-btn {
  background: var(--bg2);
  color: var(--text);
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  text-align: left;
  border: 3px solid transparent;
}
.choice-btn.selected { border-color: var(--primary); background: #2a3560; }
.choice-btn.correct { border-color: var(--success); background: #0d4a3a; }
.choice-btn.wrong { border-color: var(--danger); background: #4a1a28; }
.choice-btn:disabled { cursor: default; transform: none; }

.num-input-wrap {
  display: flex;
  gap: .5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.num-input {
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 800;
  width: 120px;
  text-align: center;
  padding: .75rem;
  border-radius: 14px;
  border: 3px solid var(--primary);
  background: var(--bg2);
  color: var(--text);
}
.num-input:focus { outline: none; border-color: var(--accent); }

.feedback {
  margin: 1rem auto;
  max-width: 420px;
  padding: 1rem;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.35;
}
.feedback.good {
  background: rgba(6, 214, 160, .2);
  color: var(--success);
  border: 2px solid var(--success);
}
.feedback.bad {
  background: rgba(239, 71, 111, .15);
  color: #ff8fab;
  border: 2px solid var(--danger);
}

.summary-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.25rem 0;
}
.big-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.big-stat span {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
}
.big-stat label {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 700;
}

.skills-list {
  list-style: none;
  text-align: left;
  max-width: 360px;
  margin: 0 auto 1.5rem;
}
.skills-list li {
  background: var(--bg2);
  padding: .65rem .9rem;
  border-radius: 12px;
  margin-bottom: .4rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
}
.skills-list .ok { color: var(--success); }

.parent-skills {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.skill-row {
  background: var(--bg2);
  border-radius: 14px;
  padding: .85rem 1rem;
}
.skill-row-header {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  margin-bottom: .4rem;
  font-size: .95rem;
}
.skill-bar {
  height: 10px;
  background: #0f1225;
  border-radius: 999px;
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
}
.skill-meta {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .35rem;
  font-weight: 700;
}
.parent-meta {
  margin-top: 1.25rem;
  font-weight: 700;
  color: var(--muted);
  font-size: .9rem;
}
.parent-settings {
  text-align: left;
  margin: 1.25rem 0 1rem;
  padding: 1rem;
  background: var(--bg2);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
}
.parent-settings-title {
  margin: 0 0 .75rem;
  font-size: 1.05rem;
  color: var(--accent);
}
.parent-setting-row {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  cursor: pointer;
  font-weight: 700;
}
.parent-setting-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.parent-setting-text {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.parent-setting-desc {
  font-weight: 600;
  color: var(--muted);
  font-size: .9rem;
}
.parent-setting-status {
  font-size: .8rem;
  font-weight: 700;
}
.parent-settings-note {
  margin: .75rem 0 0;
  font-size: .8rem;
  line-height: 1.35;
}

.coin-row, .money-visual {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: .5rem;
}
.coin {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: .7rem;
  border: 3px solid rgba(0,0,0,.2);
  color: #1a1a2e;
}
.coin.penny { background: #cd7f32; }
.coin.nickel { background: #c0c0c0; }
.coin.dime { background: #b8b8b8; width: 40px; height: 40px; font-size: .6rem; }
.coin.quarter { background: #d4d4d4; width: 56px; height: 56px; }
.bill {
  background: #06D6A0;
  color: #0f1225;
  font-weight: 900;
  padding: .5rem .75rem;
  border-radius: 8px;
  border: 2px dashed #0f1225;
  font-size: .9rem;
}

.graph-legend {
  font-size: .85rem;
  color: #333;
  font-weight: 700;
  margin-top: .25rem;
}

@media (max-width: 480px) {
  :root { font-size: 16px; }
  h1 { font-size: 1.5rem; }
  .question-prompt { font-size: 1.1rem; }
  .choice-btn { font-size: 1rem; padding: .85rem 1rem; }
}
/* logo-img sized via .logo-badge rules */

/* ——— Logo badge (full wordmark legible on dark navy) ——— */
.logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #FFF8E7;
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: 0 2px 0 rgba(0,0,0,.2), 0 0 0 1px rgba(255,255,255,.08);
  line-height: 0;
}
.logo-img {
  height: 40px;
  width: auto;
  vertical-align: middle;
  margin-right: 0;
  border-radius: 0;
  display: block;
}
.logo-sub {
  color: var(--muted);
  font-weight: 700;
  font-size: .85rem;
  margin-left: 0;
}

.top-actions { display: flex; gap: .25rem; align-items: center; }

/* ——— Profiles ——— */
.profile-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
  margin: 1rem 0 1.25rem;
  text-align: left;
}
.profile-card {
  font-family: inherit;
  background: var(--bg2);
  border: 3px solid transparent;
  border-radius: 18px;
  padding: 1rem .75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  color: var(--text);
  transition: transform .12s, border-color .12s;
}
.profile-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.profile-avatar { font-size: 2.4rem; line-height: 1; }
.profile-name { font-weight: 900; font-size: 1.05rem; }
.profile-track { font-size: .75rem; font-weight: 700; color: var(--muted); }

.form-card { text-align: left; }
.form-card h1, .form-card .tagline { text-align: center; }
.field-label {
  display: block;
  font-weight: 800;
  font-size: .85rem;
  color: var(--accent);
  margin: .85rem 0 .35rem;
}
.text-input, select.text-input {
  width: 100%;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: .75rem 1rem;
  border-radius: 14px;
  border: 3px solid var(--primary);
  background: var(--bg2);
  color: var(--text);
}
.text-input:focus { outline: none; border-color: var(--accent); }
.pin-input { letter-spacing: .35em; text-align: center; font-size: 1.4rem; }
.pin-input-lg { font-size: 2rem; padding: 1rem; max-width: 220px; margin: 0 auto; display: block; }
.form-error {
  color: #ff8fab;
  font-weight: 800;
  margin: .75rem 0;
  text-align: center;
}
.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.avatar-btn {
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 3px solid transparent;
  background: var(--bg2);
  cursor: pointer;
}
.avatar-btn.selected { border-color: var(--accent); background: #2a3560; }

.home-kid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.home-kid-avatar { font-size: 2.5rem; line-height: 1; }
.home-kid-name { font-weight: 900; font-size: 1.25rem; text-align: left; }
.home-track-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-align: left; }
.parent-kid-label { font-weight: 800; color: var(--accent); margin-bottom: .5rem; }

/* ——— Preschool ——— */
body.track-preschool {
  background: linear-gradient(160deg, #1a1440 0%, #2a1f55 40%, #1a3050 100%);
}
body.track-preschool .question-prompt { font-size: 1.45rem; }
body.track-preschool .choice-btn-xl {
  font-size: 1.45rem;
  padding: 1.25rem 1.35rem;
  min-height: 64px;
  text-align: center;
  border-radius: 20px;
}
.btn-replay[hidden] { display: none !important; }
.btn-replay {
  font-family: inherit;
  font-weight: 800;
  font-size: .95rem;
  background: var(--bg2);
  color: var(--accent);
  border: 2px solid var(--purple);
  border-radius: 999px;
  padding: .45rem 1rem;
  cursor: pointer;
  margin: 0 auto 1rem;
  display: inline-block;
}
.feedback.hint {
  background: rgba(255, 209, 102, .18);
  color: var(--accent);
  border: 2px solid var(--accent);
}
.choice-btn.soft-wrong {
  border-color: var(--accent);
  animation: softShake .4s ease;
}
@keyframes softShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.pre-count-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 360px;
  margin: 0 auto;
}
.pre-item { line-height: 0; }
.pre-item svg { background: transparent !important; padding: 0 !important; }
.pre-big-number {
  font-size: 5rem;
  font-weight: 900;
  color: #1a1a2e;
  background: #FFF8E7;
  width: 120px;
  height: 120px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto .5rem;
}
.pre-robot-side { display: flex; justify-content: center; }
.pre-robot-side svg { background: transparent !important; padding: 0 !important; }
.pre-shape-showcase svg { background: #FFF8E7 !important; border-radius: 20px; padding: 12px; }
.pre-compare-row, .pre-groups {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
}
.pre-compare-opt, .pre-group {
  background: #FFF8E7;
  border-radius: 16px;
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
}
.pre-compare-tag {
  font-weight: 900;
  font-size: 1.1rem;
  color: #1a1a2e;
}
.pre-compare-opt svg, .pre-robot-side svg { background: transparent !important; }
.pre-dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 140px; }
.pre-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid rgba(0,0,0,.15);
}
.pre-pattern {
  display: flex;
  gap: .4rem;
  justify-content: center;
  flex-wrap: wrap;
  background: #FFF8E7;
  padding: 1rem;
  border-radius: 16px;
}
.pre-pattern-cell {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  border: 2px solid #ddd;
}
.pre-pattern-cell.ask {
  border: 3px dashed var(--primary);
  color: var(--primary);
  font-weight: 900;
  background: #eef3ff;
}

@media (max-width: 480px) {
  .logo-img { height: 36px; }
  .logo-badge { padding: 5px 8px; }
}

/* ——— Multi-grade presentation ——— */
body.track-early {
  background: linear-gradient(160deg, #152238 0%, #1e3a5f 45%, #152238 100%);
}
body.track-upper {
  background: linear-gradient(160deg, #0c1020 0%, #161b33 50%, #0c1020 100%);
}
body.track-early .choice-btn-xl,
body.track-preschool .choice-btn-xl {
  font-size: 1.4rem;
  padding: 1.2rem 1.3rem;
  min-height: 60px;
  text-align: center;
}
.big-eq {
  font-size: 2rem;
  font-weight: 900;
  color: #1a1a2e;
  background: #FFF8E7;
  display: inline-block;
  padding: 1rem 1.5rem;
  border-radius: 16px;
  margin: .5rem auto;
}
.eq-visual { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.place-value-visual {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: flex-end;
  background: #FFF8E7; padding: 1rem; border-radius: 14px; max-width: 360px; margin: 0 auto;
}
.tens-rod {
  width: 18px; height: 90px; background: linear-gradient(#5B8DEF, #3d6fd4);
  border-radius: 4px; border: 2px solid #1a1a2e;
}
.ones-cube {
  width: 22px; height: 22px; background: #FFD166;
  border-radius: 4px; border: 2px solid #1a1a2e;
}
.length-compare {
  display: flex; flex-direction: column; gap: 1rem; align-items: flex-start;
  background: #FFF8E7; padding: 1rem 1.25rem; border-radius: 14px; max-width: 360px; margin: 0 auto;
}
.ribbon {
  height: 22px; border-radius: 6px; min-width: 20px;
  border: 2px solid rgba(0,0,0,.2);
}
.field-hint { margin-top: .35rem; margin-bottom: 0; }
.frac-choices-hint { color: #333; font-weight: 700; margin-bottom: .5rem; }
#btn-edit-profile { margin-top: 1rem; width: 100%; max-width: 360px; }

.pin-save-display {
  font-size: 2.75rem;
  font-weight: 900;
  letter-spacing: 0.45em;
  text-align: center;
  background: #FFF8E7;
  color: #1a1a2e;
  border-radius: 16px;
  padding: 1rem 1.25rem;
  margin: 1rem auto;
  max-width: 280px;
  border: 3px solid var(--accent);
}
.pin-save-warn { text-align: left; margin: .75rem 0 1rem; line-height: 1.4; }
.pin-save-check-label {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  font-weight: 800;
  margin: 1rem 0 1.25rem;
  cursor: pointer;
  text-align: left;
}
.pin-save-check-label input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: .15rem;
  flex-shrink: 0;
}
.pin-entry-hint { text-align: left; font-size: .85rem; margin-bottom: 1rem; }

/* ——— Robot builder ——— */
.robot-panel {
  background: var(--bg2);
  border-radius: 18px;
  padding: 1rem;
  margin: 0 auto 1.25rem;
  text-align: left;
  max-width: 520px;
}
.robot-panel-main {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.robot-svg-wrap { line-height: 0; }
.robot-build-svg { background: transparent !important; padding: 0 !important; border-radius: 16px; }
.robot-panel-info { flex: 1; min-width: 160px; }
.robot-design-name { font-weight: 900; font-size: 1.15rem; color: var(--accent); }
.robot-parts-count { font-weight: 800; margin: .25rem 0 .5rem; }
.next-part-label { font-size: .85rem; color: var(--muted); font-weight: 700; margin-bottom: .4rem; }
.next-part-track {
  height: 12px;
  background: #0f1225;
  border-radius: 999px;
  overflow: hidden;
}
.next-part-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 999px;
  transition: width .3s ease;
}
.robot-part-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .85rem;
}
.robot-part-chip {
  font-size: .7rem;
  font-weight: 800;
  background: #0f1225;
  color: var(--muted);
  border-radius: 999px;
  padding: .25rem .55rem;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  opacity: .55;
}
.robot-part-chip.got { opacity: 1; color: var(--text); background: #1e2a4a; border: 1px solid var(--success); }
.robot-part-chip span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.garage-section { margin-top: 1rem; border-top: 1px solid rgba(255,255,255,.08); padding-top: .75rem; }
.garage-title { font-size: 1rem; font-weight: 900; color: var(--accent); margin-bottom: .5rem; }
.garage-count {
  display: inline-block;
  background: var(--purple);
  color: #fff;
  border-radius: 999px;
  padding: .1rem .5rem;
  font-size: .75rem;
  margin-left: .35rem;
}
.garage-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}
.garage-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  font-size: .7rem;
  font-weight: 800;
  background: #0f1225;
  border-radius: 12px;
  padding: .4rem;
  width: 96px;
}
.garage-item svg { background: transparent !important; padding: 0 !important; }
.garage-empty { font-size: .85rem; }

.session-robot-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--card);
  border-radius: 14px;
  padding: .5rem .75rem;
  margin-bottom: .85rem;
}
.session-robot-mini { line-height: 0; flex-shrink: 0; }
.session-robot-mini svg { background: transparent !important; padding: 0 !important; }
.session-robot-meta { flex: 1; font-weight: 800; font-size: .85rem; color: var(--muted); }
.session-track { margin-top: .35rem; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 24, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn .25s ease;
}
.overlay[hidden] { display: none !important; }
.overlay-card {
  background: var(--card);
  border-radius: 24px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
  border: 2px solid var(--accent);
}
.overlay-card-wide { max-width: 460px; }
.unlock-burst { font-size: 2.5rem; animation: pop .5s ease; }
.unlock-visual { margin: .5rem 0 1rem; }
.unlock-visual svg { background: transparent !important; }
@keyframes pop {
  0% { transform: scale(.4); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.assembly-stage {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}
.assembly-stage.assembled { animation: pop .55s ease; }
.assembly-fly {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
  max-width: 280px;
}
.assembly-chip {
  font-size: 1.75rem;
  animation: flyIn .5s ease both;
}
@keyframes flyIn {
  from { transform: translateY(40px) scale(.5); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ——— Chests & workshop ——— */
.garage-chest {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  background: #0f1225;
  border: 2px solid var(--accent);
  border-radius: 14px;
  padding: .5rem .4rem;
  width: 110px;
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
  font-size: .75rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.garage-chest .chest-sub { font-size: .65rem; color: var(--muted); font-weight: 700; }
.garage-chest.bounce-glow {
  animation: chestBounce 1.1s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 209, 102, .55);
}
.garage-chest.mid-build { border-color: var(--success); }
@keyframes chestBounce {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(255, 209, 102, .4); }
  50% { transform: translateY(-6px); box-shadow: 0 0 18px 4px rgba(255, 209, 102, .55); }
}
.chest-svg { display: block; }

.overlay-workshop { align-items: stretch; padding: .5rem; }
.workshop-card {
  background: var(--card);
  border-radius: 20px;
  width: min(560px, 100%);
  max-height: 96dvh;
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
}
.workshop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.workshop-header h2 { font-size: 1.15rem; margin: 0; color: var(--accent); }
.workshop-close { font-size: 1.25rem; min-width: 44px; min-height: 44px; }
.workshop-hint { padding: 0 1rem; margin: .5rem 0; font-weight: 700; }
.workshop-playfield {
  position: relative;
  flex: 1;
  min-height: 340px;
  margin: .25rem .75rem 1rem;
  background: #12162c;
  border-radius: 16px;
  overflow: hidden;
}
.workshop-chest {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 12px;
  min-width: 120px;
  min-height: 120px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.workshop-chest.bounce-glow { animation: chestBounce 1.1s ease-in-out infinite; }
.workshop-chest.chest-opening { animation: chestPop .45s ease forwards; }
@keyframes chestPop {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.25) rotate(-6deg); }
  100% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
}
.workshop-scatter { position: absolute; inset: 0; }
.scatter-part {
  position: absolute;
  width: 72px;
  min-height: 72px;
  border-radius: 16px;
  border: 3px solid var(--accent);
  background: #1a2140;
  color: var(--text);
  font-family: inherit;
  font-weight: 800;
  font-size: .65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: .35rem;
  animation: scatterIn .4s ease both;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 2;
}
.scatter-part:active { transform: scale(0.94); }
.scatter-emoji { font-size: 1.6rem; line-height: 1; }
.scatter-label { max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scatter-part.flying {
  animation: flyToFrame .28s ease forwards;
  pointer-events: none;
  z-index: 5;
}
@keyframes scatterIn {
  from { transform: scale(0.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes flyToFrame {
  to { transform: translate(20px, -40px) scale(0.3); opacity: 0; }
}
.workshop-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
  pointer-events: none;
}
.workshop-frame.snap-pop { animation: snapPop .35s ease; }
@keyframes snapPop {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.35); transform: translate(-50%, -50%) scale(1.04); }
  100% { filter: brightness(1); transform: translate(-50%, -50%) scale(1); }
}
.workshop-frame svg { background: transparent !important; padding: 0 !important; }
.workshop-placed-count {
  font-weight: 900;
  color: var(--accent);
  margin-top: .25rem;
  font-size: .9rem;
}
.workshop-done {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
}
.workshop-done h3 { color: var(--accent); margin-bottom: .75rem; }
.workshop-done svg { background: transparent !important; }

@media (max-width: 480px) {
  .scatter-part { width: 64px; min-height: 64px; }
  .workshop-playfield { min-height: 320px; }
}

/* ——— Rarity + shimmer ——— */
.rarity-badge {
  display: inline-block;
  font-size: .6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .15rem .4rem;
  border-radius: 999px;
  margin-top: .15rem;
}
.rarity-badge-common { background: #4a5568; color: #e2e8f0; }
.rarity-badge-rare { background: #2563eb; color: #fff; }
.rarity-badge-epic { background: #7c3aed; color: #fff; }
.rarity-badge-legendary {
  background: linear-gradient(90deg, #f59e0b, #ef4444, #8b5cf6);
  color: #fff;
}
.shimmer-badge {
  display: inline-block;
  font-size: .58rem;
  font-weight: 900;
  padding: .12rem .35rem;
  border-radius: 999px;
  margin-top: .1rem;
}
.shimmer-badge-gold { background: #fbbf24; color: #1a1a2e; }
.shimmer-badge-rainbow {
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e, #3b82f6, #a855f7);
  color: #fff;
}
.garage-chest.rarity-rare { border-color: #3b82f6; }
.garage-chest.rarity-epic { border-color: #a855f7; }
.garage-chest.rarity-legendary { border-color: #f59e0b; box-shadow: 0 0 12px rgba(245, 158, 11, .45); }

.robot-svg-shell {
  position: relative;
  display: inline-block;
  line-height: 0;
  border-radius: 16px;
  overflow: hidden;
}
.robot-svg-shell .robot-build-svg {
  background: transparent !important;
  padding: 0 !important;
  display: block;
}
.robot-shimmer-gold::after,
.robot-shimmer-rainbow::after {
  content: '';
  position: absolute;
  inset: -20%;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 215, 64, 0.55) 45%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 215, 64, 0.55) 55%,
    transparent 70%
  );
  animation: shimmerSweep 2.2s ease-in-out infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}
.robot-shimmer-rainbow::after {
  background: linear-gradient(
    120deg,
    transparent 25%,
    rgba(255, 0, 80, 0.5) 35%,
    rgba(255, 200, 0, 0.55) 42%,
    rgba(0, 255, 140, 0.55) 50%,
    rgba(0, 160, 255, 0.55) 58%,
    rgba(180, 0, 255, 0.5) 65%,
    transparent 75%
  );
  animation-duration: 1.8s;
}
@keyframes shimmerSweep {
  0% { transform: translateX(-60%) rotate(12deg); }
  100% { transform: translateX(60%) rotate(12deg); }
}


/* ——— Home navigation ——— */
.btn-nav-home {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: inherit;
  font-weight: 800;
  font-size: .95rem;
  color: var(--text);
  background: var(--bg2);
  border: 2px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: .45rem .85rem .45rem .65rem;
  cursor: pointer;
  min-height: 44px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.btn-nav-home:hover,
.btn-nav-home:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.nav-home-icon { font-size: 1.15rem; line-height: 1; }
.nav-home-label { letter-spacing: -0.01em; }

.logo-home {
  display: inline-flex;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}
.logo-home:hover .logo-badge,
.logo-home:focus-visible .logo-badge {
  box-shadow: 0 2px 0 rgba(0,0,0,.2), 0 0 0 2px var(--accent);
  outline: none;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.session-bar .progress-wrap { flex: 1; min-width: 0; }
.session-bar .session-rewards {
  display: flex;
  gap: .65rem;
  font-weight: 800;
  white-space: nowrap;
}

.leave-actions {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-top: .5rem;
}
.leave-card .tagline { margin-bottom: 1rem; }
#overlay-leave-mission { z-index: 1100; }

.workshop-header #workshop-title { flex: 1; text-align: center; margin: 0; }

@media (max-width: 420px) {
  .btn-nav-home { padding: .4rem .7rem .4rem .55rem; font-size: .85rem; }
}

/* ——— Parent account ——— */
.account-banner {
  background: rgba(91, 141, 239, .18);
  border: 1px solid rgba(91, 141, 239, .45);
  border-radius: 14px;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--text);
}
.account-actions { margin-top: 1rem; }
.account-guest-note { margin-top: .75rem; font-size: .8rem; }
.account-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  justify-content: center;
}
.account-tab {
  font-family: inherit;
  font-weight: 800;
  border: 2px solid rgba(255,255,255,.12);
  background: var(--bg2);
  color: var(--muted);
  border-radius: 999px;
  padding: .45rem 1rem;
  cursor: pointer;
}
.account-tab.active {
  color: var(--text);
  border-color: var(--primary);
  background: rgba(91, 141, 239, .2);
}
.import-list {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin: 1rem 0;
}
.import-row {
  background: var(--bg2);
  border-radius: 14px;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.import-row label { font-weight: 800; display: flex; gap: .5rem; align-items: center; }
.parent-reset-pin {
  text-align: left;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg2);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
}

/* ——— Grown-ups info ——— */
.grownups-link-wrap { margin-top: 1.25rem; }
.btn-grownups.linkish, .linkish {
  background: none; border: none; color: var(--muted);
  font-family: inherit; font-weight: 700; font-size: .85rem;
  text-decoration: underline; cursor: pointer; padding: .35rem;
}
.btn-grownups.linkish:hover { color: var(--accent); }
.info-layout {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 640px) {
  .info-layout { grid-template-columns: 1fr; }
}
.info-nav {
  display: flex; flex-direction: column; gap: .35rem;
  background: var(--card); border-radius: 14px; padding: .75rem;
}
.info-nav button {
  text-align: left; font-family: inherit; font-weight: 800;
  border: none; background: transparent; color: var(--muted);
  padding: .55rem .7rem; border-radius: 10px; cursor: pointer;
}
.info-nav button.active, .info-nav button:hover {
  background: rgba(91,141,239,.2); color: var(--text);
}
.info-article {
  background: var(--card); border-radius: var(--radius);
  padding: 1.5rem 1.25rem; text-align: left; box-shadow: var(--shadow);
  line-height: 1.5;
}
.info-article h1 { font-size: 1.5rem; margin-bottom: .75rem; }
.info-article h2 { font-size: 1.05rem; margin: 1.1rem 0 .4rem; color: var(--accent); }
.info-article ul, .info-article ol { margin: .5rem 0 1rem 1.25rem; }
.info-article p { color: var(--text); margin-bottom: .75rem; }
.parent-focus {
  text-align: left; margin: 1.25rem 0 1rem; padding: 1rem;
  background: var(--bg2); border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
}
.parent-focus-list {
  display: flex; flex-direction: column; gap: .4rem;
  margin: .75rem 0;
  max-height: 240px; overflow: auto;
}
.focus-skill-row {
  display: flex; gap: .55rem; align-items: center;
  font-weight: 700; font-size: .9rem;
}
.focus-skill-row input { width: 18px; height: 18px; accent-color: var(--primary); }
