:root{
  --dir:1;
  --bg:#050507;
  --surface:#0f1014;
  --surface-2:#171921;
  --surface-3:#1d2029;
  --input-bg:#12141b;
  --border:rgba(255,255,255,.08);
  --border-strong:rgba(255,255,255,.14);
  --text:#f5f7fb;
  --text-soft:#b1b7c7;
  --text-faint:#7d8394;
  --pink:#ff4f93;
  --pink-2:#ff6aa9;
  --pink-glow:rgba(255,79,147,.28);
  --radius-xl:28px;
  --radius-lg:20px;
  --radius-md:14px;
  --radius-sm:10px;
  --shadow:0 20px 60px rgba(0,0,0,.35);
  /* translucent layers: white tints on dark, black tints on light */
  --tint-1:rgba(255,255,255,.03);
  --tint-2:rgba(255,255,255,.05);
  --tint-3:rgba(255,255,255,.1);
  --glass-sidebar:rgba(12,13,18,.92);
  --glass-panel:rgba(14,16,23,.84);
  --glass-composer:rgba(13,15,22,.82);
  --composer-border:rgba(255,255,255,.12);
  --active-text:#fff;
  --hero-glow:rgba(255,79,147,.42);

  /* ---- SIDEBAR SPACING */
  --side-edge:12px;     /* panel edge → row edge */
  --row-pad-x:12px;     /* row edge → icon (edge + this = 24px to the icons) */
  --row-pad-y:10px;     /* top/bottom inside a row: 20px icon/24px text → 44px rows */
  --row-gap:12px;       /* icon → text */
  --row-stack:0px;      /* between link rows: the 10px padding does the spacing */
  --button-stack:8px;   /* between the two bordered buttons at the top */
  --section-break:28px; /* above "Recent conversations" */

  /* ---- Breathing spotlight behind the home-screen input (see "PROMPT GLOW" below) */
  --glow-rgb:255 105 180;       /* the pink, as R G B (no commas): hot pink (was pale 255 182 193) */
  --glow-alpha:.25;             /* strength at the very center (0 to 1; was .15) */
  --glow-width:clamp(720px, 130vw, 1800px);  /* overall size of the glow */
  --glow-height:clamp(520px, 110vh, 1200px);
  --breathe-duration:3.5s;      /* one inhale OR one exhale; a full breath is 2x this */
  --breathe-scale-min:.9;
  --breathe-scale-max:1.1;
  --breathe-opacity-min:.7;
  --breathe-opacity-max:1;
  --glow-static-opacity:.85;    /* used when reduced motion is on */
}

:root[data-theme="light"]{
  --bg:#f6f7fb;
  --surface:#ffffff;
  --surface-2:#f2f4f8;
  --surface-3:#e8ebf2;
  --input-bg:#f8f9fc;
  --border:rgba(0,0,0,.08);
  --border-strong:rgba(0,0,0,.14);
  --text:#13151c;
  --text-soft:#5c6475;
  --text-faint:#667085; /* was #7f8797: 3.4:1 on the light background, below WCAG AA 4.5:1 */
  --pink-glow:rgba(255,79,147,.14);
  --shadow:0 18px 40px rgba(29,33,48,.08);
  --tint-1:rgba(0,0,0,.025);
  --tint-2:rgba(0,0,0,.04);
  --tint-3:rgba(0,0,0,.07);
  --glass-sidebar:rgba(255,255,255,.92);
  --glass-panel:rgba(255,255,255,.88);
  --glass-composer:rgba(255,255,255,.92);
  --composer-border:rgba(0,0,0,.1);
  --active-text:#c2185b;
  --hero-glow:rgba(255,79,147,.18);
  /* Pale pink barely shows on a white page: use Radd's pink, faintly. */
  --glow-rgb:255 79 147;
  --glow-alpha:.09;
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{min-height:100%}
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  line-height:var(--line-height);
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}
::selection{background:var(--pink);color:#fff}

button,input,textarea,select{font:inherit;color:inherit}
button{cursor:pointer;border:none;background:none}
textarea{resize:vertical}
img{max-width:100%;display:block}
a{color:inherit;text-decoration:none}
[hidden]{display:none !important}
[dir="rtl"]{--dir:-1}

#app{
  display:flex;
  min-height:100vh;
}

/* SIDEBAR */
.sidebar{
  width:290px;
  flex-shrink:0;
  background:var(--glass-sidebar);
  border-inline-end:1px solid var(--border);
  backdrop-filter:blur(18px);
  /* 12px edge + 12px row padding = icons start 24px from the panel's edge */
  padding:20px var(--side-edge);
  display:flex;
  flex-direction:column;
  position:sticky;
  top:0;
  height:100vh;
  overflow-y:auto;
  z-index:20;
}
.sidebar-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:8px var(--row-pad-x) 20px; /* logo lines up with the icons below */
}
.brand-mark{
  width:36px;
  height:36px;
  border-radius:12px;
  display:grid;
  place-items:center;
  background:radial-gradient(circle at 30% 30%, var(--pink-2), var(--pink));
  box-shadow:0 0 28px var(--pink-glow);
  font-size:18px;
}
.brand-name{
  font-size:28px;
  font-weight:800;
  letter-spacing:0;
}
.brand-sub{
  color:var(--pink-2);
  font-size:12px;
  margin-top:2px;
}
.sidebar-close{
  display:none;
  width:36px;
  height:36px;
  border-radius:10px;
  background:var(--surface-2);
  border:1px solid var(--border);
  color:var(--text-soft);
}
.sidebar-close:hover{border-color:var(--border-strong);color:var(--text)}

.new-conv-btn,
.nav-item,
.secondary,
.primary,
.tab,
.lang-pill{
  transition:.18s ease;
}

/* ---- SIDEBAR ROWS: icon + label (spacing tokens in :root, "SIDEBAR SPACING") */
.nav-row{
  display:flex;
  align-items:center;
  gap:var(--row-gap);            /* icon-to-text */
  width:100%;
  text-align:start;
  padding:var(--row-pad-y) var(--row-pad-x);
  min-height:44px;               /* every row 44-48px tall, the whole row clickable */
}
.nav-icon{
  flex:none;
  width:20px;
  height:20px;
  /* stroke="currentColor" in the markup: icons take the row's color in every state */
}
.nav-text{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.new-conv-btn{
  border-radius:14px;
  background:var(--surface-2);
  border:1px solid var(--border);
  color:var(--text);
  font-weight:600;
  margin-bottom:var(--button-stack);
  padding-inline:calc(var(--row-pad-x) - 1px); /* minus the 1px border: icons stay at 24px */
}
.new-conv-btn:hover{
  border-color:rgba(255,79,147,.35);
  background:var(--surface-3);
}
/* Same shape as "New conversation", same colors as other .secondary buttons. */
#install.nav-row{
  border-radius:14px;
  padding:var(--row-pad-y) calc(var(--row-pad-x) - 1px); /* restated: .secondary comes later; -1px border */
  margin:0 0 var(--button-stack);
}

