/* indic-tiny-tts page */

:root {
  --bg: #f7f4ee;
  --bg-2: #f1ece3;
  --card: #fffdf9;
  --card-2: #faf6ef;
  --line: #e9e2d6;
  --line-2: #ddd4c5;
  --text: #221d18;
  --text-2: #5e554b;
  --muted: #8f8579;
  --accent: #3b3486;
  --accent-ink: #ffffff;
  --accent-soft: #eceaf8;
  --accent-line: #c9c4ee;
  --wave-rest: #d9d1c4;
  --ok: #23845a;
  --warn: #b8730f;
  --bad: #b8433a;
  --bad-soft: #fbecea;
  --shadow: 0 1px 2px rgba(60, 45, 20, .05), 0 6px 24px -12px rgba(60, 45, 20, .18);
  --radius: 14px;
  --radius-s: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans",
    "Noto Sans Devanagari", "Noto Sans Bengali", "Noto Sans Tamil", "Noto Sans Telugu", "Noto Sans Gujarati",
    "Noto Sans Kannada", "Noto Sans Malayalam", "Noto Sans Gurmukhi", "Noto Sans Oriya", "Nirmala UI",
    "Kohinoor Devanagari", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.page { max-width: 1100px; margin: 0 auto; padding: 20px 20px 36px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px 18px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 36px; height: 36px; flex: none; }
.logo rect { fill: var(--accent); stroke: none; }
.logo path { stroke: var(--accent-ink); stroke-width: 2.4; }
.wordmark { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.tagline { color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill[data-level="idle"] .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.pill[data-level="busy"] .dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.pill[data-level="full"] .dot { background: var(--bad); }
.pill[data-level="starting"] .dot { animation: pulse 1.2s ease-in-out infinite; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { border-color: var(--line-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.small { width: 26px; height: 26px; border: 0; background: transparent; font-size: 18px; line-height: 1; }

.banner {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 10px 12px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); border-radius: var(--radius-s);
  background: var(--bad-soft); color: var(--text); font-size: 14px;
}
.banner > svg { width: 18px; height: 18px; color: var(--bad); flex: none; }
.banner span { flex: 1; }

.grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head.sub { margin-top: 20px; }
.label {
  margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2);
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.lang-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 70px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card-2); cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
.tile:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.tile:active { transform: scale(.97); }
.tile .glyph { font-size: 22px; line-height: 1.15; font-weight: 600; }
.tile .native { font-size: 11.5px; color: var(--text-2); line-height: 1.3; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.tile[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 16px -8px var(--accent); }
.tile[aria-pressed="true"] .native { color: var(--accent-ink); opacity: .85; }

.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voice-wrap { position: relative; }
.voice-wrap .preview { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); cursor: pointer; }
.voice {
  width: 100%; padding-right: 46px !important;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card-2); cursor: pointer; text-align: left;
}
.voice:hover { border-color: var(--accent-line); }
.voice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent); }
.voice .avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; flex: none;
  border: 1px solid var(--accent-line); }
.voice[aria-pressed="true"] .avatar { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.voice .vname { flex: 1; font-weight: 600; font-size: 14px; line-height: 1.2; }
.voice .vsub { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.preview {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--card); color: var(--text-2); flex: none;
}
.preview svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.preview { cursor: pointer; }
.preview:hover { color: var(--accent); border-color: var(--accent-line); }

.textbox { border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); transition: border-color .15s, box-shadow .15s; }
.textbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textbox textarea {
  display: block; width: 100%; min-height: 128px; resize: vertical; padding: 12px 14px 4px;
  border: 0; background: transparent; outline: none; font-size: 16px; line-height: 1.65;
}
.textbox-foot { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px 8px 14px; font-size: 12px; }
.textbox-foot .over { color: var(--bad); font-weight: 600; }
.link { border: 0; background: none; padding: 2px 4px; color: var(--muted); cursor: pointer; font-size: 12px; }
.link:hover { color: var(--text); }

