/* ===========================================================================
   StoryNest — playful, rounded, high-contrast UI for young authors.
   =========================================================================== */
:root {
  --pink:   #ef476f;  --pink-d:   #d63a5f;
  --blue:   #118ab2;  --blue-d:   #0d6e8f;
  --green:  #06b67f;  --green-d:  #059469;
  --yellow: #ffd166;
  --purple: #9b5de5;
  --ink:    #2b2d42;
  --muted:  #6b7280;
  --cream:  #fff9f0;
  --paper:  #ffffff;
  --line:   #ece3d6;
  --shadow: 0 10px 25px rgba(43,45,66,.12);
  --shadow-sm: 0 4px 12px rgba(43,45,66,.10);
  --radius: 22px;
}

* { box-sizing: border-box; }
/* The HTML `hidden` attribute must always win, even over component rules like
   `.modal { display: flex }` (a class selector otherwise out-specifies the UA
   `[hidden]` rule, leaving "hidden" dialogs visible). */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Quicksand", system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff3d6 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #ffe3ee 0%, transparent 55%),
    var(--cream);
  min-height: 100vh;
}
h1, h2, h3, .brand-name { font-family: "Fredoka", sans-serif; }
a { color: var(--blue-d); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Nav ---------------------------------------------------------------- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 1.2rem; background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px); border-bottom: 3px solid var(--line);
  position: sticky; top: 0; z-index: 40; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .5rem; font-size: 1.5rem;
  color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-logo { font-size: 1.8rem; }
