/* ==========================================================================
   MAGICO POST-PURCHASE DASHBOARD — STYLES
   ==========================================================================
   Theme tokens live in `:root` (shared) and `[data-magico-theme]` (per
   Magico world). Everything else references tokens, never raw colours, so a
   new theme is a new token block, not a rewrite. Content/copy lives in
   adventure-data.js — nothing here is specific to James or Dino Superfan.
   ========================================================================== */

:root {
  /* Shared Magico brand tokens */
  --magico-cream: #faf3e1;
  --magico-cream-deep: #f3e8cc;
  --magico-paper: #fffdf8;
  --magico-ink: #14261d;
  --magico-ink-soft: #4c6255;
  --magico-line: #e1d9bd;
  --magico-shadow: 0 20px 48px rgba(20, 38, 29, 0.14);
  --magico-shadow-sm: 0 8px 20px rgba(20, 38, 29, 0.1);
  --magico-radius-lg: 26px;
  --magico-radius-md: 18px;
  --magico-radius-sm: 12px;
  --magico-focus: #ffd977;

  /* Feature/accent tones referenced by data-driven "tone" values */
  --tone-leaf: #2f7d49;
  --tone-leaf-soft: #e5f4e1;
  --tone-gold: #c98a1f;
  --tone-gold-soft: #fbecc9;
  --tone-sky: #276a8a;
  --tone-sky-soft: #dcf0f6;
  --tone-plum: #6a4b96;
  --tone-plum-soft: #ece2f7;
}

/* --------------------------------------------------------------------
   Theme: dino-superfan (default, owner-approved launch theme)
   Add further `[data-magico-theme="..."]` blocks for future worlds.
   -------------------------------------------------------------------- */
[data-magico-theme="dino-superfan"] {
  --magico-header-from: #0e2a1c;
  --magico-header-to: #163a26;
  --magico-gold-text: #e7bd58;
  --magico-gold-text-soft: #f2d488;
  --magico-primary: #1c4a30;
  --magico-primary-dark: #103018;
  --magico-secondary-from: #e0a53b;
  --magico-secondary-to: #c67f22;
  --magico-secondary-ink: #3c2606;
  --magico-scene-sky-a: #9fe0ff;
  --magico-scene-sky-b: #ffe6b0;
  --magico-scene-hill-a: #4f8a4e;
  --magico-scene-hill-b: #2c5c37;
  --magico-scene-volcano: #5c4a3d;
  --magico-scene-lava: #e6672f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.magico-dashboard {
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--magico-ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.55), transparent 42%),
    linear-gradient(180deg, var(--magico-cream) 0%, var(--magico-cream-deep) 100%);
}

img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
:focus-visible {
  outline: 3px solid var(--magico-focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------- Header ---------------- */
.magico-header {
  background: linear-gradient(120deg, var(--magico-header-from), var(--magico-header-to));
  color: var(--magico-cream);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.magico-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.magico-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.magico-logo__icon {
  width: 30px;
  height: 30px;
  color: var(--magico-gold-text);
  flex: none;
}
.magico-logo__wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.magico-logo__name {
  font-weight: 900;
  font-size: 1.32rem;
  letter-spacing: 0.06em;
  color: var(--magico-gold-text);
}
.magico-logo__tagline {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgba(250, 243, 225, 0.72);
}
.magico-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.magico-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  color: rgba(250, 243, 225, 0.92);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 4px;
  border-radius: 8px;
}
.magico-nav__link:hover { color: var(--magico-gold-text-soft); }
.magico-nav__link svg { width: 19px; height: 19px; }
.magico-account {
  position: relative;
}
.magico-account__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--magico-cream);
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
}
.magico-account__trigger:hover { background: rgba(255, 255, 255, 0.12); }
.magico-account__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tone-leaf-soft);
  color: var(--tone-leaf);
  display: grid;
  place-items: center;
  border: 2px solid var(--magico-gold-text);
  flex: none;
}
.magico-account__avatar svg { width: 18px; height: 18px; }
.magico-account__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}
.magico-account__greeting { font-size: 0.68rem; color: rgba(250, 243, 225, 0.7); }
.magico-account__name { font-size: 0.86rem; font-weight: 800; }
.magico-account__chevron { width: 16px; height: 16px; transition: transform .15s ease; }
.magico-account__trigger[aria-expanded="true"] .magico-account__chevron { transform: rotate(180deg); }
.magico-account__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: var(--magico-paper);
  color: var(--magico-ink);
  border-radius: var(--magico-radius-sm);
  box-shadow: var(--magico-shadow);
  padding: 8px;
  border: 1px solid var(--magico-line);
}
.magico-account__menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--magico-ink);
}
.magico-account__menu button:hover { background: var(--tone-leaf-soft); }
.magico-account__menu small { display: block; font-weight: 500; color: var(--magico-ink-soft); margin-top: 1px; }

