:root {
  color-scheme: light;
  --background: #f8f4ef;
  --surface: #fffcf9;
  --ink: #30221f;
  --muted: #74635d;
  --line: #ece2da;
  --accent: #913a2e;
  --accent-hover: #763025;
  --accent-light: #faece5;
  --serif: Lora, Georgia, serif;
  --sans: Manrope, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 500 1rem/1.55 var(--sans);
}
button, textarea, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.shell { width: min(100% - 80px, 1248px); margin-inline: auto; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: fixed;
  z-index: 5;
  left: 16px;
  top: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--surface);
}

.topbar { border-bottom: 1px solid #eae0d8; }
.topbar-inner { display: flex; align-items: center; min-height: 73px; gap: 49px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; flex: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff4e9;
}
.brand-name { font: 700 1.45rem/1 var(--serif); letter-spacing: -.055em; }
.brand-name span { color: var(--accent); }
.nav { display: flex; gap: 26px; align-self: stretch; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 750;
  white-space: nowrap;
}
.nav a:hover, .nav .nav-primary { color: var(--accent); }
.nav-primary::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  content: "";
}
.connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 33px;
  margin-left: auto;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  background: #fdfaf7;
  font-size: .8125rem;
  font-weight: 750;
  white-space: nowrap;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #aa7853; }
