:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #65717d;
  --line: #d9e0e7;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e0f2ef;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  min-height: calc(100vh - 44px);
}

.sidebar,
.transcript {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  min-width: 0;
  overflow: hidden;
}

.brand p,
.transcript-head p {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.02;
}

.brand h1 {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.8px;
  line-height: 1.1;
}

.brand .tagline {
  display: block;
  margin-top: 5px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
}

h2 {
  font-size: 1.05rem;
}

.drop-zone {
  display: grid;
  min-height: 142px;
  place-items: center;
  gap: 7px;
  border: 1.5px dashed #93a1af;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 20px;
  text-align: center;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-title {
  font-size: 1.1rem;
  font-weight: 850;
}

.drop-copy {
  color: var(--muted);
  font-size: 0.92rem;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field:nth-child(1),
.field:nth-child(2),
.field:nth-child(3) {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

.field input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

.field input[type="range"] {
  width: 100%;
  min-height: unset;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.field.is-hidden {
  display: none;
}

.primary {
  min-height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
}

.primary:not(:disabled):hover {
  background: var(--accent-strong);
}

.downloads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.downloads button,
.transcript-head button {
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-strong);
  font-weight: 800;
}

.downloads button:last-child,
.manual-translate button {
  grid-column: 1 / -1;
}

.manual-translate,
.speech-controls {
  display: none;
  gap: 10px;
  min-width: 0;
}

.manual-translate.is-visible,
.speech-controls {
  display: grid;
  min-width: 0;
}

.manual-translate textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  font: 0.86rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.45;
}

.manual-translate button {
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 750;
}

.check-field input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}



.progress {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf1;
}

.bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.18s ease;
}

.stage {
  display: grid;
  grid-template-rows: minmax(280px, 54vh) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  position: sticky;
  top: 22px;
}

.video-shell {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #11171c;
  box-shadow: var(--shadow);
}

.video-shell video {
  display: block;
  width: 100%;
  height: 100%;
  background: #11171c;
  object-fit: contain;
}

.empty-video {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #c9d2dc;
  font-weight: 800;
  pointer-events: none;
}

.empty-video.is-hidden {
  display: none;
}

.transcript {
  display: flex;
  min-height: 0;
  max-height: 40vh;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.transcript-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 15px 16px;
}

.segments {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding: 14px;
}

.segment-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 14px;
  border: 1px solid #e8edf2;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 11px 12px;
}

.timestamp {
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  white-space: nowrap;
}

.text {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.empty-state {
  margin: auto;
  max-width: 440px;
  color: var(--muted);
  text-align: center;
}

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

.user-guide {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.user-guide h2 {
  font-size: 1.35rem;
  font-weight: 850;
  color: var(--accent-strong);
  margin-bottom: 20px;
  border-bottom: 2px solid var(--accent-soft);
  padding-bottom: 10px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.guide-card {
  position: relative;
  background: #fbfcfd;
  border: 1px solid #e8edf2;
  border-radius: 8px;
  padding: 18px 18px 18px 50px;
  transition: all 0.2s ease;
}

.guide-card:hover {
  border-color: var(--accent);
  background: #fff;
  transform: translateY(-2px);
}

.card-num {
  position: absolute;
  left: 12px;
  top: 16px;
  width: 28px;
  height: 28px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 850;
  font-size: 0.9rem;
}

.guide-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.guide-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 880px) {
  .app {
    width: min(100% - 20px, 680px);
    padding: 12px 0;
  }

  .workspace,
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .video-shell {
    aspect-ratio: 16 / 9;
  }

  .fields,
  .downloads {
    grid-template-columns: 1fr;
  }

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

  .stage {
    position: static;
  }

  .transcript {
    max-height: 60vh;
  }

  .guide-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .user-guide {
    padding: 16px;
  }
}
