/* SpeakMelayu design system.
   Quiet, product-first layout: generous whitespace, large type, soft tiles, one accent colour. */

:root {
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --bg-3: #ebebef;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --line: rgba(0, 0, 0, 0.09);
  --accent: #0a6cdb;
  --accent-hover: #0858b5;
  --accent-soft: rgba(10, 108, 219, 0.09);
  --navy: #0d1b40;
  --navy-2: #16295e;
  --gold: #f5c842;
  --gold-ink: #7a5a00;
  --ok: #1a8f4c;
  --ok-soft: rgba(26, 143, 76, 0.1);
  --warn: #b25b00;
  --warn-soft: rgba(178, 91, 0, 0.1);
  --nav-bg: rgba(255, 255, 255, 0.78);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-m: 0 2px 6px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.08);
  --r-l: 28px;
  --r-m: 18px;
  --r-s: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --gutter: max(16px, 4vw);
  --max: 1080px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-2: #111113;
    --bg-3: #1c1c1f;
    --card: #161618;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #86868b;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #3b91ff;
    --accent-hover: #6aabff;
    --accent-soft: rgba(59, 145, 255, 0.14);
    --gold-ink: #f5c842;
    --ok: #3ccf7c;
    --ok-soft: rgba(60, 207, 124, 0.14);
    --warn: #ffa94d;
    --warn-soft: rgba(255, 169, 77, 0.14);
    --nav-bg: rgba(22, 22, 24, 0.78);
    --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-m: 0 12px 40px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #111113;
  --bg-3: #1c1c1f;
  --card: #161618;
  --ink: #f5f5f7;
  --ink-2: #a1a1a6;
  --ink-3: #86868b;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #3b91ff;
  --accent-hover: #6aabff;
  --accent-soft: rgba(59, 145, 255, 0.14);
  --gold-ink: #f5c842;
  --ok: #3ccf7c;
  --ok-soft: rgba(60, 207, 124, 0.14);
  --warn: #ffa94d;
  --warn-soft: rgba(255, 169, 77, 0.14);
  --nav-bg: rgba(22, 22, 24, 0.78);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-m: 0 12px 40px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(72px, 10vw, 128px) 0; }
