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

:root {
  --bg: #0e0e10;
  --surface: #161618;
  --surface-hover: #252528;
  --input-bg: #1a1a1d;
  --border: #2a2a2d;
  --border-strong: #333;
  --text: #e5e5e5;
  --text-heading: #fff;
  --text-muted: #888;
  --text-dim: #555;
  --empty: #333;
  --accent: #646cff;
  --accent-bg: #1e1f2e;
  --green: #4caf50;
  --grid-gap: #222;
}

body.light {
  --bg: #f5f5f5;
  --surface: #fff;
  --surface-hover: #f0f0f0;
  --input-bg: #fff;
  --border: #e0e0e0;
  --border-strong: #ccc;
  --text: #333;
  --text-heading: #1a1a1a;
  --text-muted: #666;
  --text-dim: #999;
  --empty: #aaa;
  --accent: #646cff;
  --accent-bg: #eef0ff;
  --green: #2e7d32;
  --grid-gap: #e0e0e0;
}

body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

.header {
  padding: 2rem 2rem 1rem;
  text-align: center;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.title-row h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
}

#theme-toggle {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  line-height: 1;
}

#theme-toggle:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.input-row {
  display: flex;
  gap: 0.75rem;
  max-width: 800px;
  margin: 0 auto;
}

#glyph-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

#glyph-input:focus { border-color: var(--accent); }
#glyph-input::placeholder { color: var(--text-dim); }

#copy-btn {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

#copy-btn:hover { border-color: var(--text-muted); color: var(--text); }
#copy-btn.copied { border-color: var(--green); color: var(--green); }

.presets {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin: 1rem auto 0;
  max-width: 800px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--input-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.preset-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.preset-btn.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--text-heading);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--grid-gap);
  margin: 1.5rem 2rem 2rem;
  border-radius: 12px;
  overflow: hidden;
}

.column {
  background: var(--surface);
  padding: 1.5rem 1rem;
  min-height: 300px;
}

.column-header {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.column-header .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.column-header .region {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.column-header .font-name {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  font-family: system-ui, sans-serif;
}

.glyph-display {
  font-size: 2rem;
  line-height: 1.6;
  word-break: break-all;
}

.empty-state {
  color: var(--empty);
  font-size: 0.85rem;
  text-align: center;
  width: 100%;
  padding-top: 4rem;
}

footer {
  text-align: center;
  padding: 1.5rem 2rem 2rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.8;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 800px) {
  .grid { grid-template-columns: repeat(2, 1fr); margin: 1rem; }
  .header { padding: 1.5rem 1rem 0.5rem; }
}
