/* ASCII Fold — Diacritics to ASCII Folding Tool */
:root {
  --bg: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #334155;
  --bg-input: #0f172a;
  --border: #334155;
  --border-light: #475569;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-bg: rgba(99,102,241,0.1);
  --accent-border: rgba(99,102,241,0.3);
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --yellow: #eab308;
  --yellow-bg: rgba(234,179,8,0.1);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
  --transition: 0.15s ease;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.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 {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.logo-accent { color: var(--accent); }
.main-nav {
  display: flex;
  gap: 4px;
}
.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: color var(--transition), background var(--transition);
}
.main-nav a:hover, .main-nav a:focus-visible {
  color: var(--text);
  background: var(--bg-elevated);
}

/* Hero */
.hero { padding: 48px 0 32px; }
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 640px;
  margin-bottom: 20px;
}
.sample-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-mono);
}
.chip:hover, .chip:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-bg);
}

/* Workspace */
.workspace { padding: 16px 0 48px; }
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .workspace-grid { grid-template-columns: 1fr; }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.panel-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Input panel */
.input-panel, .output-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.input-area {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 14px;
  resize: vertical;
  min-height: 140px;
  transition: border-color var(--transition);
  line-height: 1.5;
}
.input-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.input-area::placeholder { color: var(--text-dim); }
.input-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 8px;
}
.preset-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.preset-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-right: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  white-space: nowrap;
}
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-xs { padding: 4px 10px; font-size: 0.78rem; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-light); }
.btn-outline { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-outline:hover { color: var(--text); border-color: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Results */
.results-wrap { min-height: 120px; }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-dim);
  text-align: center;
  gap: 12px;
}
.empty-state p { font-size: 0.9rem; }
.results-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.results-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.results-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:hover td { background: rgba(99,102,241,0.05); }
.char-original { font-size: 1.1rem; color: var(--text); }
.char-codepoint { color: var(--text-dim); font-size: 0.8rem; }
.char-name { color: var(--text-muted); font-size: 0.78rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.fold-result { color: var(--green); }
.fold-na { color: var(--text-dim); font-style: italic; }

.output-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-group label { font-size: 0.85rem; color: var(--text-muted); }
.select-sm {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.select-sm:focus { outline: none; border-color: var(--accent); }

.output-preview { margin-top: 16px; }
.output-preview h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.code-block {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
  max-height: 300px;
  overflow-y: auto;
}

/* Strategies */
.strategies { padding: 48px 0; background: var(--bg-surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.strategies h2, .reference h2, .code-snippets h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.section-desc { color: var(--text-muted); margin-bottom: 28px; max-width: 600px; }
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.strategy-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: border-color var(--transition);
}
.strategy-card:hover { border-color: var(--accent-border); }
.strategy-icon { font-size: 1.5rem; margin-bottom: 10px; }
.strategy-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; }
.strategy-card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 12px; }
.strategy-example {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
}
.ex-label { color: var(--text-dim); }
.strategy-example code { color: var(--green); }

/* Reference */
.reference { padding: 48px 0; }
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.ref-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.ref-block h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 8px; color: var(--yellow); }
.ref-block p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; }

.unicode-table-wrap { overflow-x: auto; }
.unicode-table-wrap h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.ref-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ref-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  color: var(--text);
}
.ref-table tr:hover td { background: rgba(99,102,241,0.05); }

/* Code snippets */
.code-snippets { padding: 48px 0; background: var(--bg-surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.snippet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.snippet-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
}
.snippet-card h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 10px; }
.snippet-card .code-block { margin-bottom: 10px; }
.snippet-card .copy-snippet { position: absolute; top: 16px; right: 16px; }

/* History */
.history-section { padding: 48px 0; }
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.history-header h2 { font-size: 1.2rem; font-weight: 600; }
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  gap: 12px;
}
.history-item-text {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-shrink: 0;
}
.history-item-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}
.history-item-btn:hover { border-color: var(--accent); color: var(--text); }

/* Ad section */
.ad-section { padding: 24px 0; }

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 32px 0;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-version {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color var(--transition);
}
.footer-nav a:hover { color: var(--text); }
.footer-note {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: toastIn 0.2s ease, toastOut 0.2s ease 1.8s forwards;
  pointer-events: none;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Focus visible */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Responsive */
@media (max-width: 640px) {
  .header-inner { padding: 0 12px; }
  .main-nav { gap: 2px; }
  .main-nav a { padding: 4px 8px; font-size: 0.8rem; }
  .hero { padding: 32px 0 20px; }
  .input-panel, .output-panel { padding: 14px; }
  .strategy-grid, .ref-grid, .snippet-grid { grid-template-columns: 1fr; }
  .output-actions { flex-direction: column; align-items: stretch; }
}



/* 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;
}