.nav-section{
  display:grid;
  gap:var(--row-stack);
}
.nav-label{
  font-size:12px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0;
  color:var(--text-faint);
  margin-top:var(--section-break); /* separates the recents from the main links */
  padding:0 var(--row-pad-x) 8px;
}
.nav-item{
  border-radius:12px;
  color:var(--text-soft);
  background:transparent;
}
.nav-item:hover{
  background:var(--tint-2);
  color:var(--text);
}
.nav-item:focus-visible,
.new-conv-btn:focus-visible,
#install:focus-visible,
.history-clear:focus-visible{
  outline:2px solid var(--pink);
  outline-offset:-2px;
}

/* Recent conversations: one quiet line each, like a chat app's "Recents" list */
#history{
  display:flex;
  flex-direction:column;
  gap:1px;
}
.history-item{
  display:flex;
  align-items:center;
  border-radius:10px;
}
.history-item:hover,
.history-item:focus-within{background:var(--tint-2)}
.history-item.active{background:var(--tint-3)}
.history-open{
  flex:1;
  min-width:0;
  background:none;
  border:0;
  padding:8px var(--row-pad-x); /* titles line up with the icons above */
  text-align:start;
  color:var(--text);
  font:inherit;
  font-size:.93rem;
  cursor:pointer;
  border-radius:10px;
}
.history-text{
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.history-delete{
  flex:none;
  width:30px;
  height:30px;
  margin-inline-end:4px;
  border:0;
  border-radius:8px;
  background:none;
  color:var(--text-faint);
  font-size:1.15rem;
  line-height:1;
  cursor:pointer;
  opacity:0;
}
.history-item:hover .history-delete,
.history-item:focus-within .history-delete,
.history-delete:focus-visible{opacity:1}
.history-delete:hover{color:var(--text);background:var(--tint-3)}
/* touch screens have no hover: keep the × visible but quiet */
@media (hover:none){.history-delete{opacity:.55}}
#history > .hint{padding:6px var(--row-pad-x)}
.history-clear{
  margin-top:var(--button-stack);
  background:none;
  border:0;
  border-radius:12px;
  color:var(--text-faint);
  font:inherit;
  font-size:.85rem;
  cursor:pointer;
}
.history-clear:hover{color:var(--text);background:var(--tint-2)}

.sidebar-spacer{flex:1}
.full-width{width:100%}

/* MAIN */
.main{
  position:relative;
  flex:1;
  min-width:0;
  padding:24px;
  overflow:hidden;
}
.main::before{
  content:"";
  position:absolute;
  inset:0;
  /* The pink glow now lives behind the input (.hero-composer::before). */
  background:linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,0));
  pointer-events:none;
  z-index:0;
}
.pane,
#notice,
.corner-controls,
.sidebar-toggle{
  position:relative;
  z-index:1;
}
.pane{
  max-width:1120px;
  margin:0 auto;
}

.sidebar-toggle{
  display:none;
  width:44px;
  height:44px;
  border-radius:14px;
  background:var(--tint-2);
  border:1px solid var(--border);
  color:var(--text);
  margin-bottom:18px;
}

#notice{
  min-height:24px;
  color:var(--pink-2);
  margin-bottom:8px;
  font-size:14px;
  font-weight:500;
}

.actions{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}
.top-actions{
  justify-content:flex-end;
  margin-bottom:18px;
}

.primary{
  background:linear-gradient(135deg, var(--pink), var(--pink-2));
  color:#fff;
  border-radius:999px;
  padding:12px 20px;
  font-weight:700;
  box-shadow:0 12px 28px var(--pink-glow);
}
.primary:hover{transform:translateY(-1px)}

.secondary{
  background:var(--tint-2);
  border:1px solid var(--border);
  color:var(--text-soft);
  border-radius:999px;
  padding:11px 16px;
}
.secondary:hover{
  color:var(--text);
  border-color:var(--border-strong);
  background:var(--tint-2);
}

/* HERO */
#home{
  display:grid;
  gap:28px;
}
.hero-shell{
  /* v4.22: fill the screen height so the heading, input and buttons sit in the
     vertical middle of the page (they used to hug the top on tall screens). */
  min-height:max(460px, calc(100vh - 120px));
  min-height:max(460px, calc(100dvh - 120px));
  display:grid;
  place-items:center;
  padding:44px 20px;
}
.hero-center{
  width:100%;
  max-width:860px;
  text-align:center;
}
.hero-heading{
  font-size:clamp(2rem, 5vw, 3.35rem);
  line-height:1.06;
  font-weight:800;
  letter-spacing:0;
  margin-bottom:14px;
}
.hero-sub{
  color:var(--text-soft);
  font-size:clamp(1rem, 2vw, 1.1rem);
  margin-bottom:26px;
}
.hero-composer{
  position:relative;            /* anchors the glow below to the input */
  width:100%;
  max-width:760px;
  margin:0 auto;
  display:grid;
  grid-template-columns:auto 1fr;
  align-items:center;
  gap:6px;
  padding:6px 8px;              /* slim, Gemini-style bar: ~58px tall in total */
  border-radius:999px;
  background:var(--glass-composer);
  border:1px solid var(--composer-border);
  box-shadow:var(--shadow);
}
/* ---- PROMPT GLOW: soft pink spotlight centered behind the input, slowly breathing.
   Stacking: .hero-composer has no z-index, so z-index:-1 puts the glow in .pane's
   stacking context, above the page background (.main::before) and below all text.
   .main has overflow:hidden, which clips the scaled glow: no scrollbars. */
