@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e8eef5;
  --muted: #8b9cb3;
  --accent: #3d9eff;
  --accent-dim: #2563a8;
  --danger: #f46b6b;
  --record: #ff5c5c;
  --record-glow: rgba(255, 92, 92, 0.35);
  --radius: 12px;
  --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 20% 0%, #1a2840 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 36rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.conn-status {
  display: inline-block;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.conn-status--disconnected {
  background: #3a2a2a;
  color: #ffb4b4;
}

.conn-status--connecting {
  background: #3a3528;
  color: #f5d78a;
}

.conn-status--ready {
  background: #253a2e;
  color: #8ce99a;
}

.panel {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.langs {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.field select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.controls {
  text-align: center;
  margin-bottom: 1.5rem;
}

.record-btn {
  width: 100%;
  max-width: 16rem;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  box-shadow: 0 10px 28px rgba(61, 158, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.record-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(61, 158, 255, 0.45);
}

.record-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.record-btn--active {
  background: linear-gradient(145deg, var(--record), #c23a3a);
  box-shadow: 0 0 0 6px var(--record-glow), 0 10px 28px rgba(255, 92, 92, 0.35);
}

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.result h2 {
  margin: 1rem 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.result h2:first-child {
  margin-top: 0;
}

.translation-text {
  margin: 0;
  min-height: 3rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.player {
  width: 100%;
  margin-top: 0.35rem;
  border-radius: 8px;
}

.error-msg {
  margin: 1rem 0 0;
  padding: 0.75rem;
  background: #3a2222;
  border: 1px solid #5c3030;
  border-radius: 8px;
  color: #ffc9c9;
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
