: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;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 48px;
  color: var(--muted);
}

.account-bar form {
  margin: 0;
}

.account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  text-decoration: none;
}

.account-link:hover {
  background: #edf1f5;
}

.pro-badge {
  padding: 4px 9px;
  color: #6b4300;
  border: 1px solid #e7c36b;
  border-radius: 999px;
  background: #fff4cc;
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.link-button {
  min-height: 38px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.link-button:hover:not(:disabled) {
  background: #edf1f5;
}

.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;
}

.message.success {
  color: #14532d;
  border-color: #b7e4c7;
  background: #effaf3;
}

.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;
}

.settings-shell {
  width: min(760px, calc(100% - 32px));
}

.settings-header {
  padding: 70px 0 34px;
}

.settings-header h1 {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
}

.settings-card {
  display: grid;
  gap: 15px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 80px rgba(17, 24, 39, 0.08);
}

.settings-card h2 {
  margin: 0;
  font-size: 1.8rem;
}

.settings-card p {
  margin: 0;
  line-height: 1.55;
}

.settings-note {
  color: var(--muted);
}

.status-pill {
  width: fit-content;
  padding: 6px 10px;
  color: #5b6470;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f2f5f8;
  font-size: 0.8rem;
  font-weight: 800;
}

.status-pill.active {
  color: #14532d;
  border-color: #b7e4c7;
  background: #effaf3;
}

.danger-button {
  width: fit-content;
  color: #fff;
  background: #9f1239;
}

.danger-button:hover:not(:disabled) {
  background: #7f1230;
}

.cancel-pro-copy {
  margin: 18px 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.cancel-pro-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cancel-pro-actions form,
.cancel-pro-actions button {
  width: 100%;
}

.auth-shell {
  width: min(620px, calc(100% - 32px));
}

.auth-hero {
  min-height: 190px;
}

.auth-card {
  display: grid;
  gap: 18px;
}

.auth-form {
  display: grid;
  gap: 11px;
}

.auth-form button {
  margin-top: 8px;
}

.consent-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
  cursor: pointer;
}

.consent-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--focus);
}

.auth-switch {
  margin: 0;
  color: var(--muted);
}

.auth-modal {
  width: min(520px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 28px));
  margin: auto;
  padding: 24px;
  overflow: auto;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 90px rgba(17, 24, 39, 0.25);
}

.auth-modal::backdrop {
  background: rgba(21, 23, 28, 0.58);
}

.email-opt-in-modal h2 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.15;
}

.email-opt-in-copy {
  margin: 14px 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.email-opt-in-actions {
  display: grid;
  gap: 10px;
}

.pro-price {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 26px 0 12px;
}

.pro-price strong {
  font-size: 2.5rem;
  line-height: 1;
}

.pro-price span,
.pro-copy,
.pro-payment-note {
  color: var(--muted);
}

.pro-copy {
  margin: 0 0 10px;
  font-size: 1.08rem;
  line-height: 1.55;
}

.pro-payment-note {
  margin: 0 0 24px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.pro-actions {
  display: grid;
  gap: 10px;
}

.pro-actions form,
.pro-actions button {
  width: 100%;
}

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

.secondary-button:hover:not(:disabled) {
  background: #edf1f5;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.15;
}

.modal-close {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1.65rem;
  line-height: 1;
}

.modal-close:hover:not(:disabled) {
  color: var(--ink);
  background: #edf1f5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 24px 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f5f8;
}

.auth-tab {
  min-height: 42px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 0.92rem;
}

.auth-tab:hover:not(:disabled) {
  color: var(--ink);
  background: #e8edf3;
}

.auth-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.12);
}

.auth-panel[hidden] {
  display: none;
}

.modal-messages {
  margin-bottom: 18px;
}

a {
  color: var(--accent);
  font-weight: 800;
}

@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%;
  }

  .account-bar {
    align-items: stretch;
    flex-direction: column;
    justify-content: flex-start;
  }

  .account-link {
    width: 100%;
  }

  .cancel-pro-actions {
    grid-template-columns: 1fr;
  }

  .auth-modal {
    padding: 18px;
  }
}
