:root {
  --bg: #fffdf8;
  --surface: #ffffff;
  --surface-alt: #f5efff;
  --surface-violet: #ece3ff;
  --border: #ded8e7;
  --border-strong: #cec5dc;
  --text: #10245f;
  --ink: #10245f;
  --muted: #535c78;
  --muted-light: #59627b;
  --primary: #7545c8;
  --primary-dark: #5128a8;
  --primary-soft: #d7c4f3;
  --lavender: #9c72dc;
  --coral: #f33e78;
  --teal: #13a5ad;
  --amber: #ff9b14;
  --success-soft: #edf7ee;
  --success-border: #cce5cf;
  --success-text: #285f31;
  --danger-soft: #fff0ef;
  --danger-border: #f1c9c4;
  --danger-text: #8b3127;
  --warn-soft: #fff6e6;
  --warn-border: #ecd6aa;
  --warn-text: #74521b;
  --shell-width: 390px;
  --safe-top: 54px;
  --bottom-nav-height: 78px;
  --font-ui: "Avenir Next Rounded", "Avenir Next", "Trebuchet MS", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  background:
    radial-gradient(circle at 14% 18%, rgba(184, 155, 227, 0.24), transparent 25%),
    radial-gradient(circle at 88% 82%, rgba(240, 111, 127, 0.18), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.prototype-stage {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.72), rgba(255, 248, 241, 0.58)),
    radial-gradient(circle at 8% 10%, rgba(112, 66, 184, 0.14), transparent 32%),
    radial-gradient(circle at 92% 88%, rgba(233, 163, 66, 0.12), transparent 28%);
}

.device-shell {
  border: 8px solid #18151c;
  background: #18151c;
  box-shadow: 0 22px 65px rgba(24, 16, 47, 0.22);
}

.app-surface,
.screen {
  background: var(--bg);
}

.back-to-hub {
  top: 7px;
  left: 12px;
  min-width: auto;
  min-height: 44px;
  color: var(--primary-dark);
  border: 1px solid rgba(112, 66, 184, 0.16);
  box-shadow: none;
}

.screen-scroll {
  padding: 0 16px calc(var(--bottom-nav-height) + 22px);
}

.screen-enter .screen-scroll > * {
  animation: settle-in 280ms cubic-bezier(.2, .75, .25, 1) both;
}

