:root{
  --bg:#e5e7eb; 
  --card:#ffffff; 
  --accent:#4338ca; 
  --muted:#4b5563; 
  --danger:#ef4444;
  --radius:12px; 
  --container-w:1000px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: #111827;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.body-no-scroll {
  overflow: hidden;
}

.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 1rem;
  width: 100%;
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Accessibility */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0.5rem;
  background: #000;
  color: #fff;
  z-index: 9999;
}

/* Header & Navigation */
.site-header {
  background: var(--card);
  border-bottom: 1px solid #e5e7eb;
  position: relative;
}

.site-header nav {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 20px;
}

.site-header nav .logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
}

.site-header nav .logo-link img {
  width: 56px;
  height: 56px;
}

.nav-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-links a:hover {
  background: #f3f4f6;
  color: var(--accent);
}

.nav-links a.active {
  font-weight: 600;
  color: var(--accent);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  z-index: 1001;
}

.mobile-menu-btn span {
  width: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: all 0.3s;
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Cards */
.card {
  background: var(--card);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06);
  margin: 1rem 0;
}

.card-main {
  margin-top: 2rem;
}

.card-secondary {
  margin-top: 22px;
}

/* Forms */
.form .label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.input {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.dual {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.column {
  flex: 1;
  min-width: 220px;
}

.column h3 {
  margin-top: 1rem;
}

.grid-2cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-item {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.form-item .input {
  flex: 1;
}

.form-item .weight {
  flex: 0 0 80px;
}

.form-item .btn-remove {
  background: transparent;
  color: var(--muted);
  padding: 0 0.5rem;
  font-size: 1.5rem;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.form-item .btn-remove:hover {
  color: var(--danger);
}

/* Buttons */
button {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
}

button:focus {
  outline: 3px solid rgba(79, 70, 229, 0.2);
  outline-offset: 2px;
}

.btn-outline {
  background: transparent;
  border: 1px solid #d1d5db;
  color: var(--muted);
}

.btn-outline:hover {
  background: #f9fafb;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #3730a3;
}

.btn-ghost {
  background: #eef2ff;
  color: #4338ca;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Results */
.result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
}

.hidden {
  display: none !important;
}

.result-yes {
  background: #dcfce7;
  color: #166534;
}

.result-no {
  background: #fee2e2;
  color: #991b1b;
}

.result-balanced {
  background: #fef9c3;
  color: #854d0e;
}

.chart {
  max-width: 100%;
  height: auto;
  margin: 1rem auto;
  display: block;
}

/* Footer */
.site-footer {
  border-top: 1px solid #e5e7eb;
  padding: 1.5rem 1rem;
  background: var(--card);
  margin-top: auto;
}

.site-footer .footer-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer .footer-content a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}

.site-footer .footer-content a:hover {
  color: var(--accent);
}

/* Popup */
.popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1002;
  padding: 1rem;
}

.popup-content {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.popup-logo {
  display: block;
  margin: 0 auto 1rem;
  width: 80px;
  height: 80px;
}

/* Utility Classes */
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.lead {
  font-size: 1.1rem;
  color: var(--muted);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Page-specific styles */
.page-about .grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.page-about .cta {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #0ea5a4;
  color: white;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s;
}

.page-about .cta:hover {
  background: #0d9493;
}

.page-legal .section {
  background: var(--card);
  padding: 18px;
  border-radius: 12px;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.page-about summary {
  cursor: pointer;
  font-weight: 600;
}

/* Blog post styles */
.step-card,
.reason-card,
.bias-card,
.tip-card {
  background: var(--card);
  padding: 1.25rem;
  border-radius: 12px;
  margin-top: 1.5rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}

blockquote {
  border-left: 4px solid #cbd5e1;
  padding-left: 1rem;
  margin-left: 0;
  font-style: italic;
  color: var(--muted);
}

.post {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.post .meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.post h2,
.post h3 {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.post .excerpt {
  color: var(--muted);
  margin: 0.75rem 0;
}

.read-more {
  text-decoration: none;
  font-weight: 600;
  color: var(--accent);
}

.list-styled {
  padding-left: 1.2rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* Ad slots */
.ad-slot-top,
.ad-slot-bottom {
  margin: 1.5rem 0;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0.75rem;
  }

  .site-header nav {
    padding: 1rem;
  }

  .site-header nav .logo-link img {
    width: 48px;
    height: 48px;
  }

  .brand {
    font-size: 1.25rem;
  }

  /* Show mobile menu button */
  .mobile-menu-btn {
    display: flex;
  }

  /* Hide nav links by default on mobile */
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 300px;
    height: 100vh;
    background: var(--card);
    flex-direction: column;
    padding: 4rem 1rem 1rem;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    gap: 0;
  }

  .nav-links.active {
    right: 0;
  }

  .nav-links a {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
  }

  .grid-2cols {
    grid-template-columns: 1fr;
  }

  .dual {
    flex-direction: column;
  }

  .page-about .grid {
    grid-template-columns: 1fr;
  }

  .site-footer .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .form-item {
    flex-wrap: wrap;
  }

  .form-item .weight {
    flex: 0 0 70px;
  }
}

@media (max-width: 480px) {
  .brand {
    font-size: 1.1rem;
  }

  .card {
    padding: 1rem;
  }

  .input {
    font-size: 14px;
  }

  button {
    padding: 0.5rem 0.75rem;
    font-size: 14px;
  }

  .popup-content {
    padding: 1rem;
  }
}