:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-soft: #111823;
  --surface: #151c27;
  --surface-2: #192231;
  --surface-3: #202b3c;
  --line: #2a3546;
  --line-strong: #3a485c;
  --text: #f3f7fb;
  --muted: #94a3b8;
  --muted-2: #cbd5e1;
  --accent: #32d583;
  --accent-2: #38bdf8;
  --accent-3: #fbbf24;
  --danger: #fb7185;
  --danger-bg: rgba(251, 113, 133, 0.12);
  --success-bg: rgba(50, 213, 131, 0.12);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
  --radius: 8px;
  --control-h: 48px;
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(120deg, rgba(56, 189, 248, 0.09), transparent 34%),
    linear-gradient(215deg, rgba(50, 213, 131, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

svg {
  flex-shrink: 0;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #354256;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4b5d76;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-x: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  background: rgba(17, 24, 35, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #07110d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 28px rgba(50, 213, 131, 0.22);
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  font-size: 1.24rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-copy p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-widget {
  min-height: 42px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 12px;
  color: var(--muted-2);
  background: #0f1621;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: nowrap;
}

.status-indicator {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent-3);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
}

.status-indicator.online {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(50, 213, 131, 0.12);
}

.status-indicator.offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.13);
}

.status-text {
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted-2);
  background: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--line-strong);
  outline: none;
}

.app-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 18px;
  align-items: start;
}

.workspace-inputs,
.monitor-card,
.history-card,
.tabs-nav,
.attributes-grid,
.advanced-settings {
  background: rgba(21, 28, 39, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.workspace-inputs {
  min-width: 0;
  padding: 14px;
}

.tabs-nav {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  margin-bottom: 14px;
  background: #101722;
}

.tab-btn {
  min-width: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.15;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.tab-btn:hover,
.tab-btn:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.tab-btn.active {
  color: #06110c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 28px rgba(56, 189, 248, 0.16);
}

.panels-container {
  min-width: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: panel-in 0.18s ease-out;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-row {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-row.compact-row {
  margin-top: 4px;
}

.flex-1 {
  min-width: 0;
}

label,
.section-subtitle,
.panel-title {
  letter-spacing: 0;
}

label {
  color: var(--muted-2);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.required {
  color: var(--danger);
}

textarea,
input[type="text"],
input[type="number"],
input[type="password"],
.custom-select {
  width: 100%;
  min-height: var(--control-h);
  padding: 12px 14px;
  color: var(--text);
  background: #0f1621;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.automatic-language {
  min-height: var(--control-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(52, 211, 153, 0.07));
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: var(--radius);
}

.automatic-language-icon {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-size: 1.35rem;
  line-height: 1;
}

.automatic-language span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.automatic-language strong {
  font-size: 0.92rem;
}

.automatic-language small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.55;
}

textarea.compact-textarea {
  min-height: 78px;
}

.field-meta {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

input[readonly] {
  cursor: pointer;
}

textarea::placeholder,
input::placeholder {
  color: #6f7f94;
}

textarea:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
.custom-select:focus {
  background: #111b29;
  border-color: rgba(56, 189, 248, 0.78);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.custom-select {
  padding-right: 42px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' width='18' height='18' fill='none' stroke='%2394a3b8' stroke-width='2.4' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.upload-dropzone {
  position: relative;
  min-height: 172px;
  display: grid;
  place-items: center;
  padding: 22px;
  text-align: center;
  color: var(--muted-2);
  background: #0f1621;
  border: 1px dashed #46566c;
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  background: #111b29;
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.16);
}

.file-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
}

.dropzone-content,
.dropzone-preview {
  position: relative;
  z-index: 2;
}

.dropzone-content {
  pointer-events: none;
}

.dropzone-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  color: var(--accent-2);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius);
}

.dropzone-title {
  font-weight: 800;
  line-height: 1.35;
}

.dropzone-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.86rem;
}

.dropzone-preview {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.preview-info {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted-2);
  font-size: 0.86rem;
}

.preview-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.preview-size {
  flex-shrink: 0;
  color: var(--muted);
}

.mini-audio-player,
.full-audio-player {
  width: 100%;
}

.btn-remove-file {
  align-self: flex-start;
  min-height: 36px;
  padding: 8px 12px;
  color: #fecdd3;
  background: var(--danger-bg);
  border: 1px solid rgba(251, 113, 133, 0.28);
  border-radius: var(--radius);
  font-weight: 800;
}

.btn-remove-file:hover,
.btn-remove-file:focus-visible {
  color: #fff;
  background: rgba(251, 113, 133, 0.2);
  outline: none;
}

.prosody-card {
  margin-bottom: 16px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(17, 25, 35, 0.98), rgba(12, 21, 31, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.prosody-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px;
  list-style: none;
  cursor: pointer;
}

.prosody-heading::-webkit-details-marker {
  display: none;
}

.prosody-heading:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: -2px;
}

.prosody-heading-copy {
  min-width: 0;
  flex: 1;
  display: grid;
}

.prosody-heading .eyebrow {
  margin-bottom: 4px;
  color: var(--accent-2);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.prosody-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
}

.prosody-description {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.prosody-heading-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.prosody-enabled-state {
  padding: 5px 8px;
  color: #a7f3d0;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.18);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.prosody-card.is-disabled .prosody-enabled-state {
  color: var(--muted-2);
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.18);
}

.prosody-heading .arrow {
  color: var(--muted);
  transition: transform 0.18s ease;
}

.prosody-card[open] .prosody-heading .arrow {
  transform: rotate(180deg);
}

.prosody-body {
  padding: 15px;
  border-top: 1px solid var(--line);
  transition: opacity 0.18s ease;
}

.prosody-card.is-disabled .prosody-settings {
  display: none;
}

.prosody-enable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 0 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.prosody-enable-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.prosody-enable-row strong {
  color: var(--text);
  font-size: 0.86rem;
}

.prosody-enable-row > div > span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.prosody-enable-row .switch-label.compact-switch {
  width: auto;
  min-width: 100px;
  flex-shrink: 0;
}

.prosody-toolbar {
  align-items: stretch;
}

.prosody-toolbar .form-group {
  margin-bottom: 12px;
}

.prosody-summary {
  min-height: var(--control-h);
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 12px;
  color: #a7f3d0;
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.16);
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.4;
}

.prosody-summary.warning {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.22);
}

