/* Thoothu (தூது) — the Oliyon Research design language shared with Nigandu and Suzhi:
   navy header band with the kolam motif and the living flame, warm paper ground, serif headings. */
:root {
  --navy: #002663;
  --navy-deep: #001a45;
  --navy-2: #0a3a8a;
  --ink: #15213a;
  --ink-2: #3a4458;
  --muted: #566070;
  --gold: #c9962e;
  --gold-bright: #e9a108;
  --gold-soft: #f5ecd6;
  --flame: #feb001;
  --paper: #fbfaf6;
  --leaf: #f3eee2;
  --surface: #ffffff;
  --line: #ddd6c6;
  --line-soft: #ebe6d9;
  --mine: #e9eef8;
  --ok: #2f6b3a;
  --ok-soft: #e8f1e6;
  --warn: #8a5a00;
  --warn-soft: #fbf0d6;
  --bad: #a12d2d;
  --bad-soft: #f8e4e4;
  --radius: 8px;
  --font: "Source Sans 3", "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", "Noto Serif Tamil", Georgia, "Times New Roman", serif;
  --font-ta: "Noto Sans Tamil", "Source Sans 3", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
main { flex: 1 0 auto; }
a { color: var(--navy); }
h1, h2, h3, h4 { line-height: 1.25; text-wrap: balance; margin: 0; }
h1 { font-family: var(--font-serif); font-size: 26px; font-weight: 500; color: var(--navy); }
h2 { font-family: var(--font-serif); font-size: 19px; font-weight: 500; color: var(--navy); }
h3 { font-size: 15.5px; font-weight: 600; color: var(--navy); }
p { margin: 0; }
small, .en { color: var(--muted); }
.en { display: block; font-size: 13px; margin-top: 4px; }
.num, .mono { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
}
.page { padding-block: 26px 48px; display: grid; gap: 20px; align-content: start; }

/* ---------- Header band (same as Nigandu and Suzhi) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  color: #fff;
  background: linear-gradient(100deg, #001a45 0%, #002663 55%, #0a3a8a 100%);
  box-shadow: 0 2px 10px rgba(0, 26, 69, 0.25);
  padding-top: env(safe-area-inset-top, 0px);
}
.site-header::before,
.site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M28 4 Q34 28 52 28 Q34 28 28 52 Q22 28 4 28 Q22 28 28 4 Z' fill='none' stroke='%23ffffff' stroke-opacity='0.35' stroke-width='1'/%3E%3Ccircle cx='28' cy='28' r='1.3' fill='%23feb001' fill-opacity='0.5'/%3E%3C/svg%3E");
}
.site-header::before { opacity: 0.18; }
.header-row { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding-block: 10px 6px; }
.brand { display: flex; align-items: center; line-height: 0; text-decoration: none; }
.brand img { height: 44px; width: auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.header-flame { margin-left: auto; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; width: 100%; justify-content: space-between; }
.nav-link {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  height: 44px; padding: 0 8px; border-radius: 8px; color: #fff; text-decoration: none;
  font-size: 14px; font-weight: 500; line-height: 1.15; white-space: nowrap;
}
.nav-link small { color: #b9c6dd; font-size: 11px; font-weight: 400; }
.nav-link:hover, .nav-link[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: #fff; }
.credit-pill {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: #fff;
  border: 1px solid rgba(254, 176, 1, 0.55); border-radius: 999px; padding: 4px 12px; background: rgba(254, 176, 1, 0.12);
}
.credit-pill .num { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.credit-pill .lbl { display: flex; flex-direction: column; font-size: 11px; line-height: 1.1; }
.credit-pill .lbl small { font-size: 10px; color: #b9c6dd; }
.credit-pill .free { font-size: 11px; color: var(--flame); font-weight: 600; }
@media (min-width: 900px) {
  .header-row { flex-wrap: nowrap; height: 76px; padding-block: 0; gap: 12px; }
  .brand img { height: 52px; }
  .header-flame { order: 3; margin-left: 4px; }
  .nav { width: auto; margin-left: auto; flex-wrap: nowrap; justify-content: flex-end; }
}

/* ---------- The living flame badge (same as Nigandu and Suzhi) ---------- */
.flame { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; flex: none; }
.flame .flame-svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25)); }
@media (min-width: 640px) { .flame { width: 54px; height: 54px; } }
.flame .badge { animation: badge-breathe 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.flame .halo { animation: halo-pulse 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.flame .flame-body { animation: flame-sway 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.flame .outer { animation: flame-outer 1.35s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.flame .mid { animation: flame-mid 0.95s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.flame .core { animation: flame-core 0.7s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.flame .blue { animation: flame-blue 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes flame-sway { 0%, 100% { transform: rotate(-2.2deg); } 35% { transform: rotate(1.6deg); } 65% { transform: rotate(2.4deg); } }
@keyframes flame-outer { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(0.97, 1.05); } 60% { transform: scale(1.03, 0.97); } 80% { transform: scale(0.99, 1.03); } }
@keyframes flame-mid { 0%, 100% { transform: scale(1, 1) translateY(0); opacity: 0.95; } 40% { transform: scale(0.94, 1.08) translateY(-1px); opacity: 1; } 75% { transform: scale(1.05, 0.96) translateY(1px); opacity: 0.9; } }
@keyframes flame-core { 0%, 100% { transform: scale(1, 1); opacity: 0.95; } 50% { transform: scale(0.9, 1.1); opacity: 1; } }
@keyframes flame-blue { 0%, 100% { transform: scale(1, 1); opacity: 0.8; } 50% { transform: scale(1.12, 0.9); opacity: 1; } }
@keyframes halo-pulse { 0%, 100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes badge-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.015); } }
.flame.flame-sm, .flame.flame-sm .flame-svg { width: 26px; height: 26px; }
.flame.flame-sm .flame-svg { filter: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Footer band ---------- */
.site-footer {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(100deg, #00163a 0%, #001a45 60%, #002663 100%);
  color: #c9d2e2;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.site-footer::before { opacity: 0.12; }
.site-footer .wrap { position: relative; }
.footer-grid { display: grid; gap: 28px; padding-block: 40px 30px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.footer-brand img { height: auto; width: 196px; }
.site-footer .tagline { font-family: var(--font-serif); font-style: italic; color: var(--flame); margin-top: 12px; }
.footer-muted { font-size: 13.5px; color: #b9c6dd; margin-top: 4px; }
.site-footer h4 { color: #fff; font-size: 14.5px; font-weight: 600; margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 15px; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { color: var(--flame); text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; border-top: 1px solid rgba(255, 255, 255, 0.15); padding-block: 18px; font-size: 13.5px; color: #b9c6dd; }
.footer-copy { display: inline-flex; align-items: center; gap: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }

/* ---------- Generic blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; display: grid; gap: 12px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.stat { background: var(--leaf); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12px; color: var(--muted); }
.stat.gold { background: var(--gold-soft); }

.flash-list { padding-top: 14px; display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius); background: var(--leaf); }
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.error-text { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: 6px; }
.note { background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 10px 14px; border-radius: 0 6px 6px 0; }

/* Forms */
label.field { display: grid; gap: 5px; font-weight: 600; color: var(--ink); }
label.field .hint { font-weight: 400; font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=number], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 11px; width: 100%; min-width: 0;
}
textarea { resize: none; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(0, 38, 99, .12); }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--navy); flex: none; }
.code-input { font-size: 26px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }

.btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 6px; padding: 10px 16px; cursor: pointer;
  background: var(--navy); color: #fff; text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; line-height: 1.2;
}
.btn:hover { background: var(--navy-deep); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-gold { background: var(--gold-bright); color: #1d1404; }
.btn-gold:hover { background: #d18f06; }
.btn-ghost { background: var(--leaf); color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { background: #ebe4d3; }
.btn-danger { background: var(--bad); }
.btn-small { padding: 6px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn .en { color: inherit; opacity: .8; display: inline; margin: 0; font-size: 12.5px; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 8px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child, table.data th.l { text-align: left; }
table.data td.wrap-cell { white-space: normal; text-align: left; }
table.data tr:last-child td { border-bottom: 0; }

.chip { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; background: var(--leaf); color: var(--navy); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.gold { background: var(--gold-soft); color: var(--warn); }

/* ---------- Landing ---------- */
.texture-kolam { position: relative; isolation: isolate; }
.texture-kolam::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("../brand/kolam.91d1461588fb.svg") center / 56px 56px; opacity: 0.09;
  -webkit-mask-image: radial-gradient(46% 80% at 78% 50%, #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
  mask-image: radial-gradient(46% 80% at 78% 50%, #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
}
/* Hero: same composition as oliyonresearch.com (and oliyon.in). Text on the left: Tamil name,
   tagline, heading, lead. The living flame burns in a 260px column on the right with the kolam
   drawn faintly around it. */
.hero { position: relative; isolation: isolate; overflow: hidden; padding: 72px 0 84px; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("../brand/kolam.91d1461588fb.svg") center / 56px 56px;
  opacity: 0.09;
  -webkit-mask-image: radial-gradient(46% 80% at 78% 50%, #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
          mask-image: radial-gradient(46% 80% at 78% 50%, #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
}
.texture-grain::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  grid-template-areas: "brand light" "copy light";
  column-gap: 56px;
  align-items: center;
}
.hero-brand { grid-area: brand; align-self: end; }
.hero-brand .name { font-family: "Noto Serif Tamil", var(--font-serif); font-size: 1.7rem; font-weight: 500; line-height: 1.3; color: var(--navy); margin: 0; }
.hero-brand .tagline { font-family: "Noto Serif Tamil", var(--font-serif); font-size: 0.95rem; font-weight: 500; color: var(--gold); margin: 6px 0 0; }
.hero-copy { grid-area: copy; align-self: start; }
.hero h1 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(1.75rem, 3.6vw, 2.55rem); line-height: 1.32; color: var(--navy); margin: 28px 0 20px; max-width: 22ch; }
.hero .lead { max-width: 62ch; font-size: 1.08rem; line-height: 1.8; color: var(--ink); margin: 0; }
.hero .lead .en { font-size: 15px; line-height: 1.6; margin-top: 8px; }
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; }
.hero .actions .btn { padding: 12px 20px; font-size: 16px; }

.hero-light { grid-area: light; position: relative; justify-self: center; width: min(100%, 11rem); }
.hero-light::before {
  content: ""; position: absolute; left: 50%; top: 58%; width: 260%; aspect-ratio: 1;
  translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 196, 92, 0.42), rgba(255, 196, 92, 0.16) 45%, rgba(255, 196, 92, 0.04) 72%, rgba(255, 196, 92, 0) 100%);
  animation: glow-breathe 3.9s ease-in-out infinite;
  pointer-events: none;
}
.living-flame { position: relative; z-index: 1; display: block; width: 100%; height: auto; overflow: visible; animation: flame-in 1.6s cubic-bezier(.22,.61,.36,1) both; }
.flame__body { transform-box: fill-box; transform-origin: 50% 100%; animation: flame-flicker 1.9s ease-in-out infinite; }
.flame__glow { animation: glow-flicker 1.3s ease-in-out infinite alternate; }
.flame__hot { animation: hot-flicker 2.3s ease-in-out infinite; }

@keyframes flame-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes flame-flicker {
  0%   { transform: scale(1, 1); }
  14%  { transform: scale(1.006, 0.991); }
  31%  { transform: scale(0.995, 1.012); }
  47%  { transform: scale(1.004, 0.996); }
  66%  { transform: scale(0.996, 1.01); }
  83%  { transform: scale(1.003, 0.997); }
  100% { transform: scale(1, 1); }
}
@keyframes glow-flicker { 0% { opacity: 0.58; } 30% { opacity: 0.74; } 55% { opacity: 0.62; } 80% { opacity: 0.72; } 100% { opacity: 0.66; } }
@keyframes hot-flicker { 0%, 100% { opacity: 0.72; } 40% { opacity: 0.86; } 70% { opacity: 0.66; } }
@keyframes glow-breathe {
  0%   { opacity: 0.86; scale: 0.985; }
  22%  { opacity: 1;    scale: 1.02; }
  40%  { opacity: 0.9;  scale: 0.995; }
  63%  { opacity: 1;    scale: 1.03; }
  81%  { opacity: 0.88; scale: 1; }
  100% { opacity: 0.86; scale: 0.985; }
}

@media (max-width: 760px) {
  .hero { padding: 40px 0 52px; }
  .hero::before {
    -webkit-mask-image: radial-gradient(60% 40% at 80% 14%, #000 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
            mask-image: radial-gradient(60% 40% at 80% 14%, #000 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
  }
  /* One composition on a phone: the flame stands beside the Tamil name,
     the heading and lead run the full width underneath. */
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr) 4.25rem;
    grid-template-areas: "brand light" "copy copy";
    column-gap: 20px; row-gap: 0;
    align-items: center;
  }
  .hero-brand { align-self: center; }
  .hero-brand .name { font-size: 1.5rem; }
  .hero-brand .tagline { font-size: 0.85rem; }
  .hero-light { width: 100%; align-self: center; }
  .hero-light::before { width: 320%; }
  .hero h1 { font-size: 1.55rem; margin-top: 28px; max-width: none; }
  .hero .lead { font-size: 1rem; }
}

/* Below the hero */
.landing-body { padding-top: 8px; gap: 56px; }
.demo-row { display: grid; gap: 28px; align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .demo-row { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 48px; } }
.demo-text { margin-top: 14px; font-size: 16px; line-height: 1.75; color: var(--ink-2); max-width: 58ch; }
.free-line { display: inline-flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 600; margin-top: 16px; }
.demo { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; padding: 18px; box-shadow: 0 10px 30px rgba(0, 26, 69, 0.08); }
.demo .bubble { max-width: 100%; }
.demo-cap { font-size: 12.5px; color: var(--muted); text-align: center; }
.section-title { font-family: var(--font-serif); font-size: 26px; font-weight: 500; color: var(--navy); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 18px; }
.step { display: flex; gap: 12px; }
.step b { font-family: var(--font-serif); font-size: 32px; line-height: 1; color: var(--gold); font-weight: 400; }
.step p { color: var(--ink-2); margin-top: 4px; }
.lang-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-cloud span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; }

/* ---------- Chat list ---------- */
.chat-list { display: grid; gap: 8px; }
.chat-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); text-decoration: none; color: inherit; min-width: 0; }
.chat-item:hover { border-color: var(--navy); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.chat-item .body { flex: 1; min-width: 0; }
.chat-item .title { font-weight: 600; color: var(--navy); }
.chat-item .last { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .meta { text-align: right; font-size: 12.5px; color: var(--muted); flex: none; }

/* Model picker */
.models { display: grid; gap: 8px; }
.model-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; background: var(--surface); }
.model-opt:has(input:checked) { border-color: var(--navy); background: var(--mine); }
.model-opt input { margin-top: 4px; accent-color: var(--navy); }
.model-opt .mname { font-weight: 600; color: var(--navy); }
.model-opt .cost { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.model-opt .cost b { color: var(--ink); font-size: 15px; }
.model-opt.locked { opacity: .65; }

/* ---------- Chat room ---------- */
body.room-body { height: 100%; }
body.room-body main.room { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.room-shell { display: flex; flex-direction: column; height: 100dvh; max-width: 880px; width: 100%; margin: 0 auto; background: var(--surface); border-left: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); }
.room-head {
  position: relative;
  display: flex; align-items: center; gap: 10px; color: #fff;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px));
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: linear-gradient(100deg, #001a45 0%, #002663 55%, #0a3a8a 100%);
}
.room-head .back { text-decoration: none; color: #fff; font-size: 24px; padding: 2px 6px; line-height: 1; }
.room-head .info { flex: 1; min-width: 0; }
.room-head .title { font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-head .people { font-size: 12.5px; color: #b9c6dd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-head select { background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.room-head select option { color: var(--ink); }
.icon-btn { border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.1); color: #fff; border-radius: 6px; padding: 6px 10px; cursor: pointer; font: inherit; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.18); }

.drawer { border-bottom: 1px solid var(--line-soft); background: var(--paper); padding: 14px max(14px, env(safe-area-inset-right, 0px)) 14px max(14px, env(safe-area-inset-left, 0px)); display: grid; gap: 14px; max-height: 60dvh; overflow-y: auto; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-row input { flex: 1 1 220px; font-size: 13.5px; }
.people-list { display: grid; gap: 6px; }
.person { display: flex; align-items: center; gap: 8px; }
.person .who { flex: 1; min-width: 0; }

.messages { flex: 1 1 auto; overflow-y: auto; padding: 14px max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.empty { margin: auto; color: var(--muted); text-align: center; padding: 30px 10px; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; padding: 1px 10px; }
.bubble { max-width: min(78%, 560px); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 14px 14px 14px 4px; padding: 8px 12px; display: grid; gap: 4px; align-self: flex-start; min-width: 0; }
.bubble.mine { align-self: flex-end; background: var(--mine); border-color: #d3dcef; border-radius: 14px 14px 4px 14px; }
.bubble .who { font-size: 12.5px; font-weight: 600; color: var(--navy); }
.bubble .who .lang { font-weight: 400; color: var(--muted); }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.bubble .orig { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 4px; }
.bubble .foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.bubble .foot button { font: inherit; font-size: 12px; background: none; border: 0; padding: 0; color: var(--navy); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(201, 150, 46, 0.7); text-underline-offset: 3px; }
.bubble .cost { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bubble .cost b { color: var(--warn); }
.bubble .sent-as { display: grid; gap: 4px; font-size: 13.5px; }
.bubble .sent-as div { background: rgba(255,255,255,.65); border-radius: 6px; padding: 4px 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .sent-as span { font-size: 11.5px; color: var(--muted); display: block; }
.bubble.pending .text { opacity: .8; }
.status { font-size: 12px; }
.status.failed { color: var(--bad); }
.status.pending { color: var(--warn); }

.composer { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line-soft); background: var(--surface); padding: 10px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
.composer textarea { flex: 1; max-height: 140px; min-height: 44px; font-size: 16px; }
.composer .btn { min-height: 44px; }
.composer-note { padding: 6px 14px; font-size: 13px; color: var(--bad); background: var(--bad-soft); }
.composer-note a { color: inherit; font-weight: 600; }

/* Join page */
.join-card { max-width: 460px; margin: 0 auto; width: 100%; }
.join-card .chat-name { color: var(--muted); }
.join-brand { display: flex; justify-content: center; }
.join-brand img { width: 200px; height: auto; }

/* Usage bars */
.bars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; align-items: end; height: 110px; padding-top: 6px; }
.bars .bar { background: var(--navy); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .bar.zero { background: var(--line); }
.bars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }

/* Packs */
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pack { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; background: var(--surface); }
.pack .price { font-size: 26px; font-weight: 700; color: var(--navy); }
.pack .credits { font-weight: 600; }
.pack .approx { font-size: 12.5px; color: var(--muted); }

/* Legal pages */
.prose { max-width: 72ch; display: grid; gap: 12px; }
.prose h2 { margin-top: 8px; }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

@media (max-width: 640px) {
  .nav-link { padding: 0 5px; font-size: 13px; }
  .nav-link small { display: none; }
  .bubble { max-width: 88%; }
  .room-shell { border: 0; }
  .credit-pill .lbl small { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .bubble.new { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(4px); opacity: .4; } to { transform: none; opacity: 1; } }
}

/* Landing rhythm and room-band extras */
.flame.flame-room { width: 34px; height: 34px; }
.flame.flame-room .flame-svg { width: 34px; height: 34px; }
.room-head::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M28 4 Q34 28 52 28 Q34 28 28 52 Q22 28 4 28 Q22 28 28 4 Z' fill='none' stroke='%23ffffff' stroke-opacity='0.35' stroke-width='1'/%3E%3Ccircle cx='28' cy='28' r='1.3' fill='%23feb001' fill-opacity='0.5'/%3E%3C/svg%3E"); }
.room-head > * { position: relative; }
.lang-select { width: auto; max-width: 140px; padding: 6px 8px; font-size: 13px; }

/* Thanglish switch in the composer (Tamil writers only) */
.th-toggle {
  flex: none; min-width: 44px; height: 44px; border-radius: 6px; cursor: pointer;
  font: 600 18px/1 "Noto Sans Tamil", var(--font); color: var(--navy);
  background: var(--gold-soft); border: 1px solid var(--gold);
}
.th-toggle.off { background: var(--leaf); border-color: var(--line); color: var(--muted); font-family: var(--font); }
.th-row { display: flex; gap: 8px; align-items: stretch; font-weight: 400; }
.th-row input { flex: 1; min-width: 0; }
.th-row .th-toggle { height: auto; min-height: 42px; }

