:root {
  --blue: #1b4f9c;
  --blue-dark: #123a75;
  --blue-50: #eef4fc;
  --blue-100: #dbe7f8;
  --orange: #f28a1e;
  --orange-dark: #d9740b;
  --orange-50: #fff4e8;
  --ink: #0f1d33;
  --muted: #5d6b82;
  --line: #e3e9f2;
  --bg: #ffffff;
  --bg-soft: #f6f9fd;
  --green: #12a150;
  --red: #d93636;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(18, 58, 117, .08), 0 2px 6px rgba(18, 58, 117, .05);
  --font: "Inter", "Noto Sans Devanagari", "Noto Sans Kannada", "Noto Sans Telugu", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand img { height: 48px; width: auto; }
.nav { display: flex; align-items: center; gap: 26px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px; }
.nav a:hover { color: var(--blue); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue-50); color: var(--blue);
  border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: 14px;
}
.btn-ghost:hover { background: var(--blue-100); }
.nav a.logout { color: var(--muted); background: var(--bg-soft); font-weight: 600; font-size: 14px; display: inline-flex; }
.nav a.logout:hover { color: var(--red); }

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 40px;
  background:
    radial-gradient(900px 300px at 15% -10%, rgba(242, 138, 30, .10), transparent 60%),
    radial-gradient(900px 340px at 90% 0%, rgba(27, 79, 156, .12), transparent 60%),
    var(--bg-soft);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.hero h1 { font-size: clamp(28px, 4.4vw, 46px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em; color: var(--blue-dark); font-weight: 800; }
.hero .accent { color: var(--orange); }
.hero .sub { color: var(--muted); font-size: clamp(15px, 1.8vw, 18px); max-width: 700px; margin: 0 auto 26px; }

.platforms { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 18px; }
.pf {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: .15s;
}
.pf svg { width: 18px; height: 18px; }
.pf:hover { border-color: var(--blue-100); }
.pf.active { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); color: var(--blue); }
.dot.all { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--orange)); }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  max-width: 820px; margin: 0 auto;
  background: #fff; border: 2px solid var(--blue-100); border-radius: 16px;
  padding: 8px; box-shadow: var(--shadow);
  transition: border-color .15s;
}
.searchbox:focus-within { border-color: var(--blue); }
.search-icon { color: var(--blue); padding-left: 8px; display: flex; }
.searchbox input {
  flex: 1; min-width: 0; border: 0; outline: 0; font-size: 16px; font-family: inherit; padding: 12px 6px; color: var(--ink); background: transparent;
}
.btn-paste {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--blue);
  font-weight: 600; padding: 12px 14px; border-radius: 10px; font-size: 14px;
}
.btn-paste:hover { background: var(--blue-50); }
.btn-primary {
  position: relative;
  border: 0; background: var(--orange); color: #fff;
  font-weight: 700; font-size: 16px; padding: 14px 24px; border-radius: 12px;
  box-shadow: 0 6px 16px rgba(242, 138, 30, .35);
  transition: background .15s, transform .05s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--orange-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary.sm { padding: 10px 18px; font-size: 14px; }
.btn-primary .spinner { display: none; }
.btn-primary.loading .lbl { visibility: hidden; }
.btn-primary.loading .spinner {
  display: block; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px;
  border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint { color: var(--muted); font-size: 13px; margin-top: 14px; }
.nav a.nav-poster { color: var(--orange-dark); font-weight: 700; }
.poster-cta {
  display: inline-flex; gap: 6px; align-items: center; margin-top: 18px; padding: 10px 18px; border-radius: 999px;
  background: #fff; border: 1px solid var(--orange); color: var(--ink); text-decoration: none; font-size: 14px;
  box-shadow: 0 4px 14px rgba(242, 138, 30, .15);
}
.poster-cta b { color: var(--orange-dark); }
.poster-cta:hover { background: var(--orange-50); }
kbd { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 12px; font-family: inherit; }
.alert {
  max-width: 820px; margin: 16px auto 0; text-align: left;
  background: #fff1f1; color: #9b1c1c; border: 1px solid #f6caca;
  padding: 12px 16px; border-radius: 12px; font-size: 14px;
}

/* ---------- Results ---------- */
#results { margin-top: 32px; }
.result {
  display: grid; grid-template-columns: 340px 1fr; gap: 28px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 24px;
  animation: rise .25s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.media-col { min-width: 0; }
.thumb {
  position: relative; border-radius: 12px; overflow: hidden; background: #0f1d33;
  aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center;
}
.thumb.portrait { aspect-ratio: 9 / 12; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge-pf {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .95); color: var(--ink); font-size: 12px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px;
}
.thumb .badge-pf svg { width: 14px; height: 14px; }
.thumb .dur {
  position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .75); color: #fff;
  font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
}
.media-title { font-size: 17px; font-weight: 700; margin: 14px 0 4px; line-height: 1.35; word-break: break-word; }
.media-meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.btn-best {
  margin-top: 14px; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-best svg { width: 18px; height: 18px; flex: none; }
.btn-best.done { background: var(--green); box-shadow: none; }
.btn-best.busy { background: var(--orange-dark); cursor: progress; }
.btn-best.err { background: var(--red); }
.btn-primary svg, .tab svg, .dl-btn svg { flex: none; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 10px 14px; font-weight: 600; font-size: 15px; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--orange); }
.pane[hidden] { display: none; }

.opt-table { width: 100%; border-collapse: collapse; }
.opt-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; }
.opt-table td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; font-size: 15px; }
.opt-table tr:hover td { background: var(--bg-soft); }
.q { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q small { font-weight: 500; color: var(--muted); font-size: 12px; }
.tag {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; letter-spacing: .02em;
  background: var(--blue-50); color: var(--blue);
}
.tag.hot { background: var(--orange-50); color: var(--orange-dark); }
.tag.grey { background: #f0f2f5; color: #55617a; }
.size { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-btn { width: 190px; text-align: right; }

.dl-btn {
  position: relative; overflow: hidden;
  width: 170px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; background: var(--blue); color: #fff; font-weight: 700; font-size: 14px;
  transition: background .15s;
}
.dl-btn:hover { background: var(--blue-dark); }
.dl-btn svg { width: 16px; height: 16px; position: relative; }
.dl-btn span { position: relative; }
.dl-btn .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--orange); transition: width .4s; }
.dl-btn.busy { background: var(--blue-dark); cursor: progress; }
.dl-btn.done { background: var(--green); }
.dl-btn.err { background: var(--red); }

.section-label { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--blue-dark); margin: 6px 0 4px; font-size: 14px; }