.hero-composer::before{
  content:"";
  position:absolute;
  z-index:-1;
  pointer-events:none;          /* never blocks typing, clicks or selection */
  left:50%;
  top:50%;
  width:var(--glow-width);
  height:var(--glow-height);
  /* centered with margins, so transform is free for the breathing scale */
  margin-left:calc(var(--glow-width) / -2);
  margin-top:calc(var(--glow-height) / -2);
  /* closest-side: the ellipse reaches exactly 0 at the box edge, so there's never a rim.
     Eight easing stops: quick drop near the center, long gentle tail, less banding. */
  background:radial-gradient(
    closest-side,
    rgb(var(--glow-rgb) / calc(var(--glow-alpha) * 1))    0%,
    rgb(var(--glow-rgb) / calc(var(--glow-alpha) * .85)) 12%,
    rgb(var(--glow-rgb) / calc(var(--glow-alpha) * .62)) 26%,
    rgb(var(--glow-rgb) / calc(var(--glow-alpha) * .4))  40%,
    rgb(var(--glow-rgb) / calc(var(--glow-alpha) * .22)) 55%,
    rgb(var(--glow-rgb) / calc(var(--glow-alpha) * .1))  70%,
    rgb(var(--glow-rgb) / calc(var(--glow-alpha) * .03)) 85%,
    rgb(var(--glow-rgb) / 0)                             100%
  );
  will-change:transform, opacity;
  animation:breathe var(--breathe-duration) ease-in-out infinite alternate;
}
/* Only transform and opacity change, so the GPU just scales and fades one layer. */
@keyframes breathe{
  from{transform:scale(var(--breathe-scale-min));opacity:var(--breathe-opacity-min)}
  to{transform:scale(var(--breathe-scale-max));opacity:var(--breathe-opacity-max)}
}
@media (prefers-reduced-motion: reduce){
  .hero-composer::before{
    animation:none;
    transform:none;
    opacity:var(--glow-static-opacity);
    will-change:auto;
  }
}

.icon-pill{
  width:44px;                   /* 44px square stays a comfortable tap target */
  height:44px;
  display:grid;
  place-items:center;
  background:none;              /* no circle */
  border:0;
  color:var(--text);
  cursor:pointer;
  transition:color .18s ease;
}
.upload-plus{width:24px;height:24px}  /* the plus itself: thin, 1.5px lines */
.upload-pill:hover{color:var(--pink-2)}
.hero-input{
  width:100%;
  border:none;
  outline:none;
  background:transparent;
  color:var(--text);
  height:44px;                  /* one line, same height as the plus button */
  min-height:44px;
  max-height:160px;             /* grows with long pastes (app.js), then scrolls */
  padding:10px 8px;
  line-height:24px;
  resize:none;
  overflow-y:auto;
}
/* When a long message makes the input grow past one line, soften the pill
   into a rounded box and keep the plus at the bottom, like Gemini. */
.hero-composer.is-tall{border-radius:26px;align-items:end}
/* v4.25: who sent it + context box */
.direction-toggle{display:inline-flex;gap:4px;padding:4px;margin:0 auto 12px;border-radius:999px;border:1px solid var(--border);background:var(--surface-2)}
.direction-toggle button{padding:8px 16px;border:0;border-radius:999px;background:transparent;color:var(--text-soft);font:inherit;font-size:.92rem;font-weight:600;cursor:pointer}
.direction-toggle button[aria-checked="true"]{background:linear-gradient(135deg,var(--pink),var(--pink-2));color:#fff}
.direction-toggle button:focus-visible{outline:2px solid var(--pink);outline-offset:2px}
.hero-context{display:block;width:100%;max-width:760px;margin:10px auto 0;background:var(--glass-composer);border:1px solid var(--composer-border);min-height:52px;max-height:160px;padding:12px 18px;border-radius:18px;resize:vertical;font-size:.95rem}

.hero-input::placeholder{color:var(--text-faint)}

/* ---- GENERATING: pulsing Radd logo + friendly label while replies are written */
.generating{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  color:var(--text-soft);
  font-size:15px;
  font-weight:500;
}
.generating[hidden]{display:none}
#generating{margin-top:16px}
#insight .generating{justify-content:flex-start}
.gen-mark{
  width:28px;
  height:28px;
  border-radius:9px;
  font-size:14px;
  color:#fff;
  animation:gen-pulse 1.4s ease-in-out infinite;
}
@keyframes gen-pulse{
  0%,100%{transform:scale(.82);opacity:.45;box-shadow:0 0 0 var(--pink-glow)}
  50%{transform:scale(1.08);opacity:1;box-shadow:0 0 24px var(--pink-glow)}
}
@media (prefers-reduced-motion: reduce){
  .gen-mark{animation:gen-fade 1.6s ease-in-out infinite;transform:none}
  @keyframes gen-fade{0%,100%{opacity:.5}50%{opacity:1}}
}

/* ---- RADD AVATAR: the face that thinks while replies are being written.
   Inline SVG in the results panel (no image files, no network, works
   offline). Three states on #raddAvatar, driven by setAvatar() in app.js:
   .is-generating (bob + glancing eyes + bouncing dots) and .is-idle
   (slow bob + occasional blink); hidden otherwise. See AVATAR.md. */
.radd-avatar{
  display:flex;
  align-items:center;
  gap:10px;
  margin:6px 0 12px;
}
.radd-avatar-face{
  width:72px;
  height:72px;
  flex-shrink:0;
}
.radd-avatar.is-generating .radd-avatar-face{animation:radd-bob 1.6s ease-in-out infinite}
.radd-avatar.is-idle .radd-avatar-face{animation:radd-bob 4s ease-in-out infinite}
@keyframes radd-bob{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-4px)}
}
/* SVG transforms need their own box: the blink scales the eyes around
   their own centre instead of the whole picture. */
.radd-eyes{
  transform-box:fill-box;
  transform-origin:center;
  animation:radd-blink 4.5s ease-in-out infinite;
}
@keyframes radd-blink{
  0%,91%,100%{transform:scaleY(1)}
  94%{transform:scaleY(.1)}
  97%{transform:scaleY(1)}
}
.radd-avatar.is-generating .radd-pupils{animation:radd-glance 2.4s ease-in-out infinite}
@keyframes radd-glance{
  0%,100%{transform:translateX(-2.5px)}
  50%{transform:translateX(2.5px)}
}
/* Thinking dots: a little bubble beside the face, only while generating. */
.radd-avatar-dots{
  display:none;
  align-items:center;
  gap:5px;
  padding:10px 12px;
  border-radius:999px;
  background:var(--surface-3);
}
.radd-avatar.is-generating .radd-avatar-dots{display:inline-flex}
.radd-avatar-dots span{
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--pink);
  animation:radd-dot 1.2s ease-in-out infinite;
}
.radd-avatar-dots span:nth-child(2){animation-delay:.15s}
.radd-avatar-dots span:nth-child(3){animation-delay:.3s}
@keyframes radd-dot{
  0%,100%{transform:translateY(0);opacity:.55}
  50%{transform:translateY(-4px);opacity:1}
}
@media (prefers-reduced-motion: reduce){
  .radd-avatar-face,.radd-eyes,.radd-pupils,.radd-avatar-dots span{animation:none !important}
}
.hero-quick-actions{
  display:flex;
  justify-content:center;
  gap:12px;
  margin-top:18px;
  flex-wrap:wrap;
}

