:root {
  --bg: #0b0f19;
  --surface: #151b2b;
  --surface-hover: #1e2640;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --border: #2d3748;
  --success: #22c55e;
  --danger: #ef4444;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Fira Code", "Consolas", "Monaco", "Courier New", monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav-links { display: flex; gap: 1.5rem; }

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active { color: var(--accent-hover); }

header {
  padding: 3rem 0 2rem;
  text-align: center;
}

header h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.5rem; }

header p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 1rem 0 3rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15);
}

.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.625rem;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.tool-card h3 { font-size: 1.1rem; font-weight: 700; }

.tool-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

.tool-page {
  padding: 2rem 0;
}

.tool-header {
  margin-bottom: 2rem;
}

.tool-header h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.5rem; }

.tool-header p { color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color 0.2s;
}

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { min-height: 140px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover { background: var(--accent-hover); }

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

.btn-secondary:hover { background: var(--border); }

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  min-height: 60px;
  word-break: break-all;
  white-space: pre-wrap;
}

.output:empty::before {
  content: "Result will appear here...";
  color: var(--text-muted);
}

.error { color: var(--danger); }
.success { color: var(--success); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

@media (max-width: 768px) {
  .row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  header h1 { font-size: 1.6rem; }
}

footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2rem;
}
