/* ==========================================================================
   حكاياتي — Hekayati Design System
   Soft pastel children's storybook style. RTL-first with LTR support.
   ========================================================================== */

:root {
  /* Palette */
  --sky-1: #dff3fb;
  --sky-2: #eaf8fd;
  --page-bg: #e9f6fb;
  --card: #ffffff;
  --card-soft: #fdfbf5;
  --cream: #fff9ec;

  --ink: #4a4238;
  --ink-soft: #7c7266;
  --ink-mute: #a49a8d;

  --green: #8fce6f;
  --green-d: #6fb44f;
  --green-l: #e6f7dc;

  --orange: #ffb547;
  --orange-d: #f09a1e;
  --orange-l: #fff2da;

  --pink: #ffb3c9;
  --pink-d: #f78bab;
  --pink-l: #ffeef3;

  --blue: #7ec9ea;
  --blue-d: #52aed4;
  --blue-l: #e6f5fc;

  --lilac: #c3b1e8;
  --lilac-d: #a58fd8;
  --lilac-l: #f1ecfc;

  --gold: #f5c542;
  --red: #ef6a6a;

  --line: #e8ded0;
  --line-2: #d8cbb8;

  /* Radii */
  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;
  --r-pill: 999px;

  /* Shadows */
  --sh-sm: 0 2px 0 rgba(120, 104, 84, .12), 0 4px 12px rgba(120, 104, 84, .08);
  --sh-md: 0 4px 0 rgba(120, 104, 84, .1), 0 10px 24px rgba(120, 104, 84, .12);
  --sh-lg: 0 8px 30px rgba(90, 80, 66, .16);
  --sh-card: 0 6px 18px rgba(120, 104, 84, .12);

  --header-h: 66px;
  --maxw: 1180px;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Baloo Bhaijaan 2', 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.75;
}
body[dir="ltr"] {
  font-family: 'Baloo 2', 'Baloo Bhaijaan 2', system-ui, -apple-system, sans-serif;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.35; }

/* ---------- Decorative page background ---------- */
.bg-deco {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 255, 255, .85) 0 42px, transparent 43px),
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, .7) 0 30px, transparent 31px),
    radial-gradient(circle at 86% 22%, rgba(255, 255, 255, .8) 0 38px, transparent 39px),
    radial-gradient(circle at 92% 19%, rgba(255, 255, 255, .6) 0 26px, transparent 27px),
    radial-gradient(circle at 50% 92%, rgba(255, 255, 255, .5) 0 60px, transparent 61px),
    linear-gradient(180deg, #dff2fb 0%, #eaf7fc 45%, #f3fbf6 100%);
}

/* ---------- App shell ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid #eef3ee;
  box-shadow: 0 2px 14px rgba(120, 104, 84, .07);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 14px 5px 10px;
  box-shadow: var(--sh-sm);
  transition: transform .18s;
}
.brand:hover { transform: translateY(-2px); }
.brand-logo { font-size: 22px; line-height: 1; }
.brand-name { font-size: 19px; font-weight: 800; color: #6b5c48; white-space: nowrap; }

/* Step wizard */
.stepper {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
.stepper::-webkit-scrollbar { display: none; }

.step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: #f6f2ea;
  border: 2px solid var(--line);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-mute);
  white-space: nowrap;
  transition: all .2s;
}
.step .step-ico { font-size: 15px; }
.step .step-num { opacity: .8; }
.step[data-state="done"] {
  background: var(--green-l);
  border-color: #b9e39c;
  color: var(--green-d);
  cursor: pointer;
}
.step[data-state="done"]:hover { transform: translateY(-2px); }
.step[data-state="active"] {
  background: var(--orange-l);
  border-color: var(--orange);
  color: #b5741a;
  box-shadow: 0 3px 0 rgba(240, 154, 30, .25);
}