[data-state="ready"] .status-dot { background: #48745b; }
[data-state="offline"] .status-dot { background: #ad483d; }

.hero {
  isolation: isolate;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 280px;
  margin-top: 29px;
  border-radius: 24px;
  background: #3b1014;
  color: #fff5ea;
}
.hero-art {
  position: absolute;
  z-index: -2;
  inset: 0 0 0 auto;
  width: 64%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 52%;
}
.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #3b1014 31%, rgba(59, 16, 20, .8) 43%, transparent 66%);
  content: "";
}
.hero-copy { padding: 31px 48px 37px; }
.hero h1 {
  margin: 0;
  font: 600 clamp(2.95rem, 4.6vw, 4.5rem)/1.07 var(--serif);
  letter-spacing: -.052em;
}
.hero em { color: #f3b69e; font-weight: 500; }
.hero p { max-width: 31rem; margin: 18px 0 0; color: #f3d8cc; font-size: 1rem; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  margin-top: 22px;
}
.panel {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: 0 3px 12px #492d1c08;
  scroll-margin-top: 16px;
}
.panel-heading, .output-heading, .heading-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-heading, .output-heading { justify-content: space-between; }
.panel-heading { margin-bottom: 16px; }
.heading-icon {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  flex: none;
  border-radius: 10px;
  color: var(--accent);
  background: #f8ece6;
}
.heading-icon .icon { width: 19px; height: 19px; }
h2 { margin: 0; font: 700 1.22rem/1.25 var(--serif); letter-spacing: -.04em; }
.text-button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--accent);
}
.text-button { padding: 6px 1px; font-size: .875rem; font-weight: 800; white-space: nowrap; }
.text-button .icon, .icon-button .icon { width: 16px; height: 16px; }
.text-button:hover span { text-decoration: underline; text-underline-offset: 3px; }
.text-box {
  overflow: hidden;
  border: 1px solid #e8dbd0;
  border-radius: 13px;
  background: #f9f5ef;
}
.text-box:focus-within { border-color: #ad5a47; box-shadow: 0 0 0 2px #ad5a471f; }
textarea {
  display: block;
  width: 100%;
  min-height: 158px;
  height: 179px;
  padding: 15px 16px 8px;
  resize: vertical;
  border: none;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.7;
}
textarea::placeholder { color: #82716a; opacity: 1; }
.text-box-footer { display: flex; align-items: center; justify-content: space-between; min-height: 37px; padding: 0 9px 4px 16px; }
#character-count { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.clear-button { width: 32px; height: 30px; border-radius: 8px; }
.clear-button:hover:not(:disabled) { background: #f3e6de; }
.clear-button:disabled { color: #ac9990; }
.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 15px; }
.shortcut { display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: .8125rem; }
kbd { padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; background: #f8f2ed; font: inherit; }
.primary-button, .download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.primary-button { background: var(--accent); color: #fff9f1; }
.primary-button:hover:not(:disabled) { background: var(--accent-hover); }
.primary-button:disabled:not([aria-busy="true"]) { background: #eaded7; color: #6e5147; }
.primary-button .icon { width: 19px; height: 19px; }
.primary-button[aria-busy="true"] .icon { animation: pulse 1.25s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .4; } }

.voice-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 99px;
  background: #f6eee8;
  color: #745447;
  font-size: .8125rem;
  font-weight: 800;
  white-space: nowrap;
}
.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  min-inline-size: 0;
  border: none;
  margin: 0;
  padding: 0;
}
.voice-card {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
  transition: border-color .15s, background-color .15s;
}
.voice-card:hover { border-color: #c69586; }
.voice-card:has(input:checked) { border-color: #af5b49; background: #faeee7; }
.voice-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.voice-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: stretch;
  flex: 1;
  min-width: 0;
  padding: 8px 2px 8px 8px;
  cursor: pointer;
}
.voice-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--voice-bg);
  color: var(--voice-ink);
}
.voice-mark .icon { width: 18px; height: 18px; }
.voice-name { display: block; font-size: .875rem; font-weight: 800; line-height: 1.3; }
.voice-style { display: block; margin-top: 2px; color: var(--muted); font-size: .75rem; line-height: 1.25; }
.preview-button {
  width: 30px;
  height: 30px;
  flex: none;
  margin-right: 5px;
  border-radius: 50%;
  color: #795a50;
}
.preview-button .icon { width: 16px; height: 16px; }
.preview-button:hover, .preview-button[aria-pressed="true"] { background: #f5e1d7; color: var(--accent); }
.message { margin: 10px 0 0; color: #96372d; font-size: .875rem; font-weight: 700; }

.output-panel { margin-top: 20px; }
.output-heading { margin-bottom: 12px; }
.output-format { color: var(--muted); font-size: .8125rem; font-weight: 750; }
.output-format span { padding: 0 3px; color: #9b7f73; }
.player {
  display: grid;
  grid-template-columns: auto minmax(128px, auto) minmax(45px, 1fr) auto auto;
  align-items: center;
  gap: 15px;
  min-height: 60px;
}
.player-play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: white;
}
.player-play:hover:not(:disabled) { background: var(--accent-hover); }
.player-play:disabled { background: #f0e7df; color: #9b8276; }
.track-info { min-width: 0; }
.track-info p { margin: 0; }
#track-title { font-size: .875rem; font-weight: 800; }
#track-subtitle { margin-top: 3px; color: var(--muted); font-size: .8125rem; }
.track { position: relative; height: 47px; min-width: 0; }
.waveform { display: flex; height: 100%; align-items: center; justify-content: space-between; gap: 2px; pointer-events: none; }
.waveform i { flex: 1; max-width: 5px; height: var(--amplitude); border-radius: 99px; background: #dbb3a2; }
.waveform i.is-played { background: var(--accent); }
[data-state="empty"] .waveform i { background: #e9ded5; }
.seek {
  appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}
.seek:disabled { cursor: default; }
.seek::-webkit-slider-thumb { appearance: none; width: 4px; height: 34px; background: transparent; border: 0; border-radius: 3px; }
.seek::-moz-range-thumb { width: 4px; height: 34px; background: transparent; border: 0; border-radius: 3px; }
.seek:not(:disabled):focus-visible::-webkit-slider-thumb { background: var(--accent); }
.seek:not(:disabled):focus-visible::-moz-range-thumb { background: var(--accent); }
.player-time { color: var(--muted); font-size: .8125rem; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.download-button { min-height: 41px; color: var(--accent); border-color: #dfb9aa; background: #fffaf6; text-decoration: none; }
.download-button:hover[href] { background: #f8e9e0; }
.download-button[aria-disabled="true"] { border-color: var(--line); background: #f8f3ee; color: #806e65; }
.download-button .icon { width: 17px; height: 17px; }
.footer { display: flex; justify-content: space-between; gap: 10px 24px; padding-block: 19px 23px; color: var(--muted); font-size: .8125rem; }
.footer > span:first-child { display: flex; gap: 7px; align-items: center; font-weight: 800; }
.footer .icon { width: 15px; height: 15px; color: var(--accent); }
.footer a { text-underline-offset: 3px; }

@media (max-width: 1000px) {
  .shell { width: calc(100% - 44px); }
  .workspace { grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr); gap: 14px; }
  .panel { padding: 16px; }
  .voice-choice { gap: 6px; padding-left: 6px; }
  .voice-mark { width: 27px; height: 29px; }
  .preview-button { width: 25px; height: 29px; margin-right: 2px; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .topbar-inner { min-height: 64px; gap: 24px; }
  .nav { gap: 13px; }
  .hero { min-height: 245px; margin-top: 18px; border-radius: 19px; }
  .hero-copy { padding: 24px 28px 31px; }
  .hero-art { width: 74%; }
  .hero::after { background: linear-gradient(90deg, #3b1014 15%, rgba(59, 16, 20, .85) 42%, rgba(59, 16, 20, .09) 100%); }
  .hero p { max-width: 24rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); margin-top: 15px; }
  .voice-choice { gap: 9px; padding-left: 8px; }
  .voice-mark { width: 32px; height: 32px; }
  .preview-button { width: 35px; height: 35px; margin-right: 4px; }
  .output-panel { margin-top: 15px; }
  .player { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 12px; }
  .track { grid-row: 2; grid-column: 1 / 3; height: 39px; }
  .player-time { grid-column: 3; grid-row: 2; justify-self: end; }
  .download-button { grid-column: 3; grid-row: 1; }
}
@media (max-width: 480px) {
  .topbar-inner { gap: 10px; }
  .nav { display: none; }
  .hero { min-height: 228px; }
  .hero-copy { padding-inline: 20px; }
  .hero h1 { font-size: clamp(2rem, 10vw, 2.85rem); }
  .hero p { max-width: 16.2rem; margin-top: 12px; font-size: .9rem; }
  .hero-art { width: 93%; object-position: 66% 54%; }
  .hero::after { background: linear-gradient(90deg, #3b1014 3%, #3b1014d9 40%, #3b10144d 100%); }
  .panel { padding: 13px; }
  .heading-group { gap: 7px; }
  .heading-icon { width: 29px; height: 29px; }
  h2 { font-size: 1.1rem; }
  .text-button { font-size: .8125rem; }
  .shortcut { display: none; }
  .primary-button { width: 100%; }
  .voice-grid { gap: 7px; }
  .voice-name { font-size: .8125rem; }
  .voice-choice { gap: 5px; padding-left: 5px; }
  .voice-mark { width: 25px; height: 28px; }
  .voice-mark .icon { width: 15px; height: 15px; }
  .preview-button { width: 27px; height: 36px; margin-right: 1px; }
  .footer { flex-wrap: wrap; }
}
@media (max-width: 350px) {
  .voice-grid { grid-template-columns: 1fr; }
  .voice-choice { gap: 8px; padding-left: 8px; }
  .preview-button { width: 34px; margin-right: 5px; }
  .player { gap: 8px; }
  .download-button { padding-inline: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
