:root {
  color-scheme: light dark;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-dark: #1f2126;
  --text: #1f2126;
  --text-muted: #5f6572;
  --accent: #3d7bfd;
  --accent-dark: #2958b8;
  --accent-soft: rgba(61, 123, 253, 0.12);
  --success: #2db37d;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: var(--surface-dark);
    --text: #f7f9ff;
    --text-muted: #a9b2c7;
    --accent-soft: rgba(61, 123, 253, 0.25);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

body,
button,
input {
  font-family: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
}

.logotype {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-shadow: 0 18px 34px rgba(15, 23, 42, 0.25);
}

.logotype-accent {
  background: linear-gradient(90deg, #6fa2ff 0%, #3d7bfd 45%, #2351ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logotype-main {
  color: var(--text);
}

.app-header h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
}

.app-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  display: grid;
  gap: 2rem;
}

.card {
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid rgba(110, 120, 140, 0.12);
  box-shadow: 0 16px 40px rgba(15, 20, 40, 0.1);
  padding: 2.5rem;
}

.card h2,
.card h3 {
  margin-top: 0;
}

p {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="number"] {
  border: 1px solid rgba(85, 95, 115, 0.2);
  border-radius: 12px;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  color: var(--text);
  background: var(--surface);
}

input[type="number"]:focus-visible {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.input-prefix,
.input-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix span,
.input-suffix span {
  position: absolute;
  pointer-events: none;
  color: var(--text-muted);
  font-weight: 500;
}

.input-prefix span {
  left: 1rem;
}

.input-prefix input {
  padding-left: 2.25rem;
}

.input-suffix span {
  right: 1rem;
}

.input-suffix input {
  padding-right: 2.5rem;
}

.controls {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.controls button {
  flex: 1 1 200px;
  cursor: pointer;
  border-radius: 14px;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

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

.controls button[type="submit"] {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(61, 123, 253, 0.25);
}

.controls button.secondary {
  background: rgba(70, 80, 120, 0.08);
  color: var(--text);
}

.results {
  display: grid;
  gap: 2rem;
}

@media (min-width: 900px) {
  .results {
    grid-template-columns: 320px 1fr;
    align-items: stretch;
  }
}

.result-summary {
  display: grid;
  gap: 1.5rem;
  text-align: center;
}

.progress-ring {
  margin: 0 auto;
  width: clamp(200px, 25vw, 240px);
  aspect-ratio: 1/1;
  position: relative;
}

.progress-ring svg {
  width: 100%;
  height: 100%;
}

.progress-ring .track {
  fill: none;
  stroke: rgba(94, 104, 120, 0.18);
  stroke-width: 12;
}

.progress-ring .indicator {
  fill: none;
  stroke: var(--accent);
  stroke-width: 12;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.6s ease, stroke 0.4s ease;
}

.progress-ring .score {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
}

.result-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.chart-wrapper {
  display: grid;
  gap: 0.75rem;
}

canvas {
  width: 100%;
  border-radius: 16px;
  background: var(--accent-soft);
}

.chart-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.seo-section {
  max-width: 1100px;
  margin: 0 auto 4rem;
  padding: 0 1.5rem;
  display: grid;
  gap: 2rem;
}

.content-card {
  display: grid;
  gap: 0.65rem;
  line-height: 1.6;
}

.content-card h2 {
  margin-bottom: 0.35rem;
}

.content-card p {
  margin-top: 0.35rem;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 24px rgba(61, 123, 253, 0.2);
}

.button-link:hover,
.button-link:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(61, 123, 253, 0.25);
}

.button-link:active {
  transform: translateY(0);
  box-shadow: 0 10px 20px rgba(61, 123, 253, 0.2);
}

.content-page .app-main {
  max-width: 760px;
}

.content-page .card {
  padding: 2.25rem;
}

.content-page .sub-nav {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 0.95rem;
}

.content-page .sub-nav a {
  color: var(--accent);
  text-decoration: none;
}

.content-page .sub-nav a:hover,
.content-page .sub-nav a:focus-visible {
  text-decoration: underline;
}

.footer-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-decoration-thickness: 1px;
}

.footer-link:hover,
.footer-link:focus-visible {
  color: inherit;
  text-decoration-color: currentColor;
}

.feature-list {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.feature-list strong {
  color: var(--text);
}

details {
  background: rgba(80, 90, 120, 0.08);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(90, 100, 120, 0.18);
}

details + details {
  margin-top: 0.75rem;
}

summary {
  font-weight: 600;
  cursor: pointer;
  outline: none;
  padding-block: 0.25rem;
  display: flex;
  align-items: center;
}

summary::marker {
  display: none;
}

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

summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 1rem;
  margin-right: 0.75rem;
  transition: transform 0.2s ease;
}

details[open] summary::before {
  transform: rotate(90deg);
}

.noscript-banner {
  margin: 1.5rem;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  background: #ffefc2;
  color: #4a3600;
  font-weight: 600;
  text-align: center;
}

@media (min-width: 900px) {
  .seo-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seo-section .content-card:last-child {
    grid-column: 1 / -1;
  }
}

.app-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