@keyframes settle-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-header {
  min-height: 58px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.screen-header h1,
.screen-title {
  margin: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-action,
.icon-button {
  border: 0;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
}

.header-action:hover,
.icon-button:hover {
  background: var(--surface-alt);
}

.header-spacer {
  display: block;
  width: 44px;
  height: 44px;
}

.ui-icon {
  display: block;
  pointer-events: none;
}

.home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0 8px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.home-header h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.kids-home-header {
  align-items: center;
  padding-top: 10px;
}

.kids-home-header h1 {
  color: #1164bd;
  font-size: 24px;
  font-weight: 800;
}

.hello-sun {
  display: inline-block;
  margin-right: 5px;
}

.grownups-pill {
  min-width: auto;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #cfd6eb;
  border-radius: 999px;
  background: #fff;
  color: #293b72;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.picture-day-card {
  display: block;
  width: 100%;
  margin: 4px 0 12px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #7545c8;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
}

.picture-day-title {
  display: block;
  min-height: 30px;
  padding: 5px 10px;
  background: linear-gradient(135deg, #8f5bda, #7545c8);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.picture-day-card img {
  display: block;
  width: 100%;
  height: 142px;
  object-fit: cover;
}

.picture-day-play {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.header-actions {
  display: flex;
  gap: 2px;
}

.daily-card {
  position: relative;
  overflow: hidden;
  min-height: 154px;
  margin: 4px 0 18px;
  padding: 18px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(136deg, #a47ed8 0%, #b89be3 54%, #8e6eca 100%);
}

.daily-card::after {
  content: "❉";
  position: absolute;
  right: 15px;
  top: 20px;
  font-size: 92px;
  line-height: 1;
  color: rgba(255,255,255,.2);
}

.daily-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.daily-card p {
  max-width: 170px;
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255,255,255,.96);
}

.streak-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
}

.streak-row .ui-icon { color: #ffebe0; }

.continue-button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  min-width: auto;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 9px;
}

.section-heading h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.link-button {
  min-height: 44px;
  min-width: auto;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 11.5px;
  cursor: pointer;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-bottom: 18px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.category-card span:last-child {
  font-size: 10px;
  font-weight: 650;
}

.category-glyph {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-alt);
  color: var(--primary);
  font-size: 24px;
}

.category-card[data-accent="orange"] { border-color: #ffbf63; background: #fff4df; }
.category-card[data-accent="green"] { border-color: #92d465; background: #eefae7; }
.category-card[data-accent="blue"] { border-color: #73c9ef; background: #e9f8ff; }
.category-card[data-accent="pink"] { border-color: #f89abe; background: #fff0f6; }
.category-card[data-accent="purple"] { border-color: #b8a0eb; background: #f4efff; }
.category-card[data-accent="orange"] .category-glyph { color: var(--amber); }
.category-card[data-accent="green"] .category-glyph { color: #47a830; }
.category-card[data-accent="blue"] .category-glyph { color: #168ed1; }
.category-card[data-accent="pink"] .category-glyph { color: var(--coral); }
.category-card[data-accent="purple"] .category-glyph { color: var(--primary); }

.finish-button {
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
}

.reset-picture-button {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  border: 1.5px solid #f58a9c;
  border-radius: 13px;
  background: #fff5f6;
  color: #d94e69;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.reset-picture-button:active,
.reset-picture-button:hover {
  background: #ffe8ec;
}

.recent-list {
  display: grid;
  gap: 9px;
}

.recent-row {
  display: grid;
  grid-template-columns: 58px 1fr 38px;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.recent-row img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 10px;
}

.recent-row h3 {
  margin: 0 0 2px;
  font-size: 12.5px;
}

.recent-row p,
.recent-row small {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.progress-track {
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee7f2;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--lavender));
}

.empty-state {
  padding: 26px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: rgba(255,255,255,.62);
  text-align: center;
}

.empty-state .empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  place-items: center;
  border-radius: 17px;
  background: var(--surface-violet);
  color: var(--primary);
}

.empty-state h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.empty-state p {
  margin: 0 auto 13px;
  max-width: 250px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--primary);
  background: linear-gradient(135deg, #7f4cc4, #6236aa);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--primary-dark);
}

.danger-button {
  border: 1px solid var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.bottom-nav {
  position: relative;
  padding: 4px 9px 9px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.97);
}

.nav-item {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 58px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: #625b70;
  font-size: 9.5px;
  cursor: pointer;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 750;
}

.nav-item.nav-color {
  margin-top: -31px;
}

.nav-item.nav-color .nav-orb {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 5px solid var(--surface);
  border-radius: 50%;
  background: linear-gradient(145deg, #8a55ca, #5c30a6);
  color: #fff;
}

.nav-item.nav-color > span:last-child {
  color: var(--primary);
  font-weight: 750;
}

.search-wrap {
  position: relative;
  margin: 4px 0 13px;
}

.search-wrap .ui-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 43px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
}

.chip-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  min-width: auto;
  min-height: 44px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
}

.chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.design-grid,
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.reset-designs-button {
  display: grid;
  width: 100%;
  grid-template-columns: 38px 1fr 24px;
  align-items: center;
  gap: 10px;
  margin: -2px 0 13px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.reset-designs-button:hover {
  border-color: var(--primary-soft);
  background: var(--surface-alt);
}

.reset-designs-button > span:nth-child(2) {
  min-width: 0;
}

.reset-designs-button strong,
.reset-designs-button small {
  display: block;
}

.reset-designs-button strong {
  margin-bottom: 2px;
  font-size: 12px;
}

.reset-designs-button small {
  color: var(--muted);
  font-size: 10px;
}

.reset-designs-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-violet);
  color: var(--primary-dark);
}

.design-card,
.gallery-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.design-card img,
.gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f8f1e8;
}

.design-copy,
.gallery-copy {
  padding: 10px;
}

.design-copy h3,
.gallery-copy h3 {
  margin: 0 0 2px;
  font-size: 12px;
}

.design-copy p,
.gallery-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.workspace-scroll {
  padding-left: 10px;
  padding-right: 10px;
}

.artboard-wrap {
  position: relative;
  height: min(52vh, 450px);
  min-height: 350px;
  margin: 0 -2px 10px;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  touch-action: none;
}

#artboard {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: top left;
  transition: transform 90ms ease-out;
  touch-action: none;
}

#artboard.is-zoomed {
  cursor: grab;
}

.palette-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 9px 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.swatch,
.custom-swatch {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}

.swatch.active {
  border-color: #fff;
  outline: 2px solid var(--primary);
}

.custom-swatch {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  background: #fff;
}

.custom-swatch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.tool-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding-top: 9px;
}

.tool-button {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 55px;
  padding: 5px 2px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  font-size: 9px;
  cursor: pointer;
}

.tool-button.active {
  background: var(--surface-violet);
  color: var(--primary-dark);
  font-weight: 750;
}

.completion-art {
  display: block;
  width: min(100%, 315px);
  max-height: 43vh;
  margin: 0 auto 8px;
  object-fit: contain;
}

.completion-card {
  padding: 16px;
  border: 1px solid #eee6f3;
  border-radius: 20px;
  background: linear-gradient(180deg, #fbf8fd, #fff);
  text-align: center;
}

.screen[data-route="complete"] .screen-header h1 {
  color: var(--primary-dark);
  font-size: 20px;
  font-weight: 850;
}

.completion-stars {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: -2px 0 8px;
}

.completion-stars span {
  color: #ddd7e8;
  font-size: 44px;
  line-height: 1;
  -webkit-text-stroke: 2px #ffb11b;
}

.completion-stars span.filled {
  color: #ffd33d;
  filter: drop-shadow(0 3px 0 #f28b14);
}

.completion-card h2 {
  margin: 0 0 5px;
  font-size: 16px;
}

.completion-card > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 14px;
}

.metric {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 8px;
}

.metric + .metric { border-left: 1px solid var(--border); }

.metric strong,
.metric span { display: block; }
.metric strong { font-size: 14px; }
.metric span { margin-top: 1px; color: var(--muted); font-size: 9px; }

.completion-card .primary-button { width: 100%; }

.completion-card .completion-download {
  width: 100%;
  margin-top: 8px;
}

.reward-card {
  display: grid;
  grid-template-columns: 48px 1fr 24px;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #f2c476;
  border-radius: 15px;
  background: #fff9e9;
  text-align: left;
}

.reward-card small,
.reward-card strong {
  display: block;
}

.reward-card small {
  margin-bottom: 2px;
  color: var(--coral);
  font-size: 10px;
  font-weight: 750;
}

.reward-card strong {
  color: var(--primary-dark);
  font-size: 15px;
}

.reward-emoji {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 15px;
  background: #dff8ef;
  font-size: 28px;
}

.reward-star {
  color: #ffc21c;
  font-size: 24px;
}

.closing-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10.5px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.avatar {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--lavender), var(--coral));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.profile-hero h2 { margin: 0 0 3px; font-size: 16px; }
.profile-hero p { margin: 0; color: var(--muted); font-size: 11px; }

.name-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.name-card > span:first-child { font-size: 21px; }
.name-card > span:nth-child(2) { display: grid; gap: 2px; }
.name-card strong { font-size: 12px; }
.name-card small { color: var(--muted); font-size: 9.5px; }
.name-card input {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  min-height: 60px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 23px !important;
  font-weight: 700;
  outline-color: var(--primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 12px 0 17px;
}

.stat-card {
  padding: 12px 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}

.stat-card strong { display: block; font-size: 17px; color: var(--primary-dark); }
.stat-card span { color: var(--muted); font-size: 9.5px; }

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.sticker-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border: 1px solid #eadcf9;
  border-radius: 14px;
  background: #fbf7ff;
  text-align: center;
}

.sticker-card span {
  font-size: 27px;
}

.sticker-card small {
  color: var(--primary-dark);
  font-size: 8.5px;
  font-weight: 750;
}

.settings-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.settings-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 56px;
  gap: 11px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.settings-row:last-child { border-bottom: 0; }
.settings-row .row-icon { color: var(--primary); }
.settings-row .row-copy { flex: 1; }
.settings-row strong { display: block; font-size: 12px; }
.settings-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex: 0 0 44px;
  border-radius: 999px;
  background: #d7d0dc;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.toggle.on { background: var(--primary); }
.toggle.on::after { transform: translateX(18px); }

.info-card {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-alt);
}

.info-card h2,
.info-card h3 { margin: 0 0 6px; font-size: 14px; }
.info-card p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; }

.parent-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 26px;
  padding: 26px 22px;
  border: 1px solid #decdf5;
  border-radius: 22px;
  background: linear-gradient(180deg, #faf6ff, #fff);
  text-align: center;
}

.parent-lock {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 22px;
  background: var(--surface-violet);
  font-size: 31px;
}

.parent-gate h2 {
  margin: 0 0 5px;
  color: var(--primary-dark);
  font-size: 20px;
}

.parent-gate p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.parent-gate label {
  margin-bottom: 8px;
  font-size: 15px;
}

.parent-input {
  width: 112px;
  height: 52px;
  margin-bottom: 14px;
  border: 2px solid var(--primary-soft);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

.stack { display: grid; gap: 12px; }
.button-stack { display: grid; gap: 9px; margin-top: 14px; }
.button-stack > * { width: 100%; }

.toast {
  position: absolute;
  z-index: 80;
  left: 50%;
  bottom: calc(var(--bottom-nav-height) + 16px);
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-in 180ms ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.portrait-icon { font-size: 52px; margin-bottom: 14px; }
#appPortraitLock strong { font-size: 22px; margin-bottom: 8px; }
#appPortraitLock span { max-width: 280px; color: var(--muted); font-size: 14px; }

@media (max-width: 520px) {
  .device-shell { border: 0; }
  .back-to-hub { top: calc(7px + env(safe-area-inset-top)); }
}

@media (max-height: 730px) and (min-width: 521px) {
  :root { --safe-top: 44px; --bottom-nav-height: 70px; }
  .daily-card { min-height: 140px; margin-bottom: 13px; padding: 15px; }
  .category-grid { margin-bottom: 13px; }
  .artboard-wrap { min-height: 300px; height: 47vh; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   COLORING ADVENTURE THEME
   Bright, tactile UI styling around the existing artwork.
   ============================================================ */

:root {
  --bg: #fffdf7;
  --surface: #ffffff;
  --surface-alt: #f4f0ff;
  --surface-violet: #eee7ff;
  --border: #d9dff0;
  --border-strong: #bcc7e4;
  --text: #17316f;
  --ink: #17316f;
  --muted: #56617e;
  --muted-light: #5e6985;
  --primary: #6c3ce0;
  --primary-dark: #4725a8;
  --primary-soft: #cdbbff;
  --lavender: #9569ee;
  --coral: #ff3e75;
  --teal: #00b99a;
  --amber: #ffae16;
  --sky: #27a8f3;
  --lime: #74d533;
  --bottom-nav-height: 82px;
}

html,
body {
  background: #dff5ff;
}

.prototype-stage {
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 255, 255, .9) 0 5%, transparent 5.4%),
    radial-gradient(circle at 87% 78%, rgba(255, 225, 72, .32) 0 7%, transparent 7.4%),
    #dff5ff;
}

.device-shell {
  border-color: #12254c;
  background: #12254c;
  box-shadow: 0 24px 64px rgba(23, 49, 111, .25);
}

.app-surface,
.screen {
  background: var(--bg);
}

.back-to-hub {
  top: 6px;
  left: 13px;
  min-height: 42px;
  padding: 7px 13px;
  border: 2px solid #d9cff8;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  color: var(--primary-dark);
  box-shadow: 0 3px 0 #d9cff8;
  font-size: 12px;
  font-weight: 850;
}

.back-to-hub:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #d9cff8;
}

.screen-scroll {
  padding-left: 15px;
  padding-right: 15px;
}

.screen-header {
  min-height: 58px;
  margin: 0 -15px 16px;
  padding: 6px 13px;
  border-radius: 0 0 22px 22px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 5px 0 #d9cff8;
}

.screen-header h1,
.screen-title {
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0;
}

.screen-header .header-action {
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .78);
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.screen-header .header-action:hover,
.screen-header .header-action:active {
  background: rgba(255, 255, 255, .28);
}

.screen-header .finish-button {
  border-color: #fff;
  background: #37c94a;
  box-shadow: 0 3px 0 #188d2a;
}

.home-header {
  align-items: center;
  padding: 13px 0 11px;
}

.kids-home-header h1 {
  color: #1768bd;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0;
}

.hello-sun {
  filter: drop-shadow(0 2px 0 rgba(255, 174, 22, .25));
}

.grownups-pill {
  min-height: 42px;
  padding: 8px 11px;
  border: 2px solid #cbd5ed;
  background: #fff;
  color: var(--text);
  box-shadow: 0 3px 0 #cbd5ed;
  font-size: 10.5px;
}

.grownups-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #cbd5ed;
}

.picture-day-card {
  margin: 5px 0 17px;
  border: 3px solid var(--primary);
  border-radius: 22px;
  box-shadow: 0 6px 0 #d9cff8;
}

.picture-day-title {
  min-height: 39px;
  padding: 8px 12px;
  background: var(--primary);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
}

.picture-day-card img {
  height: 150px;
}

.picture-day-play {
  min-height: 45px;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 900;
}

.picture-day-card:active,
.category-card:active,
.design-card:active,
.gallery-card:active,
.primary-button:active,
.secondary-button:active {
  transform: translateY(2px);
}

.section-heading {
  margin-bottom: 10px;
}

.section-heading h2 {
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
}

.link-button {
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
}

.category-grid {
  gap: 9px;
  margin-bottom: 22px;
}

.category-card {
  min-height: 86px;
  gap: 7px;
  padding: 10px 4px 9px;
  border-width: 2px;
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(23, 49, 111, .10);
}

.category-card span:last-child {
  min-height: 26px;
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 850;
  line-height: 1.15;
  text-align: center;
}

.category-glyph {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .72);
  font-size: 25px;
}

