/* ═══════════════════════════════════════════════════
   prefertools — Design System v3 (Light Mode First)
   Warm Parchment · Space Grotesk · DM Sans
   ═══════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:          #f5f0e8;   /* warm parchment page */
  --bg-2:        #ede8df;   /* slightly deeper parchment */

  /* Surfaces (cards) */
  --surface:     #ffffff;   /* card white */
  --surface-2:   #faf7f2;   /* warm off-white */
  --surface-3:   #f0ebe1;   /* warm light */

  /* Borders */
  --border:      #e2d9cc;   /* warm tan */
  --border-2:    #c9bfb0;   /* deeper tan */

  /* Accent — warm terracotta */
  --accent:      #c2622a;
  --accent-hover:#a8501f;
  --accent-dim:  #fdeee5;
  --accent-glow: rgba(194, 98, 42, 0.12);

  /* Semantic colours */
  --green:       #2d7a4f;
  --green-glow:  rgba(45, 122, 79, 0.08);
  --yellow:      #b07d1c;
  --yellow-glow: rgba(176, 125, 28, 0.08);
  --red:         #c0392b;
  --red-glow:    rgba(192, 57, 43, 0.08);
  --blue:        #1a6fa8;

  /* Typography */
  --text-1:      #1a1714;   /* warm near-black */
  --text-2:      #5a524a;   /* warm medium */
  --text-3:      #9c9086;   /* warm muted */

  /* Radii (8 px as spec) */
  --radius:      8px;
  --radius-sm:   8px;
  --radius-xs:   6px;

  --shadow:      0 4px 20px rgba(90, 60, 20, 0.08);
  --transition: color 0.15s, background-color 0.15s, border-color 0.15s,
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Radial dot pattern — markdownfs inspired */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(216, 201, 174, 0.4) 0.75px, transparent 0.75px);
  background-size: 12px 12px;
  pointer-events: none;
  z-index: 0;
}

/* ── Accessibility ──────────────────────────────── */
.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; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Header ─────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(245, 240, 232, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(90, 60, 20, 0.06);
  padding: 0 1.5rem;
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 1rem;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0;
  color: var(--text-1);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-yay {
  font-family: 'Fredoka', 'Comic Neue', cursive;
  font-weight: 600;
  color: var(--accent);
}

.logo-exclaim {
  font-family: 'Fredoka', 'Comic Neue', cursive;
  font-weight: 600;
  color: var(--text-1);
  margin-left: -0.05em;
}

.logo-converter {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--text-2);
  margin-left: 0.05em;
}

.logo-icon {
  display: none;
}

.logo-arrow { color: var(--accent); }

.header-nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: var(--transition);
}

.nav-link:hover { color: var(--text-1); background: var(--surface-2); }

.nav-link--active {
  color: var(--text-1);
  background: var(--surface-3);
  font-weight: 600;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Hero ────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0.75rem;
  text-align: center;
}

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #1a1714 0%, #c2622a 55%, #b07d1c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.55;
}

.hero-sub strong {
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
}

/* Hero stats row */
.hero-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.hero-stat-value {
  font-family: monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.hero-stat-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ── Feature Badges ─────────────────────────────── */
.features-bar {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0.75rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.7rem;
  color: var(--text-2);
  transition: var(--transition);
  white-space: nowrap;
}

.feature-badge:hover { border-color: var(--accent); color: var(--accent); }

.badge-toon { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-1);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-2); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }

.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

.btn.copied { background: var(--green); color: #000; border-color: var(--green); }

.btn-convert-top { font-size: 0.78rem; padding: 0.35rem 0.8rem; }

/* ── Inputs ─────────────────────────────────────── */
.select, select, input[type="text"] {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition);
}

select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ── Layout ─────────────────────────────────────── */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0.75rem auto 0;
  padding: 0 1.5rem 3rem;
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

