/* Смотрибельность матча — design tokens + layout (design contract) */

:root {
  --bg: #F5F6F5;
  --surface: #FFFFFF;
  --text: #1F1F1F;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --accent-green: #12A150;
  --accent-green-dark: #0d7a3c;
  --accent-amber: #E0A800;
  --accent-gray: #9CA3AF;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-card: 0 1px 2px rgba(31, 31, 31, 0.04), 0 8px 24px rgba(31, 31, 31, 0.06);
  --shadow-card-hover: 0 4px 10px rgba(31, 31, 31, 0.06), 0 16px 32px rgba(31, 31, 31, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  padding: 56px 20px 96px;
  display: flex;
  justify-content: center;
}

.shell {
  width: 100%;
  max-width: 760px;
}

/* ── Header ─────────────────────────────────────────────────────── */

.hero-header {
  text-align: center;
  margin-bottom: 32px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-green-dark);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.hero-header h1 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 1.25;
  margin: 0 0 12px;
  color: var(--text);
}

.hero-header .subtitle {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 560px;
  margin: 0 auto;
}

/* ── Search panel ───────────────────────────────────────────────── */

.search-panel {
  margin-bottom: 40px;
}

.search-form {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: var(--shadow-card);
}

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-muted);
}

.search-field input {
  border: none;
  outline: none;
  flex: 1;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: transparent;
}

.search-field input::placeholder {
  color: var(--text-muted);
}

.btn-analyze {
  background: var(--accent-green);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 24px;
  font-weight: 600;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.15s ease, transform 0.1s ease;
  min-height: 52px;
  white-space: nowrap;
}

.btn-analyze:hover {
  background: var(--accent-green-dark);
}

.btn-analyze:active {
  transform: scale(0.98);
}

.btn-analyze:disabled {
  cursor: progress;
  opacity: 0.9;
}

.btn-analyze:focus-visible,
.search-field input:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent-green-dark);
  outline-offset: 2px;
}

.btn-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}

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

.inline-error {
  color: #9a3412;
  background: #fff3ea;
  border: 1px solid #f3c9a8;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 12px 0 0;
  font-size: 14px;
}

/* ── Empty state (before first query) ──────────────────────────── */

.empty-state-caption {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.demo-card {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  gap: 24px;
  align-items: center;
  opacity: 0.85;
}

.demo-score {
  flex: none;
}

.demo-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-green) 0deg 288deg, var(--border) 288deg 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.demo-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  background: var(--surface);
  border-radius: 50%;
}

.demo-ring span {
  position: relative;
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--text);
}

.demo-ring .demo-ring-max {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 1px;
  align-self: flex-end;
  margin-bottom: 6px;
}

.demo-match {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.demo-verdict {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 10px;
  color: var(--text);
}

.demo-facts {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.demo-facts li + li {
  margin-top: 4px;
}

/* ── Result sections ────────────────────────────────────────────── */

.result-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

[data-fade] {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-fade].fade-in {
  opacity: 1;
  transform: translateY(0);
}

.hero-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
}

.score-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  flex: none;
}

.score-ring {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 12;
}

.score-ring-fg {
  fill: none;
  stroke: var(--accent-gray);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 377;
  stroke-dashoffset: 377;
  transition: stroke-dashoffset 1s ease, stroke 0.3s ease;
}

.score-ring-fg.score-high { stroke: var(--accent-green); }
.score-ring-fg.score-mid { stroke: var(--accent-amber); }
.score-ring-fg.score-low { stroke: var(--accent-gray); }

.score-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-size: 56px;
  color: var(--text);
}

.match-title {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 8px;
}

.verdict-title {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 24px;
  margin: 0 0 10px;
  color: var(--text);
}

.verdict-text {
  color: var(--text-muted);
  margin: 0;
}

.facts-card h2,
.alt-section h2 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.facts-card h2 i,
.alt-section h2 i {
  color: var(--accent-green);
}

.facts-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.facts-list li {
  position: relative;
  padding-left: 26px;
  color: var(--text);
}

.facts-list li::before {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 0;
  top: 2px;
  color: var(--accent-green);
  font-size: 13px;
}

.alt-section h2 {
  margin-bottom: 16px;
}

.alt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.alt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.alt-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}

.alt-card-title {
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.alt-card-title i {
  color: var(--accent-amber);
  font-size: 14px;
}

.alt-card-note {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

/* ── Toast ──────────────────────────────────────────────────────── */

.toast-error {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff3ea;
  border: 1px solid #f3c9a8;
  color: #9a3412;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card-hover);
  z-index: 50;
  font-size: 14px;
  max-width: calc(100vw - 32px);
}

.toast-retry {
  background: var(--accent-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.toast-retry:hover {
  background: var(--accent-green-dark);
}

.toast-close {
  background: none;
  border: none;
  color: #9a3412;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* ── Responsive (< 768px) ───────────────────────────────────────── */

@media (max-width: 767px) {
  .page {
    padding: 32px 14px 64px;
  }

  .hero-header h1 {
    font-size: 26px;
  }

  .search-form {
    flex-direction: column;
    padding: 12px;
  }

  .btn-analyze {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }

  .section-card {
    padding: 20px;
  }

  .hero-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 20px;
  }

  .demo-card {
    flex-direction: column;
    text-align: center;
  }

  .alt-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Reduced motion ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  [data-fade] {
    transition: none;
  }
  .score-ring-fg {
    transition: none;
  }
  .spinner {
    animation-duration: 1.6s;
  }
  .alt-card {
    transition: none;
  }
}

.d-none {
  display: none !important;
}