.pause-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pause-control {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  color: var(--muted-2);
  background: #0f1621;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
}

.pause-control b {
  min-width: 18px;
  display: inline-block;
  color: var(--accent-2);
  font-size: 1rem;
  text-align: center;
}

.pause-input {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pause-input input[type="number"] {
  width: 76px;
  min-height: 34px;
  padding: 6px 7px;
  color: var(--text);
  background: #0b111a;
  text-align: right;
}

.pause-input em {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
}

.prosody-footnote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.prosody-footnote .text-btn {
  flex-shrink: 0;
}

.advanced-block {
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.advanced-block h3 {
  color: var(--text);
  font-size: 0.9rem;
}

.advanced-block h3 span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.advanced-block p {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.voice-hints-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.attributes-grid,
.advanced-settings {
  padding: 14px;
  margin-bottom: 16px;
  background: #111923;
  box-shadow: none;
}

.section-subtitle,
.panel-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
}

.section-subtitle {
  margin-bottom: 14px;
}

.panel-title {
  margin-bottom: 16px;
}

.advanced-settings {
  padding: 0;
  overflow: hidden;
}

.advanced-summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  color: var(--muted-2);
  list-style: none;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
}

.advanced-summary::-webkit-details-marker {
  display: none;
}

.advanced-summary .arrow {
  color: var(--muted);
  transition: transform 0.18s ease;
}

.advanced-settings[open] .advanced-summary .arrow {
  transform: rotate(180deg);
}

.advanced-content {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.slider-group {
  margin-bottom: 16px;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.slider-value {
  min-width: 44px;
  padding: 4px 8px;
  color: #07110d;
  background: var(--accent);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: #303c4e;
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  background: var(--accent-2);
  border: 3px solid #0f1621;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.16);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: #303c4e;
  border-radius: 999px;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent-2);
  border: 3px solid #0f1621;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.16);
}

.checkbox-group {
  min-height: var(--control-h);
  display: flex;
  align-items: center;
}

.switch-label {
  width: 100%;
  min-height: var(--control-h);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted-2);
  background: #0f1621;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 700;
  user-select: none;
  cursor: pointer;
}

.switch-label input {
  position: absolute;
  opacity: 0;
}

.switch-slider {
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  position: relative;
  background: #334155;
  border-radius: 999px;
  transition: background 0.18s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 999px;
  transition: transform 0.18s ease;
}

.switch-label input:checked + .switch-slider {
  background: var(--accent);
}

.switch-label input:checked + .switch-slider::before {
  transform: translateX(18px);
}

.input-action-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.gpu-keys-group {
  margin-top: 16px;
}

.gpu-key-input-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.gpu-key-input-head label {
  margin-bottom: 0;
}

.gpu-key-create-link {
  min-height: 38px;
  flex: 0 0 auto;
  padding: 8px 12px;
  color: var(--accent-2);
  text-decoration: none;
}

.gpu-key-help {
  margin: 0 0 10px;
}

.submit-btn,
.btn-sec,
.text-btn {
  border-radius: var(--radius);
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.submit-btn {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 16px;
  color: #06110c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  box-shadow: 0 14px 32px rgba(50, 213, 131, 0.16);
}

.submit-btn:hover,
.submit-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(56, 189, 248, 0.2);
  outline: none;
}

.btn-sec {
  min-height: var(--control-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
}

.btn-sec:hover,
.btn-sec:focus-visible {
  background: var(--surface-3);
  border-color: rgba(56, 189, 248, 0.62);
  outline: none;
}

.text-btn {
  min-height: 34px;
  padding: 5px 9px;
  color: var(--accent-2);
  background: transparent;
  border: 1px solid transparent;
}

.inline-text-btn {
  align-self: flex-start;
  min-height: 30px;
  padding-inline: 0;
}

.text-btn:hover,
.text-btn:focus-visible {
  color: var(--text);
  background: rgba(56, 189, 248, 0.1);
  outline: none;
}

.full-width {
  width: 100%;
}

.compact-submit {
  max-width: 240px;
  margin-top: 4px;
}

.token-status-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--muted-2);
  background: #0f1621;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.82rem;
  font-weight: 900;
}

