:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --ink: #171717;
  --muted: #6e675d;
  --line: #d8d0c3;
  --panel: #fffaf1;
  --panel-strong: #fff4de;
  --green: #195f55;
  --green-dark: #0e4039;
  --blue: #255f9f;
  --red: #a33c2f;
  --shadow: 0 18px 50px rgba(57, 45, 25, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(25, 95, 85, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(37, 95, 159, 0.13), transparent 32%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 32px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.3rem, 7vw, 5.6rem);
  line-height: 0.93;
}

h2 {
  font-size: 1.25rem;
}

.privacy-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 250, 241, 0.72);
  color: var(--green-dark);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.92);
  box-shadow: var(--shadow);
}

.upload-panel {
  min-height: 420px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.drop-zone {
  min-height: 260px;
  border: 1.5px dashed #b8ad9d;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: var(--panel-strong);
  text-align: center;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.drop-zone.dragging {
  border-color: var(--green);
  background: #edf7ee;
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  inline-size: 54px;
  block-size: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  font-size: 2rem;
  line-height: 1;
}

.upload-title {
  font-size: 1.35rem;
  font-weight: 850;
}

.upload-subtitle,
.file-meta,
.status,
.empty-state {
  color: var(--muted);
}

.preview {
  width: 100%;
  max-height: 440px;
  border-radius: 8px;
  background: #111;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.94rem;
}

.controls-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #efe5d5;
}

.segment {
  border: 0;
  border-radius: 6px;
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(57, 45, 25, 0.11);
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 760;
}

.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fffdf8;
  color: var(--ink);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 720;
}

.checkbox-row input {
  inline-size: 18px;
  block-size: 18px;
  accent-color: var(--green);
}

.hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.action-row {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.primary-action,
.secondary-action,
.ghost-button,
.download-link {
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 850;
}

.primary-action {
  background: var(--green);
  color: white;
}

.primary-action:hover:not(:disabled) {
  background: var(--green-dark);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-action {
  background: #fffdf8;
  border-color: var(--line);
  color: var(--red);
}

.ghost-button,
.download-link {
  background: #fffdf8;
  border-color: var(--line);
  color: var(--green-dark);
  text-decoration: none;
}

.status {
  min-height: 22px;
  font-size: 0.94rem;
}

progress {
  width: 100%;
  height: 12px;
  accent-color: var(--green);
}

.segments-area {
  margin-top: 18px;
  padding: 18px 0 0;
}

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

.segments-list {
  display: grid;
  gap: 10px;
}

.segment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 250, 241, 0.82);
}

.segment-title {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 850;
}

.segment-index {
  inline-size: 32px;
  block-size: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dcebe5;
  color: var(--green-dark);
  flex: 0 0 auto;
}

.segment-time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.segment-state {
  color: var(--blue);
  font-weight: 780;
  white-space: nowrap;
}

.segment-state.error {
  color: var(--red);
}

.hidden,
[hidden] {
  display: none !important;
}

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

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

  .privacy-pill {
    white-space: normal;
  }

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

  .upload-panel {
    min-height: 0;
  }

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

  .segment-state,
  .download-link {
    justify-self: start;
  }
}
