:root {
  color-scheme: dark;
  --primary: #ea580c;
  --accent: #10b981;
  --bg: #0b1020;
  --surface: #111827;
  --surface-2: #172033;
  --text: #f8fafc;
  --muted: #a9b5c7;
  --border: rgba(148, 163, 184, 0.24);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f7fafc;
  --surface: #ffffff;
  --surface-2: #eef4f7;
  --text: #102033;
  --muted: #506176;
  --border: rgba(15, 23, 42, 0.15);
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10001;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
}
.skip-link:focus { top: 12px; }
.app-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  gap: 14px;
  align-content: center;
  background: var(--bg);
  transition: opacity 0.24s ease, visibility 0.24s ease;
}
.app-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}
.loader-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255,255,255,0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 32px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.brand {
  text-decoration: none;
  font-weight: 800;
  color: var(--text);
}
.top-actions { display: flex; align-items: center; gap: 8px; }
.language-select, .icon-btn, .ghost-btn, .primary-btn {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.language-select { padding: 0 12px; }
.icon-btn {
  min-width: 44px;
  cursor: pointer;
  font-weight: 800;
}
.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 4vw, 28px) 40px;
}
.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 20px 0 22px;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}
.subtitle {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 16px;
}
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.trust-strip span {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  margin-top: 18px;
}
.tool-panel, .side-panel, .result-panel, .ad-container, .related-tools {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.tool-panel, .side-panel, .result-panel, .related-tools { padding: 18px; }
.side-panel h2, .result-panel h2, .related-tools h2 {
  margin: 0 0 12px;
  font-size: 18px;
}
.side-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 24%, transparent);
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.primary-btn {
  padding: 0 16px;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.ghost-btn {
  padding: 0 14px;
  cursor: pointer;
  color: var(--text);
}
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.result-output {
  display: grid;
  gap: 10px;
  min-height: 72px;
  color: var(--muted);
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.metric {
  padding: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.metric strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  overflow-wrap: anywhere;
}
.metric span { display: block; margin-top: 4px; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
th, td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--muted);
}
th { color: var(--text); }
.status-ok { color: #34d399; }
.status-bad { color: #fb7185; }
.preview {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.ad-container {
  margin-top: 18px;
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 12px;
}
.related-tools { margin-top: 18px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.related-grid a {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  text-align: center;
}
.footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 22px;
  color: var(--muted);
}
.footer a { text-decoration: none; }
@media (max-width: 820px) {
  .hero-band, .tool-layout { grid-template-columns: 1fr; }
  .trust-strip { justify-content: flex-start; }
  .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  h1 { font-size: 30px; }
  .topbar { align-items: flex-start; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
