:root {
  color-scheme: light;
  --ink: #15171c;
  --muted: #626a76;
  --line: #d9dee7;
  --surface: #ffffff;
  --page: #f6f7f9;
  --accent: #d8243c;
  --accent-strong: #ad182d;
  --focus: #1f7a8c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(216, 36, 60, 0.08), transparent 28rem),
    linear-gradient(225deg, rgba(31, 122, 140, 0.12), transparent 30rem),
    var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0;
}

.hero {
  display: grid;
  min-height: 210px;
  align-items: end;
  padding: 24px 0;
}

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

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lede {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.messages {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.message {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #f0b8c1;
  border-radius: 8px;
  color: #7f1223;
  background: #fff2f4;
}

.tool {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 20px 80px rgba(17, 24, 39, 0.08);
}

.url-form {
  display: grid;
  gap: 10px;
}

label {
  font-weight: 750;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
}

input:focus {
  border-color: var(--focus);
  outline: 3px solid rgba(31, 122, 140, 0.18);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.video-result {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 22px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  object-fit: cover;
  background: #dce2ea;
}

.video-details {
  min-width: 0;
}

.video-details h2 {
  margin: 0 0 18px;
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.15;
  letter-spacing: 0;
}

dl {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 0 0 22px;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

dd {
  margin: 3px 0 0;
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #f2f5f8;
}

.secondary:hover:not(:disabled) {
  background: #e8edf3;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.is-loading .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.fine-print {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 22px, 960px);
    padding: 24px 0;
  }

  .hero {
    min-height: 160px;
  }

  .tool {
    padding: 16px;
  }

  .input-row,
  .video-result {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .actions,
  .actions form {
    width: 100%;
  }
}