/* Tone + length, picked on the home screen before generating. Compact pill
   selects, same options as the results tabs and Settings. */
.hero-tone-row{
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
  margin-top:14px;
}
.hero-tone-field{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--text-soft);
  font-size:.92rem;
  font-weight:600;
}
.hero-tone-field .s-input{
  width:auto;
  padding:9px 12px;
  border-radius:999px;
}
.hero-kbd-hint{
  margin-top:10px;
  font-size:.85rem;
  text-align:center;
}

#imagePreview{
  max-width:300px;
  margin:18px auto 0;
  border-radius:18px;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}

/* PANELS */
.control-panel,
#results,
#preferences,
#account,
#lessons,
#practice{
  background:var(--glass-panel);
  border:1px solid var(--border);
  border-radius:24px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(14px);
  padding:24px;
}
.panel-head{
  margin-bottom:18px;
}
.panel-head h2,
#results h1,
#preferences h1,
#account h1,
#lessons h1,
#practice h1{
  font-size:1.5rem;
  margin-bottom:6px;
}

.lang-switch,
.tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:18px;
}
.lang-pill,
.tab{
  padding:10px 14px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--tint-1);
  color:var(--text-soft);
  font-weight:600;
}
.lang-pill.active,
.tab.active,
.lang-pill:hover,
.tab:hover{
  background:rgba(255,79,147,.12);
  color:var(--active-text);
  border-color:rgba(255,79,147,.36);
}

.tailor-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  margin-bottom:18px;
}
.tailor-grid label,
.field{
  display:grid;
  gap:8px;
}
.field{margin-bottom:16px}
.field span{display:inline-flex;align-items:center;gap:10px}

.s-input{
  width:100%;
  background:var(--input-bg);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:14px;
  padding:13px 14px;
  outline:none;
}
.s-input:focus{
  border-color:rgba(255,79,147,.45);
  box-shadow:0 0 0 4px rgba(255,79,147,.12);
}
textarea.s-input{
  min-height:110px;
}
select.s-input{
  appearance:none;
}

.hint{
  color:var(--text-soft);
  font-size:.95rem;
}
#progress{
  color:var(--text-soft);
  font-size:14px;
}

/* RESULTS */
.cards-grid{
  display:grid;
  gap:16px;
  margin-top:18px;
}
.reply-card{
  background:var(--tint-1);
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px;
}
.reply-text{
  font-size:1rem;
  white-space:pre-wrap;
}
.reply-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}

#insight{white-space:pre-wrap;overflow-wrap:anywhere}
.tab:disabled{opacity:.45;cursor:not-allowed;background:var(--tint-1);border-color:var(--border);color:var(--text-soft)}
.clarify-card{
  display:grid;
  gap:12px;
  border-color:rgba(255,79,147,.36);
  background:rgba(255,79,147,.06);
}
.clarify-card h2{font-size:1.05rem}
.clarify-card .reply-text{font-size:1.05rem;font-weight:500}
.clarify-card textarea.s-input{min-height:90px}
.clarify-card .reply-actions{margin-top:0}
.reply-actions select.s-input{width:auto;padding:10px 14px;border-radius:999px}

.settings-heading{font-size:1rem;margin:22px 0 12px;color:var(--text-soft);letter-spacing:0}
#preferences .tailor-grid{margin-bottom:16px}
#preferences textarea.voice-input{min-height:80px}
#preferences .field .hint{font-size:.85rem}

.reply-card.streaming .reply-text::after{content:'▍';margin-inline-start:2px;color:var(--pink);animation:blink 1s steps(2) infinite}
@keyframes blink{50%{opacity:0}}
@media (prefers-reduced-motion: reduce){.reply-card.streaming .reply-text::after{animation:none}}