.category-card[data-accent="orange"] { border-color: #ffbf45; background: #fff1cf; }
.category-card[data-accent="green"] { border-color: #85d959; background: #eaffdf; }
.category-card[data-accent="blue"] { border-color: #66c7f2; background: #e2f6ff; }
.category-card[data-accent="pink"] { border-color: #f897ba; background: #ffe8f1; }
.category-card[data-accent="purple"] { border-color: #ad8bea; background: #f0e9ff; }

.recent-list {
  gap: 11px;
}

.recent-row {
  grid-template-columns: 64px 1fr 38px;
  gap: 10px;
  padding: 9px;
  border: 2px solid #d7dff0;
  border-radius: 18px;
  box-shadow: 0 3px 0 #e5e9f4;
}

.recent-row img {
  width: 64px;
  height: 64px;
  border-radius: 13px;
}

.recent-row h3 {
  font-size: 13px;
  font-weight: 850;
}

.search-wrap {
  margin: 2px 0 14px;
}

.search-input {
  height: 50px;
  border: 2px solid #cad4e9;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 3px 0 #e2e7f2;
  font-size: 16px;
}

.search-input:focus {
  border-color: var(--primary);
}

.chip-row {
  gap: 8px;
  margin-bottom: 17px;
  padding-bottom: 4px;
}

.chip {
  min-height: 43px;
  padding: 8px 15px;
  border: 2px solid #d4daea;
  background: #fff;
  color: var(--text);
  box-shadow: 0 3px 0 #e4e7f0;
  font-size: 12px;
  font-weight: 800;
}

.chip.active {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 3px 0 var(--primary-dark);
  color: #fff;
}

.design-grid,
.gallery-grid {
  gap: 13px;
}

.design-card,
.gallery-card {
  border: 2px solid #d2daec;
  border-radius: 18px;
  box-shadow: 0 5px 0 #e1e6f2;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.design-card:nth-child(4n + 1),
.gallery-card:nth-child(4n + 1) { border-color: #73cdf2; }
.design-card:nth-child(4n + 2),
.gallery-card:nth-child(4n + 2) { border-color: #a68aef; }
.design-card:nth-child(4n + 3),
.gallery-card:nth-child(4n + 3) { border-color: #82d75b; }
.design-card:nth-child(4n + 4),
.gallery-card:nth-child(4n + 4) { border-color: #ff9abb; }

.design-card img,
.gallery-card img {
  border-bottom: 2px solid #e1e6f2;
}

.design-copy,
.gallery-copy {
  display: block;
  min-height: 66px;
  padding: 10px 9px 11px;
  background: #fff;
}

.design-copy h3,
.gallery-copy h3 {
  margin-bottom: 3px;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.design-copy p,
.gallery-copy p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.workspace-scroll {
  padding-left: 10px;
  padding-right: 10px;
}

.color-screen .screen-header {
  margin-left: -10px;
  margin-right: -10px;
}

.color-screen .screen-scroll {
  display: grid;
  grid-template-rows: auto minmax(190px, 1fr) auto auto auto;
  gap: 8px;
  padding-bottom: 8px;
  overflow-y: hidden;
}

.color-screen .screen-header.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 36px;
  margin-top: 0;
  margin-bottom: 0;
  padding: 0;
}

.color-screen .screen-header.compact > .header-spacer {
  grid-column: 1;
  width: 1px;
  height: 1px;
}

.color-header-actions {
  display: flex;
  grid-column: 2;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.color-header-button {
  display: inline-flex;
  min-width: 0;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 9px;
  border: 2px solid;
  border-radius: 11px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.color-header-button .ui-icon {
  flex: 0 0 auto;
}

.reset-header-button {
  border-color: #ff839e;
  background: #ee3e67;
  box-shadow: 0 3px 0 #b91f43;
}

.save-header-button {
  border-color: #78dd83;
  background: #37c94a;
  box-shadow: 0 3px 0 #188d2a;
}

.color-header-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 currentColor;
}

.artboard-wrap {
  height: auto;
  min-height: 0;
  margin: 0;
  border: 3px solid #d9dff0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 5px 0 #e3e7f1;
}

.palette-bar {
  gap: 6px;
  padding: 10px 8px;
  border: 2px solid #d3daeb;
  border-radius: 20px;
  box-shadow: 0 4px 0 #e2e7f2;
}

.swatch,
.custom-swatch {
  width: 43px;
  min-width: 43px;
  height: 43px;
  min-height: 43px;
  border-width: 3px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .10);
}

.swatch.active {
  border-color: #fff;
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  transform: scale(1.04);
}

.custom-swatch {
  border: 2px solid #cbd4e7;
  color: var(--primary);
  box-shadow: 0 3px 0 #e1e6f1;
}

.reset-picture-button {
  min-height: 45px;
  margin-top: 11px;
  border: 2px solid #ff91a9;
  border-radius: 15px;
  background: #fff0f4;
  box-shadow: 0 3px 0 #ffc9d5;
  color: #d9335b;
  font-size: 13px;
}

.tool-row {
  gap: 5px;
  padding-top: 0;
}

.tool-button {
  min-height: 62px;
  padding: 7px 2px 6px;
  border: 2px solid #d9dff0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 0 #e1e6f1;
  color: var(--text);
  font-size: 9.5px;
  font-weight: 800;
}

.tool-button:nth-child(1) { background: #f0ecff; border-color: #c5b4f3; }
.tool-button:nth-child(2) { background: #fff0f5; border-color: #f8b1c8; }
.tool-button:nth-child(3) { background: #eee8ff; border-color: #ad91ee; }
.tool-button:nth-child(4) { background: #e6f7ff; border-color: #8fd7f4; }
.tool-button:nth-child(5) { background: #fff4d8; border-color: #ffd16d; }
.tool-button:nth-child(6) { background: #eaffee; border-color: #9fe0a9; }

.tool-button.active {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 3px 0 var(--primary-dark);
  color: #fff;
}

#session-progress {
  align-self: center;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 850;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 49px;
  border-width: 2px;
  font-size: 14px;
  font-weight: 900;
}

.primary-button {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 4px 0 var(--primary-dark);
}

.secondary-button {
  border-color: #bdc9e4;
  box-shadow: 0 3px 0 #dfe4ef;
}

.danger-button {
  border-color: #f39aaa;
  box-shadow: 0 3px 0 #f6c9d1;
}

.empty-state,
.completion-card,
.profile-hero,
.name-card,
.stat-card,
.settings-list,
.info-card,
.parent-gate {
  border-width: 2px;
  border-color: #d5ddef;
  background: #fff;
  box-shadow: 0 5px 0 #e5e9f3;
}

.empty-state {
  padding: 28px 18px;
  border-style: dashed;
  border-radius: 20px;
}

.empty-state .empty-icon {
  background: #ede6ff;
  color: var(--primary);
}

.empty-state h3 {
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}

.empty-state p {
  font-size: 13px;
}

.completion-card {
  border-radius: 22px;
  background: #fff;
}

.reward-card {
  border: 2px solid #ffd069;
  background: #fff6d8;
  box-shadow: 0 3px 0 #ffe3a2;
}

.profile-hero {
  border-color: #bfa8f0;
  background: #f3edff;
}

.avatar {
  border: 3px solid #fff;
  background: var(--coral);
  box-shadow: 0 3px 0 #d9cff8;
}

.stat-card:nth-child(1) { border-color: #ffd069; background: #fff7de; }
.stat-card:nth-child(2) { border-color: #7dd4f3; background: #e8f8ff; }
.stat-card:nth-child(3) { border-color: #f7a2bd; background: #ffedf3; }

.settings-row {
  min-height: 62px;
  border-bottom-color: #e2e7f2;
}

.settings-row .row-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 12px;
  background: #eee7ff;
}

.toggle.on {
  background: var(--teal);
}

.bottom-nav {
  height: var(--bottom-nav-height);
  padding: 5px 8px 9px;
  border-top: 2px solid #d8deed;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 -5px 16px rgba(23, 49, 111, .07);
}

.nav-item {
  min-height: 59px;
  gap: 3px;
  color: #68718c;
  font-size: 10px;
  font-weight: 750;
}

.nav-item .ui-icon {
  stroke-width: 2.3;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 900;
}

.nav-item:not(.nav-color).active .ui-icon {
  filter: drop-shadow(0 2px 0 #d9cff8);
}

.nav-item.nav-color {
  margin-top: -34px;
}

.nav-item.nav-color .nav-orb {
  width: 59px;
  height: 59px;
  border: 5px solid #fff;
  background: var(--primary);
  box-shadow: 0 5px 0 var(--primary-dark), 0 7px 14px rgba(72, 37, 168, .22);
}

.nav-item.nav-color > span:last-child {
  color: var(--primary);
  font-weight: 900;
}

.toast {
  min-height: 40px;
  padding: 11px 16px;
  border: 2px solid #fff;
  background: var(--text);
  box-shadow: 0 4px 0 rgba(23, 49, 111, .18);
  font-size: 12px;
  font-weight: 800;
}

:focus-visible {
  outline: 3px solid #ffbf2f;
  outline-offset: 3px;
}

@media (max-width: 370px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .palette-bar { gap: 4px; padding-inline: 6px; }
  .swatch,
  .custom-swatch { width: 39px; min-width: 39px; height: 39px; min-height: 39px; }
  .tool-button { font-size: 8.5px; }
}

@media (max-height: 700px) {
  .color-screen .screen-scroll {
    grid-template-rows: auto minmax(145px, 1fr) auto auto auto;
    gap: 5px;
  }

  .color-screen .screen-header.compact {
    min-height: 34px;
  }

  .palette-bar {
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .swatch,
  .custom-swatch {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .tool-button {
    min-height: 50px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  #session-progress {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    font-size: 10px;
  }
}

@media (max-width: 520px) {
  .device-shell { border: 0; }
}

/* VisionVix app header */
:root {
  --app-bg: #fffdf7;
  --app-text: #4725a8;
  --app-line: #cfc2f1;
}

.app-surface {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  background: var(--app-bg);
}

.vv-app-header {
  position: relative;
  z-index: 30;
  box-sizing: border-box;
  display: flex;
  height: calc(36px + env(safe-area-inset-top, 0px));
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 0px) 7px 0;
  border-bottom: 1px solid rgba(108, 60, 224, .10);
  background: var(--app-bg);
}

.app-root {
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding-top: 0;
}

.vv-my-apps {
  box-sizing: border-box;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 2px;
  padding: 3px 9px 3px 8px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: #fff;
  color: var(--app-text);
  font: 800 13.5px/1 var(--font-ui);
  text-decoration: none;
}

.vv-my-apps span {
  font-size: 14px;
  transform: translateY(-.5px);
}

.vv-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.vv-credits {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 2px;
  color: #64708f;
  font: 700 12px/1 var(--font-ui);
}

.vv-credits i {
  position: relative;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 2px solid #a96509;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff1a1 8%, #ffd44d 38%, #e7a91c 68%, #bf7710 100%);
  box-shadow:
    inset 1px 1px 1px rgba(255, 255, 255, .85),
    inset -2px -2px 2px rgba(137, 76, 6, .38),
    0 1px 2px rgba(84, 53, 10, .28);
  transform: rotate(-8deg);
}

.vv-credits i::before {
  content: "V";
  position: relative;
  z-index: 1;
  display: grid;
  width: 12px;
  height: 12px;
  place-items: center;
  border: 1px solid rgba(151, 89, 8, .72);
  border-radius: 50%;
  color: #915508;
  font: 900 8px/1 Arial, sans-serif;
  text-shadow: 0 1px 0 rgba(255, 244, 166, .9);
}

.vv-credits i::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px dashed rgba(255, 244, 166, .8);
  border-radius: 50%;
}

.vv-share {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(108, 60, 224, .48);
  border-radius: 50%;
  background: #f3edff;
  color: var(--primary-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  cursor: pointer;
}

.vv-share svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vv-share svg circle {
  fill: currentColor;
  stroke: none;
}

.screen-header.compact {
  min-height: 45px;
  margin: 0 0 7px;
  padding: 2px 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.screen-header.compact .header-action {
  border-color: #cfc2f1;
  background: #f0e9ff;
  color: var(--primary-dark);
  box-shadow: 0 3px 0 #ddd3f5;
}

.screen-header.compact .finish-button {
  border-color: #8ddb83;
  background: #37c94a;
  color: #fff;
  box-shadow: 0 3px 0 #188d2a;
}

.screen[data-route="gallery"] .screen-scroll,
.screen[data-route="profile"] .screen-scroll {
  padding-top: 10px;
}