/* ---------------- Shell ---------------- */
.magico-shell {
  /* position+z-index (not position alone) establishes a real stacking
     context here, so .magico-decor's negative z-index below is scoped to
     .magico-shell and reliably paints behind its normal-flow siblings,
     rather than being compared against the whole document. */
  position: relative;
  z-index: 0;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 56px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* ---------------- Ambient page decoration (2026-09-01 visual rebuild) ----------------
   Restrained, low-opacity storybook accents referencing the owner
   concept's page-edge decoration (a flying pterosaur, sparkles near the
   headline, a footprint trail, a jungle-leaf corner) — the single biggest
   gap a direct comparison against the concept found (see
   VISUAL_REBUILD_2026-09-01.md). Purely decorative: aria-hidden, no data,
   no book/character content, generic shapes only. Positioned against
   .magico-shell so they sit behind/around the real content rather than
   inside any card. */
.magico-decor { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.magico-decor > * { position: absolute; }
.magico-decor__pterosaur {
  top: 6px; left: 4px;
  width: 76px; height: 36px;
  color: var(--magico-ink);
  opacity: 0.16;
  transform: rotate(-4deg);
}
.magico-decor__pterosaur svg { width: 100%; height: 100%; }
.magico-decor__sparkle { color: var(--tone-gold); opacity: 0.4; }
.magico-decor__sparkle svg { display: block; width: 100%; height: 100%; }
.magico-decor__sparkle--a { top: 18px; left: 300px; width: 16px; height: 16px; }
.magico-decor__sparkle--b { top: 64px; left: 340px; width: 10px; height: 10px; opacity: 0.3; }
.magico-decor__sparkle--c { top: 4px; left: 250px; width: 8px; height: 8px; opacity: 0.28; }
.magico-decor__footprints {
  bottom: 18px; left: 6px;
  width: 70px; height: 40px;
  color: var(--magico-ink);
  opacity: 0.12;
  transform: rotate(8deg);
}
.magico-decor__footprints svg { width: 100%; height: 100%; }
.magico-decor__leaf {
  bottom: -18px; left: -18px;
  width: 150px; height: 150px;
  color: var(--tone-leaf);
  opacity: 0.14;
}
.magico-decor__leaf svg { width: 100%; height: 100%; }
@media (max-width: 620px) {
  /* Fewer, smaller, repositioned so nothing competes with the tighter
     mobile header/hero — see the mobile-specific section further down. */
  .magico-decor__sparkle--b, .magico-decor__sparkle--c { display: none; }
  .magico-decor__pterosaur { width: 56px; height: 27px; opacity: 0.13; }
  .magico-decor__leaf { width: 100px; height: 100px; opacity: 0.12; }
}

/* ---------------- Toast ---------------- */
.magico-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  background: var(--magico-ink);
  color: var(--magico-cream);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: var(--magico-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
  max-width: min(92vw, 480px);
  text-align: center;
}
.magico-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------- Hero (purchase-complete + cover + inside panel) ---------------- */
.magico-hero {
  display: grid;
  grid-template-areas: "info" "cover" "inside";
  gap: 20px;
}
@media (min-width: 900px) {
  .magico-hero {
    grid-template-areas: "info cover inside";
    /* Rebalanced 2026-09-01 against the owner concept: the cover is the
       dominant column, the right ("Inside Your Adventure") column is
       visibly narrower than the left, not equal to it — see
       VISUAL_REBUILD_2026-09-01.md. */
    grid-template-columns: minmax(300px, 1.15fr) minmax(360px, 1.4fr) minmax(240px, 0.85fr);
    align-items: start;
    gap: 24px;
  }
}

.magico-purchase-info { grid-area: info; position: relative; padding-top: 4px; }
.magico-purchase-info__decor {
  position: absolute;
  inset: -18px -12px auto auto;
  font-size: 2.4rem;
  opacity: 0.55;
  pointer-events: none;
  line-height: 1;
}
.magico-badge-complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--tone-leaf);
  background: var(--tone-leaf-soft);
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.magico-badge-complete svg { width: 18px; height: 18px; }

