:root {
  color-scheme: light;
  --ink: #342b24;
  --muted: #75685e;
  --paper: #fffaf0;
  --paper-strong: #fffdf7;
  --ivory: #f8f0df;
  --lotion: #f5ded2;
  --skin: #d9a184;
  --skin-strong: #b96b50;
  --entropic: #7c8f78;
  --entropic-dark: #4f665a;
  --line: #dfcdbb;
  --shadow: 0 18px 48px rgba(84, 62, 43, 0.13);
  --danger: #a33c2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(145deg, rgba(245, 222, 210, 0.95), rgba(255, 250, 240, 0.9) 38%, rgba(217, 161, 132, 0.38) 100%),
    var(--ivory);
  color: var(--ink);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
}

button,
input,
select,
textarea {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.app-header,
.panel-heading,
.section-heading,
.url-row,
.toggle-row,
.action-row,
.view-tabs {
  display: flex;
  align-items: center;
}

.app-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow,
.label,
.metadata-grid span,
.url-label,
.settings-grid label {
  color: var(--skin-strong);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 6px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.05rem, 4vw, 4.25rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.03rem;
  line-height: 1.2;
}

.panel-heading,
.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-heading p,
.section-heading p,
.settings-grid span,
.status,
.video-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.privacy-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(124, 143, 120, 0.35);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 253, 247, 0.78);
  color: var(--entropic-dark);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.input-panel,
.results-panel,
.transcript-section {
  border: 1px solid rgba(223, 205, 187, 0.92);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.93);
  box-shadow: var(--shadow);
}

.input-panel,
.results-panel,
.transcript-section {
  padding: 18px;
}

.url-label {
  display: block;
  margin-bottom: 8px;
}

.url-row {
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 480px;
  resize: vertical;
  padding: 15px;
  line-height: 1.52;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(185, 107, 80, 0.72);
  box-shadow: 0 0 0 3px rgba(217, 161, 132, 0.22);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.5fr) minmax(160px, 0.5fr);
  gap: 12px;
  margin-top: 14px;
}

.wide-setting {
  grid-column: 1 / -1;
}

.settings-grid label {
  display: grid;
  gap: 7px;
}

.settings-grid span {
  font-weight: 600;
  line-height: 1.35;
  text-transform: none;
}

code {
  border-radius: 4px;
  padding: 1px 5px;
  background: #f3e7d7;
  color: #635447;
}

.toggle-row,
.action-row {
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.action-row.compact {
  margin-top: 16px;
}

button,
select {
  cursor: pointer;
  font-weight: 850;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
}

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

.primary-button {
  flex: 0 0 auto;
  background: var(--skin-strong);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  background: #9f5740;
}

.secondary-button,
.tab-button {
  border-color: var(--line);
  background: var(--paper-strong);
  color: var(--ink);
}

.check-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--paper-strong);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
}

.check-toggle input {
  width: 17px;
  min-height: 17px;
  accent-color: var(--skin-strong);
}

.status {
  min-height: 22px;
  margin-top: 12px;
}

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

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

.result-card {
  border: 1px solid rgba(217, 161, 132, 0.34);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, #fff4ea, #fffaf0);
}

.result-card strong {
  display: block;
  margin: 8px 0 5px;
  overflow-wrap: anywhere;
  font-size: 1.45rem;
  line-height: 1.15;
}

.result-card span:last-child {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
}

.metadata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.metadata-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--paper-strong);
}

.metadata-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.transcript-section {
  margin-top: 18px;
}

.view-tabs {
  gap: 8px;
  flex: 0 0 auto;
}

.transcript-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.copy-transcript-button {
  min-height: 36px;
}

.tab-button {
  min-height: 36px;
}

.tab-button.active {
  border-color: rgba(124, 143, 120, 0.45);
  background: #edf1e9;
  color: var(--entropic-dark);
}

#transcriptOutput {
  font-size: 0.96rem;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .app-header,
  .workspace,
  .url-row,
  .settings-grid,
  .section-heading {
    display: block;
  }

  .privacy-pill {
    display: inline-block;
    margin-top: 14px;
  }

  .results-panel {
    margin-top: 14px;
  }

  .url-row .primary-button,
  .toggle-row button,
  .action-row button {
    width: 100%;
  }

  .url-row .primary-button {
    margin-top: 10px;
  }

  .settings-grid label + label {
    margin-top: 12px;
  }

  .metadata-grid {
    grid-template-columns: 1fr;
  }

  .section-heading .transcript-actions {
    margin-top: 12px;
  }

  .transcript-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .copy-transcript-button {
    width: 100%;
  }

  textarea {
    min-height: 420px;
  }
}