/* ACCOUNT + CREDITS */
.quota-line{margin-top:14px;font-size:.9rem;color:var(--text-soft);text-align:center}
.quota-line.empty{color:var(--pink-2);font-weight:600}
.quota-line button{margin-inline-start:8px;padding:6px 12px;font-size:.85rem}
#notice button{margin-inline-start:10px;padding:6px 12px;font-size:.85rem}
#account .tabs{margin:14px 0}
#authForm{max-width:420px}
.age-check span{font-size:.95rem}
.plan-badge{display:inline-block;margin-inline-start:8px;padding:3px 10px;border-radius:999px;font-size:.8rem;font-weight:700;border:1px solid var(--border);background:var(--tint-1)}
.plan-badge.pro{background:linear-gradient(135deg,var(--pink),var(--pink-2));color:#fff;border-color:transparent}
.pro-box{margin:18px 0;padding:16px;border-radius:16px;border:1px solid rgba(255,79,147,.36);background:rgba(255,79,147,.06);display:grid;gap:8px;max-width:520px}
.pro-box h2{font-size:1.05rem}
/* v4.26: ✓ (copy, liked) and ✕ (new version) on every reply */
.reply-top{display:flex;align-items:flex-start;gap:12px}
.reply-top .reply-text{flex:1;min-width:0}
.reply-quick{display:flex;gap:8px;flex-shrink:0}
.reply-icon{width:44px;height:44px;min-width:44px;padding:0;border-radius:999px;display:grid;place-items:center;font-size:1.15rem;font-weight:700;line-height:1;border:1px solid var(--border);background:var(--surface-2);color:var(--text);cursor:pointer}
.reply-ok:hover,.reply-ok.done{background:#1f9d55;border-color:#1f9d55;color:#fff}
.reply-no:hover{background:rgba(255,79,147,.18);border-color:var(--pink);color:var(--pink)}
.reply-icon:focus-visible{outline:2px solid var(--pink);outline-offset:2px}
/* Texting tips: Max only (v4.22) */
.nav-badge{margin-inline-start:auto;padding:1px 8px;border-radius:999px;font-size:.7rem;font-weight:700;background:linear-gradient(135deg,var(--pink),var(--pink-2));color:#fff}
.tips-locked{margin-top:14px;padding:16px;border-radius:16px;border:1px solid rgba(255,79,147,.36);background:rgba(255,79,147,.06);display:grid;gap:8px;max-width:560px}
.tips-locked p{margin:0}
.tips-locked-title{font-weight:700}
/* PLANS (v4.21): tier cards, current plan, trial */
.pro-box{max-width:760px}
.plan-current{padding:10px 12px;border-radius:12px;background:var(--surface-2);border:1px solid var(--border)}
.plan-current p{margin:0}
.plan-current-name{font-weight:700}
.tier-grid{list-style:none;margin:6px 0 0;padding:0;display:grid;gap:10px;grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
.tier-card{display:flex;flex-direction:column;gap:6px;padding:14px;border-radius:14px;border:1px solid var(--border);background:var(--surface)}
.tier-card.current{border-color:var(--pink);box-shadow:0 0 0 1px var(--pink) inset}
#proBox .tier-card h3{margin:0;font-size:1rem}
.tier-price{margin:0;font-size:1.1rem;font-weight:700;white-space:nowrap}
.tier-facts{list-style:none;margin:0;padding:0;display:grid;gap:2px;color:var(--text-soft);font-size:.9rem}
.tier-actions{margin-top:auto;display:grid;gap:6px;padding-top:6px}
.tier-actions button{width:100%}
.tier-current{margin:0;font-size:.85rem;font-weight:700;color:var(--pink)}
/* Ad space (free, trial, Basic, Plus only — the server decides) */
.ad-slot{margin:12px auto 0;max-width:520px;display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:center;padding:10px 12px;border-radius:12px;border:1px dashed var(--border);background:var(--surface-2);font-size:.9rem;color:var(--text-soft)}
.ad-label{font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;padding:1px 6px;border-radius:6px;border:1px solid var(--border)}
.ad-slot button{padding:6px 12px;font-size:.85rem}
.danger-zone{margin-top:22px;max-width:520px}
.danger-zone summary{cursor:pointer;color:var(--text-soft)}
.danger-zone[open]{display:grid;gap:10px}
.secondary.danger{border-color:rgba(255,80,80,.5);color:#ff7a7a}

/* DEV TOOLS (Settings) */
.dev-tools{margin-top:24px;padding-top:14px;border-top:1px solid var(--border)}
.dev-tools summary{cursor:pointer;color:var(--text-faint);font-size:.9rem}
.dev-tools[open]{display:grid;gap:12px}

/* LESSONS / PRACTICE */
.lesson-sources{font-size:.9rem;color:var(--text-soft)}
.lesson-sources summary{cursor:pointer;color:var(--pink-2);font-weight:600}
.lesson-sources ul{list-style:none;display:grid;gap:8px;margin-top:10px}
.lesson-sources a{color:var(--text);text-decoration:underline;text-decoration-color:var(--border-strong);text-underline-offset:3px;overflow-wrap:anywhere}
.lesson-sources a:hover{text-decoration-color:var(--pink)}
.source-tag{display:inline-block;font-size:.75rem;padding:2px 8px;border-radius:999px;border:1px solid var(--border);background:var(--tint-1);margin-inline-end:4px}
.lesson-block{
  background:var(--tint-1);
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px;
  margin-top:14px;
  display:grid;
  gap:10px;
}
.practice-scenario{
  padding:14px 16px;
  background:var(--tint-1);
  border:1px solid var(--border);
  border-radius:14px;
  margin-bottom:16px;
}
.feedback-row{
  padding:12px 14px;
  background:var(--tint-1);
  border:1px solid var(--border);
  border-radius:14px;
  margin-top:10px;
}
.stats{
  margin-top:14px;
  white-space:pre-wrap;
  word-break:break-word;
  background:var(--tint-1);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  color:var(--text-soft);
}

/* CORNER CONTROLS */
.corner-controls{
  position:fixed;
  inset-inline-end:18px;
  bottom:18px;
  display:flex;
  gap:10px;
}
.corner-btn{
  width:42px;
  height:42px;
  border-radius:999px;
  background:var(--tint-2);
  border:1px solid var(--border);
  color:var(--text);
  display:grid;
  place-items:center;
  box-shadow:var(--shadow);
}
.corner-btn:hover{
  background:var(--tint-3);
}

/* CROP DIALOG */
#crop{
  max-width:760px;
  width:min(94vw,760px);
  margin:auto;
  border:none;
  border-radius:22px;
  background:var(--surface);
  color:var(--text);
  padding:24px;
  box-shadow:var(--shadow);
}
#crop::backdrop{
  background:rgba(0,0,0,.62);
}
#crop h2{margin-bottom:8px}
#cropCanvas{
  width:100%;
  background:#000;
  border-radius:16px;
  margin:16px 0;
  border:1px solid var(--border);
}
.crop-controls{
  display:grid;
  gap:12px;
  margin-bottom:18px;
}

/* MOBILE */
@media (max-width: 960px){
  .sidebar{
    position:fixed;
    inset-inline-start:0;
    top:0;
    height:100vh;
    transform:translateX(calc(-102% * var(--dir)));
    transition:transform .22s ease;
    width:min(86vw,320px);
  }
  body.sidebar-open .sidebar{
    transform:translateX(0);
  }
  .sidebar-close,
  .sidebar-toggle{
    display:grid;
    place-items:center;
  }
  .main{
    padding:18px;
    padding-bottom:88px; /* room for the round account/settings buttons */
  }
  .hero-shell{
    min-height:380px;
    padding:22px 10px;
  }
  .hero-composer{
    grid-template-columns:46px 1fr;
    border-radius:22px;
  }
}

@media (max-width: 720px){
  .tailor-grid{
    grid-template-columns:1fr;
  }
  .control-panel,
  #results,
  #preferences,
  #lessons,
  #practice{
    padding:18px;
  }
  .hero-heading{
    font-size:2rem;
  }
  .corner-controls{
    inset-inline-end:14px;
    bottom:14px;
  }
}

@media (max-width: 560px){
  /* The upload pill stays in the input row on phones: one column would drop
     it onto its own row above the textarea. (The .hero-quick-actions rule
     that used to live here set flex-direction:column and was dead — the later
     560px block overrides it to row — so it is gone, not moved.) */
  .hero-composer{
    grid-template-columns:44px 1fr;
    border-radius:22px;
    padding:6px 8px;
  }
  .icon-pill{
    width:44px;
    height:44px;
  }
}
/* PHONE APP (installed to the home screen) */
.phone-help{display:grid;gap:10px;margin-bottom:8px;color:var(--text-soft);font-size:.92rem;line-height:1.55;max-width:70ch}
.phone-help strong{color:var(--text)}
.phone-help bdi{color:var(--text);word-break:break-all}
@supports (padding:env(safe-area-inset-top)){
  .main{padding-top:max(18px, env(safe-area-inset-top))}
  .corner-controls{bottom:calc(14px + env(safe-area-inset-bottom))}
  .sidebar{padding-top:max(20px, env(safe-area-inset-top));padding-bottom:max(20px, env(safe-area-inset-bottom))}
}
@media (max-width: 560px){
  .hero-quick-actions{flex-direction:row;align-items:stretch}
  .hero-quick-actions button{flex:1 1 140px}
}

/* RADD PRO */
#proBox{margin-top:22px}
#proBox h3{font-size:1rem;margin:20px 0 10px}
.plan-compare{width:100%;max-width:520px;border-collapse:collapse;margin:14px 0 4px;font-size:.92rem}
.plan-compare th,.plan-compare td{padding:9px 10px;text-align:start;border-bottom:1px solid var(--border)}
.plan-compare thead th{color:var(--text-soft);font-weight:600}
.plan-compare tbody th{font-weight:500;color:var(--text-soft)}
.plan-compare td:last-child,.plan-compare thead th:last-child{color:var(--text);font-weight:700}
.pro-steps{display:grid;gap:8px;padding-inline-start:22px;margin-bottom:14px;line-height:1.5;color:var(--text-soft);max-width:62ch}
.pro-steps li::marker{color:var(--pink);font-weight:700}
.pro-steps li.done{color:var(--text)}
.payments{list-style:none;display:grid;gap:8px;font-size:.9rem;color:var(--text-soft)}
.payments li{padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--tint-1)}
.payments li.failed{border-color:rgba(255,79,147,.45)}
.payments a{color:var(--pink-2)}
.fine-print{margin-top:16px;font-size:.82rem}
.fine-print a{color:var(--pink-2)}
#restorePurchases{justify-self:start;margin-top:4px}
.testing-note{font-size:.88rem;padding:10px 12px;border-radius:var(--radius-sm);background:var(--tint-2);border:1px dashed var(--border-strong);color:var(--text)}

