:root {
  --bg: #f5f8f7;
  --bg-alt: #ffffff;
  --text: #142523;
  --text-muted: #4d605d;
  --accent: #0b3d3a;
  --accent-2: #18b7a6;
  --warn: #b45309;
  --border: #dfe8e6;
  --card-shadow: 0 1px 3px rgba(11, 61, 58, 0.08), 0 8px 24px rgba(11, 61, 58, 0.06);
  --radius: 14px;
  --max-width: 1080px;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1615;
    --bg-alt: #142221;
    --text: #eaf3f1;
    --text-muted: #a9bcb8;
    --accent: #45d9c6;
    --accent-2: #18b7a6;
    --border: #24322f;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

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

a { color: var(--accent-2); }

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: 1.25rem;
}

.section-inner.narrow { max-width: 760px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
}

.brand img { display: block; }

.lang-switch select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

/* Hero */
.hero {
  padding: 2.75rem 0 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  margin: 0 0 0.6rem;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* Tool */
.tool-section { padding: 1rem 0 2.5rem; }

.tool-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.75rem;
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 720px) {
  .tool-card { grid-template-columns: 1fr; }
}

.dial-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}

.dial-wrap canvas {
  max-width: 100%;
  height: auto;
}

.digital-readout {
  position: absolute;
  top: 62%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

#speed-value {
  display: block;
  font-size: 2.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

#speed-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tool-controls { display: flex; flex-direction: column; gap: 1rem; }

.control-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.control-row label { font-size: 0.9rem; color: var(--text-muted); }

.control-row select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.buttons { gap: 0.6rem; }

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn.primary:hover { opacity: 0.92; }

.btn.ghost {
  background: transparent;
}

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

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}

.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-label { font-size: 0.78rem; color: var(--text-muted); }
.stat-value { font-weight: 600; font-variant-numeric: tabular-nums; }

.status-message {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.status-message.error { color: #b3261e; }
.status-message.ok { color: var(--accent-2); }

.safety-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--warn);
  background: rgba(180, 83, 9, 0.08);
  border: 1px solid rgba(180, 83, 9, 0.2);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
}

/* Features */
.features { padding: 1rem 0 2.5rem; }

.features h2 {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.feature-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
}

.feature-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* SEO content */
.seo-content { padding: 1rem 0 2.5rem; }

.seo-content h1, .seo-content h2 {
  font-size: 1.5rem;
  text-align: center;
}

.policy-h2 { text-align: left; font-size: 1.2rem; margin-top: 2rem; }

.seo-content p { color: var(--text-muted); }

/* FAQ */
.faq { padding: 1rem 0 3rem; }

.faq h2 { text-align: center; font-size: 1.5rem; margin-bottom: 1.25rem; }

.faq-list { display: flex; flex-direction: column; gap: 0.6rem; }

details {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

summary {
  font-weight: 600;
  cursor: pointer;
}

details p {
  margin: 0.6rem 0 0;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: 1.25rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-links a { color: var(--text-muted); text-decoration: underline; }

/* RTL */
html[dir="rtl"] .footer-inner,
html[dir="rtl"] .control-row {
  direction: rtl;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
