/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --border: #475569;
  --error: #f87171;
  --success: #4ade80;
  --radius: 8px;
  --max-width: 1100px;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.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;
}

/* === Header === */
.site-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.logo svg {
  flex-shrink: 0;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

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

.site-nav a:hover {
  color: var(--accent);
}

/* === Hero === */
.hero {
  padding: 3rem 0 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

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

/* === Sections General === */
section {
  padding: 2.5rem 0;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text);
}

/* === Converter Grid === */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.input-panel, .output-panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background-color: var(--surface-light);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.panel-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.delimiter-select {
  background-color: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  cursor: pointer;
}

.row-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.code-area {
  width: 100%;
  min-height: 260px;
  background-color: var(--bg);
  color: var(--text);
  border: none;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  tab-size: 2;
}

.code-area:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.output-area {
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  user-select: all;
}

.input-actions, .output-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background-color: var(--surface-light);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

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

.btn-secondary {
  background-color: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background-color: var(--surface-light);
  border-color: var(--text-muted);
}

/* === Error Message === */
.error-message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background-color: rgba(248, 113, 113, 0.15);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  color: var(--error);
  font-size: 0.9rem;
  display: none;
}

.error-message.visible {
  display: block;
}

/* === Features === */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s;
}

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

.feature-icon {
  margin-bottom: 1rem;
  display: inline-block;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

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

/* === How It Works === */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.step {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  position: relative;
}

.step-number {
  width: 36px;
  height: 36px;
  background-color: var(--accent);
  color: var(--bg);
  font-weight: 800;
  font-size: 1rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.step h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

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

/* === Footer === */
.site-footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: auto;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

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

.footer-links a:hover {
  color: var(--accent);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === Legal Pages === */
.legal-content {
  max-width: 720px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.7;
}

.legal-content h1 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .converter-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .section-title {
    font-size: 1.4rem;
  }

  .code-area {
    min-height: 200px;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav ul {
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

  .hero {
    padding: 2rem 0 1rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .steps-grid {
    grid-template-columns: 1fr;
  }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
