* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #f3f4f6;
  color: #111827;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
}

.ad-banner-top {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 15px;
  text-align: center;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.nav {
  margin-bottom: 24px;
}

.nav a {
  color: #6b7280;
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

.nav a:hover {
  color: #111827;
}

.header {
  margin-bottom: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e5f2ff;
  color: #1d4ed8;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.logo-wordmark {
  font-weight: 700;
  letter-spacing: -0.06em;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.subtitle {
  color: #6b7280;
  font-size: 0.95rem;
  max-width: 560px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

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

.tool-section {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 24px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}

/* Color pickers */
.color-picker-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.color-picker-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-picker-item label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="color"] {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  padding: 2px;
  background: #fff;
  flex-shrink: 0;
}

.hex-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #111827;
  background: #f9fafb;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
}

.hex-input:focus {
  outline: none;
  border-color: #1d4ed8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.hex-input.invalid {
  border-color: #ef4444;
  background: #fef2f2;
}

/* Ratio display */
.ratio-display {
  text-align: center;
  padding: 20px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.ratio-number {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #111827;
}

.ratio-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 2px;
}

/* WCAG grid */
.wcag-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wcag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.wcag-label {
  font-size: 0.875rem;
  color: #374151;
  font-weight: 500;
}

.wcag-req {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 2px;
}

.badge-pass {
  background: #dcfce7;
  color: #15803d;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-fail {
  background: #fee2e2;
  color: #dc2626;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Swap button */
.swap-btn {
  width: 100%;
  padding: 9px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.15s;
  font-family: inherit;
}

.swap-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* Preview panel */
.preview-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.preview-header {
  padding: 12px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.preview-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-heading {
  font-size: 1.4rem;
  font-weight: 700;
}

.preview-body {
  font-size: 0.9rem;
  line-height: 1.6;
}

.preview-small {
  font-size: 0.78rem;
}

.preview-btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: default;
}

/* FAQ */
.faq {
  margin-top: 40px;
}

.faq-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: #111827;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.faq-question {
  padding: 14px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #111827;
  user-select: none;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::after {
  content: '+';
  color: #6b7280;
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1;
}

details[open] > .faq-question::after {
  content: '−';
}

.faq-answer {
  padding: 12px 16px 14px;
  border-top: 1px solid #f3f4f6;
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.6;
}

/* Related tools */
.related-tools {
  margin-top: 32px;
}

.related-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #111827;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.related-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s;
}

.related-card:hover {
  border-color: #1d4ed8;
}

.related-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
}

.related-desc {
  font-size: 0.78rem;
  color: #6b7280;
}

/* Bottom ad + footer */
.ad-banner-bottom {
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 20px;
  text-align: center;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
}

.footer {
  margin-top: 12px;
  text-align: center;
  font-size: 0.78rem;
  color: #9ca3af;
}

@media (max-width: 640px) {
  .page { padding: 16px 16px 60px; }
  h1 { font-size: 1.6rem; }
  .color-picker-group { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr 1fr; }
}