.badge.success {
  color: var(--accent);
  background: var(--success-bg);
  border-color: rgba(50, 213, 131, 0.24);
}

.text-note {
  color: var(--muted);
  text-align: right;
}

.gpu-key-pool-card {
  margin-bottom: 18px;
  padding: 15px;
  background: linear-gradient(145deg, rgba(50, 213, 131, 0.07), rgba(56, 189, 248, 0.035));
  border: 1px solid rgba(50, 213, 131, 0.22);
  border-radius: var(--radius);
}

.gpu-key-pool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.gpu-key-pool-head h3 {
  margin-top: 3px;
  font-size: 1rem;
}

.gpu-key-pool-summary {
  flex-shrink: 0;
  padding: 6px 10px;
  color: var(--accent);
  background: rgba(50, 213, 131, 0.1);
  border: 1px solid rgba(50, 213, 131, 0.24);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.gpu-key-pool-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.5;
}

.gpu-key-pool-list {
  display: grid;
  gap: 7px;
  max-height: 270px;
  margin-top: 12px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.gpu-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px;
  background: rgba(13, 17, 23, 0.72);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.gpu-key-row.is-active {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.38);
  box-shadow: inset 3px 0 0 var(--accent-2);
}

.gpu-key-identity {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.gpu-key-identity strong {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpu-key-identity span,
.gpu-key-empty {
  color: var(--muted);
  font-size: 0.72rem;
}

.gpu-key-empty {
  padding: 12px 2px 4px;
}

.gpu-key-state {
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.gpu-key-state.ready {
  color: var(--accent);
  background: var(--success-bg);
  border-color: rgba(50, 213, 131, 0.25);
}

.gpu-key-state.active {
  color: var(--accent-2);
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.28);
}

.gpu-key-state.quota,
.gpu-key-state.waiting {
  color: var(--accent-3);
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.24);
}

.gpu-key-state.invalid {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(251, 113, 133, 0.25);
}

.workspace-outputs {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 18px;
}

.monitor-card,
.history-card {
  min-width: 0;
  padding: 16px;
  background: rgba(21, 28, 39, 0.93);
}

.monitor-card {
  min-height: 410px;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
}

.monitor-state {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.monitor-decor,
.success-icon-container,
.error-icon-container {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
}

.monitor-decor {
  color: var(--accent-2);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.success-icon-container {
  color: var(--accent);
  background: var(--success-bg);
  border: 1px solid rgba(50, 213, 131, 0.26);
}

.error-icon-container {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(251, 113, 133, 0.26);
}

.monitor-state h3 {
  font-size: 1.12rem;
  line-height: 1.3;
  font-weight: 900;
}

.monitor-state p {
  max-width: 440px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.loader-container {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 2px;
}

.glowing-spinner {
  width: 72px;
  height: 72px;
  border: 4px solid rgba(148, 163, 184, 0.16);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  border-radius: 999px;
  animation: spin 0.95s linear infinite;
}

.pulse-ring {
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  animation: pulse-ring 1.7s ease-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-ring {
  from {
    transform: scale(0.82);
    opacity: 0.8;
  }
  to {
    transform: scale(1.12);
    opacity: 0;
  }
}

.progress-bar-container {
  width: min(360px, 82%);
  height: 6px;
  overflow: hidden;
  background: #303c4e;
  border-radius: 999px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  border-radius: inherit;
}

.animate-progress {
  animation: fill-progress 14s ease-in-out infinite alternate;
}

@keyframes fill-progress {
  0% {
    width: 8%;
  }
  48% {
    width: 72%;
  }
  100% {
    width: 96%;
  }
}

.field-hint {
  color: var(--muted);
  font-size: 0.84rem;
}

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

.text-error {
  color: var(--danger);
}

.audio-result-box {
  width: 100%;
  padding: 10px;
  background: #0f1621;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.file-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #0f1621;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
}

.detail-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.86rem;
  line-height: 1.45;
}

.detail-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-label {
  color: var(--muted);
  font-weight: 800;
}

.detail-value {
  min-width: 0;
  color: var(--muted-2);
  overflow-wrap: anywhere;
}

.text-glow {
  color: var(--accent-2);
  font-weight: 800;
}

.select-all {
  user-select: all;
}

.italic {
  font-style: italic;
}

.error-message-box {
  width: 100%;
  max-width: 520px;
  padding: 13px;
  color: #fecdd3;
  background: var(--danger-bg);
  border: 1px solid rgba(251, 113, 133, 0.28);
  border-radius: var(--radius);
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.history-card {
  max-height: 410px;
  display: flex;
  flex-direction: column;
}

.history-list {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.history-empty {
  padding: 30px 10px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.history-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  background: #0f1621;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-item:hover {
  border-color: var(--line-strong);
}

.history-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-name {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  width: min(390px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(15, 22, 33, 0.96);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
}

.toast.success {
  border-left-color: var(--accent);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.info {
  border-left-color: var(--accent-2);
}

.toast.fade-out {
  animation: toast-out 0.18s ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1080px) {
  .app-workspace {
    grid-template-columns: 1fr;
  }

  .workspace-outputs {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-copy h1 {
    font-size: 1.1rem;
  }

  .brand-copy p {
    font-size: 0.84rem;
  }

  .status-widget {
    width: 100%;
    justify-content: space-between;
    white-space: normal;
  }

  .workspace-inputs,
  .monitor-card,
  .history-card {
    padding: 12px;
  }

  .tabs-nav {
    position: static;
    grid-template-columns: 1fr;
  }

  .tab-btn {
    justify-content: flex-start;
    padding-inline: 12px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .pause-grid,
  .voice-hints-grid {
    grid-template-columns: 1fr;
  }

  .prosody-footnote {
    align-items: flex-start;
    flex-direction: column;
  }

  .prosody-heading {
    gap: 10px;
  }

  .prosody-description {
    font-size: 0.74rem;
  }

  .prosody-heading-action {
    gap: 6px;
  }

  .prosody-enabled-state {
    padding-inline: 7px;
    font-size: 0.68rem;
  }

  .prosody-enable-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .prosody-enable-row .switch-label.compact-switch {
    width: 100%;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .input-action-row {
    grid-template-columns: 1fr;
  }

  .gpu-key-input-head {
    align-items: stretch;
    flex-direction: column;
  }

  .btn-sec,
  .submit-btn {
    width: 100%;
  }

  .token-status-info {
    align-items: flex-start;
    flex-direction: column;
  }

  .text-note {
    text-align: left;
  }

  .gpu-key-pool-head,
  .gpu-key-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .gpu-key-pool-summary,
  .gpu-key-state {
    white-space: normal;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .history-card {
    max-height: none;
  }

  .history-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .history-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 8px;
  }

  .app-header,
  .workspace-inputs,
  .monitor-card,
  .history-card {
    border-radius: 6px;
  }

  textarea,
  input[type="text"],
  input[type="number"],
  input[type="password"],
  .custom-select {
    font-size: 0.92rem;
  }

  .upload-dropzone {
    min-height: 152px;
    padding: 16px;
  }

  .monitor-state h3 {
    font-size: 1.04rem;
  }

  .toast-container {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }
}
