:root {
  --tr-canvas: #f4f7f4;
  --tr-paper: #ffffff;
  --tr-ink: #172019;
  --tr-muted: #647068;
  --tr-green: #087b53;
  --tr-green-dark: #075f42;
  --tr-mint: #e7f4ed;
  --tr-line: #dbe4de;
  --tr-yellow: #f0d64f;
  --tr-danger: #a43d38;
  --tr-shadow: 0 24px 70px rgba(24, 47, 34, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.transcription-page {
  margin: 0;
  color: var(--tr-ink);
  background:
    radial-gradient(circle at 82% 10%, rgba(240, 214, 79, 0.13), transparent 24rem),
    var(--tr-canvas);
  font-family: "Segoe UI", Arial, sans-serif;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.transcription-header {
  width: min(1400px, calc(100% - 48px));
  min-height: 78px;
  margin: 18px auto 0;
  padding: 12px 14px 12px 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--tr-line);
  border-radius: 18px;
  backdrop-filter: blur(18px);
  position: sticky;
  top: 12px;
  z-index: 30;
}

.transcription-brand {
  color: var(--tr-green);
  text-decoration: none;
}

.transcription-brand .brand-mark {
  min-width: 0;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--tr-green);
  font-family: var(--z-display-font);
  font-size: 32px;
  font-weight: 520;
  line-height: 1;
}

.transcription-header nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.transcription-header nav a {
  color: #354139;
  text-decoration: none;
  font-size: 15px;
  font-weight: 650;
}

.transcription-header nav a.is-current { color: var(--tr-green); }

.transcription-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-chip {
  min-height: 48px;
  padding: 4px 14px 4px 5px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--tr-ink);
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.account-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--tr-green);
}

.open-app-button {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--tr-green);
  border-radius: 12px;
  text-decoration: none;
  font-weight: 750;
}

.transcription-page main {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
}

.transcription-intro {
  padding: 42px 12px 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
}

.section-kicker {
  color: var(--tr-green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.transcription-intro h1 {
  max-width: 780px;
  margin: 12px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 5vw, 60px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.055em;
}

.transcription-intro > div > p {
  max-width: 720px;
  margin: 0;
  color: #536057;
  font-size: 19px;
  line-height: 1.55;
}

.quota-card {
  min-width: 320px;
  padding: 15px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--tr-ink);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--tr-line);
  border-radius: 16px;
  text-decoration: none;
}

.quota-card > i:first-child {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--tr-green);
  background: var(--tr-mint);
  border-radius: 12px;
  font-size: 20px;
}

.quota-card span { display: grid; gap: 3px; }
.quota-card strong { font-size: 14px; }
.quota-card small { color: var(--tr-muted); font-size: 12px; }

.transcription-workspace {
  min-height: 650px;
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(520px, 1.2fr);
  background: var(--tr-paper);
  border: 1px solid var(--tr-line);
  border-radius: 24px;
  box-shadow: var(--tr-shadow);
  overflow: hidden;
}

.source-column,
.transcript-column {
  padding: 30px;
  min-width: 0;
}

.source-column {
  background: linear-gradient(145deg, #fbfdfb, #f1f7f3);
  border-right: 1px solid var(--tr-line);
}

.transcript-column {
  display: flex;
  flex-direction: column;
}

.workspace-panel-heading {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 13px;
}

.workspace-panel-heading > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--tr-green);
  background: var(--tr-mint);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}