.magico-headline {
  font-size: clamp(2.1rem, 4.4vw, 3.1rem);
  line-height: 1.02;
  margin: 0 0 14px;
  color: var(--magico-primary-dark);
  font-weight: 900;
}
.magico-subcopy {
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--magico-ink-soft);
  max-width: 34rem;
  margin: 0 0 22px;
}
.magico-subcopy strong { color: var(--tone-leaf); }

.magico-cta-stack { display: flex; flex-direction: column; gap: 12px; max-width: 340px; }
.magico-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 15px 20px;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  min-height: 52px;
}
.magico-btn__lead { display: flex; align-items: center; gap: 10px; }
.magico-btn svg { width: 20px; height: 20px; flex: none; }
.magico-btn--primary {
  background: var(--magico-primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(16, 48, 24, 0.32);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.magico-btn--primary:hover { filter: brightness(1.05); }
.magico-btn--primary:active { transform: scale(.98); box-shadow: 0 4px 10px rgba(16, 48, 24, 0.32); }
.magico-btn--secondary {
  background: linear-gradient(120deg, var(--magico-secondary-from), var(--magico-secondary-to));
  color: var(--magico-secondary-ink);
  box-shadow: 0 10px 22px rgba(150, 99, 26, 0.28);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.magico-btn--secondary:hover { filter: brightness(1.04); }
.magico-btn--secondary:active { transform: scale(.98); box-shadow: 0 4px 10px rgba(150, 99, 26, 0.28); }
.magico-btn--ghost {
  /* Content-width, not stretched — visually secondary to the two real
     CTAs above it, matching the concept's compact tertiary button
     (VISUAL_REBUILD_2026-09-01.md). */
  align-self: flex-start;
  background: var(--magico-paper);
  color: var(--magico-primary-dark);
  border: 2px solid var(--magico-line);
  justify-content: center;
  padding: 11px 22px;
  min-height: 42px;
}
.magico-btn--ghost:hover { border-color: var(--magico-primary); }

/* Cover */
.magico-cover { grid-area: cover; display: flex; justify-content: center; position: relative; }
/* Book-mockup "page stack" — a purely decorative presentation layer
   behind the cover card, referencing the owner-supplied cover-concept
   reference render's book-object feel (depth/thickness) rather than a
   flat poster. No data, no image, no personalised content: the actual
   cover content is coverArt(adventure) inside .magico-cover__card,
   completely unchanged by this. See DASHBOARD_VISUAL_INTEGRATION.md. */
.magico-cover__pages {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  /* Taller than a standard 3:4 book cover, and a larger max-width, so the
     cover reads as the dominant object per the owner concept rather than
     "one card among three" — see VISUAL_REBUILD_2026-09-01.md. */
  aspect-ratio: 3 / 3.6;
  border-radius: var(--magico-radius-lg);
  pointer-events: none;
}
.magico-cover__pages::before,
.magico-cover__pages::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--magico-paper);
  border: 1px solid var(--magico-line);
}
.magico-cover__pages::before { transform: translate(5px, 7px) rotate(0.6deg); z-index: 1; }
.magico-cover__pages::after  { transform: translate(2px, 3px) rotate(0.3deg); z-index: 2; }
.magico-cover__card {
  width: 100%;
  max-width: 480px;
  /* Taller than a standard 3:4 book cover, and a larger max-width, so the
     cover reads as the dominant object per the owner concept rather than
     "one card among three" — see VISUAL_REBUILD_2026-09-01.md. */
  aspect-ratio: 3 / 3.6;
  border-radius: var(--magico-radius-lg);
  overflow: hidden;
  position: relative;
  z-index: 3;
  /* Deeper, warmer two-layer shadow than a flat UI card gets — closer to
     the concept reference's "lifted, physical object" presence. */
  box-shadow: 0 28px 44px rgba(20, 38, 29, 0.28), 0 8px 16px rgba(20, 38, 29, 0.18);
  background: linear-gradient(180deg, var(--magico-scene-sky-a) 0%, var(--magico-scene-sky-b) 34%, var(--magico-scene-hill-a) 60%, var(--magico-scene-hill-b) 100%);
}
.magico-cover__card img { width: 100%; height: 100%; object-fit: cover; }
/* Subtle glossy-laminate highlight across the top of the cover — inside
   the clipped card, on top of the scene, below the title/plaque text
   (z-index order follows source order; this is the first painted layer
   inside the card via ::before on the card itself). */
.magico-cover__card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  background: linear-gradient(160deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.06) 22%, transparent 40%);
  pointer-events: none;
  z-index: 6;
}
.magico-cover__scene { position: absolute; inset: 0; }
.magico-cover__hill {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -6%;
  height: 46%;
  background: var(--magico-scene-hill-b);
  border-radius: 50% 50% 0 0 / 60% 60% 0 0;
}
.magico-cover__hill--near {
  bottom: -12%;
  height: 34%;
  background: var(--magico-scene-hill-a);
  opacity: 0.92;
}
.magico-cover__volcano {
  position: absolute;
  right: 10%;
  bottom: 30%;
  width: 26%;
  height: 24%;
  background: var(--magico-scene-volcano);
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
}
.magico-cover__lava {
  position: absolute;
  right: 21%;
  bottom: 42%;
  width: 8%;
  height: 12%;
  background: linear-gradient(#ffd25d, var(--magico-scene-lava));
  clip-path: polygon(40% 0, 60% 0, 78% 100%, 22% 100%);
}
.magico-cover__flyer {
  position: absolute;
  width: 34px;
  height: 17px;
  color: rgba(20, 38, 29, 0.55);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.12));
}
.magico-cover__flyer svg { width: 100%; height: 100%; }
.magico-cover__flyer--a { top: 9%; left: 9%; }
.magico-cover__flyer--b { top: 14%; right: 11%; transform: scaleX(-1); }
.magico-cover__figures {
  position: absolute;
  left: 0; right: 0; bottom: 16%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4%;
  font-size: 3.6rem;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,.2));
}
.magico-cover__titles {
  position: absolute;
  left: 0; right: 0; top: 6%;
  text-align: center;
  padding: 0 8%;
}
.magico-cover__series {
  font-weight: 900;
  font-size: clamp(1.9rem, 6.6vw, 2.8rem);
  letter-spacing: 0.01em;
  color: var(--magico-gold-text);
  /* Carved/embossed treatment (concept reference) rather than a flat soft
     shadow: a thin dark outline (stacked 1px shadows) plus a deeper drop
     shadow for storybook-title presence. */
  text-shadow:
    -1px -1px 0 rgba(60, 30, 0, .75), 1px -1px 0 rgba(60, 30, 0, .75),
    -1px 1px 0 rgba(60, 30, 0, .75), 1px 1px 0 rgba(60, 30, 0, .75),
    0 3px 0 rgba(60, 30, 0, .55), 0 10px 18px rgba(0, 0, 0, .38);
  line-height: 0.92;
}
.magico-cover__story {
  margin-top: 6px;
  display: inline-block;
  background: rgba(20, 26, 18, 0.72);
  color: #fff;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 5px 12px;
  border-radius: 8px;
}
.magico-cover__plaque {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%);
  /* Fixed-width box (not content-sized) so the name-plate has a real
     available width to shrink-to-fit against — mirrors the title-render
     machine's fixed-geometry plaque (left:14%/right:14% in
     09_website-prototype). Without a bound here the plaque would just
     keep growing to fit any name instead of ever needing to shrink. */
  max-width: 72%;
  /* Lighter honey-wood tone, closer to the concept's plaque than the
     previous dark walnut — VISUAL_REBUILD_2026-09-01.md. */
  background: #c9924f;
  border: 2px solid #8a5f2e;
  color: #3c2409;
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  padding: 8px 20px;
  border-radius: 6px;
  text-align: center;
  white-space: nowrap;
}
/* Sized at runtime by dashboard.js's fitNamePlate() (ported from the
   title-render machine's fitNamePlates()) — --name-max-size is only the
   starting point, then it shrinks to fit any name length. The static
   font-size below is a no-JS fallback matching that starting point. */
