/* Lyla's World. Palette lifted from her wildflower painting on black canvas. */
:root {
  --canvas: #17141a;
  --canvas-2: #231e29;
  --canvas-3: #2f2836;
  --ink: #f6efe4;
  --muted: #b9adbf;
  --sun: #ffc531;
  --poppy: #ff4b3a;
  --orange: #ff8a1f;
  --teal: #2fc4c0;
  --lav: #9b6bd6;
  --pink: #ff8fc2;
  --leaf: #2e9e63;
  --gold: #d9a25f;
  --display: "Bagel Fat One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --hand: "Gaegu", "Comic Sans MS", cursive;
  --body: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  background-color: var(--canvas);
  /* canvas weave */
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1; margin: 0; }
h2 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
h3 { font-size: 1.25rem; color: var(--sun); margin: 1.4rem 0 .6rem; }
p { margin: 0 0 .75rem; }
.hand { font-family: var(--hand); font-size: 1.35rem; line-height: 1.25; color: var(--muted); }
.small { font-size: .85rem; color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 6px; }

main { max-width: 1120px; margin: 0 auto; padding: 0 20px 60px; overflow-x: clip; }
button, a, input, select, .swatch { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
section[data-page] { padding-top: 28px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- The cord: navigation is a string of pony beads ---------- */
.cord {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: flex-start; gap: 22px;
  padding: 12px 20px 6px;
  background: linear-gradient(var(--canvas) 70%, transparent);
  overflow-x: auto; scrollbar-width: none;
}
.cord::-webkit-scrollbar { display: none; }
.cord::before {
  content: ""; position: absolute; left: 0; right: 0; top: 28px; height: 3px; min-width: 100%;
  background: #8d8172; border-radius: 2px;
}
.logo, .cord nav { position: relative; display: flex; }
.logo { gap: 3px; text-decoration: none; flex: none; min-height: 44px; align-items: center; }
.lb {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: #fbf7ef; color: var(--canvas); font: 800 1.15rem/1 var(--body);
  box-shadow: inset -3px -3px 5px rgba(0,0,0,.18);
}
.cord nav { gap: 6px; margin-left: auto; }
.bead-link {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  min-width: 68px; padding: 0 4px 6px; flex: none;
  color: var(--muted); text-decoration: none; font: 700 1.05rem/1 var(--hand);
}
.bead {
  width: 26px; height: 32px; border-radius: 10px; background: var(--c);
  box-shadow: inset 7px 0 0 -3px rgba(255,255,255,.4), inset -5px 0 7px rgba(0,0,0,.28);
  transition: transform .2s cubic-bezier(.3,1.6,.5,1);
}
.bead-link:hover .bead { transform: translateY(3px) rotate(-8deg); }
.bead-link[aria-current="page"] { color: var(--ink); }
.bead-link[aria-current="page"] .bead { transform: scale(1.25); }

/* ---------- Buttons, chips, cards ---------- */
.btn {
  font: 800 1rem/1 var(--body); color: var(--canvas); background: var(--sun);
  border: 0; border-radius: 999px; padding: 13px 20px; cursor: pointer; text-decoration: none;
  display: inline-block; box-shadow: 0 4px 0 #b9860a; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9860a; }
.btn.ghost { background: var(--canvas-3); color: var(--ink); box-shadow: 0 4px 0 #0d0b0f; }
.btn.ghost:active { box-shadow: 0 1px 0 #0d0b0f; }
.chip {
  font: 600 .95rem/1 var(--body); color: var(--ink); background: transparent;
  border: 2px solid var(--canvas-3); border-radius: 999px; padding: 9px 14px; cursor: pointer; min-height: 44px;
}
.chip[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: var(--canvas); }
.card { background: var(--canvas-2); border-radius: 22px; padding: 22px; }
input[type="text"], select {
  font: 600 1rem/1 var(--body); color: var(--ink); background: var(--canvas);
  border: 2px solid var(--canvas-3); border-radius: 12px; padding: 12px 14px; min-width: 0; flex: 1;
}
input::placeholder { color: #7d7285; }
.page-head { margin-bottom: 22px; }
.page-head .hand { margin-top: 8px; max-width: 34ch; }
.shelf-title { margin-top: 44px; }
.big-num { font: 400 clamp(3.4rem, 9vw, 5rem)/.9 var(--display); color: var(--sun); margin: 0 0 4px; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: 1fr minmax(260px, 440px); align-items: center; gap: 24px; padding: 16px 0 40px; }
.hero h1 { font-size: clamp(4.2rem, 13vw, 9.5rem); line-height: .82; color: var(--ink); letter-spacing: -.01em; }
.hero h1::first-line { color: var(--sun); }
.hero .hand { font-size: 1.6rem; margin: 22px 0; max-width: 22ch; color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.planet { position: relative; aspect-ratio: 1; }
.planet img {
  position: absolute; inset: 21%; width: 58%; height: 58%; object-fit: cover; object-position: 40% 35%;
  border-radius: 50%; box-shadow: inset 0 0 0 4px var(--canvas), 0 0 0 5px var(--canvas-3), -18px 18px 60px rgba(155,107,214,.35);
}
.orbit { position: absolute; inset: 0; animation: spin 90s linear infinite; }
.orbit svg { width: 100%; height: 100%; display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bday { display: grid; grid-template-columns: 130px 1fr; gap: 20px; align-items: center; }
.bday img { width: 130px; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; transform: rotate(-3deg); border: 5px solid var(--ink); }
.bday p { margin-bottom: 6px; }
.challenge h2 { font-size: 1.6rem; color: var(--teal); }
.challenge-text { font-size: 1.7rem; color: var(--ink); margin: 12px 0 16px; min-height: 2.5em; }
.challenge .small { margin: 14px 0 6px; }
.sticker-shelf { display: flex; flex-wrap: wrap; gap: 4px; }
.sticker-shelf svg { width: 30px; height: 30px; }

.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 20px; }
.door { position: relative; aspect-ratio: 1; border-radius: 22px; overflow: hidden; text-decoration: none; }
.door img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.door:hover img { transform: scale(1.06); }
.door span {
  position: absolute; left: 10px; bottom: 10px; background: var(--canvas); color: var(--ink);
  font: 400 1.05rem/1 var(--display); padding: 8px 12px; border-radius: 999px;
}

/* ---------- Art wall ---------- */
.chips { margin-bottom: 26px; }
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 30px 22px; }
.pin {
  position: relative; background: #fbf7ef; color: var(--canvas); padding: 10px 10px 12px; border: 0; cursor: pointer;
  text-align: left; border-radius: 3px; transform: rotate(var(--tilt, 0deg)); transition: transform .2s;
  box-shadow: 0 10px 24px rgba(0,0,0,.45);
}
.pin:hover, .pin:focus-visible { transform: rotate(0) scale(1.03); z-index: 2; }
.pin::before { /* washi tape */
  content: ""; position: absolute; top: -11px; left: 50%; width: 76px; height: 22px; margin-left: -38px;
  background: var(--tape, var(--teal)); opacity: .85; transform: rotate(-3deg);
}
.pin img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.pin b { display: block; font: 700 1.25rem/1.1 var(--hand); margin-top: 9px; }
.add-art { margin-top: 44px; display: grid; gap: 12px; max-width: 460px; }
.add-art h3 { margin: 0; }
.add-art label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.add-art input[type="file"] { color: var(--ink); font: inherit; min-height: 44px; max-width: 100%; }
.add-art input[type="file"]::file-selector-button { font: 800 .9rem var(--body); min-height: 44px; padding: 0 16px; margin-right: 10px; border: 0; border-radius: 999px; background: var(--canvas-3); color: var(--ink); }
.add-art .btn { justify-self: start; }

/* ---------- Makers (bracelet, slime, looks share a layout) ---------- */
.maker { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.maker-stage { background: var(--canvas-2); border-radius: 28px; padding: 18px; text-align: center; }
.maker-stage .small { margin: 6px 0 0; }
.maker-tools h3:first-child { margin-top: 0; }
.maker-tools form.row { margin-top: 18px; flex-wrap: nowrap; }
.maker-tools > .btn { margin-top: 12px; }
.tools { margin-top: 18px; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 46px; height: 46px; border-radius: 14px; border: 2px solid transparent; background: var(--canvas-2);
  display: grid; place-items: center; cursor: pointer; padding: 0; transition: transform .12s cubic-bezier(.3,1.6,.5,1);
}
.swatch:hover { transform: scale(1.12); }
.swatch:active { transform: scale(.9); }
.swatch svg { width: 38px; height: 38px; }
.swatch.dot::after { content: ""; width: 28px; height: 28px; border-radius: 50%; background: var(--c); }
.swatch.none::after { background: none; border: 2px dashed var(--muted); }
.swatch[aria-pressed="true"] { border-color: var(--ink); }

.bracelet svg { width: 100%; max-width: 480px; height: auto; display: block; margin: 0 auto; }
.bracelet .b { cursor: pointer; }
.bracelet .b:hover { opacity: .7; }
.bead-box, .jars, .looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.saved { background: var(--canvas-2); border-radius: 20px; padding: 14px; text-align: center; }
.saved svg { width: 100%; height: auto; max-width: 150px; }
.saved b { display: block; font: 700 1.3rem/1.1 var(--hand); margin: 6px 0 10px; }
.saved .row { justify-content: center; }
.saved .chip { padding: 7px 12px; font-size: .85rem; }
.empty { font-family: var(--hand); font-size: 1.3rem; color: var(--muted); grid-column: 1 / -1; }

.slime-stage canvas { width: 100%; aspect-ratio: 1; max-height: 520px; display: block; touch-action: none; cursor: grab; border-radius: 16px; }
.slime-stage canvas:active { cursor: grabbing; }
.jar-blob { width: 84px; height: 84px; margin: 4px auto 0; border-radius: 46% 54% 50% 50% / 55% 48% 52% 45%; background: var(--c); box-shadow: inset 10px 10px 0 -4px rgba(255,255,255,.3); }
.saved .mix { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }

.chart svg { width: 100%; max-width: 380px; height: auto; display: block; margin: 0 auto; border-radius: 14px; }
.look-dots { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
.look-dots i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--canvas-3); }

/* ---------- Roxy ---------- */
.roxy-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 22px; align-items: start; }
.roxy-photo { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 24px; overflow: hidden; }
.roxy-photo img { width: 100%; aspect-ratio: 3/4; object-fit: cover; object-position: 50% 25%; }
.roxy-photo span { position: absolute; left: 12px; bottom: 12px; background: var(--canvas); color: var(--ink); padding: 4px 12px; border-radius: 999px; }
.roxy-photo:active img { transform: scale(1.03); }
.roxy-card .mood { color: var(--ink); font-size: 1.5rem; margin-bottom: 18px; }
.roxy-card .big-num { color: var(--gold); }
.roxy-card .btn { margin: 4px 0 22px; }
.facts { margin: 0; display: grid; gap: 10px; }
.facts div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: baseline; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; font: 700 1.3rem/1.2 var(--hand); border-bottom: 2px dashed var(--canvas-3); min-height: 1.6em; padding: 0 4px; }
[data-edit]:empty::before { content: attr(data-ph); color: #7d7285; font-weight: 400; }
.roxy-wide { grid-column: 1 / -1; margin: 0; }
.roxy-wide img { width: 100%; aspect-ratio: 16/8; object-fit: cover; border-radius: 24px; }
.roxy-wide figcaption { margin-top: 8px; }
.heart { position: fixed; pointer-events: none; z-index: 50; width: 28px; height: 28px; animation: floatUp 1s ease-out forwards; }
@keyframes floatUp { to { transform: translate(var(--dx), -120px) scale(1.5) rotate(var(--rot)); opacity: 0; } }

/* ---------- Lightbox, toast, footer ---------- */
dialog { background: var(--canvas-2); color: var(--ink); border: 0; border-radius: 22px; padding: 18px; max-width: min(92vw, 720px); }
dialog::backdrop { background: rgba(10,8,12,.85); }
dialog img { max-height: 68vh; margin: 10px auto; border-radius: 10px; }
dialog h3 { color: var(--ink); font-size: 1.5rem; margin: 10px 0 4px; }
dialog .close { float: right; background: none; border: 0; color: var(--muted); font: 600 .95rem var(--body); cursor: pointer; padding: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 80px); z-index: 60;
  background: var(--ink); color: var(--canvas); font-weight: 800; padding: 12px 20px; border-radius: 999px;
  transition: transform .25s cubic-bezier(.3,1.4,.5,1), opacity .2s; pointer-events: none; max-width: 90vw; opacity: 0;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
footer { text-align: center; padding: 30px 20px 50px; }

/* ---------- Small screens ---------- */
@media (max-width: 780px) {
  /* phones: the bead string becomes a thumb-reach tab bar along the bottom */
  .cord { position: static; padding: calc(12px + env(safe-area-inset-top)) 16px 0; overflow: visible; background: none; }
  .cord::before { display: none; }
  .cord nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; gap: 0; justify-content: space-around;
    padding: 9px max(4px, env(safe-area-inset-left)) calc(5px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-right));
    background: var(--canvas); box-shadow: 0 -2px 0 var(--canvas-3);
  }
  .cord nav::before { content: ""; position: absolute; left: 0; right: 0; top: 23px; height: 3px; background: #8d8172; }
  .bead-link { position: relative; flex: 1 1 0; min-width: 0; min-height: 54px; padding: 0 0 2px; font-size: .88rem; white-space: nowrap; }
  .bead { width: 22px; height: 28px; border-radius: 9px; }
  .bead-link span { font-size: 0; }
  .bead-link span::after { content: attr(data-s); font-size: .95rem; }
  main { padding: 0 16px calc(110px + env(safe-area-inset-bottom)); }
  footer { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .hero { grid-template-columns: 1fr; padding-top: 4px; }
  .planet { max-width: 340px; margin: 0 auto; order: -1; width: 100%; }
  .home-grid, .maker, .roxy-grid { grid-template-columns: 1fr; }
  .doors { grid-template-columns: 1fr 1fr; }
  .bday { grid-template-columns: 96px 1fr; }
  .bday img { width: 96px; }
  .maker-tools form.row { flex-wrap: wrap; }
  .maker-tools form.row .btn { flex: 1 1 100%; }
  .facts div { grid-template-columns: 1fr; gap: 0; }
  .wall { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 26px 14px; padding: 0 4px; }
  .swatch { width: 48px; height: 48px; }
  dialog img { max-height: 58vh; }
}
@media (max-width: 780px) and (orientation: landscape) and (max-height: 480px) {
  .bead-link span { display: none; } .bead-link { min-height: 40px; } main { padding-bottom: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
