:root {
  --blue: #2f7df6;
  --blue-dark: #1559c7;
  --green: #009b5a;
  --ink: #172033;
  --muted: #66758a;
  --line: #dbe5f3;
  --panel: #ffffff;
  --soft: #f5f8ff;
  --shadow: 0 18px 48px rgba(26, 86, 190, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 44%, #ffffff 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #e5322d;
  font-size: 14px;
}

.tool-name {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.app-shell {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 72px;
}

.intro {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(38px, 6vw, 58px);
  line-height: 1.08;
}

.input-panel,
.tool-panel,
.media-card,
.transcript-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.input-panel,
.tool-panel {
  box-shadow: var(--shadow);
}

.input-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
}

.transcript-form {
  display: flex;
  min-height: 56px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.transcript-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0 16px;
  color: var(--ink);
}

.transcript-form button,
.transcript-actions button,
.upload-strip label,
.source-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.transcript-actions button.success {
  border-color: #16a34a;
  color: #166534;
  background: #dcfce7;
}

.transcript-form button {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
  padding-inline: 24px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto auto auto;
  align-items: end;
  gap: 14px;
}

.control-row label {
  display: grid;
  gap: 8px;
  color: #44505d;
  font-size: 13px;
  font-weight: 700;
}

.control-row select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.toggle {
  grid-template-columns: 18px max-content;
  align-items: center;
  min-height: 42px;
}

.upload-strip input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.quality-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tool-panel {
  padding: 28px;
}

.tool-header,
.transcript-header,
.media-title-row,
.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.tool-header {
  min-width: 0;
}

.tool-header > div:first-child {
  min-width: 0;
}

.tool-header h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.status {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: #eaf3ff;
  font-weight: 800;
}

.progress {
  height: 8px;
  margin: 18px 0 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eefb;
}

.progress span {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #6d5dfc);
  animation: loading 1.1s infinite ease-in-out;
}

.process-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

@keyframes loading {
  0% {
    transform: translateX(-80%);
  }
  100% {
    transform: translateX(240%);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(420px, 1fr);
  gap: 30px;
  margin-top: 24px;
}

.media-card,
.transcript-card {
  padding: 24px;
}

.media-preview {
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 520px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  color: var(--muted);
  background: #05070d;
  text-align: center;
  padding: 16px;
}

.media-preview.portrait {
  width: min(100%, 330px);
  aspect-ratio: 9 / 16;
  margin-inline: auto;
}

.media-preview.square {
  width: min(100%, 430px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
}

.media-preview.loading span {
  animation: pulse 1.1s ease-in-out infinite;
}

.media-preview img,
.media-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #05070d;
}

.poster-button {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: #05070d;
  cursor: pointer;
}

.poster-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.poster-button.poster-failed {
  display: grid;
  place-items: center;
  color: #dbeafe;
  font-weight: 800;
}


.media-title-row {
  align-items: flex-start;
  margin-top: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.media-title-row h3 {
  margin-bottom: 6px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.media-title-row p,
.media-description,
.stats-row span,
.id-list span {
  color: var(--muted);
}

.media-description {
  margin: 18px 0;
  line-height: 1.65;
}

.stats-row {
  justify-content: flex-start;
  gap: 42px;
  margin-bottom: 18px;
}

.stats-row div {
  display: grid;
  gap: 4px;
}

.stats-row strong {
  font-size: 18px;
}

.stats-row span {
  font-size: 12px;
}

.id-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.id-list div {
  display: grid;
  gap: 5px;
}

.id-list code {
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
}

.source-link {
  display: inline-flex;
  align-items: center;
}

.transcript-card {
  min-width: 0;
}

.transcript-header {
  margin-bottom: 18px;
}

.transcript-header h3 {
  margin-bottom: 0;
  font-size: 22px;
}

.transcript-actions {
  display: flex;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 500px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  padding: 18px 22px;
  color: #111827;
  line-height: 1.7;
  background: #fff;
}

textarea[dir="rtl"] {
  text-align: right;
}

textarea::selection {
  background: #dbeafe;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 32px));
  border-radius: 8px;
  padding: 14px 16px;
  color: #fff;
  background: #172033;
  font-weight: 800;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.24);
}

.toast.success {
  background: #16a34a;
}

.toast.error {
  background: #dc2626;
}

@media (max-width: 980px) {
  .control-row,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .transcript-form,
  .tool-header,
  .transcript-header,
  .stats-row {
    align-items: stretch;
    flex-direction: column;
  }

  .transcript-form {
    display: grid;
  }

  .transcript-form input,
  .transcript-form button {
    min-height: 48px;
  }
}

@media (max-width: 560px) {
  .site-header {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 20px;
  }

  .tool-name {
    text-align: left;
  }
}

.admin-cookies {
  margin: -10px 0 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 16px;
}

.admin-cookies summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.cookie-admin-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.cookie-admin-form label {
  display: grid;
  gap: 7px;
  color: #44505d;
  font-size: 13px;
  font-weight: 700;
}

.cookie-admin-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

.cookie-admin-form button {
  min-height: 42px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 0 14px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.cookie-admin-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 720px) {
  .cookie-admin-form {
    grid-template-columns: 1fr;
  }
}