/* FIRST-LAUNCH SETUP + TUTORIAL */
body.ob-open{overflow:hidden}
.onboarding{position:fixed;inset:0;z-index:50;background:var(--bg);display:flex;flex-direction:column;
  padding:max(14px, env(safe-area-inset-top)) 18px max(14px, env(safe-area-inset-bottom))}
.onboarding[hidden]{display:none}
.ob-top{display:grid;grid-template-columns:72px 1fr 72px;align-items:center;max-width:560px;width:100%;margin:0 auto}
.ob-link{background:none;border:0;color:var(--text-soft);font:inherit;font-size:.95rem;padding:8px 0;cursor:pointer}
.ob-link:first-child{justify-self:start}
.ob-link:last-child{justify-self:end}
.ob-progress{display:grid;justify-items:center;gap:2px;text-align:center}
.ob-kicker{font-size:.74rem;letter-spacing:.08em;color:var(--text-faint)}
.ob-step{font-weight:700;font-size:.95rem}
.ob-bar{height:3px;border-radius:3px;background:var(--tint-3);max-width:560px;width:100%;margin:10px auto 0;overflow:hidden}
.ob-bar span{display:block;height:100%;background:var(--pink);transition:width .25s ease}
@media (prefers-reduced-motion: reduce){.ob-bar span{transition:none}}
.ob-body{flex:1;overflow-y:auto;max-width:560px;width:100%;margin:0 auto;padding:26px 2px 18px;display:flex;flex-direction:column;gap:14px}
.ob-title{font-size:1.65rem;line-height:1.2}
.ob-sub{color:var(--text-soft);line-height:1.5;margin-top:-4px}
.ob-options{display:grid;gap:10px;margin-top:6px}
.ob-option{display:grid;gap:4px;text-align:start;padding:16px 18px;border-radius:var(--radius-md);border:1px solid var(--border-strong);
  background:var(--surface);color:var(--text);font:inherit;font-size:1.02rem;font-weight:600;cursor:pointer}
