:root {
  --bg: #08090c;
  --bg-panel: #111319;
  --bg-panel-2: #171a22;
  --border: #24272f;
  --border-soft: #1a1d24;
  --text: #f0f2f5;
  --text-dim: #8b8f9c;
  --text-faint: #5c606b;
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --accent-2: #ff6b8a;
  --mono: 'Sora', 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(45% 35% at 20% -5%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(40% 30% at 100% 15%, rgba(255, 107, 138, 0.09), transparent 60%);
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 6vw;
  border-bottom: 1px solid var(--border-soft);
}

.logo {
  font-family: var(--mono);
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 11px;
}

.logo em {
  font-style: normal;
  color: var(--accent);
}

.logo-mark {
  color: var(--accent);
  display: flex;
  align-items: center;
}

.logo-mark svg {
  width: clamp(30px, 5vw, 38px);
  height: clamp(30px, 5vw, 38px);
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 60px 6vw 40px;
}

.hero {
  margin-bottom: 44px;
  text-align: center;
}

.hero h1 {
  font-family: var(--mono);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.accent-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
}

.charcount {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

textarea {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Custom dropdown (replaces native <select> so long voice/language
   names always wrap fully instead of being clipped) */
.dropdown {
  position: relative;
  width: 100%;
}

.dropdown-trigger {
  width: 100%;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dropdown-trigger:focus,
.dropdown-trigger.open {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dropdown-value {
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
  display: inline-block;
  transform-origin: left center;
}

.dropdown-arrow {
  flex-shrink: 0;
  color: var(--text-faint);
  margin-top: 3px;
  transition: transform 0.15s ease;
}

.dropdown-trigger.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  display: none;
}

.dropdown-list.open {
  display: block;
}

.dropdown-list li {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
  transition: background 0.1s ease;
}

.dropdown-list li:hover,
.dropdown-list li.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sliders {
  display: flex;
  gap: 24px;
  margin: 24px 0 8px;
  flex-wrap: wrap;
}

.slider-field {
  flex: 1;
  min-width: 160px;
}

.slider-field label {
  margin-bottom: 10px;
}

.slider-field label span {
  color: var(--accent);
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), #9b7dff);
  color: #0a0710;
  border: none;
  padding: 15px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(124, 92, 255, 0.28);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon {
  font-size: 12px;
}

.status {
  font-size: 13px;
  color: var(--text-dim);
}

.status.error {
  color: var(--accent-2);
}

.status.success {
  color: var(--accent);
}

.player-wrap {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.player-wrap.hidden {
  display: none;
}

audio {
  flex: 1;
  min-width: 240px;
  height: 42px;
}

.duration {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  font-weight: 600;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-download {
  background: var(--bg-panel-2);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  padding: 14px 26px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}

.btn-download:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(124, 92, 255, 0.18);
}

.btn-download .btn-icon {
  font-size: 15px;
}

.footer {
  text-align: center;
  padding: 36px;
  font-size: 13px;
  color: var(--text-faint);
  border-top: 1px solid var(--border-soft);
  margin-top: 40px;
}

@media (max-width: 720px) {
  .row { flex-direction: column; }
}