.section.alt { background: var(--bg-2); }
.center { text-align: center; }
.eyebrow {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0;
}
.h-xl {
  font-size: clamp(44px, 8vw, 88px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0;
}
.h-l {
  font-size: clamp(34px, 5.4vw, 60px);
  line-height: 1.07;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 16px;
}
.h-m {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 10px;
}
.lede {
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.4;
  color: var(--ink-2);
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0;
}
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.gradient-text {
  background: linear-gradient(100deg, var(--accent) 0%, #6c5ce7 45%, #e0a100 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 22px;
  border-radius: 980px;
  border: 0;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { opacity: 0.86; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-quiet { background: var(--bg-2); color: var(--ink); }
.btn-quiet:hover { background: var(--bg-3); }
.btn-sm { min-height: 34px; padding: 6px 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.link-arrow { font-size: 17px; font-weight: 500; white-space: nowrap; }
.link-arrow::after { content: " ›"; }
.cta-row { display: flex; gap: 14px 24px; flex-wrap: wrap; align-items: center; }
.center .cta-row { justify-content: center; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand svg { width: 58px; height: 36px; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--ink); font-size: 14px; opacity: 0.85; }
.nav-links a:hover { opacity: 1; text-decoration: none; }
.nav-links .btn { opacity: 1; color: #fff; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 18px; height: 1.5px; background: var(--ink); margin: 5px 0; transition: transform 0.2s; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 56px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .nav.open .nav-links { display: flex; }
  .nav-links a { padding: 14px 0; font-size: 17px; border-bottom: 1px solid var(--line); }
  .nav-links .btn { margin-top: 14px; border-bottom: 0; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(56px, 9vw, 110px) 0 0; text-align: center; overflow: hidden; }
.hero .lede { max-width: 720px; margin: 22px auto 30px; }
.hero-note { margin-top: 14px; font-size: 14px; color: var(--ink-3); }
.hero-stage {
  position: relative;
  margin: clamp(48px, 7vw, 80px) auto 0;
  max-width: 980px;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 340px) 1fr;
  align-items: end;
  gap: 24px;
}
.float-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 16px 18px;
  text-align: left;
  box-shadow: var(--shadow-m);
  font-size: 14px;
  margin-bottom: 64px;
}
.float-card b { display: block; font-size: 15px; margin-bottom: 4px; }
.float-card .tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; margin-bottom: 8px; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.phone {
  background: var(--card);
  border: 10px solid #1d1d1f;
  border-bottom: 0;
  border-radius: 46px 46px 0 0;
  height: 440px;
  padding: 18px 14px 0;
  box-shadow: var(--shadow-m);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.phone-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; border-bottom: 1px solid var(--line); }
.avatar-ai {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--accent));
  display: grid;
  place-items: center;
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.phone-head b { font-size: 15px; display: block; }
.phone-head span { font-size: 12px; color: var(--ok); }
.bubble { max-width: 84%; padding: 9px 13px; border-radius: 18px; font-size: 14px; line-height: 1.4; }
.bubble small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.bubble.ai { background: var(--bg-2); border-bottom-left-radius: 6px; align-self: flex-start; }
.bubble.me { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.bubble.fix { background: var(--ok-soft); color: var(--ink); align-self: flex-start; font-size: 13px; border-radius: 12px; }
.mic-dock { margin-top: auto; display: flex; justify-content: center; padding: 14px 0 20px; }
.mic-dot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 0 rgba(10, 108, 219, 0.45);
  animation: pulse 2.2s infinite;
}
.mic-dot svg { width: 24px; height: 24px; fill: #fff; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(10, 108, 219, 0.45); }
  70% { box-shadow: 0 0 0 18px rgba(10, 108, 219, 0); }
  100% { box-shadow: 0 0 0 0 rgba(10, 108, 219, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .mic-dot, .rec-on { animation: none !important; }
  html { scroll-behavior: auto; }
}
@media (max-width: 820px) {
  .hero-stage { grid-template-columns: 1fr; max-width: 360px; }
  .hero-stage .float-card { display: none; }
}

/* ---------- Tiles ---------- */
.tiles { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 48px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
  background: var(--card);
  border-radius: var(--r-l);
  padding: clamp(28px, 4vw, 44px);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.section.alt .tile { background: var(--card); }
.section:not(.alt) .tile { background: var(--bg-2); }
.tile .h-m { margin-top: 6px; }
.tile p { color: var(--ink-2); margin: 0 0 18px; }
.tile .cta-row { margin-top: auto; padding-top: 10px; }
.tile-dark { background: var(--navy) !important; color: #fff; }
.tile-dark p { color: rgba(255, 255, 255, 0.72); }
.tile-dark .eyebrow { color: var(--gold); }
.tile-dark a { color: #8ec5ff; }
.tile .icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  margin-bottom: 18px;
}
.tile .icon svg { width: 24px; height: 24px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.checks { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); font-size: 16px; }
.tile-dark .checks li { color: #fff; }
.checks li::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%230a6cdb' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}
.tile-dark .checks li::before { background-color: rgba(245, 200, 66, 0.18); }
.meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--bg-3);
  color: var(--ink-2);
}
.tile-dark .chip { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.8); }
@media (max-width: 900px) { .tiles.three { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .tiles { grid-template-columns: 1fr; } }

/* ---------- AI section ---------- */
.ai-section { background: #000; color: #f5f5f7; }
.ai-section .lede { color: #a1a1a6; }
.ai-section .eyebrow { color: var(--gold); }
.ai-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(28px, 5vw, 64px); align-items: start; margin-top: 44px; }
.feature-list { display: grid; gap: 26px; }
.feature-list h3 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.015em; }
.feature-list p { margin: 0; color: #a1a1a6; font-size: 16px; }
.scenario-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.scenario-cloud span { font-size: 13px; padding: 6px 12px; border-radius: 99px; background: #1c1c1f; color: #d2d2d7; }
@media (max-width: 860px) { .ai-grid { grid-template-columns: 1fr; } }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 48px; counter-reset: step; }
.step { background: var(--card); border-radius: var(--r-l); padding: 32px; }
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  margin-bottom: 18px;
}
.step h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.015em; }
.step p { margin: 0; color: var(--ink-2); font-size: 16px; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

/* ---------- Pricing ---------- */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 48px; align-items: stretch; }
.plan {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.plan.featured { border: 2px solid var(--accent); box-shadow: var(--shadow-m); }
.plan-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 99px;
  white-space: nowrap;
}
.plan h3 { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.015em; }
.plan .for { color: var(--ink-2); font-size: 15px; margin: 0 0 20px; min-height: 44px; }
.price { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.price small { font-size: 16px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.plan .checks { margin: 22px 0 26px; }
.plan .checks li { font-size: 15px; }
.plan .btn { margin-top: auto; width: 100%; }
.price-foot { margin-top: 28px; text-align: center; color: var(--ink-2); font-size: 15px; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; max-width: 460px; margin-left: auto; margin-right: auto; } }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin: 40px auto 0; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 22px 36px 22px 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 18px; font-size: 26px; font-weight: 300; color: var(--ink-2); transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 22px; color: var(--ink-2); }

/* ---------- Footer ---------- */
.footer { background: var(--bg-2); padding: 40px 0 48px; font-size: 13px; color: var(--ink-2); }
.footer-top { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer a { color: var(--ink-2); }
.footer a:hover { color: var(--ink); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; text-align: left; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.notice { border-radius: var(--r-s); padding: 12px 16px; font-size: 15px; margin: 0 0 16px; text-align: left; }
.notice.error { background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.auth-card {
  max-width: 440px;
  margin: clamp(40px, 8vw, 90px) auto;
  background: var(--card);
  border-radius: var(--r-l);
  padding: clamp(28px, 5vw, 44px);
  box-shadow: var(--shadow-m);
  text-align: center;
}
.auth-card .btn { width: 100%; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  color: var(--ink);
  border-radius: var(--r-l);
  padding: 32px;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-m);
  text-align: center;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.modal h2 { margin: 0 0 10px; font-size: 26px; letter-spacing: -0.02em; }
.modal p { color: var(--ink-2); margin: 0 0 18px; }
.code-box {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--bg-2);
  border-radius: var(--r-s);
  padding: 16px;
  margin: 0 0 12px;
  user-select: all;
}

/* ============================================================
   Cikgu AI chat widget
   ============================================================ */
.cikgu {
  --c-bg: var(--card);
  background: var(--c-bg);
  color: var(--ink);
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 600px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: var(--shadow-m);
  text-align: left;
}
.ai-section .cikgu { border-color: #2c2c2e; }
.cikgu-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cikgu-head .who { flex: 1; min-width: 0; }
.cikgu-head b { display: block; font-size: 15px; }
.cikgu-head .status { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--bg-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); }
.icon-btn[aria-pressed="true"] svg { stroke: var(--accent); }
.cikgu-scenes { display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.cikgu-scenes::-webkit-scrollbar { display: none; }
.scene {
  flex: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}
.scene[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.scene .lock { opacity: 0.6; margin-left: 4px; }
.cikgu-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 86%; display: flex; flex-direction: column; gap: 6px; }
.msg.ai { align-self: flex-start; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg .b { padding: 10px 14px; border-radius: 18px; font-size: 16px; line-height: 1.42; overflow-wrap: anywhere; }
.msg.ai .b { background: var(--bg-2); border-bottom-left-radius: 6px; }
.msg.me .b { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg .tr { font-size: 13px; color: var(--ink-2); padding: 0 6px; }
.msg .tools { display: flex; gap: 6px; padding: 0 2px; }
.msg .tools button {
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.msg .tools button:hover { color: var(--accent); background: var(--accent-soft); }
.fix-card { background: var(--ok-soft); border-radius: 14px; padding: 10px 14px; font-size: 14px; align-self: flex-start; max-width: 92%; }
.fix-card b { color: var(--ok); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; display: block; margin-bottom: 2px; }
.fix-card .fixed { font-weight: 600; font-size: 15px; }
.fix-card .why { color: var(--ink-2); margin-top: 3px; }
.sys-note { align-self: center; font-size: 13px; color: var(--ink-2); background: var(--bg-2); padding: 8px 14px; border-radius: 12px; text-align: center; max-width: 92%; }
.sys-note a { font-weight: 600; }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; background: var(--bg-2); border-radius: 18px; border-bottom-left-radius: 6px; align-self: flex-start; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.cikgu-suggest { display: flex; gap: 8px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.cikgu-suggest::-webkit-scrollbar { display: none; }
.cikgu-suggest button {
  flex: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: 99px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cikgu-suggest button:hover { background: var(--accent-soft); }
.cikgu-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.cikgu-input textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.3;
  overflow-y: hidden;
}
.cikgu-input textarea:focus { outline: none; border-color: var(--accent); }
.round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background 0.2s, transform 0.15s;
}
.round:active { transform: scale(0.94); }
.round svg { width: 20px; height: 20px; }
.round.mic { background: var(--bg-2); }
.round.mic svg { fill: var(--ink); }
.round.mic.rec-on { background: #e5383b; animation: rec 1.4s infinite; }
.round.mic.rec-on svg { fill: #fff; }
@keyframes rec { 0% { box-shadow: 0 0 0 0 rgba(229, 56, 59, 0.5); } 70% { box-shadow: 0 0 0 12px rgba(229, 56, 59, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 56, 59, 0); } }
.round.send { background: var(--accent); }
.round.send svg { fill: #fff; }
.round[disabled] { opacity: 0.4; cursor: not-allowed; }
.cikgu-foot { font-size: 12px; color: var(--ink-3); padding: 0 16px 10px; text-align: center; }
.level-select {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  border-radius: 99px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ============================================================
   Learning portal
   ============================================================ */
.portal-body { background: var(--bg-2); }
.app-bar { position: sticky; top: 0; z-index: 40; background: var(--nav-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.app-bar .nav-inner { max-width: none; padding: 0 20px; }
.app-bar-right { display: flex; align-items: center; gap: 10px; }
.plan-pill { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 99px; background: var(--bg-3); color: var(--ink-2); white-space: nowrap; }
.plan-pill.paid { background: var(--ok-soft); color: var(--ok); }
.app { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 57px); }
.sidebar { border-right: 1px solid var(--line); background: var(--bg); padding: 18px 14px 40px; position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.segmented button { border: 0; background: transparent; padding: 7px 8px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-s); }
.week-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.week-list button {
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  align-items: center;
}
.week-list button:hover { background: var(--bg-2); }
.week-list button[aria-current="true"] { background: var(--accent-soft); }
.week-list .n { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.week-list .t { font-size: 14px; font-weight: 500; line-height: 1.3; }
.week-list .s { font-size: 12px; color: var(--ink-3); }
.week-list .done { color: var(--ok); }
.side-cta { margin-top: 18px; background: var(--bg-2); border-radius: var(--r-m); padding: 16px; font-size: 14px; }
.side-cta p { margin: 0 0 10px; color: var(--ink-2); }
.main { padding: clamp(20px, 4vw, 44px); min-width: 0; }
.lesson { max-width: 860px; margin: 0 auto; }
.lesson-head .eyebrow { margin-bottom: 4px; }
.lesson-head h1 { font-size: clamp(30px, 4.4vw, 44px); letter-spacing: -0.03em; line-height: 1.08; margin: 0 0 6px; }
.lesson-head .lede { font-size: 20px; }
.card { background: var(--card); border-radius: var(--r-m); padding: clamp(20px, 3vw, 28px); margin-top: 18px; }
.card h2 { font-size: 20px; letter-spacing: -0.015em; margin: 0 0 14px; }
.goals { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.flip {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
  min-height: 86px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: border-color 0.2s, background 0.2s;
}
.flip:hover { border-color: var(--accent); }
.flip .ms { font-weight: 600; font-size: 16px; }
.flip .en { font-size: 14px; color: var(--ink-2); }
.flip .hint { font-size: 12px; color: var(--ink-3); }
.flip.hide-en .en { visibility: hidden; }
.phrase-list { display: grid; gap: 8px; }
.phrase {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-2);
}
.phrase .ms { font-weight: 600; }
.phrase .en { font-size: 14px; color: var(--ink-2); }
.speak-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--card); display: grid; place-items: center; cursor: pointer; }
.speak-btn svg { width: 16px; height: 16px; fill: var(--accent); }
.grammar-body { margin: 0 0 14px; color: var(--ink); }
.practice-card { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.practice-card p { color: rgba(255, 255, 255, 0.75); margin: 0 0 16px; }
.practice-card .eyebrow { color: var(--gold); }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.lesson-done { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.lesson-done input { width: 20px; height: 20px; accent-color: var(--accent); }
.locked { text-align: center; padding: clamp(28px, 6vw, 56px) 20px; }
.locked .lock-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; margin: 0 auto 16px; }
.locked .lock-ico svg { width: 24px; height: 24px; stroke: var(--ink-2); fill: none; stroke-width: 1.8; }
.locked .plans { margin-top: 28px; }

/* AI drawer inside portal */
.drawer {
  position: fixed;
  top: 57px;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  z-index: 45;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  padding: 12px;
}
.drawer.open { transform: translateX(0); box-shadow: var(--shadow-m); }
.drawer .cikgu { height: 100%; max-height: none; box-shadow: none; }
.drawer-close { align-self: flex-end; margin-bottom: 8px; }
.ai-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 44;
  box-shadow: var(--shadow-m);
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
  .week-list { grid-auto-flow: column; grid-auto-columns: minmax(210px, 70%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .week-list li { scroll-snap-align: start; }
  .side-cta { display: none; }
  /* Subscribers keep a compact progress strip on phones: bar, badges and the way to the certificate. */
  .side-cta.paid { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; padding: 10px 12px; }
  .side-cta.paid p { margin: 0; flex: 1 1 100%; font-size: 13px; }
  .side-cta.paid .side-bar { flex: 1 1 100%; }
  .side-cta.paid .badge-row { margin: 0; flex: 1 1 auto; gap: 4px; }
  .side-cta.paid .badge-dot { width: 26px; height: 26px; font-size: 13px; }
  .app-bar .plan-pill { display: none; }
}
.cikgu-head b { white-space: nowrap; }
@media (max-width: 480px) {
  .cikgu-head { gap: 8px; padding: 12px; }
  .cikgu-head .avatar-ai { width: 30px; height: 30px; font-size: 12px; }
  .level-select { padding: 5px 6px; font-size: 12px; }
  .icon-btn { width: 32px; height: 32px; }
}

/* ---------- Teacher picker, credits & subscriber showcase ---------- */
.cikgu-tutors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 10px 12px 0; }
.tutor-chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 12px;
  padding: 7px 8px;
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 1px;
  min-width: 0;
}
.tutor-chip b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tutor-chip span { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tutor-chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tutor-chip[aria-checked="true"] span { color: var(--accent); }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.exclusive-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 99px;
  color: #6b4e00;
  background: linear-gradient(135deg, #ffe38a, #f5c842);
  white-space: nowrap;
}
.showcase .cikgu-log { flex: 1; min-height: 180px; }
.showcase-panel { border-top: 1px solid var(--line); padding: 16px; display: grid; gap: 12px; background: var(--bg-2); }
.showcase-title { margin: 0; font-weight: 700; font-size: 15px; text-align: center; }
.tutor-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tutor-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 3px; align-content: start; }
.tutor-card b { font-size: 14px; }
.tutor-card span { font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.tutor-card em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--accent); }
.credit-pill { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 99px; background: linear-gradient(135deg, #fff4c7, #ffe38a); color: #6b4e00; border: 0; cursor: pointer; white-space: nowrap; }
.pack-list { display: grid; gap: 10px; margin: 0 0 14px; }
.pack { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-align: left; }
.pack b { font-size: 17px; display: block; }
.pack span { font-size: 13px; color: var(--ink-2); }
.bonus-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(245, 200, 66, 0.16), rgba(10, 108, 219, 0.08)); font-size: 14px; margin: 18px 0 0; text-align: left; }
.credits-strip { margin: 28px auto 0; max-width: 760px; display: flex; gap: 16px 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--bg-2); border-radius: var(--r-m); padding: 18px 22px; text-align: left; }
.credits-strip p { margin: 0; color: var(--ink-2); font-size: 15px; }
.credits-strip b { color: var(--ink); }
@media (max-width: 480px) {
  .tutor-cards { grid-template-columns: 1fr; }
  .tutor-card { grid-template-columns: 1fr auto; align-items: center; }
  .tutor-card span { display: none; }
}

/* ---------- Help language & Semak Tulisan ---------- */
.lang-select { max-width: 150px; }
.cikgu-scenes .level-select { flex: none; }
.scene-sep { flex: none; width: 1px; background: var(--line); margin: 2px 2px; }
.penulis-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.write-types { display: flex; flex-wrap: wrap; gap: 6px; }
.write-types .scene[aria-checked="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.write-box {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}
.write-box:focus { outline: none; border-color: var(--accent); background: var(--card); }
.write-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); }
.write-card { background: var(--bg-2); border-radius: 14px; padding: 14px 16px; font-size: 15px; }
.write-card h4 { margin: 0 0 8px; font-size: 15px; }
.write-card p { margin: 0; color: var(--ink); }
[data-result] { display: grid; gap: 10px; }
.ok-card { background: var(--ok-soft); }
.write-rating { color: #e0a100; font-size: 18px; letter-spacing: 2px; margin-bottom: 4px; }
.write-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.write-text { white-space: pre-wrap; line-height: 1.55; }
.mistakes { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.mistakes del { color: #d63a3a; text-decoration-thickness: 1.5px; }
.mistakes ins { color: var(--ok); text-decoration: none; font-weight: 600; }
.mistakes .chip { font-size: 11px; padding: 2px 8px; margin-left: 4px; }
.mistakes .why { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.tips { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.ai-modes { margin: 0 0 10px; }

.cikgu[hidden] { display: none; }
.drawer .cikgu { flex: 1; min-height: 0; height: auto; }
.showcase-sub { margin: -6px 0 0; text-align: center; font-size: 13px; color: var(--ink-2); }
.drawer .penulis .cikgu-head { display: none; }
.show-sm { display: none; }
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .show-sm { display: inline-flex; }
}
.locked .plans { grid-template-columns: minmax(0, 380px); justify-content: center; }
.tutor-card small { font-size: 11px; color: var(--ink-3); margin-top: -2px; }
.gloss { font-size: 11px; font-weight: 600; color: var(--ink-3); background: var(--bg-2); border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.segmented[hidden], .segmented button[hidden] { display: none; }

/* ---------- Lesson dialogue (illustrated stage) ---------- */
.dlg-stage { scroll-margin-top: 88px; position: relative; aspect-ratio: 2 / 1; border-radius: 18px; overflow: hidden; background: #e9e4dc; isolation: isolate; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); }
.dlg-stage .scene-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
.dlg-stage::after { content: ""; position: absolute; inset: auto 0 0 0; height: 35%; background: linear-gradient(to top, rgba(0, 0, 0, 0.18), transparent); z-index: 0; pointer-events: none; }
.dlg-actor { position: absolute; bottom: 0; height: 88%; z-index: 1; display: flex; justify-content: center; transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.45s; transform-origin: bottom center; }
.dlg-actor.left { left: 3%; }
.dlg-actor.right { right: 3%; }
.dlg-figure { position: relative; height: 100%; aspect-ratio: 338 / 520; animation: breathe 4.2s ease-in-out infinite; transform-origin: bottom center; }
.dlg-actor.left .dlg-figure { scale: -1 1; } /* face (and gesture) toward the centre */
.dlg-actor.right.mirrored .dlg-figure { scale: -1 1; }
.dlg-actor.left.mirrored .dlg-figure { scale: 1 1; }
.dlg-actor.right .dlg-figure { animation-delay: -2.1s; }
.dlg-pose { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; opacity: 0; transition: opacity 0.18s; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18)); }
.dlg-pose.on { opacity: 1; }
.dlg-actor.speaking { transform: translateY(-2%) scale(1.04); z-index: 2; }
.dlg-actor.speaking .dlg-figure { animation: talk-bob 0.9s ease-in-out infinite; }
.dlg-actor.listening { transform: scale(0.96); filter: brightness(0.88) saturate(0.9); }
.dlg-name { position: absolute; bottom: 5%; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.94); color: #1d1d1f; padding: 3px 10px; border-radius: 99px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); transition: background 0.3s, color 0.3s; }
.dlg-actor.speaking .dlg-name { background: var(--accent); color: #fff; }
.dlg-say { position: absolute; top: 7%; z-index: 3; max-width: 52%; padding: 10px 16px; border-radius: 18px; background: #fff; color: #1d1d1f; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); display: grid; gap: 3px; }
.dlg-say[hidden] { display: none; }
.dlg-say.from-left { left: 24%; border-bottom-left-radius: 6px; }
.dlg-say.from-right { right: 24%; border-bottom-right-radius: 6px; }
.dlg-say::after { content: ""; position: absolute; bottom: -9px; width: 18px; height: 18px; background: #fff; clip-path: polygon(0 0, 100% 0, 0 100%); }
.dlg-say.from-left::after { left: 14px; }
.dlg-say.from-right::after { right: 14px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.dlg-say.pop { animation: say-pop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1); }
.dlg-say-ms { font-size: 17px; font-weight: 600; line-height: 1.3; }
.dlg-say-en { font-size: 13px; color: #6e6e73; }
.dlg-start { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 4; width: 68px; height: 68px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(255, 255, 255, 0.95); color: var(--accent); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22); display: grid; place-items: center; transition: transform 0.2s, opacity 0.3s; animation: pulse 2.2s ease-in-out infinite; }
.dlg-start svg { width: 30px; height: 30px; fill: currentColor; margin-left: 4px; }
.dlg-start:hover { transform: scale(1.06); }
.dlg-stage.started .dlg-start { opacity: 0; pointer-events: none; }
@keyframes breathe { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-0.6%) scaleY(1.008); } }
@keyframes talk-bob { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-1.2%) rotate(-0.6deg); } 65% { transform: translateY(-0.4%) rotate(0.5deg); } }
@keyframes say-pop { from { opacity: 0; transform: translateY(8px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22), 0 0 0 0 rgba(255, 255, 255, 0.6); } 50% { box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22), 0 0 0 14px rgba(255, 255, 255, 0); } }
@media (max-width: 640px) {
  .dlg-stage { aspect-ratio: 4 / 3; }
  .dlg-actor { height: 76%; }
  .dlg-actor.left { left: -2%; }
  .dlg-actor.right { right: -2%; }
  .dlg-say { max-width: 70%; top: 5%; padding: 8px 12px; }
  .dlg-say.from-left { left: 6%; }
  .dlg-say.from-right { right: 6%; }
  .dlg-say-ms { font-size: 15px; }
}
.dlg-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 10px; flex-wrap: wrap; }
.dlg-controls .btn svg { width: 14px; height: 14px; fill: currentColor; }
.dlg-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.dlg-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.dlg-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dlg-line { display: flex; }
.dlg-line.from-right { justify-content: flex-end; }
.dlg-bubble { max-width: 86%; text-align: left; border: 0; cursor: pointer; padding: 9px 14px; border-radius: 16px; background: var(--bg-2); color: var(--ink); display: grid; gap: 2px; font: inherit; transition: background 0.2s, transform 0.2s; }
.from-left .dlg-bubble { border-bottom-left-radius: 5px; }
.from-right .dlg-bubble { border-bottom-right-radius: 5px; background: var(--accent-soft); }
.dlg-line.active .dlg-bubble { background: var(--accent); color: #fff; transform: scale(1.02); }
.dlg-line.active .dlg-who, .dlg-line.active .dlg-en { color: rgba(255, 255, 255, 0.85); }
.dlg-who { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.dlg-ms { font-size: 16px; font-weight: 500; }
.dlg-en { font-size: 13px; color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) {
  .dlg-figure, .dlg-actor.speaking .dlg-figure, .dlg-start, .dlg-say.pop { animation: none; }
}

/* ---------- Culture, quiz and writing task ---------- */
.culture-card { background: linear-gradient(135deg, rgba(245, 200, 66, 0.14), rgba(10, 108, 219, 0.06)); }
.culture-card .eyebrow { color: var(--gold-ink); }
.culture-card p { margin: 0 0 10px; color: var(--ink); }
.quiz-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.quiz-score { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.quiz-list { margin: 0; padding-left: 22px; display: grid; gap: 18px; }
.quiz-prompt { margin: 0 0 8px; font-weight: 600; }
.quiz-options { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.quiz-opt { text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; cursor: pointer; }
.quiz-opt:hover:not([disabled]) { border-color: var(--accent); }
.quiz-opt[disabled] { cursor: default; opacity: 0.75; }
.quiz-opt.is-answer { border-color: var(--ok); background: var(--ok-soft); opacity: 1; font-weight: 600; }
.quiz-opt.is-wrong { border-color: #d63a3a; background: rgba(214, 58, 58, 0.08); opacity: 1; }
.quiz-feedback { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.quiz-q.right .quiz-feedback b { color: var(--ok); }
.quiz-q.wrong .quiz-feedback b { color: #d63a3a; }
.order-built { min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--line); background: var(--bg); font-weight: 600; margin-bottom: 8px; }
.order-bank { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 15px; cursor: pointer; }
.chip-btn[disabled] { opacity: 0.35; cursor: default; }
.order-actions { display: flex; gap: 8px; }
.quiz-result { margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: var(--bg-2); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.writing-card h2 { font-size: 20px; }
.writing-card p { margin: 0 0 10px; color: var(--ink-2); }
.write-task { display: grid; gap: 2px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 15px; }
.write-task b { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.write-task small { color: var(--ink-2); }

/* ---------- Time estimates, listening and repeat-after-me drills ---------- */
.time-tag { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 9px; border-radius: 99px; background: var(--bg-2); color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.short-on-time { margin: 12px 0 0; }
.drill-intro { margin: 4px 0 16px; }
.drill { display: grid; gap: 14px; justify-items: start; }
.drill > * { justify-self: stretch; }
.drill > .btn { justify-self: start; }
.drill-dots { display: flex; gap: 6px; }
.drill-dots span { width: 28px; height: 5px; border-radius: 99px; background: var(--line); transition: background 0.3s; }
.drill-dots span.done { background: var(--ok); }
.drill-dots span.now { background: var(--accent); }
.drill-audio { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drill-play, .drill-mic { width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; background: var(--accent); box-shadow: 0 6px 18px rgba(10, 108, 219, 0.3); transition: transform 0.15s; }
.drill-play:hover, .drill-mic:hover { transform: scale(1.05); }
.drill-play svg, .drill-mic svg { width: 28px; height: 28px; fill: currentColor; }
.drill-audio .btn svg { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; margin-right: 4px; }
.drill-mic { background: #e5484d; box-shadow: 0 6px 18px rgba(229, 72, 77, 0.3); margin-left: auto; }
.drill-mic.on { animation: mic-pulse 1.1s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5); } 50% { box-shadow: 0 0 0 16px rgba(229, 72, 77, 0); } }
.drill-next { margin-left: 8px; }
.repeat-card { padding: 18px; border-radius: 16px; background: var(--bg-2); display: grid; gap: 10px; }
.repeat-ms { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.25; }
.repeat-en { margin: 0; color: var(--ink-2); }
.repeat-result:empty { display: none; }
.repeat-result { padding-top: 10px; border-top: 1px solid var(--line); }
.repeat-result p { margin: 0 0 6px; }
.repeat-words { font-size: 18px; font-weight: 600; }
.repeat-words .ok { color: var(--ok); }
.repeat-words .miss { color: #e5484d; text-decoration: underline wavy; text-underline-offset: 4px; }
.drill-foot { display: flex; justify-content: flex-end; }
@media (prefers-reduced-motion: reduce) { .drill-mic.on { animation: none; outline: 3px solid #e5484d; outline-offset: 3px; } }

/* ---------- Formal & tidak formal, exam tip ---------- */
.register-table { display: grid; gap: 6px; }
.register-row { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); }
.register-row > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.register-row .speak-btn { flex: none; }
.register-head { background: transparent; padding: 0 12px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.register-head small { font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.register-note { grid-column: 1 / -1; color: var(--ink-3); padding-left: 46px; }
.exam-tip { border: 1px solid rgba(10, 108, 219, 0.35); background: linear-gradient(135deg, rgba(10, 108, 219, 0.09), rgba(10, 108, 219, 0.02)); }
.exam-tip .eyebrow { color: var(--accent); }
.exam-tip p { margin: 6px 0 12px; }
#summary-btn { margin-top: 12px; }
@media (max-width: 560px) {
  .register-row { grid-template-columns: 1fr; }
  .register-note { padding-left: 0; }
  .register-head { display: none; }
  .register-row > span:nth-child(2)::before { content: "Tidak formal"; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; min-width: 72px; }
}

/* ---------- 1-page printable summary ---------- */
#print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body.print-summary > *:not(#print-sheet) { display: none !important; }
  body.print-summary { background: #fff !important; }
  body.print-summary #print-sheet { display: block; color: #1d1d1f; font: 9.6pt/1.4 Inter, system-ui, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-sheet h1 { font-size: 17pt; margin: 0; line-height: 1.15; }
  #print-sheet h2 { font-size: 10pt; margin: 10pt 0 4pt; color: #0a6cdb; text-transform: uppercase; letter-spacing: 0.06em; }
  #print-sheet p { margin: 0 0 4pt; }
  .ps-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16pt; padding-bottom: 8pt; border-bottom: 2pt solid #0a6cdb; }
  .ps-brand { font-weight: 800; font-size: 13pt; color: #0a6cdb; }
  .ps-course { font-size: 9pt; color: #6e6e73; }
  .ps-title { text-align: right; }
  .ps-title p { color: #6e6e73; }
  .ps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16pt; }
  #print-sheet table { width: 100%; border-collapse: collapse; }
  #print-sheet td, #print-sheet th { padding: 2.5pt 4pt; border-bottom: 0.5pt solid #e0e0e5; vertical-align: top; text-align: left; }
  #print-sheet td:first-child { font-weight: 600; width: 50%; }
  #print-sheet th { font-size: 8.5pt; color: #6e6e73; }
  .ps-register td { font-weight: 600; }
  .ps-tip { margin-top: 8pt !important; padding: 5pt 7pt; border-radius: 5pt; background: #eef4fd; }
  .ps-dialogue ol { margin: 0; padding-left: 14pt; columns: 2; column-gap: 16pt; }
  .ps-dialogue li { break-inside: avoid; margin-bottom: 2pt; }
  .ps-dialogue i { color: #6e6e73; }
  .ps-foot { margin-top: 12pt; padding-top: 6pt; border-top: 0.5pt solid #e0e0e5; font-size: 8pt; color: #6e6e73; text-align: center; }
}

/* ---------- Audio notice ---------- */
.sm-toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 80; max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 14px; background: #1d1d1f; color: #fff; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); animation: toast-in 0.3s ease; transition: opacity 0.5s; }
.sm-toast.out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Notes (Kebangsaan A) ---------- */
.notes-card h3 { font-size: 17px; margin: 22px 0 8px; }
.notes-card h3:first-of-type { margin-top: 6px; }
.notes-list { margin: 0; padding-left: 20px; display: grid; gap: 7px; line-height: 1.6; }
.notes-table-wrap { overflow-x: auto; margin: 4px 0 6px; border: 1px solid var(--line); border-radius: 12px; }
.notes-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
.notes-table th, .notes-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.notes-table thead th { background: var(--bg-2); font-size: 13px; color: var(--ink-2); }
.notes-table tbody th { font-weight: 600; white-space: nowrap; }
.notes-table tbody tr:last-child > * { border-bottom: 0; }
.notes-refs { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); font-size: 14px; }
.notes-refs summary { cursor: pointer; font-weight: 600; }
.notes-refs ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }

/* ---------- Topic field tags (Profesional sidebar) ---------- */
.w-tag { display: inline-block; margin: 3px 4px 0 0; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; white-space: nowrap; }

/* ============================================================
   Badges & certificate (sidebar strip and modal)
   ============================================================ */
.side-bar { height: 6px; background: var(--bg-3); border-radius: 6px; overflow: hidden; }
.side-bar > div { height: 100%; background: var(--accent); }
.badge-row { display: flex; gap: 6px; margin: 12px 0 10px; flex-wrap: wrap; }
.badge-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--bg-3); filter: grayscale(1); opacity: 0.45; }
.badge-dot.on { filter: none; opacity: 1; background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--gold); }
.modal:has(.badge-grid) { max-width: 560px; }
.badge-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 4px; text-align: center; }
.badge-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: var(--r-s); background: var(--bg-2); font-size: 13px; color: var(--ink-3); }
.badge-card b { color: var(--ink-2); font-size: 14px; }
.badge-card .badge-ico { font-size: 28px; filter: grayscale(1); opacity: 0.4; }
.badge-card.on { background: var(--accent-soft); color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--gold); }
.badge-card.on b { color: var(--ink); }
.badge-card.on .badge-ico { filter: none; opacity: 1; }
.cert-form { display: flex; flex-direction: column; gap: 8px; text-align: left; margin-bottom: 8px; }
@media (max-width: 480px) { .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ref-note { margin: 4px 0 14px; padding: 8px 12px; border-radius: var(--r-s); background: var(--ok-soft); color: var(--ok); font-size: 14px; }
.invite-code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 24px; font-weight: 700; letter-spacing: 0.08em; background: var(--bg-2); border-radius: var(--r-s); padding: 14px; margin: 0 0 10px; user-select: all; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.invite-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.invite-stats div { background: var(--bg-2); border-radius: var(--r-s); padding: 12px; }
.invite-stats b { display: block; font-size: 22px; color: var(--ink); }
.invite-stats span { font-size: 13px; color: var(--ink-3); }

/* ---------- Legal pages (terms, privacy, refunds) ---------- */
.legal { max-width: 760px; padding-top: clamp(40px, 7vw, 72px); padding-bottom: 72px; line-height: 1.65; }
.legal h1 { font-size: clamp(30px, 5vw, 40px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
.legal h2 { font-size: 20px; margin: 36px 0 10px; }
.legal p, .legal li { color: var(--ink); font-size: 16px; }
.legal ul { padding-left: 22px; margin: 0 0 16px; }
.legal li { margin: 6px 0; }
.legal .updated { color: var(--ink-2); font-size: 14px; margin: 0 0 28px; }
.legal .summary { background: var(--bg-2); border-radius: var(--r-m); padding: 18px 22px; margin: 0 0 28px; }
.legal .summary h2 { margin-top: 0; font-size: 17px; }
.legal .summary p, .legal .summary li { font-size: 15px; }