.ob-option.active{border-color:var(--pink);background:rgba(255,79,147,.1);box-shadow:0 0 0 1px var(--pink) inset}
.ob-option:focus-visible{outline:2px solid var(--pink);outline-offset:2px}
.ob-option-example{font-weight:400;font-size:.92rem;color:var(--text-soft)}
.ob-text{min-height:120px}
.ob-bottom{max-width:560px;width:100%;margin:0 auto}
.ob-bottom .primary{width:100%;padding:15px;font-size:1.02rem}
/* tutorial: a pretend chat with Radd's reply panel under it */
.demo-chat{display:flex;flex-direction:column;gap:8px;padding:14px;border-radius:var(--radius-lg);background:var(--surface);border:1px solid var(--border)}
.demo-who{display:flex;align-items:center;gap:8px;justify-content:center;font-weight:600;font-size:.9rem;margin-bottom:4px}
.demo-avatar{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:var(--tint-3);font-weight:700}
.demo-bubble{max-width:80%;padding:9px 13px;border-radius:18px;line-height:1.4;font-size:.95rem}
.demo-bubble.in{align-self:flex-start;background:var(--surface-3);border-end-start-radius:6px}
.demo-bubble.out{align-self:flex-end;background:var(--pink);color:#fff;border-end-end-radius:6px}
.demo-panel{display:grid;gap:8px;padding:12px;border-radius:var(--radius-lg);background:rgba(255,79,147,.07);border:1px solid rgba(255,79,147,.32)}
.demo-panel-title{text-align:center;font-weight:700;font-size:.9rem}
.demo-reply{display:grid;gap:6px;text-align:start;padding:12px 14px;border-radius:var(--radius-md);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;cursor:pointer}
.demo-reply.active{border-color:var(--pink)}
.demo-reply-hint{font-size:.78rem;color:var(--pink-2)}


/* =============================================================================
   TYPOGRAPHY — one system, switched by <html lang>. This block is the source of truth
   for fonts, sizes, weights and spacing; it overrides any older size rules above.

   Roles (same feeling in both languages):
     body  — friendly, geometric interface: text, chat, buttons, menus, labels
     name  — soft, romantic: people's names, onboarding headlines
     brand — bold, playful: logo, big screen headers, celebration. A few words, large only.
   Fonts are Google Fonts served from /fonts (licenses: /fonts/LICENSES.txt).
   ============================================================================= */
@font-face{font-family:'Tajawal';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/tajawal-400.woff2) format('woff2')}
@font-face{font-family:'Tajawal';font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/tajawal-500.woff2) format('woff2')}
@font-face{font-family:'Tajawal';font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/tajawal-700.woff2) format('woff2')}
@font-face{font-family:'El Messiri';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/elmessiri-600.woff2) format('woff2')}
@font-face{font-family:'Lalezar';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/lalezar-400.woff2) format('woff2')}
/* English faces cover Latin only, so Arabic text inside the English interface (a chat
   message, a name) falls through to the Arabic face of the same role. */
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/plusjakartasans-400.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2193,U+2212,U+2215}
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/plusjakartasans-500.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2193,U+2212,U+2215}
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/plusjakartasans-700.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2193,U+2212,U+2215}
@font-face{font-family:'Fraunces';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/fraunces-600.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2193,U+2212,U+2215}
@font-face{font-family:'Fraunces';font-style:italic;font-weight:600;font-display:swap;src:url(/fonts/fraunces-600-italic.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2193,U+2212,U+2215}
@font-face{font-family:'Fredoka';font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/fredoka-500.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2193,U+2212,U+2215}
@font-face{font-family:'Fredoka';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/fredoka-600.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2193,U+2212,U+2215}

:root[lang="ar"]{
  --font-body:'Tajawal', sans-serif;
  --font-name:'El Messiri', serif;
  --font-brand:'Lalezar', sans-serif;
  --line-height:1.7;
  --fw-brand:400;          /* Lalezar is already heavy: never bold */
  --fs-chat:16px;          /* chat bubbles, bios, replies */
  --fs-body:16px;
  --fs-secondary:14px;     /* never below 14px for text people read */
  --fs-caption:13px;       /* timestamps and tiny captions only */
  --fs-button:16px;        /* buttons and labels, weight 700 */
  --fs-name:23px;          /* people's names */
  --fs-headline:30px;      /* onboarding headlines */
  --fs-header:36px;        /* big screen headers */
  --fs-celebrate:56px;
  --fs-logo:30px;
}
:root[lang="en"]{
  --font-body:'Plus Jakarta Sans', 'Tajawal', sans-serif;
  --font-name:'Fraunces', 'El Messiri', serif;
  --font-brand:'Fredoka', 'Lalezar', sans-serif;
  --line-height:1.5;
  --fw-brand:600;          /* Fredoka: 500–600, never more */
  --fs-chat:15px;
  --fs-body:15px;
  --fs-secondary:13px;
  --fs-caption:12px;
  --fs-button:15px;
  --fs-name:21px;
  --fs-headline:27px;
  --fs-header:32px;
  --fs-celebrate:50px;
  --fs-logo:28px;
}
@media (min-width: 900px){
  :root[lang="ar"]{--fs-headline:32px;--fs-header:40px;--fs-celebrate:64px}
  :root[lang="en"]{--fs-headline:28px;--fs-header:36px;--fs-celebrate:56px}
}
@media (max-width: 560px){
  :root[lang="ar"]{--fs-headline:28px;--fs-header:32px;--fs-celebrate:48px}
  :root[lang="en"]{--fs-headline:26px;--fs-header:28px;--fs-celebrate:44px}
}

/* ---- body: interface text */
body{font-family:var(--font-body);font-size:var(--fs-body);font-weight:400;line-height:var(--line-height);letter-spacing:0}
button,input,select,textarea{font-family:inherit;line-height:inherit;letter-spacing:0}
input,select,textarea,.s-input{font-size:var(--fs-chat);font-weight:400}
p,li,td,th,summary,label,.field{line-height:var(--line-height)}

/* buttons and labels: 700 */
button,.primary,.secondary,.tab,.lang-pill,.ob-option,.ob-bottom .primary,.ob-link,
.plan-badge,.history-clear,.quota-line button,#notice button,.ob-bottom .primary{
  font-size:var(--fs-button);font-weight:700;
}
.field,.tailor-grid label,.settings-heading,.ob-step,.demo-panel-title,
.control-panel h2,.clarify-card h2,#proBox h3,.plan-compare thead th{
  font-size:var(--fs-button);font-weight:700;
}
/* menus and lists: body size, a little emphasis */
.nav-item{font-size:var(--fs-body);font-weight:500}
.history-open{font-size:var(--fs-body);font-weight:400}
.history-delete{font-weight:400}
.ob-option-label{font-weight:700}

/* secondary text */
.hint,.ob-sub,.quota-line,.phone-help,.pro-steps,.payments,.plan-compare,
.lesson-sources,.ob-option-example,.testing-note,.dev-tools summary,#insight,.brand-sub,
#preferences .field .hint,.age-check span,.history-clear{
  font-size:var(--fs-secondary);font-weight:400;
}
.plan-compare tbody th{font-weight:500}
.plan-compare td:last-child{font-weight:700}
.ob-option-example,.quota-line.empty{font-weight:500}

/* captions (the only text allowed below 14px in Arabic) */
.fine-print,.source-tag,.plan-badge,.ob-kicker,.demo-reply-hint,#transcript .hint,.stats{
  font-size:var(--fs-caption);font-weight:400;
}
.plan-badge{font-weight:700}

/* chat: bubbles, replies, bios */
.reply-text,.demo-bubble,.demo-reply-text,.demo-bio,.practice-scenario,.reply-card .s-input{
  font-size:var(--fs-chat);font-weight:400;line-height:var(--line-height);
}
.clarify-card .reply-text{font-size:var(--fs-chat);font-weight:500}
.hero-input{font-size:var(--fs-chat);font-weight:400}
.hero-sub{font-size:var(--fs-body);font-weight:400}
#notice,#progress{font-size:var(--fs-secondary);font-weight:500}

/* ---- name: people's names and headlines (soft, romantic) */
.demo-name,.ob-title,.hero-heading,.lesson-block h2,.pro-box h2,.celebrate-sub{
  font-family:var(--font-name);font-weight:600;letter-spacing:0;
}
.demo-name,.lesson-block h2,.pro-box h2{font-size:var(--fs-name);line-height:1.3}
.ob-title{font-size:var(--fs-headline);line-height:1.25}
.hero-heading{font-size:var(--fs-header);line-height:1.2}
:root[lang="ar"] .demo-name,:root[lang="ar"] .lesson-block h2,:root[lang="ar"] .pro-box h2,
:root[lang="ar"] .ob-title,:root[lang="ar"] .hero-heading{line-height:var(--line-height)}