/* ── Panel ──────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 500px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-header-actions { display: flex; align-items: center; gap: 0.4rem; }

.panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.panel-title .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  animation: pulseDot 2.5s ease-in-out infinite;
}

.row-count {
  display: inline-flex;
  padding: 0.12rem 0.45rem;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 100px;
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.panel-body {
  flex: 1;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
}

/* ── Drop Zone ──────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, var(--accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: rgba(167,139,250,0.02); }
.drop-zone:hover::before, .drop-zone.drag-over::before { opacity: 1; }

.drop-zone-icon { font-size: 1.8rem; display: block; margin-bottom: 0.4rem; position: relative; z-index: 1; }
.drop-zone-text { position: relative; z-index: 1; }
.drop-zone-text p { color: var(--text-2); font-size: 0.85rem; margin-bottom: 0.15rem; }
.drop-zone-text .highlight { color: var(--accent); font-weight: 600; }
.drop-zone-text small { color: var(--text-3); font-size: 0.72rem; }

#file-input { position: absolute; opacity: 0; width: 0; height: 0; }

.or-divider { display: flex; align-items: center; gap: 0.55rem; color: var(--text-3); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; flex-shrink: 0; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── CSV Textarea ────────────────────────────────── */
.csv-textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font-family: monospace;
  font-size: 0.76rem;
  line-height: 1.5;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-1);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.csv-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.csv-textarea::placeholder { color: var(--text-3); font-size: 0.73rem; }

/* ── Settings ────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; flex-shrink: 0; }

.setting-group { display: flex; flex-direction: column; gap: 0.25rem; }
.setting-group label:first-child { font-size: 0.68rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.setting-group select, .setting-group input[type="text"] { width: 100%; }
.setting-group--checkbox { justify-content: flex-end; }

.checkbox-group { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-2); cursor: pointer; user-select: none; padding: 0.25rem 0; }
.checkbox-group input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* ── Error ────────────────────────────────────────── */
.error-msg {
  background: var(--red-glow);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--red);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  animation: slideDown 0.25s ease;
  flex-shrink: 0;
}

/* ── Preview Table ───────────────────────────────── */
.preview-section { flex-shrink: 0; }
.preview-heading { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.35rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.preview-heading span { color: var(--text-3); font-weight: 400; text-transform: none; letter-spacing: 0; }

.preview-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 160px; overflow-y: auto; }
.preview-table { width: 100%; border-collapse: collapse; font-family: monospace; font-size: 0.7rem; }
.preview-table th { background: var(--surface-2); padding: 0.35rem 0.5rem; text-align: left; font-family: 'Space Grotesk', sans-serif; font-weight: 600; color: var(--blue); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.preview-table td { padding: 0.28rem 0.5rem; border-bottom: 1px solid var(--border); color: var(--text-2); white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.preview-table tr:last-child td { border-bottom: none; }
.preview-table tr:hover { background: rgba(255,255,255,0.015); }

/* ── Type Table (SQL page) ───────────────────────── */
.type-table-container { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; max-height: 200px; overflow-y: auto; flex-shrink: 0; }
.type-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.type-table th { background: var(--surface-2); padding: 0.4rem 0.65rem; text-align: left; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.66rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.type-table td { padding: 0.35rem 0.65rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.type-table tr:last-child td { border-bottom: none; }
.type-table tr:hover { background: rgba(255,255,255,0.015); }
.col-name { font-family: 'JetBrains Mono', monospace; font-size: 0.73rem; color: var(--blue); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-val { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-3); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-select { padding: 0.25rem 0.4rem; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface); color: var(--yellow); font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; outline: none; cursor: pointer; max-width: 150px; }
.type-select:focus { border-color: var(--accent); }

/* ── Convert Row ─────────────────────────────────── */
.convert-row { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; margin-top: auto; padding-top: 0.2rem; }
.convert-btn { font-size: 0.88rem; padding: 0.55rem 1.5rem; position: relative; overflow: hidden; }
.convert-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%); transform: translateX(-100%); transition: transform 0.4s; }
.convert-btn:hover:not(:disabled)::after { transform: translateX(100%); }
.convert-hint { font-size: 0.7rem; color: var(--text-3); font-family: 'JetBrains Mono', monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.12rem 0.35rem; }

/* ── Output Panel ────────────────────────────────── */
.output-actions { display: flex; gap: 0.4rem; }

.btn-advanced { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.btn-advanced:hover { background: var(--surface-3); color: var(--text-1); }

.advanced-panel { margin-top: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.advanced-panel.hidden { display: none; }
.advanced-header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem; background: var(--surface-3); border-bottom: 1px solid var(--border); }
.advanced-title { font-size: 0.8rem; font-weight: 600; color: var(--text-1); }
.advanced-close { background: none; border: none; font-size: 1.2rem; color: var(--text-3); cursor: pointer; padding: 0 0.25rem; line-height: 1; }
.advanced-close:hover { color: var(--text-1); }
.advanced-content { padding: 0.75rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.advanced-section { }
.advanced-section-title { font-size: 0.72rem; color: var(--text-2); font-weight: 600; margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }
.advanced-options { display: flex; flex-direction: column; gap: 0.35rem; }
.advanced-option { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-2); cursor: pointer; }
.advanced-option input { accent-color: var(--accent); }
.advanced-select { width: 100%; padding: 0.35rem 0.5rem; font-size: 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text-1); }
.btn-active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

/* ── Token Calculator ────────────────────────────── */
.section-heading { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.55rem; font-weight: 700; }

.token-comparison-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.65rem; flex-wrap: wrap; gap: 0.5rem; }
.token-comparison-header .section-heading { margin-bottom: 0; }

.token-summary { font-size: 0.74rem; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 0.25rem 0.6rem; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 0.4rem; }
.token-summary-val { color: var(--accent); font-family: monospace; font-size: 0.88rem; }

.token-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.token-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  cursor: pointer;
  transition: var(--transition);
}

