/* ClickHouse-inspired tokens. See DESIGN.md neon-on-obsidian system. */
:root {
  --bg: #000000;
  --bg-panel: #000000;
  --surface: #141414;
  --border: rgba(65, 65, 65, 0.8);
  --text: #ffffff;
  --muted: #a0a0a0;
  --accent: #faff69;
  --accent-dim: #4f5100;
  --accent-soft: rgba(250, 255, 105, 0.1);
  --heal: #3dde7a;
  --heal-soft: rgba(61, 222, 122, 0.16);
  --pressed: #f4f692;
  --cta: #166534;
  --hover: #3a3a3a;
  --warn: #f4f692;
  --danger: #ff5c5c;
  --info: #f4f692;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Inconsolata", "Cascadia Mono", Consolas, monospace;
  --radius: 8px;
  --radius-sharp: 4px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--text);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #000000;
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: none;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.wordmark:hover {
  color: var(--text);
  text-decoration: none;
}

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sharp);
  background: var(--accent);
  color: #141414;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.site-nav a {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sharp);
}

.site-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--accent);
  font-weight: 600;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.page-head { margin: 0 0 32px; }

.kicker {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.brand {
  margin: 0 0 12px;
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.lead {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.catalog-grid > .panel,
.layout > .panel,
.split > .panel {
  margin-bottom: 0;
}

.section-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.field { margin-bottom: 16px; }

input,
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sharp);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  box-shadow: rgba(0, 0, 0, 0.14) 0 4px 16px inset;
}

textarea { font-family: var(--mono); font-weight: 600; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder { color: #585858; }

button {
  font-family: inherit;
  cursor: pointer;
}

button.primary,
button[type="submit"] {
  padding: 12px 16px;
  border: 1px solid #141414;
  border-radius: var(--radius-sharp);
  background: var(--cta);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}

button.primary:hover,
button[type="submit"]:hover {
  background: var(--hover);
  color: rgba(255, 255, 255, 0.8);
}

button.primary:active,
button[type="submit"]:active { color: var(--pressed); }

button.primary:disabled,
button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.ghost {
  padding: 12px 16px;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sharp);
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

button.ghost:hover {
  background: var(--surface);
  color: var(--accent);
}

button.ghost:active { color: var(--pressed); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip {
  width: auto;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.filter-chip:hover { color: var(--accent); border-color: var(--accent-dim); }

.filter-chip.active {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.status {
  margin-top: 12px;
  min-height: 1.2em;
  font-size: 14px;
  color: var(--muted);
}

.status.error { color: var(--danger); }
.status.ok { color: var(--accent); }

.empty {
  color: var(--muted);
  font-size: 14px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sharp);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

a.module-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000000;
  color: var(--text);
}

a.module-card:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.module-card h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

  .module-card .go {
  margin-top: auto;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.damage-chart {
  margin: 4px 0 20px;
}

.damage-chart h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.damage-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.damage-row {
  display: grid;
  grid-template-columns: 8em 1fr 4.8em;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  font-size: 13px;
}

.damage-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.damage-track {
  height: 28px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.damage-fill {
  display: flex;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
}

.damage-seg {
  position: relative;
  height: 100%;
  min-width: 0;
}

.damage-seg + .damage-seg {
  box-shadow: inset 1px 0 rgba(0, 0, 0, 0.35);
}

.damage-seg-value {
  position: absolute;
  right: 6px;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

.damage-total {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.damage-chart .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.damage-chart .check {
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  position: relative;
  flex: 0 0 14px;
}

.damage-chart .filter-chip.active .check::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 3px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

@media (max-width: 720px) {
  .topbar-inner {
    height: auto;
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .site-nav { flex-wrap: wrap; gap: 0; }
  .site-nav a { padding: 8px 10px; }

  .wrap { padding: 28px 16px 64px; }

  .brand { font-size: 36px; }

  .module-grid { grid-template-columns: 1fr; }
}