.magico-cover__plaque-name {
  display: block;
  margin-top: 1px;
  font-size: 19px;
  --name-max-size: 19;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}
/* Cover figures — controlled CSS-drawn placeholder silhouettes, adapted
   from the same flat-shape technique already used for the child figure in
   07_interactive-prototype/index.html. Not production artwork. */
.child-figure { position: relative; width: 70px; height: 132px; }
.child-figure .cf-head { position: absolute; left: 19px; top: 0; width: 34px; height: 38px; border-radius: 50%; background: #f2c092; border: 3px solid #633e27; }
.child-figure .cf-hair { position: absolute; left: 14px; top: -4px; width: 42px; height: 20px; border-radius: 50% 50% 35% 30%; background: #5a3420; transform: rotate(-6deg); }
.child-figure .cf-body { position: absolute; left: 15px; top: 34px; width: 40px; height: 46px; background: #5e7d52; border-radius: 12px 12px 8px 8px; }
.child-figure .cf-shorts { position: absolute; left: 15px; top: 76px; width: 40px; height: 22px; background: #c8ad76; border-radius: 6px; }
.child-figure .cf-leg { position: absolute; top: 94px; width: 12px; height: 24px; background: #f0bc8e; border-radius: 5px; }
.child-figure .cf-leg.l { left: 20px; } .child-figure .cf-leg.r { right: 14px; }
.child-figure .cf-boot { position: absolute; top: 112px; width: 18px; height: 11px; background: #6d482f; border-radius: 7px 7px 3px 3px; }
.child-figure .cf-boot.l { left: 17px; } .child-figure .cf-boot.r { right: 11px; }
.child-figure .cf-pack { position: absolute; left: 4px; top: 40px; width: 18px; height: 32px; border-radius: 7px; background: #2e8fb7; border: 2px solid #1f657f; }

.dino-figure { position: relative; opacity: 0.95; filter: drop-shadow(0 5px 6px rgba(0,0,0,.18)); flex: none; }
.dino-figure.sauropod { width: 118px; height: 96px; }
.dino-figure.sauropod .df-body { position: absolute; left: 18px; bottom: 0; width: 84px; height: 54px; background: #4f8a4e; border-radius: 50%; }
.dino-figure.sauropod .df-neck { position: absolute; left: 4px; bottom: 34px; width: 22px; height: 60px; background: #4f8a4e; border-radius: 14px; transform: rotate(-18deg); }
.dino-figure.sauropod .df-head { position: absolute; left: -8px; bottom: 82px; width: 22px; height: 16px; background: #4f8a4e; border-radius: 10px 10px 10px 2px; }
.dino-figure.sauropod .df-leg { position: absolute; bottom: -6px; width: 14px; height: 20px; background: #3d6f3f; border-radius: 6px; }
.dino-figure.sauropod .df-leg.a { left: 28px; } .dino-figure.sauropod .df-leg.b { left: 74px; }

.dino-figure.trike { width: 108px; height: 82px; }
.dino-figure.trike .df-body { position: absolute; left: 14px; bottom: 0; width: 82px; height: 46px; background: #8a7a56; border-radius: 40% 46% 40% 40%; }
.dino-figure.trike .df-frill { position: absolute; left: -4px; bottom: 22px; width: 44px; height: 44px; background: #8a7a56; border-radius: 50% 50% 18% 18%; transform: rotate(6deg); }
.dino-figure.trike .df-horn { position: absolute; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 16px solid #6b5c3e; }
.dino-figure.trike .df-horn.a { left: 2px; bottom: 48px; transform: rotate(-16deg); }
.dino-figure.trike .df-horn.b { left: 12px; bottom: 52px; }
.dino-figure.trike .df-leg { position: absolute; bottom: -6px; width: 14px; height: 18px; background: #6b5c3e; border-radius: 6px; }
.dino-figure.trike .df-leg.a { left: 24px; } .dino-figure.trike .df-leg.b { left: 72px; }

/* Cover's own placeholder indicator uses the same restrained .status-badge
   component as the preview cards, positioned bottom-right (clear of the
   title/flyer decorations above and the name-plate above it) rather than
   the previous full-width pill across the illustration. */
.magico-cover__card .status-badge { top: auto; bottom: 10px; right: 10px; z-index: 7; }

/* Inside Your Adventure panel */
.magico-inside { grid-area: inside; }
.magico-card {
  background: var(--magico-paper);
  border-radius: var(--magico-radius-lg);
  box-shadow: var(--magico-shadow-sm);
  border: 1px solid var(--magico-line);
  padding: 22px;
}
.magico-card__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.18rem;
  font-weight: 900;
  color: var(--magico-primary-dark);
  margin: 0 0 16px;
}
.magico-card__heading svg { width: 20px; height: 20px; color: var(--tone-leaf); }

/* Packed tighter than Phase 2's version — that pass over-corrected away
   from the concept's denser composition; re-tightened 2026-09-01 against
   a direct comparison. See VISUAL_REBUILD_2026-09-01.md. */
.magico-feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.magico-feature {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}
.magico-feature__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}
.magico-feature__icon svg { width: 20px; height: 20px; }
.magico-feature__title { font-weight: 800; margin: 0 0 3px; font-size: 0.98rem; }
.magico-feature__body { margin: 0; font-size: 0.87rem; line-height: 1.45; color: var(--magico-ink-soft); }

.tone-leaf .magico-feature__icon { background: var(--tone-leaf-soft); color: var(--tone-leaf); }
.tone-gold .magico-feature__icon { background: var(--tone-gold-soft); color: var(--tone-gold); }
.tone-sky  .magico-feature__icon { background: var(--tone-sky-soft);  color: var(--tone-sky); }
.tone-plum .magico-feature__icon { background: var(--tone-plum-soft); color: var(--tone-plum); }

/* ---------------- Lower grid: shelf + preview carousel ---------------- */
.magico-lower {
  display: grid;
  grid-template-areas: "shelf" "preview";
  gap: 20px;
}
@media (min-width: 900px) {
  .magico-lower {
    grid-template-areas: "shelf preview";
    /* Preview column widened relative to the shelf column, matching the
       concept's proportion more closely — VISUAL_REBUILD_2026-09-01.md. */
    grid-template-columns: minmax(250px, 1fr) minmax(0, 2.6fr);
    align-items: start;
    gap: 24px;
  }
}

/* min-width:0 on both grid items: without it, a grid item's implicit
   min-width:auto lets its content's intrinsic size (here, the preview
   carousel's non-wrapping flex row) blow out the grid track instead of
   scrolling inside .magico-preview__track's overflow-x:auto — invisible
   at >=900px only because that breakpoint's grid-template-columns
   already pins the preview column to minmax(0, 2.1fr); the single
   implicit mobile column had no equivalent floor. Found via an actual
   scrollWidth-vs-clientWidth check during the 2026-09-01 visual
   integration pass, not previously caught by screenshot inspection alone. */
.magico-shelf, .magico-preview { min-width: 0; }
.magico-shelf { grid-area: shelf; }
.magico-shelf__hint { margin: 0 0 16px; font-size: 0.86rem; color: var(--magico-ink-soft); }
.magico-shelf-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid var(--magico-line);
  border-radius: var(--magico-radius-md);
  padding: 14px;
  background: var(--magico-cream);
}
.magico-shelf-item__thumb {
  width: 68px;
  aspect-ratio: 3/4;
  border-radius: 10px;
  flex: none;
  overflow: hidden;
  box-shadow: var(--magico-shadow-sm);
  background: linear-gradient(180deg, var(--magico-scene-sky-a), var(--magico-scene-hill-b));
  position: relative;
}
.magico-shelf-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Scaled-down .status-badge for this small 68px thumbnail. */
.magico-shelf-item__thumb .status-badge { width: 15px; height: 15px; top: 3px; right: 3px; }
.magico-shelf-item__thumb .status-badge svg { width: 9px; height: 9px; }
.magico-shelf-item__title { font-weight: 900; margin: 0; font-size: 1rem; color: var(--magico-primary-dark); }
.magico-shelf-item__subtitle { margin: 2px 0 6px; font-size: 0.82rem; color: var(--magico-ink-soft); }
.magico-shelf-item__meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.76rem; color: var(--tone-leaf); font-weight: 700; margin-bottom: 10px;
}
.magico-shelf-item__meta svg { width: 14px; height: 14px; }
.magico-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 0;
  font-weight: 800; font-size: 0.84rem; color: var(--magico-primary);
}
.magico-link-btn svg { width: 15px; height: 15px; }
.magico-link-btn:hover { text-decoration: underline; }

/* Preview carousel */
.magico-preview { grid-area: preview; position: relative; }
.magico-preview__track-wrap { position: relative; }
.magico-preview__track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.magico-preview__track:focus-visible { outline-offset: 4px; }
.preview-card {
  scroll-snap-align: start;
  flex: 0 0 min(270px, 78vw);
  border: 1px solid var(--magico-line);
  border-radius: var(--magico-radius-md);
  overflow: hidden;
  background: var(--magico-paper);
  box-shadow: var(--magico-shadow-sm);
}
.preview-card__art {
  aspect-ratio: 4/3;
  position: relative;
  background: var(--magico-cream-deep);
  display: grid;
  place-items: center;
}
.preview-card__art img { width: 100%; height: 100%; object-fit: cover; }
.preview-card__art svg { width: 56%; height: 56%; color: var(--magico-primary); opacity: 0.82; }
.preview-card__caption { padding: 12px 14px 14px; font-weight: 800; font-size: 0.88rem; text-align: center; }

/* ---------------- Restrained status badge ----------------
   Replaces the earlier full-width coloured tag/note bars, which the
   owner flagged as customer-facing "developer-looking visual noise"
   dominating the composition (2026-09-01 visual rebuild). REVIEW /
   sampleOnly status stays fully present in the data model and DOM — the
   PLACEHOLDER/REVIEW state and the sampleOnly fact are both always in
   this badge's accessible name and native tooltip (`title`) — just no
   longer a loud bar across the artwork. See VISUAL_REBUILD_2026-09-01.md. */
.status-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(20, 38, 29, 0.22);
  display: grid;
  place-items: center;
  color: var(--magico-ink-soft);
  cursor: default;
}
.status-badge svg { width: 12px; height: 12px; }
.status-badge--review { color: var(--tone-gold); border-color: rgba(201, 138, 31, 0.45); }

.magico-carousel-btn {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--magico-line);
  background: var(--magico-paper);
  box-shadow: var(--magico-shadow-sm);
  display: grid;
  place-items: center;
  color: var(--magico-primary-dark);
}
.magico-carousel-btn svg { width: 18px; height: 18px; }
.magico-carousel-btn--prev { left: -14px; }
.magico-carousel-btn--next { right: -14px; }
.magico-carousel-btn:disabled { opacity: 0.35; cursor: default; }
@media (max-width: 560px) {
  .magico-carousel-btn--prev { left: -6px; }
  .magico-carousel-btn--next { right: -6px; }
}

/* ---------------- Footer / trust strip ---------------- */
.magico-footer {
  border-radius: var(--magico-radius-lg);
  border: 1px solid var(--magico-line);
  background: var(--magico-cream-deep);
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.magico-footer__thanks { display: flex; gap: 12px; align-items: flex-start; max-width: 360px; }
.magico-footer__thanks svg { width: 30px; height: 30px; color: var(--tone-gold); flex: none; margin-top: 2px; }
.magico-footer__thanks strong { display: block; font-size: 1rem; }
.magico-footer__thanks span { display: block; font-size: 0.85rem; color: var(--magico-ink-soft); margin-top: 2px; }
.magico-trust-list { display: flex; flex-wrap: wrap; gap: 22px; list-style: none; margin: 0; padding: 0; }
.magico-trust-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8rem; max-width: 190px; }
.magico-trust-list svg { width: 20px; height: 20px; color: var(--tone-leaf); flex: none; margin-top: 1px; }
.magico-trust-list strong { display: block; font-size: 0.83rem; }
.magico-trust-list span { color: var(--magico-ink-soft); }
.magico-trust-list button.magico-trust-item {
  display: flex; gap: 8px; align-items: flex-start; background: none; border: 0; padding: 0; text-align: left;
}

/* ---------------- Certificate modal ---------------- */
.magico-modal-backdrop {
  position: fixed; inset: 0; background: rgba(14, 22, 16, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 80;
}
.magico-modal-backdrop[hidden] { display: none; }
.magico-modal {
  background: var(--magico-paper);
  border-radius: var(--magico-radius-lg);
  max-width: 420px; width: 100%;
  padding: 22px;
  box-shadow: var(--magico-shadow);
  position: relative;
}
.magico-modal__close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--magico-line); background: var(--magico-cream);
  display: grid; place-items: center;
}
.magico-modal__close svg { width: 16px; height: 16px; }
.magico-modal h2 { margin: 0 0 4px; font-size: 1.2rem; color: var(--magico-primary-dark); }
.magico-modal p.hint { margin: 0 0 16px; font-size: 0.84rem; color: var(--magico-ink-soft); }
.magico-certificate-art {
  aspect-ratio: 4/3;
  border-radius: var(--magico-radius-md);
  border: 3px double var(--tone-gold);
  background: var(--magico-cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 16px; text-align: center; margin-bottom: 16px;
}
.magico-certificate-art svg { width: 46px; height: 46px; color: var(--tone-gold); }
.magico-certificate-art strong { font-size: 1.1rem; color: var(--magico-primary-dark); }
.magico-certificate-art span { font-size: 0.8rem; color: var(--magico-ink-soft); }
/* REVIEW/APPROVED image variant — the real certificate art fills the same
   frame the CSS placeholder used, padding/gap collapse so the image
   reaches the double-gold border edge cleanly. */
.magico-certificate-art.has-image { padding: 0; gap: 0; }
.magico-certificate-art.has-image img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: calc(var(--magico-radius-md) - 3px);
}

/* ---------------- Responsive tweaks ---------------- */
@media (max-width: 620px) {
  /* Substantially more compact than a straight scale-down of the desktop
     header — smaller everything, tagline dropped, tighter gaps — per the
     owner's explicit mobile-header instruction (VISUAL_REBUILD_2026-09-01.md). */
  .magico-header__inner { padding: 7px 14px; gap: 8px; }
  .magico-logo { gap: 7px; }
  .magico-logo__icon { width: 24px; height: 24px; }
  .magico-logo__name { font-size: 1.05rem; }
  .magico-logo__tagline { display: none; }
  .magico-nav { gap: 12px; }
  .magico-nav__link svg { width: 17px; height: 17px; }
  .magico-nav__label { display: none; }
  .magico-account__trigger { padding: 4px 8px 4px 4px; }
  .magico-account__avatar { width: 26px; height: 26px; }
  .magico-account__avatar svg { width: 14px; height: 14px; }
  .magico-account__chevron { width: 13px; height: 13px; }
  .magico-account__text { display: none; }
  .magico-shell { padding: 20px 16px 40px; gap: 20px; }
  .magico-cta-stack { max-width: none; }
  .magico-btn--ghost { align-self: stretch; }
  .magico-footer { justify-content: flex-start; }
  .magico-trust-list li { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* MAGICO My Library v2 — wider, calmer collection-first composition. */
.magico-header__inner,.magico-shell{max-width:1580px!important;width:100%}
.magico-shell{padding-inline:clamp(18px,3.5vw,56px)!important}
@media(min-width:1100px){
.magico-hero{grid-template-columns:minmax(300px,1.07fr) minmax(420px,1.35fr) minmax(270px,.8fr)!important;gap:32px!important}
.magico-cover__card,.magico-cover__pages{max-width:540px!important}
}
.magico-headline{font-family:Georgia,serif;letter-spacing:-.035em}
.magico-cover__card{border:8px solid #ecddbe;border-radius:12px}
.magico-cover__pages{opacity:.65}
.magico-cover__card:after{content:"PREVIEW · NOT A PURCHASED BOOK";position:absolute;left:10px;right:10px;bottom:8px;background:#093528e8;color:#fbe8b4;text-align:center;border-radius:5px;font:700 10px system-ui;padding:6px;letter-spacing:.08em;z-index:9}
.magico-badge-complete{background:#e4eee5;color:#24583b}