.token-card:hover { border-color: var(--border-2); transform: translateY(-1px); }

.token-card--active { border-color: var(--accent) !important; background: rgba(167,139,250,0.06); box-shadow: 0 0 12px var(--accent-glow); }

.token-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }

.token-format-name { font-size: 0.72rem; font-weight: 600; color: var(--text-2); }

.token-badge {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: monospace;
  padding: 0.1rem 0.4rem;
  border-radius: 100px;
}

.token-winner  .token-badge { background: var(--green-glow); color: var(--green); border: 1px solid rgba(74,222,128,0.2); }
.token-better  .token-badge { background: var(--yellow-glow); color: var(--yellow); border: 1px solid rgba(251,191,36,0.2); }
.token-baseline .token-badge { background: var(--red-glow); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }

.token-card-value {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}

.token-unit { font-size: 0.65rem; font-weight: 400; color: var(--text-3); }

.token-card-cost { font-size: 0.65rem; color: var(--text-3); margin-top: 0.2rem; font-family: monospace; }

/* ── Format Tabs ─────────────────────────────────── */
.format-tabs {
  display: flex;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.format-tab {
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'DM Sans', sans-serif;
}

.format-tab:hover { border-color: var(--border-2); color: var(--text-1); }

.format-tab--active {
  border-color: var(--accent);
  background: rgba(167,139,250,0.08);
  color: var(--accent);
  font-weight: 600;
}

/* ── Output Textarea ─────────────────────────────── */
.output-textarea,
.sql-output {
  flex: 1;
  width: 100%;
  min-height: 300px;
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  line-height: 1.5;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-1);
  outline: none;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
}

.output-textarea:focus,
.sql-output:focus { border-color: var(--border-2); }

/* ── Empty / Loading State ───────────────────────── */
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem 1.25rem; color: var(--text-3); min-height: 280px; }
.empty-state-icon { font-size: 2.75rem; margin-bottom: 0.85rem; opacity: 0.3; font-family: 'JetBrains Mono', monospace; }
.empty-state p { font-size: 0.85rem; max-width: 240px; line-height: 1.5; }
.empty-state-hint { margin-top: 0.35rem !important; font-size: 0.72rem !important; font-family: 'JetBrains Mono', monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.15rem 0.45rem; display: inline-block; }