/* thumbnail pane */
.thumb-pane { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.thumb-pane img { max-width: 320px; border-radius: 12px; border: 1px solid var(--line); }

/* transcribe pane */
.tr-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field select, .field textarea {
  font-family: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; outline: none;
}
.field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }
.tr-note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.progress { margin-top: 16px; }
.progress .track { height: 10px; background: var(--blue-50); border-radius: 999px; overflow: hidden; }
.progress .fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--orange)); transition: width .4s; }
.progress .ptext { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }
.transcript {
  margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.tr-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.tr-toolbar .meta { font-size: 12px; color: var(--muted); }
.tr-toolbar .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-toggle { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.tr-body { max-height: 420px; overflow: auto; padding: 14px 16px; font-size: 16px; line-height: 1.8; white-space: pre-wrap; }
.tr-body .seg { display: flex; gap: 12px; }
.tr-body .seg time { color: var(--blue); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 5px; min-width: 62px; font-weight: 600; }

.btn-outline {
  border: 1px solid var(--line); background: #fff; color: var(--blue);
  font-weight: 600; font-size: 13px; padding: 8px 12px; border-radius: 9px;
}
.btn-outline:hover { border-color: var(--blue); }
.btn-outline.danger { color: var(--red); }
.btn-link { background: none; border: 0; color: var(--blue); font-weight: 600; font-size: 13px; }

/* carousel items */
.carousel-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.carousel-head h3 { margin: 0; font-size: 18px; color: var(--blue-dark); }

/* ---------- Queue ---------- */
.queue-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 22px; box-shadow: var(--shadow); margin-bottom: 30px; }
.queue-head { display: flex; justify-content: space-between; align-items: center; }
.queue-head h3 { margin: 0; color: var(--blue-dark); font-size: 17px; }
#queue { list-style: none; margin: 10px 0 0; padding: 0; }
#queue li { display: grid; grid-template-columns: 1fr 200px 110px; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
#queue li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#queue li .name small { display: block; color: var(--muted); font-weight: 500; }
#queue li .mini { height: 6px; background: var(--blue-50); border-radius: 99px; overflow: hidden; }
#queue li .mini div { height: 100%; background: var(--orange); width: 0; transition: width .4s; }
#queue li .st { font-size: 12px; color: var(--muted); text-align: right; }
#queue li .st a { color: var(--green); font-weight: 700; text-decoration: none; }
#queue li .st.err { color: var(--red); }

/* ---------- Features / how / faq ---------- */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 44px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature h4 { margin: 12px 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.ficon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.ficon svg { width: 22px; height: 22px; }
.ficon.blue { background: var(--blue-50); color: var(--blue); }
.ficon.orange { background: var(--orange-50); color: var(--orange); }

.how, .faq { margin-top: 60px; }
.how h2, .faq h2 { text-align: center; color: var(--blue-dark); font-size: 28px; margin: 0 0 24px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.steps li { display: flex; gap: 14px; background: var(--bg-soft); border-radius: var(--radius); padding: 20px; }
.steps .num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.steps p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.faq details { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 0 auto 10px; max-width: 820px; background: #fff; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { color: var(--muted); margin: 10px 0 0; font-size: 15px; }

.footer { margin-top: 70px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.footer-inner { display: flex; align-items: center; gap: 18px; padding: 22px 20px; }
.footer img { height: 36px; width: auto; }
.footer p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- Modal & toast ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100% - 32px)); box-shadow: 0 30px 80px rgba(15, 29, 51, .25); }
dialog::backdrop { background: rgba(15, 29, 51, .45); }
.modal { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; color: var(--blue-dark); }
.x { border: 0; background: var(--bg-soft); width: 32px; height: 32px; border-radius: 8px; font-size: 20px; line-height: 1; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
#cookieStatus { font-style: normal; font-weight: 600; }
#cookieStatus.on { color: var(--green); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 50; max-width: calc(100% - 32px);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .result { grid-template-columns: 1fr; }
  .thumb.portrait { aspect-ratio: 16 / 12; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .tr-form { grid-template-columns: 1fr 1fr; }
  .tr-form .btn-primary { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .nav a:not(.logout) { display: none; }
  .nav { gap: 8px; }
  .btn-ghost span { display: none; }
  .brand img { height: 40px; }
  .hero { padding: 36px 0 30px; }
  .searchbox { flex-wrap: wrap; padding: 8px; }
  .searchbox input { flex-basis: calc(100% - 40px); }
  .btn-paste { flex: 1; }
  .btn-primary { flex: 2; }
  .opt-table th:nth-child(2), .opt-table td:nth-child(2) { display: none; }
  .td-btn { width: auto; }
  .dl-btn { width: 132px; }
  .features { grid-template-columns: 1fr; }
  .tr-form { grid-template-columns: 1fr; }
  #queue li { grid-template-columns: 1fr; gap: 6px; }
  #queue li .st { text-align: left; }
  .footer-inner { flex-direction: column; text-align: center; }
}
