/* 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-template-columns: 1fr 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; }
  .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; }
}