.loading-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.85rem; min-height: 280px; color: var(--text-2); font-size: 0.88rem; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ── Stats (SQL page) ────────────────────────────── */
.stats { display: flex; gap: 0.75rem; flex-wrap: wrap; flex-shrink: 0; }
.stat-item { display: flex; align-items: center; gap: 0.25rem; font-size: 0.73rem; color: var(--text-3); }
.stat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.stat-value { font-family: 'JetBrains Mono', monospace; color: var(--text-2); font-weight: 600; font-size: 0.76rem; }

/* ── SEO Content ─────────────────────────────────── */
.seo-content { position: relative; z-index: 1; max-width: 820px; margin: 3rem auto; padding: 0 1.5rem; color: var(--text-2); line-height: 1.8; }
.seo-content h2 { font-family: 'Space Grotesk', sans-serif; color: var(--text-1); font-size: 1.15rem; margin: 2rem 0 0.55rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.seo-content h2:first-child { margin-top: 0; }
.seo-content h3 { font-family: 'Space Grotesk', sans-serif; color: var(--text-1); font-size: 0.92rem; margin: 1.25rem 0 0.35rem; }
.seo-content p { margin-bottom: 0.8rem; font-size: 0.9rem; }
.seo-content a { color: var(--accent); text-decoration: none; }
.seo-content a:hover { text-decoration: underline; }
.seo-content code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 4px; font-family: monospace; font-size: 0.82em; color: var(--blue); border: 1px solid var(--border); }

/* ── Footer ─────────────────────────────────────── */
.footer { position: relative; z-index: 1; text-align: center; padding: 1.75rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg-2); color: var(--text-3); font-size: 0.78rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: center; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--text-3); text-decoration: none; font-size: 0.78rem; transition: var(--transition); }
.footer-links a:hover { color: var(--accent); }
.footer-affiliate a { color: var(--accent); text-decoration: none; }
.footer-affiliate a:hover { text-decoration: underline; }

/* ── Animations ──────────────────────────────────── */
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.9); } }
.animate-in { animation: fadeIn 0.3s ease both; }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

.hidden { display: none !important; }

/* ── Responsive: Tablet ──────────────────────────── */
@media (max-width: 960px) {
  .panels { grid-template-columns: 1fr; }
  .app-container { padding: 0.6rem 0.9rem 2rem; }
  .hero { padding: 1.25rem 1rem 0.5rem; }
  .features-bar { padding: 0.4rem 1rem 0; }
  .token-grid { grid-template-columns: repeat(2, 1fr); }
  .convert-row .convert-btn { display: none; }
  .convert-hint { display: none; }
  .btn-convert-top { display: inline-flex !important; }
  .panel { min-height: auto; }
  .hero-stats { gap: 1.25rem; }
}

@media (max-width: 600px) {
  .header-inner { padding: 0; }
  .header { padding: 0 0.65rem; }
  .hero-title { font-size: 1.3rem; }
  .hero-sub { font-size: 0.88rem; }
  .hero-stats { gap: 0.8rem; }
  .hero-stat-value { font-size: 1.1rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .token-grid { grid-template-columns: 1fr; }
  .output-actions { flex-wrap: wrap; }
  .output-actions .btn { flex: 1; justify-content: center; }
  .format-tabs { gap: 0.15rem; }
  .format-tab { padding: 0.3rem 0.5rem; font-size: 0.68rem; }
  .btn-convert-top { width: 100%; justify-content: center; }
  .panel-header-actions { width: 100%; }
  .nav-link { padding: 0.35rem 0.55rem; font-size: 0.75rem; }
}

@media (min-width: 961px) {
  .btn-convert-top { display: none; }
}

/* ── Tools Suite Section ─────────────────────────── */
.tools-suite-section {
  padding: 4rem 1.5rem;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.tools-suite-section .section-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
  text-transform: none;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-2);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(90, 60, 20, 0.05);
}

.tool-card:hover {
  border-color: var(--accent);
  background: var(--surface);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(194, 98, 42, 0.12);
}

.tool-card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.tool-card h3 {
  color: var(--text-1);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.tool-card p {
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}

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