.header-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--cream);
  border: 2px solid var(--line);
  font-size: 16px;
  box-shadow: var(--sh-sm);
  transition: transform .18s, background .18s;
}
.icon-btn:hover { transform: translateY(-2px); background: #fff; }

.lang-btn {
  padding: 0 14px;
  width: auto;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 800;
  color: #6b5c48;
}

/* ---------- Main / screens ---------- */
.main-area { flex: 1; padding: 22px 16px 44px; }
.screen { max-width: var(--maxw); margin: 0 auto; animation: screenIn .42s cubic-bezier(.2, .8, .3, 1); }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Panel (main white rounded card) ---------- */
.panel {
  background: var(--card);
  border: 3px solid #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  padding: 26px 26px 30px;
  position: relative;
  overflow: hidden;
}
.panel.tight { padding: 22px 20px 26px; }
.panel.plain { background: var(--card-soft); }

.panel-title {
  text-align: center;
  font-size: clamp(21px, 2.6vw, 28px);
  color: #5f5241;
  margin-bottom: 6px;
}
.panel-sub {
  text-align: center;
  color: var(--ink-mute);
  font-size: 14.5px;
  margin: 0 0 22px;
  font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: var(--r-pill);
  font-size: 15.5px;
  font-weight: 800;
  border: 2.5px solid transparent;
  transition: transform .16s, box-shadow .16s, filter .16s;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(2px) scale(.99); }
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.btn-orange { background: var(--orange); border-color: #eaa233; color: #6b4708; box-shadow: 0 4px 0 #e59a26, var(--sh-sm); }
.btn-green  { background: var(--green);  border-color: #7cbf5b; color: #2f5c1a; box-shadow: 0 4px 0 #6cae4d, var(--sh-sm); }
.btn-blue   { background: var(--blue);   border-color: #62b8dd; color: #12495f; box-shadow: 0 4px 0 #56aacf, var(--sh-sm); }
.btn-pink   { background: var(--pink);   border-color: #f79cb8; color: #7d2a44; box-shadow: 0 4px 0 #ef8fae, var(--sh-sm); }
.btn-lilac  { background: var(--lilac);  border-color: #b09ce0; color: #443068; box-shadow: 0 4px 0 #a893d6, var(--sh-sm); }
.btn-gold   { background: var(--gold);   border-color: #e6b62f; color: #6a4f04; box-shadow: 0 4px 0 #dcae2c, var(--sh-sm); }
.btn-ghost  { background: var(--cream);  border-color: var(--line-2); color: #6b5c48; box-shadow: var(--sh-sm); }
.btn-white  { background: #fff; border-color: var(--line); color: #6b5c48; box-shadow: var(--sh-sm); }

.btn-lg { padding: 14px 34px; font-size: 17px; border-radius: var(--r-pill); }
.btn-sm { padding: 8px 18px; font-size: 13.5px; }
.btn-block { width: 100%; }

.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}
.btn-row.split { justify-content: space-between; }

/* ---------- Hero (screen 1) ---------- */
.hero {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: var(--sh-lg);
  min-height: 460px;
  display: grid;
  place-items: center;
  padding: 34px 22px;
}
.hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.08) 45%, rgba(255,255,255,.35));
  z-index: 1;
}
.hero-content { position: relative; z-index: 2; width: 100%; max-width: 470px; }

/* Cloud card for the name input */
.cloud-card {
  background: rgba(255, 255, 255, .95);
  border: 3px solid #fff;
  border-radius: 44px;
  padding: 26px 28px 28px;
  box-shadow: 0 12px 34px rgba(90, 80, 66, .2);
  text-align: center;
  position: relative;
}
.cloud-card::before,
.cloud-card::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, .95);
  border-radius: 50%;
  z-index: -1;
}
.cloud-card::before { width: 88px; height: 88px; top: -30px; inset-inline-start: 32px; }
.cloud-card::after  { width: 66px; height: 66px; top: -22px; inset-inline-end: 40px; }

.cloud-title {
  font-size: clamp(20px, 2.6vw, 26px);
  color: #5f5241;
  margin-bottom: 16px;
}

/* Side action rail (screen 1) — always on the visual left, as in the design */
.hero-rail {
  position: absolute;
  z-index: 3;
  top: 26px;
  left: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 138px;
}
.hero-rail .btn { width: 100%; padding: 10px 14px; font-size: 14.5px; }

/* ---------- Inputs ---------- */
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-soft);
  margin-bottom: 6px;
  padding-inline-start: 6px;
}
.input, .select {
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--r-pill);
  border: 2.5px solid var(--line-2);
  background: var(--cream);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input::placeholder { color: #bdb2a2; font-weight: 600; }
.input:focus, .select:focus {
  border-color: var(--orange);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 181, 71, .2);
}
.input.error, .select.error { border-color: var(--red); box-shadow: 0 0 0 4px rgba(239, 106, 106, .16); }
.input-big { padding: 16px 22px; font-size: 18px; text-align: center; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23a49a8d' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 18px center;
  padding-inline-end: 18px;
}
body[dir="ltr"] .select { background-position: right 18px center; }

.field-error { color: var(--red); font-size: 12.5px; font-weight: 700; margin-top: 5px; padding-inline-start: 8px; min-height: 16px; }

/* Chip radio group */
.chips { display: flex; gap: 9px; flex-wrap: wrap; }
.chip {
  padding: 9px 18px;
  border-radius: var(--r-pill);
  background: var(--cream);
  border: 2.5px solid var(--line-2);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all .18s;
}
.chip:hover { transform: translateY(-2px); }
.chip[aria-pressed="true"] {
  background: var(--orange-l);
  border-color: var(--orange);
  color: #b5741a;
  box-shadow: 0 3px 0 rgba(240,154,30,.22);
}

/* ---------- Choice cards grid ---------- */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.choice-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.choice-card {
  background: var(--card-soft);
  border: 3px solid var(--line);
  border-radius: var(--r-lg);
  padding: 12px 12px 16px;
  text-align: center;
  box-shadow: var(--sh-card);
  transition: transform .2s, border-color .2s, box-shadow .2s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice-card:hover { transform: translateY(-5px); box-shadow: 0 12px 26px rgba(120,104,84,.18); }
.choice-card[aria-pressed="true"], .choice-card.selected {
  border-color: var(--green);
  background: var(--green-l);
  box-shadow: 0 0 0 4px rgba(143, 206, 111, .25), var(--sh-card);
}
.choice-card[aria-pressed="true"]::after {
  content: '✓';
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: var(--sh-sm);
}
.choice-media {
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #f0ece2;
  border: 2px solid #fff;
}
.choice-media img { width: 100%; height: 100%; object-fit: cover; }
.choice-title { font-size: 16.5px; font-weight: 800; color: #5f5241; }
.choice-desc { font-size: 12.8px; color: var(--ink-mute); font-weight: 600; line-height: 1.5; padding: 0 4px; }

/* ---------- Element tabs (screen 3) ---------- */
.elem-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.elem-card {
  border-radius: var(--r-lg);
  border: 3px solid var(--line);
  background: var(--card-soft);
  overflow: hidden;
  box-shadow: var(--sh-card);
  display: flex;
  flex-direction: column;
}
.elem-head {
  padding: 11px 14px;
  font-weight: 800;
  font-size: 15.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  border-bottom: 2px solid rgba(255,255,255,.7);
}
.elem-head.pink  { background: var(--pink-l);  color: #a04e6a; }
.elem-head.blue  { background: var(--blue-l);  color: #2b6d88; }
.elem-head.lilac { background: var(--lilac-l); color: #6a52a0; }
.elem-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.elem-media { border-radius: var(--r-md); overflow: hidden; aspect-ratio: 16/10; border: 2px solid #fff; }
.elem-media img { width: 100%; height: 100%; object-fit: cover; }

.opt-list { display: flex; flex-direction: column; gap: 7px; }
.opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-radius: var(--r-pill);
  background: #fff;
  border: 2.5px solid var(--line);
  font-size: 13.8px;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: start;
  transition: all .16s;
}
.opt:hover { transform: translateX(-3px); border-color: var(--line-2); }
body[dir="ltr"] .opt:hover { transform: translateX(3px); }
.opt-emoji { font-size: 17px; }
.opt[aria-pressed="true"] {
  background: var(--green-l);
  border-color: var(--green);
  color: var(--green-d);
  box-shadow: 0 3px 0 rgba(143,206,111,.28);
}
.opt[aria-pressed="true"] .opt-check { margin-inline-start: auto; color: var(--green-d); font-weight: 900; }

/* ---------- Book preview (screen 4) ---------- */
.preview-wrap {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: var(--sh-lg);
  padding: 30px 26px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 26px;
  align-items: center;
  background: #eef7ef;
}
.preview-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.preview-wrap > *:not(.preview-bg) { position: relative; z-index: 2; }
.preview-wrap::after {
  content: '';
  position: absolute; inset: 0; z-index: 1;
  background: rgba(255,255,255,.42);
}

/* 3D book */
.book3d {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 8px var(--r-sm) var(--r-sm) 8px;
  overflow: hidden;
  box-shadow: 0 14px 32px rgba(70, 60, 48, .34);
  border: 3px solid #fff;
  background: #f6f0e4;
}
body[dir="rtl"] .book3d { border-radius: var(--r-sm) 8px 8px var(--r-sm); }
.book3d img { width: 100%; height: 100%; object-fit: cover; }
.book3d::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-start: 0;
  width: 15px;
  background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,0));
  z-index: 3;
}
body[dir="ltr"] .book3d::before { background: linear-gradient(270deg, rgba(0,0,0,.28), rgba(0,0,0,0)); inset-inline-start: auto; inset-inline-end: 0; }
.book-cover-text {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 4;
  padding: 14px 12px 16px;
  background: linear-gradient(0deg, rgba(0,0,0,.55), transparent);
  color: #fff;
  text-align: center;
}
.book-cover-text .bt { font-size: 15px; font-weight: 800; text-shadow: 0 2px 6px rgba(0,0,0,.5); line-height: 1.4; }
.book-cover-text .bs { font-size: 11.5px; opacity: .92; font-weight: 600; }

.story-bubble {
  background: rgba(255, 255, 255, .95);
  border: 3px solid #fff;
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--sh-md);
}
.story-bubble h3 { font-size: 20px; color: #5f5241; margin-bottom: 8px; }
.story-bubble p { margin: 0; font-size: 15px; color: var(--ink-soft); font-weight: 600; line-height: 1.9; }

/* ---------- Product cards (screen 5) ---------- */
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-card {
  background: var(--card-soft);
  border: 3px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  text-align: center;
  box-shadow: var(--sh-card);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .2s, border-color .2s;
}
.product-card:hover { transform: translateY(-5px); }
.product-card.selected { border-color: var(--green); background: var(--green-l); box-shadow: 0 0 0 4px rgba(143,206,111,.25), var(--sh-card); }
.product-visual {
  aspect-ratio: 4/3;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid #fff;
  background: #efeae0;
  display: grid;
  place-items: center;
  font-size: 46px;
  position: relative;
}
.product-visual img { width: 100%; height: 100%; object-fit: cover; }
.product-name { font-size: 16px; font-weight: 800; color: #5f5241; }
.product-note { font-size: 12.5px; color: var(--ink-mute); font-weight: 600; min-height: 34px; }
.price-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  justify-content: center;
  font-size: 19px;
  font-weight: 900;
  color: #6b5c48;
}
.price-tag .cur { font-size: 12.5px; font-weight: 700; color: var(--ink-mute); }

.ribbon {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 2px solid #fff;
  box-shadow: var(--sh-sm);
  z-index: 5;
}
.ribbon.gold { background: var(--gold); color: #6a4f04; }

/* ---------- Payment methods (screen 7) ---------- */
.pay-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 620px; margin: 0 auto; }
.pay-card {
  background: #fff;
  border: 3px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px 12px;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 116px;
  box-shadow: var(--sh-card);
  transition: transform .18s, border-color .18s;
}
.pay-card:hover { transform: translateY(-4px); }
.pay-card.selected { border-color: var(--green); box-shadow: 0 0 0 4px rgba(143,206,111,.25), var(--sh-card); }
.pay-logo { font-size: 15px; font-weight: 900; letter-spacing: .5px; }
.pay-name { font-size: 12.5px; font-weight: 700; color: var(--ink-mute); }

/* ---------- Success (screen 8) ---------- */
.success-card {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  background: rgba(255,255,255,.96);
  border: 3px solid #fff;
  border-radius: var(--r-xl);
  padding: 26px 24px 30px;
  box-shadow: var(--sh-lg);
}
.success-art { width: 190px; margin: 0 auto 10px; }
.order-no {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border: 2.5px dashed var(--line-2);
  border-radius: var(--r-pill);
  padding: 8px 20px;
  font-weight: 800;
  color: #6b5c48;
  font-size: 14.5px;
  margin: 14px 0 4px;
  direction: ltr;
}

/* ---------- Library (screen 9) ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.lib-card {
  background: var(--card-soft);
  border: 3px solid var(--line);
  border-radius: var(--r-lg);
  padding: 12px;
  box-shadow: var(--sh-card);
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: relative;
  transition: transform .2s;
}
.lib-card:hover { transform: translateY(-5px); }
.lib-thumb { border-radius: var(--r-md); overflow: hidden; aspect-ratio: 3/4; border: 2px solid #fff; }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-title { font-size: 14.8px; font-weight: 800; color: #5f5241; line-height: 1.45; }
.lib-meta { font-size: 11.8px; color: var(--ink-mute); font-weight: 700; }
.lib-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.lib-actions .btn { flex: 1; padding: 7px 10px; font-size: 12.5px; }

/* ---------- Reader (screen 10) ---------- */
.reader {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: var(--sh-lg);
  background: #fffdf7;
  min-height: 430px;
}
.reader-img { position: relative; background: #eef3ea; min-height: 100%; }
.reader-img img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.reader-text {
  padding: 30px 28px;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.06), transparent 18px),
    var(--cream);
}
body[dir="ltr"] .reader-text { background: linear-gradient(270deg, rgba(0,0,0,.06), transparent 18px), var(--cream); }
.reader-text p {
  margin: 0;
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 2.1;
  color: #5b5142;
  font-weight: 600;
}
.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.page-nav {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2.5px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 8px;
  box-shadow: var(--sh-sm);
}
.page-nav .pn-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--cream);
  border: 2px solid var(--line);
  font-size: 14px;
  transition: transform .16s;
}
.page-nav .pn-btn:hover:not(:disabled) { transform: scale(1.08); background: var(--orange-l); }
.page-nav .pn-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-count { font-size: 14px; font-weight: 800; color: var(--ink-soft); min-width: 62px; text-align: center; direction: ltr; }

