:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --panel: #ffffff;
  --ink: #211f1b;
  --muted: #6f6a61;
  --line: #ded8cd;
  --accent: #116a6b;
  --accent-dark: #0c4d4e;
  --danger: #b42318;
  --focus: #d59d2f;
  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: var(--bg);
  color: var(--ink);
}

button,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  align-items: stretch;
}

.interview-panel,
.recording-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.interview-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.recording-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.status-pill,
.counter {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.status-pill {
  background: #e8f2ef;
  color: var(--accent-dark);
  font-weight: 700;
}

.status-pill.recording {
  background: #fde8e6;
  color: var(--danger);
}

.counter {
  border: 1px solid var(--line);
  color: var(--muted);
}

.question-area {
  max-width: 760px;
}

.language-control {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.language-control label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 36px 0 12px;
  background: #fffdf9;
  color: var(--ink);
  cursor: pointer;
}

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

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.6rem);
  line-height: 1;
  letter-spacing: 0;
}

.helper-text {
  max-width: 660px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.answer-area,
.transcript-area {
  display: grid;
  gap: 8px;
}

.answer-area label,
.transcript-area label,
.downloads h2 {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.section-label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.transcript-status {
  color: var(--muted);
  font-size: 0.86rem;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: #fffdf9;
  line-height: 1.45;
}

.transcript-box {
  overflow: auto;
  min-height: 130px;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbfa;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

.transcript-box .interim {
  color: var(--muted);
}

textarea:focus,
select:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button {
  min-width: 0;
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

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

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button {
  background: #211f1b;
  color: white;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.video-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  width: 100%;
  border-radius: 8px;
  background: #151412;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recording-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(33, 31, 27, 0.82);
  color: white;
  font-size: 0.86rem;
  font-weight: 800;
}

.recording-badge span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff4d3d;
}

.downloads {
  min-height: 120px;
}

.downloads h2 {
  margin: 0 0 10px;
}

.downloads ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.downloads a {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(33, 31, 27, 0.52);
}

.modal-backdrop[hidden] {
  display: none;
}

.intro-modal {
  display: grid;
  gap: 22px;
  width: min(100%, 560px);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(33, 31, 27, 0.24);
}

.intro-modal h2 {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.intro-modal p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.intro-copy {
  display: grid;
  gap: 14px;
}

.intro-language-control {
  align-items: flex-start;
}

.intro-language-control select {
  min-width: min(100%, 220px);
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 680px);
    padding: 10px 0;
  }

  .interview-panel,
  .recording-panel {
    padding: 18px;
  }

  .recording-panel {
    order: -1;
  }

  .video-frame {
    aspect-ratio: 16 / 10;
  }

  .controls button {
    width: 100%;
  }
}

@media (max-width: 1040px) {
  .controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .intro-modal {
    padding: 20px;
  }
}
