.generator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  padding: 24px;
  align-items: start;
  width: 100%;
  max-width: 1560px;
}

.generator-main {
  min-width: 0;
}

.editor-card,
.settings-card,
.submit-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(182, 141, 64, 0.14);
  border-radius: 28px;
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.editor-card {
  display: grid;
  gap: 18px;
  padding: 22px;
  min-height: calc(100vh - 48px);
}

.generator-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.generator-page-header__copy {
  display: grid;
  gap: 6px;
}

.generator-kicker {
  margin: 0;
  color: #9a6700;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.generator-title {
  margin: 0;
  color: #182533;
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  line-height: 1.05;
  text-wrap: balance;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(182, 141, 64, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(46, 64, 82, 0.08), rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.editor-import {
  display: inline-grid;
  gap: 3px;
  padding: 12px 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #182533;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.06);
}

.editor-import__eyebrow {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.editor-import__label {
  font-size: 0.92rem;
}

#upload-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.editor-toolbar-hint {
  margin: 0;
  color: #52637b;
  font-size: 0.9rem;
  line-height: 1.55;
  text-align: right;
}

#textboxes {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.textarea-wrapper {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(249, 250, 251, 0.98), rgba(243, 247, 251, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.segment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.segment-label {
  color: #182533;
  font-size: 0.98rem;
  font-weight: 800;
}

.segment-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.char-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(46, 64, 82, 0.08);
  color: #52637b;
  font-size: 0.8rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: clamp(320px, 52vh, 620px);
  margin: 0;
  padding: 22px 24px;
  border-radius: 22px;
  resize: vertical;
  font-size: 1rem;
  line-height: 1.65;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

textarea::placeholder {
  color: #8a94a3;
}

.minus-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 999px;
  border: 0;
  background: rgba(46, 64, 82, 0.92);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.minus-btn.is-clear {
  background: rgba(46, 64, 82, 0.16);
  color: #314152;
}

.config-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

.transition-music-select,
.voice-select {
  margin: 0;
  border-radius: 16px;
}

.segment-style-details,
.settings-disclosure {
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.segment-style-details[hidden] {
  display: none !important;
}

.segment-style-details__summary,
.settings-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  list-style: none;
  cursor: pointer;
}

.segment-style-details__summary::-webkit-details-marker,
.settings-disclosure summary::-webkit-details-marker {
  display: none;
}

.segment-style-details__title,
.settings-disclosure summary span:first-child {
  color: #243447;
  font-size: 0.9rem;
  font-weight: 800;
}

.segment-style-details__hint,
.settings-disclosure-hint {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.segment-style-details__body,
.settings-disclosure-body {
  padding: 0 16px 16px;
}

.voice-instructions-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(182, 141, 64, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(46, 64, 82, 0.08), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(182, 141, 64, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.voice-instructions-panel[hidden] {
  display: none !important;
}

.voice-instructions-panel .neo-voice-picker__description {
  max-width: 48ch;
}

.button-container {
  display: flex;
  justify-content: flex-start;
  padding-bottom: 4px;
}

.add-field-btn {
  border: 0;
  color: #fff;
  padding: 13px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2e4052, #41596f);
  box-shadow: 0 14px 24px rgba(46, 64, 82, 0.16);
}

.audio-settings {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  min-width: 0;
}

.audio-settings-content {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  height: 100%;
}

.settings-card,
.submit-card {
  padding: 20px;
}

.settings-card {
  min-height: 0;
  overflow-y: auto;
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.settings-head h2 {
  margin: 6px 0 0;
  color: #182533;
  font-size: 1.18rem;
  line-height: 1.15;
}

.settings-stack {
  display: grid;
  gap: 12px;
}

.settings-group {
  display: grid;
  gap: 8px;
}

.settings-label {
  color: #52637b;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-mix-grid {
  display: grid;
  gap: 12px;
}

.custom-select,
.language-autocomplete {
  position: relative;
}

.select-selected {
  background: linear-gradient(180deg, #2e4052, #243545);
  color: #fff;
  padding: 13px 14px;
  border-radius: 16px;
  cursor: pointer;
  position: relative;
  padding-right: 42px;
  font-weight: 700;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.select-selected::after {
  content: '\25BC';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.75rem;
}

.select-selected:hover {
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.select-items {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background-color: #f8fafc;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.15);
  border-radius: 18px;
  overflow: hidden;
  z-index: 120;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.select-items div {
  padding: 11px 13px;
  cursor: pointer;
  background-color: #fff;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.select-items div:hover {
  background-color: #eef2f7;
}

.select-hide {
  display: none;
}

.playBtn,
.deleteBtn {
  padding: 3px 8px;
  border-radius: 8px;
  border: none;
  background-color: #8ca2b9;
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.playBtn:hover,
.deleteBtn:hover {
  background-color: var(--primary-color);
  transform: translateY(-1px);
}

.autocomplete-items {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 110;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

.autocomplete-items div {
  padding: 11px 13px;
  cursor: pointer;
  background-color: #fff;
  border-bottom: 1px solid #d4d4d4;
}

.autocomplete-items div:hover {
  background-color: #eef2f7;
}

#languageInput::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.tts-language-select {
  width: 100%;
  min-height: 48px;
  margin: 0;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.tts-language-help {
  color: #64748b;
  font-size: 0.84rem;
  line-height: 1.5;
}

.total-char-count-container {
  background-color: #fff;
  padding: 14px 16px;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
  width: 100%;
  margin-bottom: 12px;
}

#total-char-count {
  color: #1f2937;
  font-weight: 800;
  font-size: 1rem;
}

.article-estimate-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(182, 141, 64, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.article-estimate-total {
  color: #182533;
  font-size: 0.96rem;
  font-weight: 800;
}

.submitBtn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #b68d40, #cda85a);
  color: white;
  padding: 14px 16px;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 800;
  font-size: 1rem;
}

.submitBtn:hover {
  background: linear-gradient(135deg, #aa8135, #bf9847);
}

#soundChart {
  position: fixed;
  bottom: 0;
  left: 225px;
  width: calc(100% - 225px);
  height: 50px;
  background-color: #e9e9e9;
  border: 0;
}

@media (max-width: 1440px) {
  .generator-shell {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 1240px) {
  .generator-page-header,
  .editor-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-toolbar-hint {
    text-align: left;
  }

  .audio-settings {
    position: static;
    height: auto;
    max-height: none;
  }

  .audio-settings-content {
    grid-template-rows: auto;
    height: auto;
  }

  .settings-card {
    overflow: visible;
  }
}

@media (max-width: 1120px) {
  .generator-shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .editor-card {
    min-height: 0;
  }

  textarea {
    min-height: 320px;
  }

  #soundChart {
    left: 0;
    width: 100%;
  }
}

@media (max-width: 720px) {
  .editor-card,
  .settings-card,
  .submit-card,
  .textarea-wrapper {
    border-radius: 22px;
  }

  .config-row,
  .settings-mix-grid {
    grid-template-columns: 1fr;
  }

  .segment-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .segment-meta {
    width: 100%;
    justify-content: space-between;
  }
}