.brand-name { font-weight: 700; }
.brand-img { height: 38px; width: auto; display: block; }
@media (max-width: 480px) { .brand-img { height: 32px; } }
.nav-links { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.nav-link { padding: .4rem .7rem; border-radius: 999px; color: var(--ink);
  font-weight: 700; }
.nav-link:hover { background: #fff0d6; text-decoration: none; }
.nav-link.ghost { color: var(--muted); }
.nav-user { padding: .35rem .8rem; background: #fff; border: 2px solid var(--line);
  border-radius: 999px; font-weight: 700; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1.05rem;
  border: none; border-radius: 999px; padding: .7rem 1.4rem; cursor: pointer;
  color: #fff; box-shadow: var(--shadow-sm); transition: transform .08s, filter .15s;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active { transform: translateY(2px); }
.btn-pink  { background: var(--pink); }
.btn-blue  { background: var(--blue); }
.btn-green { background: var(--green); }
.btn-ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn-ghost.danger { color: var(--pink-d); }
.btn-lg { font-size: 1.25rem; padding: .9rem 1.8rem; }
.btn-sm { font-size: .95rem; padding: .5rem 1rem; }
.btn.block { width: 100%; }

.icon-btn {
  border: 2px solid var(--line); background: #fff; border-radius: 14px;
  width: 44px; height: 44px; font-size: 1.2rem; cursor: pointer; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #fff0d6; }
.icon-btn.danger { color: var(--pink-d); }

/* ---- Flash -------------------------------------------------------------- */
.flash-wrap { position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: .5rem; width: min(90%, 460px); }
.flash { padding: .8rem 1.1rem; border-radius: 16px; font-weight: 700; color: #fff;
  box-shadow: var(--shadow); animation: drop .4s ease; }
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } }
.flash-success { background: var(--green); }
.flash-error   { background: var(--pink); }
.flash-info    { background: var(--blue); }

/* ---- Layout ------------------------------------------------------------- */
.page { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.2rem 4rem; }
.page.narrow { max-width: 480px; }
.section-title { font-size: 2rem; margin: .2rem 0 1rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.tiny { font-size: .8rem; color: var(--muted); }

/* ---- Hero --------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; text-align: center;
  padding: 3.5rem 1rem 3rem; }
.hero-inner { position: relative; z-index: 2; }
.hero-brand { font-family: "Fredoka", sans-serif; font-weight: 700; line-height: 1;
  font-size: clamp(3.4rem, 14vw, 7rem); letter-spacing: .03em; margin: 0 0 .2rem; }
.hero-brand span { display: inline-block; text-shadow: 0 4px 0 rgba(0,0,0,.08);
  animation: brandBounce 2.6s ease-in-out infinite; }
.hero-brand span:nth-child(1) { color: #ef476f; }
.hero-brand span:nth-child(2) { color: #f78c6b; animation-delay: .1s; }
.hero-brand span:nth-child(3) { color: #ffd166; animation-delay: .2s; }
.hero-brand span:nth-child(4) { color: #06d6a0; animation-delay: .3s; }
.hero-brand span:nth-child(5) { color: #118ab2; animation-delay: .4s; }
.hero-brand span:nth-child(6) { color: #9b5de5; animation-delay: .5s; }
@keyframes brandBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.hero-free { display: inline-block; font-family: "Fredoka", sans-serif; font-weight: 700;
  font-size: clamp(1.1rem, 4vw, 1.7rem); color: #fff; background: var(--green);
  padding: .2rem 1rem; border-radius: 999px; transform: rotate(-3deg);
  box-shadow: 0 4px 0 var(--green-d); margin: 0 0 1rem;
  animation: wiggle 2.5s ease-in-out infinite; }
.hero-title { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0 0 .4rem; }
.hero-sub { font-size: clamp(1rem, 3vw, 1.35rem); color: var(--muted); margin: 0 0 1.5rem; }
.hero-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.hero-story { display: inline-block; color: var(--ink); }
@keyframes wiggle { 0%,100%{transform: rotate(-3deg);} 50%{transform: rotate(3deg);} }
.hero-blob { position: absolute; border-radius: 50%; filter: blur(8px); opacity: .5; z-index: 1; }
.blob1 { width: 200px; height: 200px; background: #ffd6e7; top: -40px; left: -30px; }
.blob2 { width: 260px; height: 260px; background: #cdebff; bottom: -80px; right: -40px; }

/* ---- Library shelf ------------------------------------------------------ */
.library { max-width: 1080px; margin: 0 auto; padding: 1rem 1.2rem 4rem; }
.library-head { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.search { display: flex; gap: .5rem; }
.search input { border: 2px solid var(--line); border-radius: 999px; padding: .6rem 1rem;
  font: inherit; min-width: 220px; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.4rem; }
.book-card { display: flex; flex-direction: column; gap: .5rem; color: var(--ink); }
.book-card:hover { text-decoration: none; }
.book-card:hover .book-cover { transform: translateY(-6px) rotate(-1deg); }
.book-cover {
  position: relative; aspect-ratio: 3/4; border-radius: 8px 16px 16px 8px;
  background: var(--cover, var(--yellow)); display: flex; flex-direction: column;
  padding: .55rem .5rem .55rem .9rem; text-align: center; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .18s; overflow: hidden;
}
.book-meta form { margin: 0; }
.shelf .book-meta { gap: .35rem; align-items: flex-start; }
/* The book's topic/title printed ON the cover. White label so it stays readable
   on any cover colour or gradient. */
.cover-title {
  background: rgba(255, 255, 255, .92); color: var(--ink); border-radius: 8px;
  padding: .3rem .4rem; width: 100%; box-sizing: border-box;
  font-family: "Fredoka"; font-weight: 600; font-size: .82rem; line-height: 1.12;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.book-emoji { flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 3rem; }
/* author's name printed on the cover, below the picture */
.cover-author { align-self: center; max-width: 100%; margin-top: .35rem;
  background: rgba(255, 255, 255, .85); color: var(--ink); border-radius: 999px;
  padding: .12rem .55rem; font-size: .7rem; font-weight: 700; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-author-link { font-size: .8rem; color: var(--blue-d); font-weight: 700; }
.book-author-link:hover { text-decoration: underline; }
.book-spine { position: absolute; left: 0; top: 0; bottom: 0; width: 12px;
  background: rgba(0,0,0,.12); border-radius: 8px 0 0 8px; }
.book-meta { display: flex; flex-direction: column; gap: .15rem; }
.book-title { font-weight: 700; font-family: "Fredoka"; line-height: 1.15; }
.book-author { font-size: .85rem; color: var(--muted); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-emoji { font-size: 4rem; margin-bottom: .5rem; }

/* ---- Cards / forms ------------------------------------------------------ */
.card { background: var(--paper); border-radius: var(--radius); padding: 1.8rem;
  box-shadow: var(--shadow); border: 3px solid var(--line); }
.card-title { margin: 0 0 1.2rem; font-size: 1.8rem; text-align: center; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field > span { font-weight: 700; }
.field input { border: 2px solid var(--line); border-radius: 14px; padding: .75rem 1rem;
  font: inherit; }
.field input:focus { outline: none; border-color: var(--blue); }

.role-pick, .pub-options { display: flex; gap: .8rem; }
.role-option input, .avatar-option input { position: absolute; opacity: 0; }
.role-box { display: block; flex: 1; text-align: center; padding: 1rem; border: 3px solid var(--line);
  border-radius: 16px; cursor: pointer; font-weight: 700; }
.role-option input:checked + .role-box { border-color: var(--pink); background: #fff0f4; }
.role-pick { }
.role-option { flex: 1; }

.avatar-pick { display: grid; grid-template-columns: repeat(8, 1fr); gap: .4rem; }
.avatar-box { display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; padding: .3rem; border: 3px solid transparent; border-radius: 12px;
  cursor: pointer; background: #faf5ec; }
.avatar-option input:checked + .avatar-box { border-color: var(--pink); background: #fff0f4; }
.avatar-pick-btn { font-family: inherit; width: 100%; }
.avatar-pick-btn:hover, .pop-pick:hover { border-color: var(--pink); background: #fff0f4; }

/* ---- Welcome / how-to video -------------------------------------------- */
.welcome { max-width: 760px; margin: 0 auto; padding: 1.5rem 1.2rem 4rem; text-align: center; }
.welcome-title { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: .3rem 0; }
.welcome-sub { color: var(--muted); font-size: 1.15rem; margin: 0 0 1.4rem; }
.video-frame { border-radius: 22px; overflow: hidden; box-shadow: var(--shadow);
  border: 5px solid #fff; outline: 2px solid var(--line); background: #000; }
.howto-video { display: block; width: 100%; height: auto; }
.video-hint { color: var(--muted); font-weight: 700; margin: .7rem 0 1.4rem; }
.welcome-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.welcome-cta form { margin: 0; }

/* ---- About page -------------------------------------------------------- */
.about { max-width: 860px; margin: 0 auto; padding: 1.5rem 1.2rem 4rem; }
.about-heading { font-size: clamp(2rem, 6vw, 2.8rem); text-align: center; margin: .2rem 0 1.5rem; }
.about-brand { color: var(--pink); }
.about-card { display: flex; gap: 1.8rem; background: #fff; border: 3px solid var(--line);
  border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); align-items: flex-start; }
.about-photo-wrap { position: relative; flex: 0 0 auto; }
.about-photo { width: 260px; max-width: 38vw; min-width: 180px; aspect-ratio: 3/4;
  object-fit: cover; border-radius: 18px; border: 5px solid #fff;
  outline: 3px solid var(--yellow); box-shadow: var(--shadow); display: block; }
.about-badge { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  background: var(--pink); color: #fff; font-family: "Fredoka"; font-weight: 600;
  font-size: .85rem; padding: .3rem .9rem; border-radius: 999px; white-space: nowrap;
  box-shadow: var(--shadow-sm); }
.about-text { flex: 1; min-width: 0; }
.about-text p { font-size: 1.08rem; line-height: 1.6; margin: 0 0 .9rem; }
.about-sign { font-family: "Fredoka"; font-size: 1.15rem; line-height: 1.4; margin-top: 1.2rem !important; }
.journey { text-align: center; margin-top: 2rem; }
.journey-title { font-size: 1.5rem; margin: 0 0 1rem; }
.journey-video { width: 100%; max-width: 360px; aspect-ratio: 4/5; display: block;
  margin: 0 auto; border-radius: 18px; background: #000; box-shadow: var(--shadow);
  border: 5px solid #fff; outline: 2px solid var(--line); }
.about-cta { text-align: center; margin-top: 1.6rem; }
.about-cta form { margin: 0; }
@media (max-width: 640px) {
  .about-card { flex-direction: column; align-items: center; text-align: center; }
  .about-photo { max-width: 70vw; }
  .about-badge { font-size: .8rem; }
}

/* ---- Header "Watch Video" lightbox ------------------------------------- */
.video-modal { position: fixed; inset: 0; background: rgba(43,45,66,.78); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.video-modal-inner { position: relative; width: min(900px, 96vw); }
.video-modal-inner video { width: 100%; max-height: 86vh; display: block;
  border-radius: 16px; background: #000; box-shadow: var(--shadow); }
.video-modal-x { position: absolute; top: 10px; right: 10px; width: 42px; height: 42px;
  border-radius: 50%; border: none; background: rgba(255,255,255,.92); color: var(--ink);
  cursor: pointer; font-size: 1.15rem; z-index: 2; box-shadow: var(--shadow-sm); }
.video-modal-x:hover { background: #fff; }

/* ---- Dashboard ---------------------------------------------------------- */
.dash-head, .mod-list { max-width: 1080px; margin-left: auto; margin-right: auto; }
.dash-head { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dash-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.dash-actions form { margin: 0; }
.mod-banner { display: block; background: #fff3bf; border: 3px solid #ffe066;
  color: #8a6d00; padding: .8rem 1.2rem; border-radius: 16px; font-weight: 700;
  margin-bottom: 1.2rem; }
.mod-banner:hover { text-decoration: none; filter: brightness(.98); }
.shelf-mine .book-card.mine { background: #fff; border: 3px solid var(--line);
  border-radius: 18px; padding: .9rem; box-shadow: var(--shadow-sm); }
.shelf-mine { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.shelf-mine .book-cover { aspect-ratio: 4/3; }
.shelf-mine .book-emoji { font-size: 2.4rem; }
.shelf-mine .cover-title { -webkit-line-clamp: 2; font-size: .8rem; }
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700; width: fit-content; }
.badge-grey  { background: #eef0f3; color: #5b6472; }
.badge-amber { background: #fff3bf; color: #8a6d00; }
.badge-green { background: #d3f9e8; color: #06794f; }
.badge-red   { background: #ffe3e3; color: #c92a4a; }
.reject-note { font-size: .85rem; color: #c92a4a; margin: .2rem 0; }
.link-copy { background: none; border: none; color: var(--blue-d); cursor: pointer;
  font: inherit; font-weight: 700; padding: 0; text-align: left; }
.card-actions { display: flex; gap: .4rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.card-actions form { margin: 0; }

/* ===========================================================================
   EDITOR
   =========================================================================== */
.editor-page { overflow-x: hidden; }
.editor { max-width: 1280px; margin: 0 auto; padding: 0; }
.editor-bar { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem;
  background: #fff; border-bottom: 3px solid var(--line); position: sticky; top: 0; z-index: 30;
  flex-wrap: wrap; }
.title-input { font-family: "Fredoka"; font-size: 1.25rem; font-weight: 600;
  border: 2px solid transparent; border-radius: 12px; padding: .4rem .7rem; min-width: 160px;
  flex: 1 1 200px; background: #faf5ec; }
.title-input:focus { outline: none; border-color: var(--blue); background: #fff; }
.cover-chip { display: flex; align-items: center; gap: .4rem; border: 2px solid var(--line);
  background: #fff; border-radius: 999px; padding: .25rem .7rem .25rem .25rem; cursor: pointer;
  font: inherit; font-weight: 700; }
.cover-chip #cover-emoji, .cover-chip #back-emoji { width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.cover-label { color: var(--muted); }
.spacer { flex: 1; }
.save-status { color: var(--green-d); font-weight: 700; font-size: .9rem; min-height: 1em; }

.editor-body { display: flex; gap: 1rem; padding: 1rem; align-items: flex-start; }
.tools { flex: 0 0 250px; display: flex; flex-direction: column; gap: 1rem;
  background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 1rem; }
.tool-group { border-bottom: 2px dashed var(--line); padding-bottom: .8rem; }
.tool-group:last-child { border-bottom: none; padding-bottom: 0; }
.tool-label { font-weight: 700; font-family: "Fredoka"; margin-bottom: .5rem; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: .3rem; }
.bg-swatches { grid-template-columns: repeat(8, 1fr); }
.swatch { aspect-ratio: 1; border-radius: 8px; border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch[data-active] { box-shadow: 0 0 0 3px var(--blue); transform: scale(1.05); }
.sizes { display: flex; gap: .4rem; margin-top: .5rem; }
.size { flex: 1; height: 38px; border: 2px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.size[data-active] { border-color: var(--blue); background: #eaf6fb; }
.size i { display: block; background: var(--ink); border-radius: 50%; }
.tool-btn { width: 100%; text-align: left; border: 2px solid var(--line); background: #fff;
  border-radius: 12px; padding: .6rem .8rem; font: inherit; font-weight: 700; cursor: pointer;
  margin-top: .4rem; }
.tool-btn:hover { background: #fff0d6; }
.tool-btn[data-active] { border-color: var(--blue); background: #eaf6fb; }
.tool-btn.danger { color: var(--pink-d); }
.stickers { display: grid; grid-template-columns: repeat(8, 1fr); gap: .25rem; }
.sticker { font-size: 1.3rem; background: #faf5ec; border: 2px solid transparent;
  border-radius: 10px; cursor: pointer; padding: .2rem 0; }
.sticker[data-active] { border-color: var(--pink); background: #fff0f4; }
.tool-hint { font-size: .78rem; color: var(--muted); margin: .4rem 0 0; }

.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.page-indicator { font-family: "Fredoka"; font-weight: 600; color: var(--muted); }
.canvas-wrap { width: 100%; max-width: 720px; aspect-ratio: 900/650; border-radius: 16px;
  box-shadow: var(--shadow); border: 4px solid #fff; outline: 2px solid var(--line);
  overflow: hidden; background: #fff; touch-action: none; }
#art { display: block; width: 100%; height: 100%; cursor: crosshair; }
/* Story text box with a spell-check underline overlay. The backdrop mirrors the
   textarea exactly (same font metrics, padding) and draws red squiggles behind
   the transparent-background textarea, so they line up under the real text. */
.page-text-wrap { position: relative; width: 100%; max-width: 720px; background: #fff;
  border: 3px solid var(--line); border-radius: 14px; }
.page-text-wrap:focus-within { border-color: var(--blue); }
.spell-backdrop { position: absolute; inset: 0; overflow: hidden; padding: .9rem 1.1rem;
  border-radius: 14px; pointer-events: none; }
#spell-highlights { margin: 0; color: transparent; white-space: pre-wrap;
  overflow-wrap: break-word; word-break: break-word;
  font-family: "Quicksand"; font-weight: 600; font-size: 1.15rem; line-height: 1.5; }
.sp-err { text-decoration: underline wavy #ef476f; text-decoration-thickness: 2px;
  text-underline-offset: 3px; -webkit-text-decoration: underline wavy #ef476f; }
.page-text { position: relative; z-index: 1; display: block; width: 100%; min-height: 90px;
  resize: vertical; border: none; background: transparent; padding: .9rem 1.1rem;
  color: var(--ink); font-family: "Quicksand"; font-weight: 600; font-size: 1.15rem;
  line-height: 1.5; }
.page-text:focus { outline: none; }

/* Spelling suggestion bubble that pops above the tapped word */
.spell-pop { position: fixed; z-index: 85; background: #fff; border: 3px solid var(--pink);
  border-radius: 16px; box-shadow: var(--shadow); padding: .5rem .6rem; display: flex;
  gap: .4rem; align-items: center; flex-wrap: wrap; max-width: 92vw; }
.spell-pop .sp-label { font-size: .8rem; color: var(--muted); font-weight: 700; padding: 0 .2rem; }
.spell-pop button { border: 2px solid var(--line); background: #fff0f4; border-radius: 999px;
  padding: .35rem .85rem; font: inherit; font-weight: 700; cursor: pointer; color: var(--ink); }
.spell-pop button:hover { background: var(--pink); color: #fff; }
.page-strip { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  justify-content: center; }
.page-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.page-chip { min-width: 38px; height: 38px; border-radius: 10px; border: 2px solid var(--line);
  background: #fff; cursor: pointer; font: inherit; font-weight: 700; }
.page-chip.active { border-color: var(--pink); background: #fff0f4; }

/* ---- SLIDES MODE — PowerPoint-style editor (only when data-kind="slides") -- */
.slide-rail { display: none; }
.slide-overlay { display: none; }

/* Left thumbnail rail */
.editor-body[data-kind="slides"] .slide-rail {
  display: flex; flex-direction: column; gap: .5rem; flex: 0 0 132px;
  max-height: 80vh; overflow-y: auto; padding: .2rem .1rem; }
.slide-thumb { display: flex; align-items: stretch; gap: .35rem; width: 100%;
  background: none; border: none; padding: 0; font: inherit; cursor: pointer; }
.slide-thumb .st-num { align-self: center; flex: 0 0 16px; text-align: right;
  color: var(--muted); font-weight: 700; font-size: .78rem; }
.slide-thumb .st-mini { flex: 1; aspect-ratio: 16/9; border: 2px solid var(--line);
  border-radius: 6px; background: #fff; overflow: hidden; padding: .25rem .3rem;
  font-size: .5rem; line-height: 1.15; color: #333; text-align: left;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.slide-thumb.active .st-mini { border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink); }
.slide-thumb.active .st-num { color: var(--pink); }

/* The slide itself: a white 16:9 canvas with a soft shadow */
.editor-body[data-kind="slides"] .canvas-wrap {
  max-width: 900px; aspect-ratio: 16/9; border-radius: 8px; border: 1px solid var(--line);
  outline: none; box-shadow: 0 12px 34px rgba(0,0,0,.14); position: relative; }

/* On-slide Title + Body text (PowerPoint-style placeholders) */
.editor-body[data-kind="slides"] .slide-overlay {
  display: flex; flex-direction: column; position: absolute; inset: 0;
  padding: 6% 7%; pointer-events: none; }
.editor-body[data-kind="slides"] .slide-title,
.editor-body[data-kind="slides"] .slide-body {
  pointer-events: auto; outline: none; border-radius: 6px; padding: .05em .15em; }
.editor-body[data-kind="slides"] .slide-title {
  font-family: "Fredoka", sans-serif; font-weight: 700; color: #1a2b5c;
  font-size: clamp(1.4rem, 3.3vw, 2.3rem); line-height: 1.15; min-height: 1.2em; }
.editor-body[data-kind="slides"] .slide-body {
  margin-top: 4%; flex: 1; font-family: "Quicksand", sans-serif; font-weight: 600;
  color: var(--ink); font-size: clamp(1rem, 2.1vw, 1.35rem); line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-body[data-kind="slides"] .slide-title:focus,
.editor-body[data-kind="slides"] .slide-body:focus {
  background: rgba(17,138,178,.06); box-shadow: 0 0 0 2px rgba(17,138,178,.35); }
.slide-title.is-empty::before, .slide-body.is-empty::before {
  content: attr(data-ph); color: #b4b8c4; }

/* In slides mode the book-style text box + number chips are replaced by the above */
.editor-body[data-kind="slides"] .page-text-wrap,
.editor-body[data-kind="slides"] .page-chips { display: none; }

/* ---- CARD mode — a portrait invitation with centred text on the decoration */
.editor-body[data-kind="card"] .canvas-wrap {
  max-width: 440px; aspect-ratio: 3/4; border-radius: 14px; border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(0,0,0,.14); position: relative; }
.editor-body[data-kind="card"] .slide-overlay {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: .5rem; position: absolute; inset: 0; padding: 12% 9%; pointer-events: none; }
.editor-body[data-kind="card"] .slide-title,
.editor-body[data-kind="card"] .slide-body {
  pointer-events: auto; outline: none; border-radius: 6px; width: 100%;
  text-shadow: 0 1px 6px rgba(255,255,255,.9), 0 0 2px rgba(255,255,255,.9); }
.editor-body[data-kind="card"] .slide-title {
  font-family: "Fredoka", sans-serif; font-weight: 700; color: #2b2d42;
  font-size: clamp(1.1rem, 4.4vw, 1.7rem); line-height: 1.15; }
.editor-body[data-kind="card"] .slide-body {
  font-family: "Quicksand", sans-serif; font-weight: 600; color: var(--ink);
  font-size: clamp(.85rem, 3.3vw, 1.05rem); line-height: 1.5; white-space: pre-wrap; }
.editor-body[data-kind="card"] .slide-title:focus,
.editor-body[data-kind="card"] .slide-body:focus {
  background: rgba(17,138,178,.06); box-shadow: 0 0 0 2px rgba(17,138,178,.3); }
.editor-body[data-kind="card"] .page-text-wrap,
.editor-body[data-kind="card"] .page-chips { display: none; }

/* ---- DESIGNED cards (complete Canva-style invitation designs) ------------ */
.editor-body[data-design]:not([data-design=""]) .tools,
.editor-body[data-design]:not([data-design=""]) .page-strip,
.editor-body[data-design]:not([data-design=""]) .canvas-tools { display: none; }
.card-stage { width: min(460px, 92vw); margin: 0 auto; display: flex;
  flex-direction: column; gap: .6rem; }
.card-stage .card-scale-box { width: 100%; }
.card-view-stage { display: flex; justify-content: center; margin: .6rem 0 1.2rem; }
.card-view-stage .card-scale-box { width: min(430px, 92vw); }

/* Popovers + modal */
.popover { position: fixed; inset: 0; background: rgba(43,45,66,.25); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.pop-card { background: #fff; border-radius: 20px; padding: 1.4rem; box-shadow: var(--shadow);
  width: min(94%, 420px); max-height: 88vh; overflow-y: auto; }
.pop-card h3 { margin: 0 0 1rem; }
.pop-card input { width: 100%; border: 2px solid var(--line); border-radius: 12px;
  padding: .7rem .9rem; font: inherit; }
.pop-emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: .3rem; margin-bottom: 1rem; }
.pop-emoji { font-size: 1.6rem; border: 2px solid transparent; border-radius: 10px;
  background: #faf5ec; cursor: pointer; padding: .25rem 0; }
.pop-emoji[data-active] { border-color: var(--pink); background: #fff0f4; }
.pop-colors { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pop-color { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.pop-color[data-active] { box-shadow: 0 0 0 3px var(--blue); }
.pop-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

.modal { position: fixed; inset: 0; background: rgba(43,45,66,.4); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-card { position: relative; background: #fff; border-radius: 24px; padding: 2rem;
  box-shadow: var(--shadow); width: min(94%, 520px); text-align: center; }
.modal-card h2 { margin: 0 0 .5rem; font-size: 1.8rem; }
.modal-x { position: absolute; top: 1rem; right: 1rem; border: none; background: #f1f1f4;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.pub-options { flex-direction: column; gap: .8rem; margin-top: 1.2rem; }
.pub-option { display: flex; flex-direction: column; gap: .2rem; text-align: left;
  border: 3px solid var(--line); border-radius: 18px; padding: 1rem 1.2rem; cursor: pointer;
  background: #fff; font: inherit; }
.pub-option:hover { border-color: var(--pink); background: #fff8fa; }
.pub-emoji { font-size: 1.8rem; }
.pub-h { font-family: "Fredoka"; font-weight: 600; font-size: 1.15rem; }
.pub-d { color: var(--muted); font-size: .9rem; }
.issue-list { text-align: left; background: #ffe3e3; border-radius: 14px; padding: 1rem 1rem 1rem 2.2rem;
  color: #c92a4a; }
#pub-share { display: flex; gap: .5rem; margin: 1rem 0; }
#pub-share input { flex: 1; border: 2px solid var(--line); border-radius: 12px; padding: .6rem .8rem; font: inherit; }

/* ===========================================================================
   READER
   =========================================================================== */
.reader-page { }
.reader { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 3rem; text-align: center; }
.reader-top { margin-bottom: 1rem; }
.reader-title { font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 0; }
.reader-author { color: var(--muted); margin: .2rem 0 0; }
.flipbook { display: flex; align-items: center; gap: .6rem; justify-content: center; }
.flip-arrow { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%; border: none;
  background: #fff; box-shadow: var(--shadow-sm); font-size: 1.4rem; cursor: pointer; color: var(--ink); }
.flip-arrow:hover { background: var(--yellow); }
.flip-arrow:disabled { opacity: .35; cursor: default; }
.book-stage { flex: 1; max-width: 640px; }
.page-paper { background: #fff; border-radius: 18px; box-shadow: var(--shadow);
  border: 5px solid #fff; outline: 2px solid var(--line); overflow: hidden; }
.page-paper.flip { animation: flip .35s ease; }
@keyframes flip { from { opacity: 0; transform: translateX(20px) rotateY(8deg); } }
.page-art-wrap { width: 100%; aspect-ratio: 900/650; background: #fafafa;
  display: flex; align-items: center; justify-content: center; }
#page-art { width: 100%; height: 100%; object-fit: contain; }
.page-noart { font-size: 4rem; opacity: .3; }
.page-noart.back-cover-art { font-size: clamp(5rem, 22vw, 11rem); opacity: 1; line-height: 1; }
.page-story.the-end { text-align: center !important; font-family: "Fredoka", sans-serif !important;
  font-weight: 700; color: var(--ink) !important; letter-spacing: .04em; }
.page-story { font-size: clamp(1.1rem, 3.2vw, 1.5rem); line-height: 1.55; padding: 1.1rem 1.3rem;
  margin: 0; text-align: left; min-height: 2em; white-space: pre-wrap; }
.page-foot { display: flex; align-items: center; justify-content: space-between;
  margin-top: .7rem; padding: 0 .3rem; }
.page-count { font-family: "Fredoka"; color: var(--muted); }
#read-aloud.reading { background: var(--pink); }

.reactions { display: flex; gap: .6rem; justify-content: center; margin: 1.4rem 0 .5rem; flex-wrap: wrap; }
.react-btn { display: flex; align-items: center; gap: .35rem; border: 3px solid var(--line);
  background: #fff; border-radius: 999px; padding: .4rem .9rem; cursor: pointer; font: inherit;
  font-weight: 700; transition: transform .1s; }
.react-btn:hover { transform: translateY(-2px); }
.react-btn.on { border-color: var(--pink); background: #fff0f4; }
.react-btn:active { transform: scale(1.2); }
.react-emoji { font-size: 1.3rem; }
.react-readonly { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.react-static { font-weight: 700; }
.reader-bottom { margin-top: 1.5rem; }

/* ===========================================================================
   MODERATION
   =========================================================================== */
.mod-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.mod-card { display: flex; gap: 1rem; background: #fff; border: 3px solid var(--line);
  border-radius: 18px; padding: 1rem; box-shadow: var(--shadow-sm); align-items: center; }
.mod-cover { flex: 0 0 110px; height: 84px; border-radius: 12px; background: var(--cover, var(--yellow));
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mod-cover img { width: 100%; height: 100%; object-fit: cover; }
.mod-cover .book-emoji { font-size: 2.4rem; }
.mod-info { flex: 1; min-width: 0; }
.mod-info h3 { margin: 0; }
.mod-actions { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }

/* ===========================================================================
   BATCH-1: filters, chips, author profile, certificate, undo/redo
   =========================================================================== */
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 0 0 1.2rem; }
.filter-bar select { border: 2px solid var(--line); border-radius: 999px; padding: .5rem .9rem;
  font: inherit; font-weight: 700; background: #fff; color: var(--ink); cursor: pointer; }
.filter-clear { font-weight: 700; color: var(--pink-d); }

a.book-author { color: var(--muted); }
a.book-author:hover { color: var(--blue-d); text-decoration: underline; }
.tag-row { display: flex; gap: .3rem; flex-wrap: wrap; }
.chip { display: inline-block; background: #eef1f4; color: #5b6472; border-radius: 999px;
  padding: .12rem .55rem; font-size: .72rem; font-weight: 700; }
.chip-level { background: #e7f5ff; color: #0d6e8f; }
.reader-tags { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; margin-top: .5rem; }
.reader-author a { color: var(--blue-d); }

.canvas-tools { display: flex; align-items: center; gap: .5rem; justify-content: center; margin-bottom: .2rem; }
.canvas-tools .icon-btn { width: 40px; height: 40px; font-size: 1.1rem; }
.canvas-tools .icon-btn:disabled { opacity: .4; cursor: default; }

.pop-card select { width: 100%; border: 2px solid var(--line); border-radius: 12px;
  padding: .6rem .8rem; font: inherit; background: #fff; }

.author-hero { text-align: center; padding: 1.5rem 1rem .5rem; }
.author-avatar-big { font-size: 4rem; line-height: 1; }

.cert-wrap { max-width: 820px; margin: 0 auto; padding: 1.5rem 1rem 3rem; text-align: center; }
.certificate { background: #fff; border: 10px solid var(--yellow); border-radius: 18px;
  padding: 2.5rem 2rem; box-shadow: var(--shadow); outline: 3px solid #fff; outline-offset: -16px; }
.cert-emoji { font-size: 3.5rem; }
.cert-kicker { color: var(--muted); font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; font-size: .78rem; margin: .3rem 0; }
.cert-title { font-family: "Fredoka"; font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: .2rem 0 1rem; color: var(--pink); }
.cert-line { margin: .4rem 0; }
.cert-name { font-family: "Fredoka"; font-size: 1.8rem; margin: .4rem 0; }
.cert-book { font-family: "Fredoka"; font-size: 1.4rem; color: var(--blue-d); margin: .3rem 0; }
.cert-date { color: var(--muted); margin-top: 1rem; }
.cert-foot { display: flex; justify-content: space-between; margin-top: 1.8rem;
  font-family: "Fredoka"; font-weight: 600; }
.cert-actions { display: flex; gap: .8rem; justify-content: center; margin-top: 1.4rem; flex-wrap: wrap; }
@media print {
  .nav, .flash-wrap, .cert-actions, .no-print { display: none !important; }
  body { background: #fff; }
  .certificate { box-shadow: none; }
}

/* ===========================================================================
   BATCH-2: clip-art tabs, text styling, read-along
   =========================================================================== */
.sticker-tabs { display: flex; gap: .25rem; margin-bottom: .45rem; flex-wrap: wrap; }
.stab { flex: 1; min-width: 32px; border: 2px solid var(--line); background: #fff;
  border-radius: 10px; font-size: 1.1rem; padding: .25rem 0; cursor: pointer; }
.stab.on { border-color: var(--pink); background: #fff0f4; }

/* book text sizes — shared by editor textarea + spell backdrop + reader story */
.ts-s { font-size: .95rem; } .ts-m { font-size: 1.15rem; }
.ts-l { font-size: 1.4rem; } .ts-xl { font-size: 1.75rem; }

.align-pick { display: flex; gap: .5rem; }
.align-opt { flex: 1; border: 2px solid var(--line); background: #fff; border-radius: 12px;
  padding: .5rem; font: inherit; font-weight: 700; cursor: pointer; }
.align-opt.on { border-color: var(--pink); background: #fff0f4; }
.pop-card input[type="color"] { width: 100%; height: 44px; border: 2px solid var(--line);
  border-radius: 12px; padding: .2rem; background: #fff; cursor: pointer; }

/* read-along: highlight the word currently being spoken */
.page-story .rw { border-radius: 5px; transition: background .12s ease; }
.reading-word { background: #ffe066; box-shadow: 0 0 0 3px #ffe066; }

/* ===========================================================================
   CLASSROOMS
   =========================================================================== */
.class-section { max-width: 1080px; margin: 0 auto 2rem; }
.class-h2 { font-family: "Fredoka"; font-size: 1.35rem; margin: .2rem 0 1rem; }
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem; margin-bottom: 1.1rem; }
.class-card { display: block; background: #fff; border: 3px solid var(--line);
  border-radius: 18px; padding: 1.1rem; box-shadow: var(--shadow-sm); color: var(--ink);
  transition: transform .15s, border-color .15s; }
.class-card:hover { transform: translateY(-4px); border-color: var(--pink); text-decoration: none; }
.class-emoji { font-size: 2.2rem; }
.class-name { font-family: "Fredoka"; font-weight: 600; font-size: 1.15rem; margin-top: .2rem; }
.class-meta { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.class-form { display: flex; gap: .5rem; flex-wrap: wrap; max-width: 520px; }
.class-form input { flex: 1; min-width: 200px; border: 2px solid var(--line);
  border-radius: 999px; padding: .6rem 1rem; font: inherit; }
.class-detail { max-width: 1080px; margin: 0 auto; }
.join-code { display: inline-flex; align-items: center; gap: .5rem; background: #fff3bf;
  border: 2px solid #ffe066; color: #8a6d00; border-radius: 12px; padding: .4rem .9rem;
  font-size: 1.05rem; margin-top: .4rem; }
.join-code b { font-family: "Fredoka"; letter-spacing: .08em; }
.assignment-box { margin: 1.3rem 0; }
.assignment-box textarea { width: 100%; border: 2px solid var(--line); border-radius: 14px;
  padding: .7rem 1rem; font: inherit; font-weight: 600; resize: vertical; }
.assignment-show { background: #e7f5ff; border: 2px solid #b8e0ff; border-radius: 14px;
  padding: .8rem 1.1rem; font-weight: 600; }
.roster { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.5rem; }
.roster-row { display: flex; align-items: center; gap: .8rem; background: #fff;
  border: 2px solid var(--line); border-radius: 14px; padding: .55rem 1rem; }
.roster-who { font-weight: 700; color: var(--ink); }
.roster-row .muted { margin-left: auto; }
.roster-row form { margin: 0; }
.class-detail .class-h2 { margin-top: 1.6rem; }
.class-actions { display: flex; gap: .6rem; margin-top: 1.6rem; flex-wrap: wrap; align-items: center; }
.class-actions form { margin: 0; }

/* ===========================================================================
   EMOJI PICKER ("Pick any emoji")
   =========================================================================== */
.emoji-modal { position: fixed; inset: 0; background: rgba(43,45,66,.4); z-index: 95;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.emoji-card { background: #fff; border-radius: 20px; width: min(96%, 460px);
  max-height: 82vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
  overflow: hidden; }
.emoji-head { display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem .4rem; }
.emoji-head h3 { margin: 0; }
.emoji-x { border: none; background: #f1f1f4; width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; font-size: 1rem; }
.emoji-typer { display: flex; gap: .5rem; padding: 0 1.2rem .6rem; }
.emoji-typer input { flex: 1; border: 2px solid var(--line); border-radius: 12px;
  padding: .5rem .8rem; font: inherit; font-size: 1.3rem; }
.emoji-body { overflow-y: auto; padding: 0 1rem 1rem; }
.emoji-group-name { font-weight: 700; color: var(--muted); font-size: .78rem;
  margin: .7rem 0 .3rem; position: sticky; top: 0; background: #fff; padding: .25rem 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: .2rem; }
.emoji-cell { font-size: 1.5rem; background: none; border: 2px solid transparent;
  border-radius: 10px; cursor: pointer; padding: .2rem 0; line-height: 1.2; }
.emoji-cell:hover { background: #fff0f4; border-color: var(--pink); }

/* ===========================================================================
   CREATE — "what do you want to make?" chooser + kind badges
   =========================================================================== */
.create-head { text-align: center; margin: 1rem 0 1.6rem; }
.create-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem; max-width: 820px; margin: 0 auto; }
.create-card-form { display: flex; }
.create-card { display: flex; flex-direction: column; align-items: center; gap: .35rem;
  width: 100%; text-align: center; cursor: pointer; background: #fff;
  border: 3px solid var(--line); border-radius: 22px; padding: 1.6rem 1.2rem;
  font: inherit; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.create-card:hover { transform: translateY(-4px); border-color: var(--pink);
  box-shadow: 0 14px 30px rgba(239,71,111,.18); }
.create-emoji { font-size: 3.2rem; line-height: 1; }
.create-label { font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 1.35rem;
  color: var(--ink); }
.create-blurb { color: var(--muted); font-size: .95rem; min-height: 2.6em; }
.create-cta { margin-top: .3rem; color: var(--pink-d); font-weight: 700; }

.kind-badge { display: inline-block; background: #eef2ff; color: #3b4a8a; border: 2px solid #dfe6ff;
  border-radius: 999px; padding: .1rem .55rem; font-size: .78rem; font-weight: 700; }
.create-card { text-decoration: none; }

/* ---- Birthday invitation template gallery (Canva-style) ------------------ */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 1.2rem; max-width: 1000px; margin: 0 auto; }
.tpl-card-v2 { position: relative; display: block; width: 100%; border: none; background: none;
  padding: 0; cursor: pointer; border-radius: 14px; overflow: hidden; font: inherit;
  transition: transform .12s ease, box-shadow .12s ease; }
.tpl-card-v2:hover { transform: translateY(-4px); }
.tpl-card-v2 .card-scale-box { border-radius: 14px; box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.tpl-card-v2 .tpl-use { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(43,45,66,.84);
  color: #fff; font-weight: 700; font-size: .82rem; padding: .5rem; z-index: 2;
  transform: translateY(100%); transition: transform .16s ease; }
.tpl-card-v2:hover .tpl-use, .tpl-card-v2:focus-visible .tpl-use { transform: translateY(0); }
.tpl-blank-sub { font-size: .78rem; color: var(--muted); font-weight: 600; }
.tpl-form { display: flex; flex-direction: column; align-items: center; gap: .45rem; }
.tpl-card { position: relative; width: 100%; aspect-ratio: 3/4; border: none; cursor: pointer;
  border-radius: 16px; overflow: hidden; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .5rem; padding: 1rem .8rem;
  text-align: center; font: inherit; box-shadow: 0 6px 16px rgba(0,0,0,.12);
  transition: transform .12s ease, box-shadow .12s ease; }
.tpl-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(0,0,0,.22); }
.tpl-card > span { text-shadow: 0 1px 6px rgba(255,255,255,.9), 0 0 3px rgba(255,255,255,.9); }
.ci-invited { font-size: .62rem; font-weight: 700; letter-spacing: .18em; color: #3a3a4a; }
.ci-emoji { font-size: 2.7rem; line-height: 1; text-shadow: 0 2px 3px rgba(0,0,0,.12); }
.ci-title { font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 1.15rem;
  color: #2b2d42; line-height: 1.1; }
.ci-rule { width: 46px; height: 2px; background: #2b2d42; opacity: .5; border-radius: 2px; }
.ci-meta { font-size: .64rem; font-weight: 700; color: #3a3a4a; line-height: 1.5; }
.tpl-use { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(43,45,66,.82);
  color: #fff; font-weight: 700; font-size: .82rem; padding: .5rem;
  transform: translateY(100%); transition: transform .16s ease; }
.tpl-card:hover .tpl-use, .tpl-card:focus-visible .tpl-use { transform: translateY(0); }
.tpl-name { font-weight: 700; color: var(--ink); font-size: .9rem; }
.tpl-blank { background: #fff; border: 3px dashed var(--line); box-shadow: none; color: var(--muted); gap: .3rem; }
.tpl-blank:hover { border-color: var(--pink); color: var(--pink-d); transform: translateY(-4px); }
.tpl-plus { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.tpl-blank-label { font-weight: 700; }

/* ===========================================================================
   RESPONSIVE
   =========================================================================== */
@media (max-width: 820px) {
  .editor-body { flex-direction: column; }
  .tools { flex: 1 1 auto; width: 100%; }
  .swatches, .stickers, .pop-emojis, .avatar-pick { grid-template-columns: repeat(8, 1fr); }
  .nav { padding: .6rem .8rem; }
  .nav-user { display: none; }
  /* Slides rail becomes a horizontal filmstrip on small screens */
  .editor-body[data-kind="slides"] .slide-rail {
    flex-direction: row; flex: 0 0 auto; max-height: none; width: 100%;
    overflow-x: auto; overflow-y: hidden; order: 3; }
  .editor-body[data-kind="slides"] .slide-thumb { flex: 0 0 112px; width: 112px; }
}
@media (max-width: 480px) {
  .avatar-pick { grid-template-columns: repeat(6, 1fr); }
  .flip-arrow { width: 44px; height: 44px; }
}
