:root {
  color-scheme: light;
  --bg: #f3f5fb;
  --bg-accent: rgba(79, 105, 255, 0.13);
  --card: #ffffff;
  --text: #141a2a;
  --text-muted: #5d6780;
  --border: #e4e8f2;
  --field-bg: #fbfcff;
  --accent: #3f5bf6;
  --accent-hover: #3049e0;
  --accent-ring: rgba(63, 91, 246, 0.18);
  --accent-soft: #eef1ff;
  --accent-soft-hover: #e2e7ff;
  --accent-contrast: #ffffff;
  --success: #0d8a5d;
  --success-soft: #e6f7ef;
  --danger: #bf2f39;
  --danger-soft: #fdecec;
  --warning: #975500;
  --warning-soft: #fff4e2;
  --shadow: 0 26px 60px -34px rgba(20, 26, 42, 0.5);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1020;
    --bg-accent: rgba(96, 116, 255, 0.17);
    --card: #131a2c;
    --text: #eef1ff;
    --text-muted: #9aa6c4;
    --border: #263047;
    --field-bg: #0f1626;
    --accent: #8796ff;
    --accent-hover: #a1adff;
    --accent-ring: rgba(135, 150, 255, 0.22);
    --accent-soft: rgba(135, 150, 255, 0.13);
    --accent-soft-hover: rgba(135, 150, 255, 0.2);
    --accent-contrast: #0b1020;
    --success: #5ed6a6;
    --success-soft: rgba(94, 214, 166, 0.12);
    --danger: #ff9198;
    --danger-soft: rgba(255, 145, 152, 0.12);
    --warning: #ffc46b;
    --warning-soft: rgba(255, 196, 107, 0.12);
    --shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.85);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% -12%, var(--bg-accent), transparent 62%),
    radial-gradient(720px 440px at 112% 8%, var(--bg-accent), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px 16px;
}

.card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 38px);
}

.card-header {
  margin-bottom: 26px;
}

.mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  margin-bottom: 18px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 5vw, 1.72rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.97rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 600;
}

.field,
.link-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field {
  height: 50px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 1rem;
}

.field::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.field:focus,
.link-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.hint {
  margin: 8px 0 18px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    transform 0.08s ease, opacity 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  width: 100%;
  height: 50px;
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  cursor: progress;
  opacity: 0.75;
}

.btn-secondary {
  height: 48px;
  flex: 0 0 auto;
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-soft-hover);
}

.btn-ghost {
  height: 42px;
  justify-self: start;
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

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

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

.is-loading .btn-label {
  opacity: 0.85;
}

.status {
  position: relative;
  margin: 20px 0 0;
  padding: 13px 15px 13px 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field-bg);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.status::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status[data-kind="loading"] {
  color: var(--text-muted);
}

.status[data-kind="loading"]::before {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.status[data-kind="error"] {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.status[data-kind="warning"] {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning);
}

.status[data-kind="error"]::before,
.status[data-kind="warning"]::before {
  background: currentColor;
}

.result {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  animation: rise 0.35s ease both;
}

.result-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  color: var(--success);
  background: var(--success-soft);
}

.result h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.result-lead {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.link-box {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.link-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  padding: 0 13px;
  border-radius: 11px;
  font-family: var(--mono);
  font-size: 0.84rem;
}

.steps {
  display: grid;
  gap: 6px;
  margin: 20px 0 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Инструкция «Где взять старую ссылку» */

.guide {
  margin: 0 0 22px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--accent-soft);
}

.guide-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  border-radius: 16px;
}

.guide:not([open]) .guide-summary:hover {
  background: var(--accent-soft-hover);
}

.guide-summary::-webkit-details-marker {
  display: none;
}

.guide-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.guide-icon {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.guide-summary-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.guide-summary-title {
  font-size: 0.93rem;
  font-weight: 650;
  line-height: 1.35;
}

.guide-summary-hint {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.35;
}

.guide-chevron {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-left: auto;
  margin-right: 3px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.guide[open] .guide-chevron {
  transform: rotate(-135deg);
}

.guide[open] .guide-summary {
  border-bottom: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
}

.guide-body {
  padding: 14px 16px 16px;
}

.guide-lead {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.guide-lead code {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.guide-steps {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-step {
  display: grid;
  gap: 9px;
}

.guide-step-text {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  font-size: 0.89rem;
  line-height: 1.5;
}

.guide-step-body {
  flex: 1 1 auto;
  min-width: 0;
}

.guide-step-body code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  font-family: var(--mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.guide-step-num {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}

.guide-note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.shot {
  display: grid;
  gap: 6px;
  justify-items: start;
  margin: 0 0 0 31px;
}

.shot-img {
  display: none;
  width: 100%;
  max-width: 240px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.shot.is-loaded .shot-img {
  display: block;
}

.shot.is-loaded .shot-placeholder {
  display: none;
}

.shot-placeholder {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 9 / 16;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text-muted);
}

.shot-placeholder-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.shot-placeholder-text {
  font-size: 0.8rem;
  line-height: 1.45;
}

.shot-caption {
  max-width: 240px;
  color: var(--text-muted);
  font-size: 0.77rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.support {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 16px;
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--field-bg);
}

.support-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
}

.support-text {
  flex: 1 1 200px;
  min-width: 0;
}

.support-title {
  margin: 0 0 2px;
  font-size: 0.92rem;
  font-weight: 650;
}

.support-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.support-link {
  flex: none;
  text-decoration: none;
}

/* Окно после копирования новой ссылки */

.dialog {
  width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: auto;
}

.dialog[open] {
  animation: rise 0.22s ease both;
}

.dialog::backdrop {
  background: rgba(9, 13, 26, 0.55);
  backdrop-filter: blur(2px);
}

.dialog-body {
  padding: clamp(20px, 5vw, 26px);
}

.dialog-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  color: var(--accent);
  background: var(--accent-soft);
}

.dialog-title {
  margin: 0 0 8px;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}

.dialog-desc {
  margin: 0 0 10px;
  font-size: 0.94rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.dialog-desc strong {
  font-weight: 650;
}

.dialog-note {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.dialog-actions {
  display: grid;
  gap: 8px;
}

.dialog-btn {
  width: 100%;
  text-decoration: none;
}

.footnote {
  max-width: 460px;
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.noscript {
  margin: 0;
  padding: 12px 16px;
  text-align: center;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 0.9rem;
}

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

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 480px) {
  .page {
    justify-content: flex-start;
    padding: 18px 12px 28px;
  }

  .card {
    border-radius: 18px;
    padding: 22px 18px;
  }

  .link-box {
    flex-direction: column;
  }

  .btn-secondary,
  .btn-ghost {
    width: 100%;
    justify-self: stretch;
  }

  .shot {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
