/* Akuru design tokens: white-dominant, deep navy type, purple + electric blue accents. */
:root {
  --font-ui: 'Poppins', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-si: 'Noto Sans Sinhala', 'Iskoola Pota', 'Nirmala UI', 'Sinhala Sangam MN', sans-serif;
  --font-ta: 'Noto Sans Tamil', 'Latha', 'Nirmala UI', 'Tamil Sangam MN', sans-serif;
  --font-ar: 'Noto Naskh Arabic', 'Noto Sans Arabic', 'Segoe UI', 'Traditional Arabic', 'Arial', 'Geeza Pro', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace;

  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --border: #e3e6ef;
  --border-strong: #cfd4e2;
  --text: #16193b;
  --text-2: #5b6283;
  --text-3: #8a90ab;
  --purple: #6d35d6;
  --purple-600: #5b26c2;
  --purple-50: #efe9fd;
  --purple-100: #e3d8fb;
  --blue: #2563eb;
  --blue-600: #1d4fd6;
  --blue-50: #e8effe;
  --green: #16a34a;
  --amber: #b45309;
  --amber-50: #fff7e6;
  --red: #dc2626;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(22, 25, 59, 0.06), 0 2px 8px rgba(22, 25, 59, 0.04);
  --focus: 0 0 0 3px rgba(109, 53, 214, 0.25);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0d0f1e;
  --surface: #151833;
  --surface-2: #1b1f3f;
  --border: #272c55;
  --border-strong: #363c6c;
  --text: #eceefb;
  --text-2: #a9aed0;
  --text-3: #7b81a6;
  --purple: #9b6dff;
  --purple-600: #8a59f5;
  --purple-50: #241c4a;
  --purple-100: #2f2560;
  --blue: #5b8cff;
  --blue-600: #4a7af0;
  --blue-50: #1b2550;
  --amber-50: #2a2112;
  --amber: #f2b45a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }

.lang-si { font-family: var(--font-si); }
.lang-ta { font-family: var(--font-ta); }
.lang-ar { font-family: var(--font-ar); }
textarea.lang-ar, .unicode-out.lang-ar { font-size: 1.25em; line-height: 1.8; }
.mono { font-family: var(--font-mono); }

.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--purple) 0%, var(--purple-600) 100%); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--purple-600); }
.btn-blue { background: linear-gradient(180deg, var(--blue) 0%, var(--blue-600) 100%); border-color: transparent; color: #fff; }
.btn-blue:hover { background: var(--blue-600); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-danger { color: var(--red); }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--purple); }
.icon-btn.active { color: var(--purple); background: var(--purple-50); }

.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; font-weight: 600; font-size: 12.5px; }
.field-label .hint { font-weight: 400; color: var(--text-3); }

textarea.input, input.input, select.input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 10px 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { resize: vertical; line-height: 1.55; }
textarea.input:focus, input.input:focus, select.input:focus { border-color: var(--purple); box-shadow: var(--focus); outline: none; }
select.input { padding: 6px 28px 6px 10px; height: 34px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6283' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }

.switch { position: relative; display: inline-flex; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background 0.15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--purple); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }

.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 600; background: var(--purple-50); color: var(--purple); }
.badge.warn { background: var(--amber-50); color: var(--amber); }
.badge.muted { background: var(--surface-2); color: var(--text-3); }

.warnings { margin: 6px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--amber-50); color: var(--amber); font-size: 12px; line-height: 1.45; }
.warnings:empty { display: none; }
.warnings p { margin: 0; }
.warnings p + p { margin-top: 3px; }

/* "You fixed … → …  [Save to my words]" and "This looks like FM text [Use it]" bars. */
.fix-bar, .detect-note {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 0; padding: 6px 8px 6px 10px;
  border-radius: var(--radius-sm); background: var(--purple-50); color: var(--text); font-size: 12.5px; line-height: 1.4;
}
.fix-bar[hidden], .detect-note[hidden] { display: none; }
.fix-bar .fix-text, .detect-note .detect-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.fix-bar .icon-btn { width: 26px; height: 26px; font-size: 16px; }
.sugg-for { align-self: center; white-space: nowrap; }

.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 12px); opacity: 0;
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  background: var(--text); color: var(--surface); font-weight: 600; font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(22,25,59,.25); transition: opacity .18s, transform .18s; pointer-events: none; z-index: 1000;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .icon { stroke: #4ade80; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.muted { color: var(--text-3); }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }
[hidden] { display: none !important; }
