/* Airmail-postcard identity: the striped frame around the robot is the one bold element. */
:root {
  --paper: #f3f6fa;
  --surface: #ffffff;
  --ink: #16233a;
  --muted: #5b6b82;
  --line: #d6dee9;
  --red: #e0313f;
  --blue: #2357a6;
  --gold: #f1b434;
  --screen: #16233a;
  --eye: #8fe3ff;
  --font-display: 'Fredoka', 'Rubik', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-body: 'Rubik', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1622;
    --surface: #162236;
    --ink: #e8eef6;
    --muted: #93a3ba;
    --line: #2a3a54;
    --red: #ff5a66;
    --blue: #6e9bea;
    --gold: #f6c75a;
    --screen: #0a111c;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font-body);
}
:lang(ar) body, [lang="ar"] body { font-family: 'IBM Plex Sans Arabic', var(--font-body); }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- Top bar ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
}
.brand {
  font: 600 1.5rem/1 var(--font-display);
  letter-spacing: -0.01em;
}
.bar-end { display: flex; align-items: center; gap: 0.75rem; position: relative; }
.minutes {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.minutes[data-low="true"] { color: var(--red); }
.account {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}
.account img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account::before { content: attr(data-initial); font-weight: 600; }
.account:has(img:not([hidden]))::before { content: none; }
.menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 0.5rem);
  z-index: 5;
  display: grid;
  gap: 0.5rem;
  min-width: 13rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgb(22 35 58 / 0.14);
}
.menu-email { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.menu button {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--red);
  font-weight: 500;
  cursor: pointer;
}

/* ---------- Main column ---------- */
main {
  max-width: 34rem;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero h1 {
  margin: 0.75rem 0 0.5rem;
  font: 600 clamp(1.9rem, 7vw, 2.6rem)/1.08 var(--font-display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.hero p { margin: 0 auto 1.5rem; max-width: 26rem; color: var(--muted); text-wrap: pretty; }

/* ---------- The stage: airmail frame ---------- */
@property --shift {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}
.stage {
  --stripe: 14px;
  width: min(100%, 22rem);
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 34px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) var(--shift) calc(var(--shift) + var(--stripe)),
    var(--paper) calc(var(--shift) + var(--stripe)) calc(var(--shift) + var(--stripe) * 1.6),
    var(--blue) calc(var(--shift) + var(--stripe) * 1.6) calc(var(--shift) + var(--stripe) * 2.6),
    var(--paper) calc(var(--shift) + var(--stripe) * 2.6) calc(var(--shift) + var(--stripe) * 3.2)
  );
}
/* The stripes travel only while the robot talks. */
.stage[data-state="speaking"] { animation: airmail 1.6s linear infinite; }
@keyframes airmail { to { --shift: 44.8px; } }
.stage-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 25px;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
}
.stage-inner video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.robot-wrap { width: 78%; }
.robot { width: 100%; height: auto; display: block; overflow: visible; }
.r-head { fill: var(--blue); }
.r-body { fill: var(--blue); }
.r-ear { fill: var(--gold); transition: fill 0.25s; }
.r-screen { fill: var(--screen); }
.r-eye, .r-mouth { fill: var(--eye); }
.r-bulb { fill: var(--red); }
.r-stroke { stroke: var(--blue); }
.r-eyes { transform-origin: 120px 100px; animation: blink 5s infinite; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
.robot[data-state="listening"] .r-ear { fill: var(--eye); }
.robot[data-state="thinking"] .r-eyes { animation: look 1.2s ease-in-out infinite alternate; }
@keyframes look { from { transform: translateX(-6px); } to { transform: translateX(6px); } }

.status {
  min-height: 1.6em;
  margin: 0.9rem 0 0.25rem;
  font-weight: 500;
  color: var(--muted);
}
.stage[data-state="listening"] + .status { color: var(--blue); }

/* ---------- Sign in ---------- */
.signin { display: grid; justify-items: center; gap: 0.6rem; margin-top: 0.5rem; }
.signin-label { margin: 0; font-weight: 500; }
.trial { margin: 0; font-size: 0.9rem; color: var(--muted); }

/* ---------- Controls ---------- */
.controls { width: 100%; display: grid; gap: 1.1rem; margin-top: 0.75rem; }
.langs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 0.5rem;
  text-align: start;
}
.lang { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.lang select {
  width: 100%;
  min-height: 2.9rem;
  padding: 0 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
}
.swap {
  width: 2.9rem;
  height: 2.9rem;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}
.swap svg { width: 1.25rem; height: 1.25rem; }
.levels {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
}
.levels legend { width: 100%; margin-bottom: 0.4rem; font-size: 0.85rem; color: var(--muted); }
.levels label { position: relative; }
.levels input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.levels span {
  display: block;
  padding: 0.45rem 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
}
.levels input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.levels input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }

.talk {
  justify-self: center;
  min-width: 15rem;
  min-height: 3.6rem;
  padding: 0 2rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 600 1.15rem/1 var(--font-display);
  cursor: pointer;
  transition: transform 0.12s, background 0.2s;
}
.talk:active { transform: scale(0.97); }
.talk[data-live="true"] { background: var(--red); color: #fff; }
.talk:disabled { opacity: 0.55; cursor: progress; }

.captions-toggle {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}
.captions-toggle input { width: 1.05rem; height: 1.05rem; accent-color: var(--blue); }
.captions {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1rem;
  max-height: 14rem;
  overflow-y: auto;
  display: grid;
  gap: 0.5rem;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.captions li { font-size: 0.95rem; }
.captions b { font-weight: 600; color: var(--blue); }
.captions li.you b { color: var(--muted); }

.notice {
  width: 100%;
  margin: 1.25rem 0 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
  font-weight: 500;
}
.notice[data-kind="ok"] {
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--blue) 35%, transparent);
}

/* ---------- Plans ---------- */
.plans { width: 100%; margin-top: 3rem; text-align: start; }
.plans h2 { margin: 0 0 0.75rem; font: 600 1.35rem/1.2 var(--font-display); }
.plan-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--line); }
.plan {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 1rem 0;
  border-bottom: 1.5px solid var(--line);
}
.plan-name { font-weight: 600; font-size: 1.05rem; }
.plan-price { font: 600 1.35rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.plan-price small { font: 400 0.85rem var(--font-body); color: var(--muted); }
.plan-minutes { color: var(--muted); font-size: 0.92rem; }
.plan button {
  grid-row: span 2;
  align-self: center;
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: none;
  font-weight: 500;
  cursor: pointer;
}
.plan button:disabled { border-color: var(--line); color: var(--muted); cursor: default; }
.plan-info { display: grid; gap: 0.15rem; }
.fine { margin: 0.75rem 0 0; font-size: 0.85rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .stage[data-state="speaking"], .r-eyes, .robot[data-state="thinking"] .r-eyes { animation: none; }
  .talk { transition: none; }
}