.chips-head { margin: 14px 0 8px; font-size: 10.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  max-width: 100%; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip:hover { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }
.chip .v { margin-left: 6px; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 24px; align-items: start; margin-top: 18px; }
.slider-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.slider-top output { font-variant-numeric: tabular-nums; color: var(--accent); }
.slider-ends { display: flex; justify-content: space-between; font-size: 11.5px; margin-top: -2px; }
input[type="range"] { width: 100%; margin: 8px 0; accent-color: var(--accent); height: 20px; }
.advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 1px 0; list-style-position: inside; }
.adv-body { display: grid; gap: 4px; margin-top: 8px; max-width: 220px; font-size: 13px; }
.adv-body input {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card-2);
  font-variant-numeric: tabular-nums;
}

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { height: 44px; padding: 0 22px; border-color: var(--accent); background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 20px -10px var(--accent); font-size: 15px; }
.btn.primary svg { fill: currentColor; stroke: none; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { opacity: .55; cursor: progress; }
.btn.ghost { height: 44px; background: transparent; }
.btn.ghost svg { fill: currentColor; stroke: none; width: 14px; }
.btn.small { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.small svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.busy { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-line);
  border-top-color: var(--accent); animation: spin .8s linear infinite; }
.kbd-hint { margin-left: auto; font-size: 12px; }
.load-note { margin: 8px 0 0; font-size: 12px; line-height: 1.4; }
kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px;
  background: var(--card-2); font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); }

.result { margin-top: 16px; }
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.badge { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: 16px; flex: none; }
.result-title { flex: 1; min-width: 0; }
.result-title h2 { margin: 0; font-size: 15px; font-weight: 700; }
.state-tag { font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.state-tag[data-s="playing"] { color: var(--bad); }
.state-tag[data-s="playing"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: pulse 1.2s ease-in-out infinite; }
.state-tag[data-s="working"] { color: var(--accent); }
.wave-wrap { position: relative; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); padding: 6px 8px; }
.wave { display: block; width: 100%; height: 84px; cursor: pointer; }
.result[data-working="1"] .wave { cursor: progress; }
.player-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.round-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; flex: none; }
.round-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.round-btn .i-pause { display: none; }
.round-btn[data-playing="1"] .i-play { display: none; }
.round-btn[data-playing="1"] .i-pause { display: block; }
.round-btn:disabled { opacity: .5; }
.time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-2); min-width: 86px; }
.spacer { flex: 1; }
.result-text { margin: 14px 0 6px; font-size: 15.5px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-variant-numeric: tabular-nums; }
.meta b { color: var(--text-2); font-weight: 600; }

.feedback { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.fb-q { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-right: 2px; }
.fb[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.fb-comment { display: flex; flex: 1; gap: 8px; min-width: 220px; }
.fb-comment input { flex: 1; min-width: 0; height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card-2); font-size: 13.5px; }
.fb-comment input:focus { outline: none; border-color: var(--accent); }
.fb-thanks { font-size: 13.5px; color: var(--ok); font-weight: 600; }

.recent { margin-top: 22px; }
.recent ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.recent li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card);
}
.recent .badge { width: 28px; height: 28px; font-size: 13px; }
.recent .r-body { flex: 1; min-width: 0; }
.recent .r-text { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .r-sub { font-size: 11.5px; color: var(--muted); }
.recent .preview { width: 30px; height: 30px; }
.recent .dl { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--text-2); }
.recent .dl svg { width: 16px; height: 16px; }
.recent .dl:hover { color: var(--accent); }

.footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.footer p { margin: 3px 0; }
.footer .notice { color: var(--text-2); }
.footer .links a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.footer .links a:hover { color: var(--accent); border-color: var(--accent); }
#model-links { display: inline; }
#model-links a { margin-right: 8px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 860px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .lang-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 560px) {
  .page { padding: 12px 12px 28px; }
  .topbar { padding-bottom: 12px; }
  .tagline { font-size: 12px; }
  .wordmark { font-size: 16px; }
  .pill { padding: 0 10px; }
  .card { padding: 14px; border-radius: 12px; }
  .lang-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .tile { min-height: 62px; }
  .controls { grid-template-columns: minmax(0, 1fr); }
  .kbd-hint { display: none; }
  .actions .btn.primary { flex: 1; justify-content: center; }
  .player-row .spacer { flex-basis: 100%; height: 0; }
  .player-row .btn.small { flex: 1; justify-content: center; padding: 0 6px; }
  .fb-comment { min-width: 100%; }
}

.footer .links > .muted { margin-right: 6px; }
.recent ul { grid-template-columns: minmax(0, 1fr); }
#model-links a { display: inline-block; }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.load-bar { height: 3px; margin: -10px 2px 14px; border-radius: 3px; background: var(--line); overflow: hidden; }
.load-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.meta .where { color: var(--text-2); }
.meta .diag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
