:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-border: #30363d;
  --surface-hover: #21262d;
  --accent: #ff9933; /* Traditional Saffron */
  --accent-light: #ffb366;
  --accent-glow: rgba(255, 153, 51, 0.25);
  --gold: #f59e0b;
  --text: #f0f6fc;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --success: #2ea043;
  --danger: #f85149;
  --radius: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-devanagari: "Noto Serif Devanagari", "Tiro Devanagari Sanskrit", serif;
  --font-mono: "SF Mono", Menlo, Consolas, Monaco, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  padding: 2rem 1rem 4rem;
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(255, 153, 51, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.05) 0%, transparent 40%);
}

.container {
  max-width: 860px;
  margin: 0 auto;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 153, 51, 0.15);
  border: 1px solid rgba(255, 153, 51, 0.35);
  color: var(--accent-light);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.devanagari-title {
  font-family: var(--font-devanagari);
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 620px;
  margin: 0 auto 1.25rem;
}

.spec-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.pill {
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-family: var(--font-mono);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s;
}

.card:hover {
  border-color: #484f58;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--surface-border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Status & Loader */
.engine-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6e7681;
}

.status-dot.ready { background: var(--success); box-shadow: 0 0 10px rgba(46, 160, 67, 0.6); }
.status-dot.loading { background: var(--gold); animation: pulse 1.2s infinite; }
.status-dot.error { background: var(--danger); }

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.progress-container {
  margin-top: 1rem;
  background: #21262d;
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  display: none;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 0.15s ease;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--surface-border);
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.btn:hover:not(:disabled) {
  background: #30363d;
  border-color: #8b949e;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: var(--accent-light);
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-danger {
  background: rgba(248, 81, 73, 0.15);
  color: #ff7b72;
  border-color: rgba(248, 81, 73, 0.4);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 81, 73, 0.25);
  border-color: #f85149;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.tab-btn.active {
  color: var(--accent-light);
  background: rgba(255, 153, 51, 0.12);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Mic Recording */
.record-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0;
  gap: 1.25rem;
}

.record-btn-wrapper {
  position: relative;
}

.record-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: #21262d;
  color: var(--text);
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.record-btn:hover:not(:disabled) {
  background: #30363d;
  transform: scale(1.05);
}

.record-btn.recording {
  background: var(--danger);
  color: white;
  animation: pulse-recording 1.4s infinite;
}

@keyframes pulse-recording {
  0% { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.6); }
  70% { box-shadow: 0 0 0 16px rgba(248, 81, 73, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0); }
}

.recording-timer {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-muted);
}

.wave-canvas {
  width: 100%;
  height: 64px;
  background: #0d1117;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--surface-border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(13, 17, 23, 0.4);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: rgba(255, 153, 51, 0.04);
}

.dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-dim);
}

/* Sample Cards */
.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.sample-card {
  background: #0d1117;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.sample-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: rgba(255, 153, 51, 0.04);
}

.sample-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--accent-light);
}

.sample-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-devanagari);
}

/* Audio Player */
.audio-player-wrapper {
  margin-top: 1rem;
  display: none;
  background: #0d1117;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

audio {
  width: 100%;
  height: 36px;
}

/* Transcript Results */
.transcript-box {
  background: #0d1117;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 120px;
  position: relative;
  margin-bottom: 1rem;
}

.devanagari-output {
  font-family: var(--font-devanagari);
  font-size: 1.8rem;
  line-height: 1.6;
  color: #ffffff;
  word-break: break-word;
  white-space: pre-wrap;
}

.devanagari-output.placeholder {
  color: var(--text-dim);
  font-size: 1.05rem;
  font-family: var(--font-sans);
}

.iast-output {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--surface-border);
}

.telemetry-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.telemetry-pill {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-family: var(--font-mono);
}

.telemetry-pill span {
  color: var(--accent-light);
  font-weight: 600;
}

/* Footer */
footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 3rem;
  line-height: 1.8;
}

footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

footer a:hover {
  color: var(--accent-light);
}

/* Responsive */
@media (max-width: 640px) {
  h1 { font-size: 1.85rem; }
  .card { padding: 1.15rem; }
  .devanagari-output { font-size: 1.4rem; }
}