/* ---- brand: logo, big screen headers, celebration (a few words, large only) */
.brand-name,.pane > section > h1,.celebrate-text,
#results h1,#preferences h1,#account h1,#lessons h1,#practice h1{
  font-family:var(--font-brand);font-weight:var(--fw-brand);letter-spacing:0;line-height:1.15;
}
.brand-name{font-size:var(--fs-logo)}
.pane > section > h1,#results h1,#preferences h1,#account h1,#lessons h1,#practice h1{font-size:var(--fs-header)}
.celebrate-text{font-size:var(--fs-celebrate)}
:root[lang="ar"] .brand-name,:root[lang="ar"] .pane > section > h1,:root[lang="ar"] .celebrate-text,
:root[lang="ar"] #results h1,:root[lang="ar"] #preferences h1,:root[lang="ar"] #account h1,
:root[lang="ar"] #lessons h1,:root[lang="ar"] #practice h1{line-height:1.5}

/* ---- English-only: italic accent word in Fraunces headlines; small uppercase labels */
:root[lang="en"] .ob-title em,:root[lang="en"] .hero-heading em{font-style:italic;font-weight:600;color:inherit}
:root[lang="en"] .nav-label,:root[lang="en"] .ob-kicker{text-transform:uppercase;letter-spacing:.07em;font-size:var(--fs-caption);font-weight:700}
em{font-style:normal}

/* ---- Arabic rules: no italics, no letter-spacing, no uppercase; emphasis by weight/color */
:root[lang="ar"] *,:root[lang="ar"] *::before,:root[lang="ar"] *::after{
  font-style:normal !important;letter-spacing:0 !important;text-transform:none !important;
}
:root[lang="ar"] em{font-weight:700;color:var(--pink-2)}
:root[lang="ar"] .nav-label{font-size:var(--fs-secondary);font-weight:500}
:root[lang="ar"] .ob-kicker{font-size:var(--fs-secondary)}

/* ---- direction: icons that point somewhere flip in RTL */
.icon-dir{display:inline-block}
:root[dir="rtl"] .icon-dir{transform:scaleX(-1)}

/* ---- celebration (finished setup, Pro switched on) */
.celebrate{position:fixed;inset:0;z-index:60;display:grid;place-items:center;align-content:center;gap:10px;
  background:rgba(5,5,7,.86);text-align:center;padding:24px}
:root[data-theme="light"] .celebrate{background:rgba(246,247,251,.92)}
.celebrate[hidden]{display:none}
.celebrate-text{color:var(--pink);margin:0}
.celebrate-sub{font-size:var(--fs-name);color:var(--text)}
@media (prefers-reduced-motion: no-preference){
  .celebrate-text{animation:pop .5s cubic-bezier(.2,1.4,.4,1) both}
  @keyframes pop{from{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}
}

/* ---- Personalization: approve button and "Your style profile" (account page) */
.approve-btn{border-color:var(--pink)}
.style-box{margin-top:22px;max-width:620px}
.style-box h3{margin:22px 0 6px}
.style-rules{list-style:none;padding:0;margin:10px 0;display:grid;gap:8px}
.style-rules li{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--border);border-radius:14px}
.style-rules .rule-text{flex:1 1 220px;min-width:0;overflow-wrap:anywhere}
.style-rules .rule-source{font-size:.75rem;color:var(--text-soft);padding:2px 8px;border-radius:999px;border:1px solid currentColor}
.style-rules li .s-input{flex:1 1 220px}
.style-rules .secondary{padding:6px 12px}
.style-add{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.style-add .s-input{flex:1 1 240px}

/* Age question: Terms/Privacy line under the answers */
.ob-legal{font-size:.9rem;margin-top:14px}
.ob-legal a,.age-check a{color:var(--pink-2)}

/* ---- Account: "Forgot your password?" link and the confirm-your-email note */
.link-button{
  display:block;
  margin-top:12px;
  padding:6px 0;
  background:none;
  border:0;
  color:var(--pink-2);
  font:inherit;
  font-size:.92rem;
  text-decoration:underline;
  text-underline-offset:3px;
  cursor:pointer;
}
.link-button:hover{color:var(--pink)}
.link-button:focus-visible{outline:2px solid var(--pink);outline-offset:3px;border-radius:4px}
.verify-box{
  max-width:620px;
  margin:4px 0 18px;
  padding:14px 16px;
  border:1px solid var(--border-strong);
  border-inline-start:3px solid var(--pink);
  border-radius:var(--radius-md);
  background:var(--tint-1);
}
.verify-box p{margin:0 0 10px;color:var(--text-soft);line-height:1.5}
#authTitle{margin:0 0 6px}

/* ---- Results as a chat: earlier replies, the user's follow-ups, and the composer */
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.thread{display:flex;flex-direction:column;gap:10px;margin:4px 0 14px}
.thread:empty{display:none}
.thread-replies{
  display:flex;flex-direction:column;gap:6px;
  padding:10px 14px;
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  background:var(--tint-1);
  opacity:.72;
}
.thread-replies:hover,.thread-replies:focus-within{opacity:1}
.thread-reply{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.thread-reply p{margin:0;color:var(--text-soft);white-space:pre-wrap;font-size:.94rem}
.thread-reply .link-button{margin:0;padding:2px 0;flex:none;font-size:.85rem}
/* The user's turn: a bubble on the end side, like a sent message. */
.thread-you{
  align-self:flex-end;
  max-width:min(80%,520px);
  margin:0;
  padding:9px 14px;
  border-radius:18px 18px 4px 18px;
  background:linear-gradient(135deg,var(--pink),var(--pink-2));
  color:#fff;
  white-space:pre-wrap;
  line-height:1.45;
}
[dir="rtl"] .thread-you{border-radius:18px 18px 18px 4px}
.follow-form{
  position:sticky;bottom:0;
  margin-top:18px;
  padding:12px 0 calc(12px + env(safe-area-inset-bottom,0px));
  background:linear-gradient(to top,var(--surface) 70%,transparent);
  z-index:2;
}
.follow-chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.chip{
  padding:6px 12px;
  border:1px solid var(--border-strong);
  border-radius:999px;
  background:var(--tint-1);
  color:var(--text-soft);
  font:inherit;font-size:.86rem;
  cursor:pointer;
}
.chip:hover{color:var(--text);border-color:var(--pink)}
.chip:focus-visible{outline:2px solid var(--pink);outline-offset:2px}
.follow-row{display:flex;gap:8px;align-items:flex-end}
.follow-row textarea{flex:1;resize:none;min-height:44px;max-height:140px;line-height:1.4}
.follow-row .primary{flex:none;min-height:44px}
.chip:disabled,.follow-row .primary:disabled{opacity:.5;cursor:default}
.follow-left{margin:8px 0 0;font-size:.84rem}
.follow-left b{color:var(--pink-2)}