.workspace-panel-heading h2 {
  margin: 1px 0 5px;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.workspace-panel-heading p {
  margin: 0;
  color: var(--tr-muted);
  font-size: 14px;
  line-height: 1.45;
}

.transcript-heading {
  grid-template-columns: auto 1fr auto;
}

.source-tabs {
  margin: 24px 0 14px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #e8eeea;
  border-radius: 12px;
}

.source-tabs button {
  min-height: 44px;
  color: #566259;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 750;
}

.source-tabs button.is-active {
  color: var(--tr-green);
  background: white;
  box-shadow: 0 3px 12px rgba(23, 32, 25, 0.07);
}

.media-dropzone {
  min-height: 300px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px dashed #9cb7a7;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.media-dropzone:hover,
.media-dropzone.is-dragging {
  border-color: var(--tr-green);
  background: #fff;
  transform: translateY(-2px);
}

.media-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dropzone-mark {
  width: 76px;
  height: 76px;
  margin-bottom: 20px;
  display: grid;
  place-items: center;
  color: var(--tr-green);
  background: var(--tr-mint);
  border-radius: 22px;
  position: relative;
  font-size: 31px;
}

.dropzone-mark i:last-child {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  position: absolute;
  right: -6px;
  bottom: -5px;
  color: var(--tr-ink);
  background: var(--tr-yellow);
  border: 3px solid white;
  border-radius: 50%;
  font-size: 14px;
}

.media-dropzone strong { font-size: 20px; }
.media-dropzone > span:not(.dropzone-mark) { margin-top: 7px; color: var(--tr-muted); }
.media-dropzone small { margin-top: 20px; color: #758078; font-size: 12px; }

.recorder-card {
  min-height: 300px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: white;
  border: 1px solid var(--tr-line);
  border-radius: 18px;
}

.youtube-card {
  min-height: 300px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: white;
  border: 1px solid var(--tr-line);
  border-radius: 18px;
}

.youtube-mark {
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  color: #c9292c;
  background: #fff0f0;
  border-radius: 16px;
  font-size: 27px;
}

.youtube-card strong { font-size: 19px; }
.youtube-card p { margin: 7px 0 20px; color: var(--tr-muted); line-height: 1.5; }
.youtube-card label { margin-bottom: 7px; font-size: 12px; font-weight: 800; }
.youtube-card > small { margin-top: 9px; color: #758078; font-size: 11px; line-height: 1.4; }

.youtube-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.youtube-input-row input {
  min-width: 0;
  min-height: 48px;
  padding: 0 13px;
  color: var(--tr-ink);
  background: #fbfdfb;
  border: 1px solid #bdcbc2;
  border-radius: 12px;
}

.youtube-input-row input:focus {
  border-color: var(--tr-green);
  box-shadow: 0 0 0 3px rgba(8, 123, 83, 0.1);
  outline: 0;
}

.recorder-visual {
  height: 68px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.recorder-visual span {
  width: 5px;
  height: 22px;
  background: var(--tr-green);
  border-radius: 10px;
}

.recorder-visual span:nth-child(2),
.recorder-visual span:nth-child(6) { height: 40px; }
.recorder-visual span:nth-child(3),
.recorder-visual span:nth-child(5) { height: 58px; }
.recorder-visual span:nth-child(4) { height: 30px; }
.recorder-visual.is-recording span { animation: recorderPulse 0.75s ease-in-out infinite alternate; }
.recorder-visual.is-recording span:nth-child(2n) { animation-delay: -0.35s; }

@keyframes recorderPulse { to { transform: scaleY(0.35); opacity: 0.55; } }

.recorder-card strong { font-size: 19px; }
.recorder-card p { max-width: 330px; margin: 9px 0 22px; color: var(--tr-muted); }
.recorder-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action { color: white; background: var(--tr-green); border: 1px solid var(--tr-green); }
.secondary-action { color: var(--tr-ink); background: white; border: 1px solid var(--tr-line); }
.secondary-action.danger { color: var(--tr-danger); }
.text-action { color: var(--tr-muted); background: transparent; border: 0; cursor: pointer; font-weight: 700; }

.selected-file {
  margin-top: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px solid var(--tr-line);
  border-radius: 13px;
}

.selected-file > i { color: var(--tr-green); font-size: 23px; }
.selected-file span { min-width: 0; display: grid; gap: 3px; }
.selected-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.selected-file small { color: var(--tr-muted); }
.selected-file button { width: 34px; height: 34px; border: 0; border-radius: 9px; background: #f0f3f1; cursor: pointer; }

.transcribe-button {
  width: 100%;
  min-height: 58px;
  margin-top: 14px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--tr-green);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
}

.transcribe-button:disabled { cursor: not-allowed; background: #9aaba0; }
.source-consent { margin: 12px 4px 0; color: #7b857e; font-size: 11px; line-height: 1.45; text-align: center; }
.source-consent a { color: inherit; }

.transcript-actions { display: flex; align-items: center; gap: 7px; }
.transcript-actions button {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tr-green);
  background: #f1f7f3;
  border: 1px solid var(--tr-line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.transcript-empty,
.processing-state {
  flex: 1;
  min-height: 440px;
  padding: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.speech-rail {
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--tr-green);
}

.speech-rail span { width: 4px; height: 18px; background: var(--tr-green); border-radius: 6px; }
.speech-rail span:nth-child(2), .speech-rail span:nth-child(4) { height: 32px; }
.speech-rail span:nth-child(3) { height: 46px; }
.speech-rail i { margin: 0 13px; font-size: 25px; }
.speech-rail b { padding: 9px 12px; color: var(--tr-ink); background: #f6f8f6; border: 1px solid var(--tr-line); border-radius: 9px; font-family: Georgia, serif; font-size: 18px; }
.transcript-empty strong { font-family: Georgia, serif; font-size: 27px; }
.transcript-empty p { max-width: 430px; margin: 12px 0 0; color: var(--tr-muted); line-height: 1.6; }

.processing-orbit {
  width: 74px;
  height: 74px;
  margin-bottom: 24px;
  border: 1px solid #b8d2c3;
  border-radius: 50%;
  position: relative;
  animation: orbitSpin 1.2s linear infinite;
}

.processing-orbit span { width: 17px; height: 17px; position: absolute; top: 2px; left: 8px; background: var(--tr-yellow); border-radius: 50%; }
@keyframes orbitSpin { to { transform: rotate(360deg); } }
.processing-state strong { font-family: Georgia, serif; font-size: 25px; }
.processing-state p { color: var(--tr-muted); }
.processing-line { width: min(320px, 80%); height: 5px; margin-top: 20px; overflow: hidden; background: #edf1ee; border-radius: 99px; }
.processing-line span { display: block; width: 45%; height: 100%; background: var(--tr-green); border-radius: inherit; animation: loadingLine 1.8s ease-in-out infinite; }
@keyframes loadingLine { 0% { transform: translateX(-110%); } 100% { transform: translateX(250%); } }

.transcript-editor {
  flex: 1;
  width: 100%;
  min-height: 470px;
  margin-top: 20px;
  padding: 24px;
  resize: vertical;
  color: var(--tr-ink);
  background:
    linear-gradient(to bottom, transparent 31px, #edf1ee 32px);
  background-size: 100% 32px;
  border: 1px solid var(--tr-line);
  border-radius: 15px;
  outline: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 32px;
}

.transcript-editor:focus { border-color: var(--tr-green); box-shadow: 0 0 0 3px rgba(8, 123, 83, 0.1); }
.transcript-footer { padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.transcript-footer > span { color: var(--tr-muted); font-size: 13px; white-space: nowrap; }

.study-pack-action {
  min-width: 330px;
  padding: 12px 14px 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  color: white;
  background: var(--tr-green-dark);
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  text-align: left;
}

.study-pack-action span { display: grid; gap: 2px; }
.study-pack-action small { color: #cae7d9; }

.workspace-status {
  margin: 14px 0 0;
  padding: 13px 16px;
  border: 1px solid var(--tr-line);
  border-radius: 12px;
  background: white;
  font-weight: 650;
}

.workspace-status.is-error { color: #842d29; border-color: #e7c2bf; background: #fff6f5; }
.workspace-status.is-success { color: #075f42; border-color: #bbdaca; background: #f1faf5; }

.transcription-explainer,
.transcription-faq {
  margin-top: 90px;
}

.explainer-lead { max-width: 780px; }
.explainer-lead h2,
.transcription-faq h2 {
  margin: 12px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.explainer-lead p { color: var(--tr-muted); font-size: 18px; line-height: 1.7; }
.explainer-grid { margin-top: 34px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.explainer-grid article { min-height: 230px; padding: 24px; background: white; border: 1px solid var(--tr-line); border-radius: 17px; }
.explainer-grid article > span { width: 32px; height: 32px; display: grid; place-items: center; color: var(--tr-green); background: var(--tr-mint); border-radius: 9px; font-weight: 800; }
.explainer-grid h3 { margin: 30px 0 8px; font-size: 20px; }
.explainer-grid p { margin: 0; color: var(--tr-muted); line-height: 1.6; }

.transcription-faq { max-width: 900px; margin-bottom: 100px; }
.transcription-faq details { border-top: 1px solid var(--tr-line); }
.transcription-faq details:last-child { border-bottom: 1px solid var(--tr-line); }
.transcription-faq summary { padding: 22px 4px; cursor: pointer; font-size: 18px; font-weight: 750; }
.transcription-faq details p { margin: -5px 4px 24px; color: var(--tr-muted); line-height: 1.7; }

.transcription-footer-site {
  padding: 34px max(24px, calc((100vw - 1400px) / 2));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  color: #c9d4cd;
  background: #18241d;
}

.transcription-footer-site .transcription-brand { color: white; font-size: 25px; }
.transcription-footer-site p { margin: 0; }
.transcription-footer-site nav { display: flex; gap: 20px; }
.transcription-footer-site nav a { color: #d8e0db; text-decoration: none; }

.auth-overlay {
  position: fixed;
  inset: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(16, 25, 20, 0.64);
  z-index: 100;
}

.auth-dialog {
  width: min(470px, 100%);
  max-height: calc(100vh - 40px);
  padding: 34px;
  overflow: auto;
  background: white;
  border-radius: 22px;
  box-shadow: var(--tr-shadow);
  position: relative;
}

.auth-close { width: 40px; height: 40px; position: absolute; top: 16px; right: 16px; border: 0; border-radius: 50%; background: #f0f3f1; cursor: pointer; font-size: 21px; }
.auth-mark { width: 48px; height: 48px; display: grid; place-items: center; color: var(--tr-green); background: var(--tr-mint); border-radius: 14px; font-size: 24px; }
.auth-dialog h2 { margin: 20px 0 8px; font-family: Georgia, serif; font-size: 30px; line-height: 1.1; }
.auth-dialog > p { color: var(--tr-muted); line-height: 1.5; }
.auth-tabs { margin: 24px 0 18px; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; background: #edf1ee; border-radius: 12px; }
.auth-tabs button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 750; }
.auth-tabs button.is-active { color: var(--tr-green); background: white; }
.auth-dialog form { display: grid; gap: 14px; }
.auth-dialog form label { display: grid; gap: 7px; font-size: 13px; font-weight: 750; }
.auth-dialog form input { min-height: 48px; padding: 0 13px; border: 1px solid #cdd7d0; border-radius: 11px; outline: 0; }
.auth-dialog form input:focus { border-color: var(--tr-green); box-shadow: 0 0 0 3px rgba(8, 123, 83, 0.1); }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-status { min-height: 20px; margin: 12px 0 0; color: var(--tr-danger) !important; font-size: 13px; }
.verification-state { padding: 18px; text-align: center; background: #f1faf5; border: 1px solid #bbdaca; border-radius: 14px; }
.verification-state > i { color: var(--tr-green); font-size: 31px; }
.verification-state strong { display: block; margin-top: 8px; }
.verification-state p { color: var(--tr-muted); line-height: 1.5; }
.verification-state button { min-height: 42px; padding: 0 15px; color: var(--tr-green); background: white; border: 1px solid #acd0bc; border-radius: 10px; cursor: pointer; font-weight: 750; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(8, 123, 83, 0.35);
  outline-offset: 3px;
}

@media (max-width: 1050px) {
  .transcription-header nav { display: none; }
  .transcription-header { grid-template-columns: 1fr auto; }
  .transcription-intro { align-items: stretch; flex-direction: column; gap: 22px; }
  .quota-card { min-width: 0; max-width: 460px; }
  .transcription-workspace { grid-template-columns: 1fr; }
  .source-column { border-right: 0; border-bottom: 1px solid var(--tr-line); }
  .transcript-empty, .processing-state { min-height: 360px; }
}

@media (max-width: 700px) {
  .transcription-header,
  .transcription-page main { width: min(100% - 24px, 1400px); }
  .transcription-header { min-height: 64px; margin-top: 8px; padding: 8px 9px 8px 15px; top: 6px; border-radius: 14px; }
  .transcription-brand .brand-mark { font-size: 27px; }
  .open-app-button { display: none; }
  .account-chip { padding-right: 5px; }
  .account-chip #accountLabel { display: none; }
  .transcription-intro { padding: 40px 2px 20px; }
  .transcription-intro h1 { font-size: clamp(42px, 14vw, 62px); }
  .transcription-intro > div > p { font-size: 16px; }
  .transcription-workspace { border-radius: 18px; }
  .source-column, .transcript-column { padding: 20px 16px; }
  .transcript-heading { grid-template-columns: auto 1fr; }
  .transcript-actions { grid-column: 1 / -1; margin-top: 10px; }
  .media-dropzone, .recorder-card, .youtube-card { min-height: 250px; padding: 22px 16px; }
  .source-tabs button { font-size: 13px; }
  .youtube-input-row { grid-template-columns: 1fr; }
  .youtube-input-row .primary-action { width: 100%; }
  .transcript-empty, .processing-state { min-height: 320px; padding: 32px 12px; }
  .transcript-editor { min-height: 460px; padding: 16px; font-size: 17px; }
  .transcript-footer { align-items: stretch; flex-direction: column; }
  .study-pack-action { min-width: 0; width: 100%; }
  .explainer-grid { grid-template-columns: 1fr; }
  .transcription-explainer, .transcription-faq { margin-top: 64px; }
  .transcription-footer-site { grid-template-columns: 1fr; }
  .transcription-footer-site nav { flex-wrap: wrap; }
  .auth-dialog { padding: 28px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
