:root {
  --bg: #0a0e07;
  --bg-2: #0f150b;
  --card: rgba(18, 24, 14, 0.78);
  --border: rgba(118, 185, 0, 0.16);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #e8f0e0;
  --muted: #8b9680;
  --nv: #76b900;            /* NVIDIA green */
  --nv-bright: #a4e80a;
  --nv-grad: linear-gradient(135deg, #76b900 0%, #b6ff3d 100%);
  --danger: #ff5b5b;
  --ok: #76b900;
  --radius: 16px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.85);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(118,185,0,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(118,185,0,0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
}
.glow {
  position: fixed; top: -260px; left: 50%; transform: translateX(-50%);
  width: 900px; height: 520px; z-index: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(118,185,0,0.22) 0%, transparent 65%);
  filter: blur(40px);
}

/* topbar */
.topbar {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(18px, 5vw, 56px) 10px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 50px; height: 50px; display: grid; place-items: center;
  border-radius: 13px; background: var(--nv-grad);
  box-shadow: 0 10px 30px -8px rgba(118,185,0,0.6);
}
.brand-mark span { font-weight: 900; font-size: 18px; color: #0a0e07; letter-spacing: -0.5px; }
.brand-text h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.4px; }
.brand-text h1 em {
  font-style: normal; background: var(--nv-grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand-text p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.status {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  background: var(--card); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 999px; backdrop-filter: blur(10px); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--nv); box-shadow: 0 0 10px var(--nv); animation: pulse 2.2s infinite; }
.dot.loading { background: #e0b500; animation: pulse 1s infinite; }
.dot.err { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* spec ribbon — above the cards so the model dropdown isn't clipped by them */
.spec-ribbon {
  position: relative; z-index: 50;
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 6px clamp(18px, 5vw, 56px) 4px;
  max-width: 920px; margin: 0 auto; width: 100%;
}
.spec {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: 11px; padding: 8px 14px; backdrop-filter: blur(8px);
}
.spec b { font-size: 13px; font-weight: 700; color: var(--text); }
.spec i { font-size: 10.5px; font-style: normal; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
.spec.speed { border-color: var(--border); }
.spec.speed b { color: var(--nv-bright); }

/* model selector dropdown (first chip) */
.model-select { position: relative; padding: 0; border-color: var(--border); z-index: 300; }
.lang-wrap { display: flex; flex-direction: column; gap: 1px; padding: 6px 12px; }
.lang-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
.lang-select { background: transparent; color: var(--nv-bright); border: none; font-size: 13px; font-weight: 700; cursor: pointer; outline: none; padding: 0; }
.lang-select option { background: #141a0d; color: var(--text); }
.model-btn {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  background: transparent; border: none; cursor: pointer; padding: 8px 14px; border-radius: 11px; width: 100%;
}
.model-btn:hover { background: rgba(118,185,0,0.10); }
.model-btn b { font-size: 13px; font-weight: 700; color: var(--nv-bright); }
.model-btn i { font-size: 10.5px; font-style: normal; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
.model-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 100; min-width: 230px;
  background: #141a0d; border: 1px solid var(--border); border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
  max-height: 70vh; overflow-y: auto;
}
.model-item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: transparent; border: none; color: var(--text); cursor: pointer;
  padding: 9px 11px; border-radius: 9px; font-size: 13px;
}
.model-item:hover { background: rgba(118,185,0,0.12); }
.model-item.active { background: rgba(118,185,0,0.18); }
.model-item .mi-main { display: flex; flex-direction: column; flex: 1; }
.model-item .mi-name { font-weight: 700; }
.model-item .mi-sub { font-size: 11px; color: var(--muted); }
.model-item .mi-state { font-size: 11px; font-weight: 700; }
.mi-state.loaded { color: var(--nv-bright); }
.mi-state.spin { color: #e0b500; }
.mi-state.idle { color: var(--muted); }

/* layout */
.app {
  position: relative; z-index: 1;
  width: 100%; max-width: 720px; margin: 16px auto 36px;
  padding: 0 clamp(16px, 4vw, 24px);
  display: flex; flex-direction: column; gap: 18px;
}
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); padding: 22px;
  animation: rise 0.4s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }

/* tabs */
.tabs { display: flex; gap: 6px; background: rgba(0,0,0,0.3); padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.tab {
  flex: 1; border: none; background: transparent; color: var(--muted);
  padding: 10px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.tab.active { background: rgba(118,185,0,0.14); color: var(--nv-bright); }

/* recorder */
.recorder { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 0 4px; }
.rec-btn {
  width: 88px; height: 88px; border-radius: 50%; cursor: pointer; border: none;
  background: var(--nv-grad); display: grid; place-items: center;
  box-shadow: 0 12px 38px -10px rgba(118,185,0,0.65); transition: transform .15s;
}
.rec-btn:hover { transform: scale(1.05); }
.rec-btn:active { transform: scale(0.96); }
.rec-icon { width: 28px; height: 28px; border-radius: 50%; background: #0a0e07; transition: all .2s; }
.rec-btn.recording { background: linear-gradient(135deg,#ff5b5b,#ff9d3d); animation: recpulse 1.4s infinite; }
.rec-btn.recording .rec-icon { width: 24px; height: 24px; border-radius: 6px; }
@keyframes recpulse { 0%,100% { box-shadow: 0 12px 38px -10px rgba(255,91,91,0.5);} 50% { box-shadow: 0 12px 56px -4px rgba(255,91,91,0.85);} }
.timer { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.rec-hint { font-size: 13px; color: var(--muted); }
.visualizer { width: 100%; height: 54px; }
.visualizer canvas { width: 100%; height: 100%; }

/* dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 42px 20px; border: 2px dashed var(--border); border-radius: 13px; cursor: pointer;
  text-align: center; transition: all .2s; background: rgba(118,185,0,0.03);
}
.dropzone:hover, .dropzone.drag { border-color: var(--nv); background: rgba(118,185,0,0.09); }
.dz-icon {
  font-size: 26px; font-weight: 800; color: var(--nv-bright);
  width: 56px; height: 56px; display: grid; place-items: center;
  border: 2px solid var(--border); border-radius: 50%;
}
.dz-title { font-size: 15.5px; font-weight: 600; }
.dz-sub { font-size: 12.5px; color: var(--muted); }

/* playback */
.file-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.file-name { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
audio { width: 100%; margin-bottom: 16px; border-radius: 10px; }
.ghost {
  background: transparent; border: 1px solid var(--border-soft); color: var(--muted);
  border-radius: 9px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .18s;
}
.ghost:hover { color: var(--nv-bright); border-color: var(--nv); }
.ghost.active { color: #0a0e07; background: var(--nv); border-color: var(--nv); }

.run-btn {
  width: 100%; border: none; cursor: pointer; color: #0a0e07; font-weight: 800; font-size: 15px;
  background: var(--nv-grad); padding: 15px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 12px 34px -12px rgba(118,185,0,0.7); transition: transform .12s, opacity .2s;
}
.run-btn:hover { transform: translateY(-1px); }
.run-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.bolt { font-size: 16px; }
.spinner { width: 16px; height: 16px; border: 2.5px solid rgba(10,14,7,0.3); border-top-color: #0a0e07; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* performance strip */
.perf {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  background: linear-gradient(135deg, rgba(118,185,0,0.12), rgba(118,185,0,0.02));
  border: 1px solid var(--border); border-radius: 13px; padding: 16px 18px; margin-bottom: 18px;
}
.perf-hero { display: flex; align-items: baseline; gap: 8px; }
.perf-num { font-size: 34px; font-weight: 900; color: var(--nv-bright); letter-spacing: -1px; line-height: 1; }
.perf-unit { font-size: 12.5px; color: var(--muted); max-width: 90px; line-height: 1.2; }
.perf-mini { display: flex; gap: 18px; flex-wrap: wrap; }
.perf-mini span { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.perf-mini b { font-size: 16px; color: var(--text); font-weight: 700; text-transform: none; letter-spacing: 0; }

/* result */
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.result-head h2 { font-size: 16px; font-weight: 700; }
.result-actions { display: flex; gap: 8px; position: relative; }
.hint-line { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.transcript {
  background: rgba(0,0,0,0.32); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 18px; font-size: 16.5px; line-height: 1.9; min-height: 70px; word-break: break-word;
}
.transcript .w {
  cursor: pointer; border-radius: 5px; padding: 1px 2px; transition: background .12s, color .12s;
}
.transcript .w:hover { background: rgba(118,185,0,0.18); }
.transcript .w.active { background: var(--nv); color: #0a0e07; font-weight: 800; border-radius: 5px; box-shadow: 0 0 0 2px var(--nv); transition: background .05s linear; }
.transcript.show-ts .w { display: inline-flex; flex-direction: column; align-items: flex-start; margin: 2px 3px; }
.transcript.show-ts .w .t { font-size: 9.5px; color: var(--nv-bright); font-variant-numeric: tabular-nums; line-height: 1; }
.transcript:not(.show-ts) .w .t { display: none; }

/* download menu */
.dl { position: relative; }
.dl-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5;
  background: #141a0d; border: 1px solid var(--border); border-radius: 11px; padding: 6px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 180px;
}
.dl-menu button {
  background: transparent; border: none; color: var(--text); text-align: left;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
}
.dl-menu button:hover { background: rgba(118,185,0,0.14); color: var(--nv-bright); }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #141a0d; border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 11px; font-size: 14px; z-index: 10; box-shadow: var(--shadow);
  animation: rise .3s both;
}
.toast.err { border-color: var(--danger); }

.footer { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

@media (max-width: 540px) {
  .topbar { flex-direction: column; gap: 12px; align-items: flex-start; }
  .perf { justify-content: flex-start; }
}

/* ============================ model comparison ============================ */
.compare {
  margin: 14px 0 4px;
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
}
.compare-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.compare-title { font-size: 13.5px; font-weight: 700; }
.compare-title i { display: block; font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.add-model { position: relative; }
.add-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  min-width: 240px; max-height: 320px; overflow-y: auto;
  background: #0f150b; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px;
}
.add-menu.hidden { display: none; }
.add-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  width: 100%; text-align: left; padding: 9px 11px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text); cursor: pointer;
}
.add-item:hover { background: rgba(118,185,0,0.10); }
.add-item .mi-name { font-size: 13px; font-weight: 650; }
.add-item .mi-sub { font-size: 11px; color: var(--muted); }
.add-empty { padding: 10px 12px; font-size: 12px; color: var(--muted); }

.compare-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; min-height: 20px; }
.compare-empty { font-size: 12px; color: var(--muted); }
.cmp-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 12px; border-radius: 999px;
  background: rgba(118,185,0,0.10); border: 1px solid var(--border);
}
.cmp-chip b { font-size: 12.5px; font-weight: 700; }
.cmp-chip i { font-style: normal; font-size: 11px; color: var(--muted); }
.chip-x {
  width: 20px; height: 20px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer; font-size: 11px;
  background: rgba(255,255,255,0.06); color: var(--muted);
}
.chip-x:hover { background: var(--danger); color: #fff; }

.cmp-count { font-size: 13px; color: var(--muted); font-weight: 500; }
.compare-grid {
  display: grid; gap: 14px; margin-top: 8px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.cmp-card {
  border: 1px solid var(--border); border-radius: 14px;
  background: rgba(255,255,255,0.02); padding: 14px 15px;
  display: flex; flex-direction: column; gap: 10px;
}
.cmp-card.is-fastest { border-color: rgba(118,185,0,0.5); box-shadow: inset 0 0 0 1px rgba(118,185,0,0.25); }
.cmp-card.err { border-color: rgba(255,91,91,0.4); }
.cmp-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cmp-name { font-size: 14px; font-weight: 800; letter-spacing: -0.2px; }
.cmp-spec { font-size: 11px; color: var(--muted); }
.cmp-badge {
  display: inline-block; font-size: 9.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.4px; padding: 2px 7px; border-radius: 999px; margin-left: 4px; vertical-align: middle;
}
.cmp-badge.fast { background: var(--nv-grad); color: #0a0e07; }
.cmp-badge.long { background: rgba(255,255,255,0.10); color: var(--text); }
.cmp-metrics { display: flex; gap: 16px; }
.cmp-metrics span { display: flex; flex-direction: column; font-size: 10.5px; color: var(--muted); }
.cmp-metrics b { font-size: 15px; color: var(--nv-bright); font-weight: 800; }
.cmp-text {
  font-size: 15px; line-height: 1.65; color: var(--text);
  background: rgba(0,0,0,0.22); border-radius: 10px; padding: 11px 13px;
  white-space: pre-wrap; word-break: break-word;
}
.cmp-error { font-size: 12.5px; color: var(--danger); }
.cmp-copy { align-self: flex-start; font-size: 12px; }

/* ---------------------------------------------------------------- live transcription */
.live { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 6px; }
.live-btn { background: var(--nv-grad); }
.live-btn.recording { background: linear-gradient(135deg,#ff5b5b,#ff9d3d); animation: recpulse 1.4s infinite; }
.live-meter { width: min(360px, 90%); height: 6px; border-radius: 6px; background: rgba(255,255,255,0.07); overflow: hidden; }
.live-meter span { display: block; height: 100%; width: 0%; background: var(--muted); border-radius: 6px; transition: width .08s linear; }
.live-meter span.speaking { background: var(--nv-grad); }
.live-stats { font-size: 12px; color: var(--muted); min-height: 16px; font-variant-numeric: tabular-nums; text-align: center; }
.live-head { margin-top: 14px; }
.live-text {
  min-height: 140px; max-height: 340px; overflow-y: auto; padding: 14px 16px; border-radius: 12px;
  background: rgba(0,0,0,0.28); border: 1px solid var(--border-soft); font-size: 18px; line-height: 1.75;
}
.live-empty { color: var(--muted); font-size: 14px; }
.live-seg { display: flex; gap: 10px; align-items: baseline; padding: 2px 0; }
.live-t { font-size: 11px; color: var(--nv-bright); font-variant-numeric: tabular-nums; flex: 0 0 auto; opacity: .8; }
.live-seg.interim .live-w { color: var(--muted); font-style: italic; }
.live-hint { margin-top: 10px; margin-bottom: 0; }

/* ---------------------------------------------------------------- regional -> standard */
.std-switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.std-switch input { accent-color: var(--nv); width: 16px; height: 16px; cursor: pointer; }
.std-box { margin: 4px 0 14px; padding: 12px 14px; border-radius: 12px; background: rgba(118,185,0,0.08); border: 1px solid var(--border); }
.std-label { font-size: 12px; color: var(--nv-bright); margin-bottom: 6px; }
.std-text { font-size: 17px; line-height: 1.8; }

/* saved hotword list panel */
.hw-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.6); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; }
.hw-panel { width: 100%; max-width: 520px; max-height: 84vh; display: flex; flex-direction: column; gap: 12px;
  background: #141a0d; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.hw-head { display: flex; align-items: center; justify-content: space-between; }
.hw-head h3 { font-size: 16px; }
.hw-x { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.hw-x:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.hw-hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.hw-add { display: flex; gap: 8px; }
.hw-add input { background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 9px 11px; font-size: 14px; outline: none; min-width: 0; }
.hw-add input:focus { border-color: var(--nv); }
#hwWord { flex: 1; }
#hwStrength { width: 64px; }
.hw-add button, .hw-save { background: var(--nv); color: #0a0e07; border: none; border-radius: 10px; padding: 9px 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.hw-save:disabled { background: rgba(118,185,0,0.25); color: var(--muted); cursor: default; }
.hw-link { align-self: flex-start; background: transparent; border: none; color: var(--nv-bright); font-size: 12px; cursor: pointer; padding: 0; }
.hw-link:hover { text-decoration: underline; }
.hw-items { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; overflow-y: auto; min-height: 40px; padding: 2px; }
.hw-item { display: flex; align-items: center; gap: 6px; background: rgba(118,185,0,0.12); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; }
.hw-s { font-size: 11px; color: var(--muted); }
.hw-del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 999px; }
.hw-del:hover { color: var(--danger); background: rgba(255,91,91,0.12); }
.hw-empty { color: var(--muted); font-size: 13px; }
.hw-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.hw-msg { font-size: 12.5px; color: var(--nv-bright); line-height: 1.45; }
.hw-msg.err { color: #e0b500; }
#hwState { font-size: 12px; color: var(--muted); }
#hwState.hw-dirty { color: #e0b500; font-weight: 700; }
@media (max-width: 480px) { .hw-add { flex-wrap: wrap; } #hwWord { flex-basis: 100%; } }

/* dari settings panel (reuses the hotword panel styles) */
#dariSetBtn.dari-custom i { color: var(--nv-bright); }
.dari-row { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.dari-row label b { font-size: 14px; }
.dari-help { display: block; font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.dari-ctl { display: flex; align-items: center; gap: 12px; }
.dari-ctl input[type=range] { flex: 1; min-width: 0; accent-color: var(--nv); cursor: pointer; }
.dari-ctl output { min-width: 64px; text-align: right; font-weight: 700; color: var(--nv-bright); font-variant-numeric: tabular-nums; }