/* ---------- Song player (screen 11) ---------- */
.player-card {
  max-width: 620px;
  margin: 0 auto;
  background: linear-gradient(180deg, #fff 0%, var(--cream) 100%);
  border: 3px solid #fff;
  border-radius: var(--r-xl);
  padding: 22px 24px 26px;
  box-shadow: var(--sh-lg);
  text-align: center;
}
.player-art { width: 230px; margin: 0 auto 6px; }
.player-meta { font-size: 13px; color: var(--ink-mute); font-weight: 700; margin-bottom: 14px; }
.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.time { font-size: 12px; font-weight: 800; color: var(--ink-mute); direction: ltr; min-width: 38px; }
.track {
  flex: 1;
  height: 10px;
  border-radius: var(--r-pill);
  background: #eee6d6;
  border: 2px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}
.track-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--lilac), var(--blue));
  border-radius: var(--r-pill);
  transition: width .2s linear;
}
.player-controls { display: flex; align-items: center; justify-content: center; gap: 14px; }
.pc-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--cream);
  border: 2.5px solid var(--line);
  font-size: 15px;
  box-shadow: var(--sh-sm);
  transition: transform .16s;
}
.pc-btn:hover { transform: scale(1.08); }
.pc-btn.main {
  width: 58px; height: 58px;
  background: var(--orange);
  border-color: #eaa233;
  color: #6b4708;
  font-size: 20px;
  box-shadow: 0 4px 0 #e59a26, var(--sh-sm);
}

