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

:root {
  --bg: #f7f8fc;
  --bg-alt: #ffffff;
  --bg-card: #ffffff;
  --nav-bg: #0a2540;
  --nav-text: #e8edf5;
  --nav-hover: rgba(255,255,255,0.1);
  --text: #0a2540;
  --text-muted: #647591;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --accent: #1d6ef5;
  --accent-hover: #1558d6;
  --accent-light: #e8f0fe;
  --accent-2: #00c2a8;
  --accent-3: #f5a623;
  --textarea-bg: #ffffff;
  --textarea-border: #cbd5e1;
  --btn-bg: #f1f5f9;
  --btn-text: #334155;
  --btn-hover: #e2e8f0;
  --btn-active-bg: #0a2540;
  --btn-active-text: #ffffff;
  --stat-bg: #f1f5f9;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --dropdown-bg: #ffffff;
  --dropdown-shadow: 0 8px 32px rgba(0,0,0,0.12);
  --dropdown-border: #e2e8f0;
  --footer-bg: #0a2540;
  --footer-text: #94a3b8;
  --footer-heading: #e8edf5;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --bg-card: #1c2333;
  --nav-bg: #090f1a;
  --nav-text: #c9d1d9;
  --nav-hover: rgba(255,255,255,0.07);
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-light: #6e7681;
  --border: #30363d;
  --accent: #4d8ef7;
  --accent-hover: #6ba3f9;
  --accent-light: #1a2744;
  --accent-2: #00d4b8;
  --textarea-bg: #161b22;
  --textarea-border: #30363d;
  --btn-bg: #21262d;
  --btn-text: #c9d1d9;
  --btn-hover: #30363d;
  --btn-active-bg: #4d8ef7;
  --btn-active-text: #ffffff;
  --stat-bg: #161b22;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --dropdown-bg: #1c2333;
  --dropdown-shadow: 0 8px 32px rgba(0,0,0,0.5);
  --dropdown-border: #30363d;
  --footer-bg: #090f1a;
  --footer-text: #6e7681;
  --footer-heading: #8b949e;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

/* ===== NAV ===== */
nav {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 4px;
}

.logo {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.5px;
  margin-right: 16px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-2);
  border-radius: 50%;
  display: inline-block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  list-style: none;
}

.nav-item {
  position: relative;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--nav-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  opacity: 0.9;
}

.nav-btn:hover {
  background: var(--nav-hover);
  opacity: 1;
}

.nav-btn svg { width: 12px; height: 12px; transition: transform 0.2s; flex-shrink: 0; }
.nav-item.open .nav-btn svg { transform: rotate(180deg); }

.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-border);
  border-radius: var(--radius);
  box-shadow: var(--dropdown-shadow);
  min-width: 220px;
  padding: 6px;
  z-index: 200;
}

.nav-item.open .dropdown { display: block; }

.dropdown a {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  border-radius: var(--radius-xs);
  transition: background 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown a:hover { background: var(--btn-bg); }

.dropdown-grid {
  grid-template-columns: 1fr 1fr;
  min-width: 380px;
}

.nav-item.open .dropdown-grid { display: grid; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.theme-toggle {
  background: var(--nav-hover);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--nav-text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover { background: rgba(255,255,255,0.15); }
.theme-toggle svg { width: 16px; height: 16px; }
.sun-icon, .moon-icon { transition: opacity 0.2s; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: none; }

/* ===== HERO ===== */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
  letter-spacing: 0.3px;
}

h1 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: var(--text);
  max-width: 560px;
  margin-bottom: 8px;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 480px;
}

/* ===== TOOL ===== */
.tool-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.textarea-container {
  position: relative;
  background: var(--bg-card);
  border: 1.5px solid var(--textarea-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.2s;
}

.textarea-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,110,245,0.1);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--btn-bg);
}

.tool-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.tool-icon-btn:hover { background: var(--btn-hover); color: var(--text); }
.tool-icon-btn svg { width: 15px; height: 15px; }

.tool-icon-btn.danger:hover { background: #fee2e2; color: #dc2626; }
[data-theme="dark"] .tool-icon-btn.danger:hover { background: #3b0f0f; color: #f87171; }

#mainText {
  width: 100%;
  min-height: 220px;
  padding: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  line-height: 1.75;
  background: var(--textarea-bg);
  color: var(--text);
  border: none;
  outline: none;
  resize: vertical;
  transition: background 0.2s, color 0.2s;
}

#mainText::placeholder { color: var(--text-light); }

.stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--btn-bg);
}

.stat-pill {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 4px 12px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.stat-pill:last-child { border-right: none; }
.stat-pill span { color: var(--text); font-weight: 600; }

/* ===== CASE BUTTONS ===== */
.case-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.case-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--btn-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}

.case-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.case-btn.active {
  background: var(--btn-active-bg);
  border-color: var(--btn-active-bg);
  color: var(--btn-active-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.case-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  background: var(--btn-bg);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.case-btn.active .case-tag {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 100px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== FEATURES ===== */
.features {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.section-label {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 32px;
  color: var(--text);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.card-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-teal { background: rgba(0,194,168,0.12); color: var(--accent-2); }
.badge-amber { background: rgba(245,166,35,0.12); color: #d97706; }

.card-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.card-preview {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  line-height: 1.6;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ===== FOOTER ===== */
footer {
  background: var(--footer-bg);
  padding: 48px 0 32px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 40px;
}

.footer-brand .logo { margin-bottom: 12px; }

.footer-desc {
  font-size: 13px;
  color: var(--footer-text);
  line-height: 1.6;
  max-width: 220px;
}

.footer-col-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--footer-heading);
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: var(--footer-text);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}

.footer-links a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy {
  font-size: 12px;
  color: var(--footer-text);
}

.footer-legal {
  display: flex;
  gap: 20px;
}

.footer-legal a {
  font-size: 12px;
  color: var(--footer-text);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-legal a:hover { color: #fff; }

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: var(--border);
  max-width: 1200px;
  margin: 0 auto 48px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 32px 16px 24px; }
  .tool-wrap, .features { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 520px) {
  .nav-links { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
}