.lyrics-box {
  margin-top: 18px;
  background: #fff;
  border: 2.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  text-align: center;
}
.lyrics-line { font-size: 15px; font-weight: 700; color: var(--ink-soft); line-height: 2.05; transition: all .3s; }
.lyrics-line.active { color: var(--orange-d); transform: scale(1.04); font-weight: 800; }
.lyrics-line.spacer { height: 10px; }

/* ---------- Tracking timeline (screen 12) ---------- */
.timeline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  max-width: 760px;
  margin: 26px auto 0;
  position: relative;
}
.tl-step { flex: 1; text-align: center; position: relative; }
.tl-dot {
  width: 54px; height: 54px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #fff;
  border: 3px solid var(--line);
  font-size: 21px;
  box-shadow: var(--sh-card);
  position: relative;
  z-index: 2;
}
.tl-step.done .tl-dot { background: var(--green-l); border-color: var(--green); color: var(--green-d); }
.tl-step.current .tl-dot {
  background: var(--orange-l);
  border-color: var(--orange);
  animation: pulseDot 1.9s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 181, 71, .5); }
  50%      { box-shadow: 0 0 0 10px rgba(255, 181, 71, 0); }
}
.tl-label { font-size: 13.5px; font-weight: 800; color: var(--ink-soft); }
.tl-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 26px;
  inset-inline-start: calc(50% + 30px);
  width: calc(100% - 60px);
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  z-index: 1;
}
.tl-step.done:not(:last-child)::after { background: var(--green); }

.eta-banner {
  margin: 24px auto 0;
  max-width: 520px;
  text-align: center;
  background: var(--green-l);
  border: 2.5px solid #b9e39c;
  border-radius: var(--r-lg);
  padding: 13px 20px;
  font-weight: 800;
  color: #4e7a34;
  font-size: 15px;
}

/* ---------- Info blocks (about/help) ---------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.info-card {
  background: var(--card-soft);
  border: 3px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--sh-card);
}
.info-icon { font-size: 30px; margin-bottom: 8px; }
.info-card h4 { font-size: 16.5px; color: #5f5241; margin-bottom: 6px; }
.info-card p { margin: 0; font-size: 13.8px; color: var(--ink-mute); font-weight: 600; line-height: 1.85; }

.faq-item {
  background: var(--card-soft);
  border: 3px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-q {
  width: 100%;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
  color: #5f5241;
  text-align: start;
}
.faq-q .faq-arrow { margin-inline-start: auto; transition: transform .25s; color: var(--ink-mute); }
.faq-item.open .faq-q .faq-arrow { transform: rotate(180deg); }
.faq-a {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
  font-size: 14px;
  color: var(--ink-mute);
  font-weight: 600;
  line-height: 1.9;
}
.faq-item.open .faq-a { max-height: 300px; padding: 0 20px 16px; }

/* ---------- Summary rows ---------- */
.summary {
  background: var(--cream);
  border: 2.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  max-width: 520px;
  margin: 0 auto 4px;
}
.sum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
  border-bottom: 1.5px dashed rgba(216, 203, 184, .7);
}
.sum-row:last-child { border-bottom: 0; }
.sum-row.total { font-size: 17px; font-weight: 900; color: #6b5c48; padding-top: 12px; }
.sum-row .sv { color: #6b5c48; font-weight: 800; }

/* ---------- Loading overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(233, 246, 251, .93);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}
.overlay[hidden] { display: none; }
.magic-spinner {
  font-size: 54px;
  animation: spinWand 1.5s ease-in-out infinite;
  margin-bottom: 12px;
}
@keyframes spinWand {
  0%, 100% { transform: rotate(-14deg) scale(1); }
  50%      { transform: rotate(14deg) scale(1.14); }
}
.overlay h3 { font-size: 21px; color: #5f5241; margin-bottom: 6px; }
.overlay p { color: var(--ink-mute); font-weight: 700; font-size: 14.5px; margin: 0; }
.dots span { animation: blink 1.4s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
body[dir="rtl"] .toast-host { transform: translateX(50%); }
.toast {
  background: #fff;
  border: 3px solid var(--green);
  border-radius: var(--r-pill);
  padding: 11px 24px;
  font-weight: 800;
  font-size: 14.5px;
  color: #4e7a34;
  box-shadow: var(--sh-lg);
  animation: toastIn .3s cubic-bezier(.2,.8,.3,1);
}
.toast.warn { border-color: var(--orange); color: #b5741a; }
.toast.err  { border-color: var(--red); color: #b83b3b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Footer ---------- */
.site-footer {
  padding: 20px 16px 26px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.footer-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.footer-links button:hover { color: var(--orange-d); text-decoration: underline; }

/* ---------- Misc helpers ---------- */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 18px; }
.mt-3 { margin-top: 26px; }
.mb-2 { margin-bottom: 18px; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-narrow { max-width: 480px; margin: 0 auto; }
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state .es-ico { font-size: 54px; margin-bottom: 10px; }
.empty-state h3 { color: #5f5241; margin-bottom: 6px; }
.empty-state p { color: var(--ink-mute); font-weight: 700; margin: 0 0 18px; }
.badge-soft {
  display: inline-block;
  background: var(--blue-l);
  color: #2b6d88;
  border: 2px solid #bfe6f6;
  border-radius: var(--r-pill);
  padding: 4px 14px;
  font-size: 12.5px;
  font-weight: 800;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .choice-grid.cols-3, .elem-grid, .product-grid { grid-template-columns: 1fr; }
  .preview-wrap { grid-template-columns: 1fr; }
  .book3d { max-width: 200px; margin: 0 auto; }
  .reader { grid-template-columns: 1fr; }
  .reader-img { min-height: 240px; aspect-ratio: 4 / 3; }
  .reader-text { background: var(--cream) !important; min-height: 200px; }
  .hero-rail {
    position: static;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 18px;
  }
  .hero-rail .btn { width: auto; flex: 1 1 120px; }
  .hero { min-height: auto; padding: 22px 16px 26px; align-content: start; }
  .pay-grid { grid-template-columns: 1fr; }
  .timeline { flex-direction: column; gap: 4px; align-items: stretch; }
  .tl-step { display: flex; align-items: center; gap: 14px; text-align: start; padding: 6px 0; }
  .tl-dot { margin: 0; width: 46px; height: 46px; flex-shrink: 0; }
  .tl-step:not(:last-child)::after { display: none; }
}

@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand { order: 1; }
  .header-tools { order: 2; margin-inline-start: auto; }
  .stepper { order: 3; width: 100%; flex: 1 0 100%; justify-content: flex-start; }
  .brand-name { font-size: 17px; }
  .panel { padding: 20px 15px 24px; border-radius: var(--r-lg); }
  .main-area { padding: 14px 10px 34px; }
  .step { font-size: 12px; padding: 5px 11px; }
  .grid-2 { grid-template-columns: 1fr; }
  .btn { padding: 10px 20px; font-size: 14.5px; }
  .btn-lg { padding: 12px 26px; font-size: 15.5px; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .header-tools .lang-btn { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
