:root {
  --bg: #070b12;
  --bg-2: #0a1019;
  --panel: #0e1622;
  --panel-2: #121c2b;
  --panel-3: #162234;
  --line: #1e2b3f;
  --line-2: #27384f;
  --text: #e9eef7;
  --muted: #8fa1ba;
  --muted-2: #6b7d95;
  --gold: #d9b45a;
  --gold-2: #f0d18c;
  --gold-dim: rgba(217, 180, 90, 0.12);
  --danger: #ef6b6b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(217, 180, 90, 0.08), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(70, 110, 180, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
  z-index: 0;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  color: #111;
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 12, 20, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crest { color: var(--gold); display: flex; filter: drop-shadow(0 2px 10px rgba(217, 180, 90, 0.25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-line { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.brand-sub { font-size: 15px; font-weight: 650; letter-spacing: 0.01em; white-space: nowrap; }

.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  padding: 8px 13px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.tab.is-active {
  color: var(--gold-2);
  background: var(--gold-dim);
  border-color: rgba(217, 180, 90, 0.28);
}
.tab-badge {
  background: var(--gold);
  color: #14100a;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.version-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line-2);
  padding: 6px 11px;
  border-radius: 30px;
  white-space: nowrap;
}
.version-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 180, 90, 0.15);
}
.chip-muted { color: var(--muted-2); font-weight: 500; }

/* ---------------- layout ---------------- */
main {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 24px 70px;
}
.view { display: none; animation: fade 0.25s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 650;
}
h1 {
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  font-weight: 700;
}
.lede { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; max-width: 70ch; }
.muted { color: var(--muted); }

/* ---------------- hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 34px;
  align-items: center;
  padding: 18px 0 30px;
}
.hero-foot {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.hero-note {
  margin: 0;
  display: inline-block;
  font-size: 11.5px;
  color: var(--muted-2);
  border-left: 2px solid var(--gold);
  padding-left: 10px;
}
.hero-pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gold-2);
  text-decoration: none;
  border-bottom: 1px dashed rgba(217, 180, 90, 0.35);
  padding-bottom: 1px;
}
.hero-pdf:hover { color: #fff; border-bottom-color: var(--gold-2); }
.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.stat:first-child { grid-column: span 2; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 12px; color: var(--gold); font-weight: 600; letter-spacing: 0.06em; margin-left: 2px; }
.stat:first-child .stat-value { color: var(--gold-2); }
.stat-label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }

/* ---------------- howto ---------------- */
.howto {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(217, 180, 90, 0.05), rgba(14, 22, 34, 0.6));
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.howto h2 { margin: 0 0 12px; font-size: 14px; letter-spacing: 0.01em; }
.howto ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
  display: grid;
  gap: 2px;
  grid-template-columns: 1fr 1fr;
  column-gap: 28px;
}
.howto li::marker { color: var(--gold); font-weight: 700; }
.howto-link { margin-top: 14px; }

/* ---------------- toolbar ---------------- */
.toolbar {
  position: sticky;
  top: 61px;
  z-index: 20;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  margin-top: 4px;
  background: linear-gradient(180deg, rgba(7, 11, 18, 0.96) 60%, rgba(7, 11, 18, 0.82), transparent);
}
.search-wrap { position: relative; flex: 1; display: flex; align-items: center; }
.search-icon { position: absolute; left: 14px; color: var(--muted-2); pointer-events: none; }
#search {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  padding: 12px 46px 12px 42px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search::placeholder { color: var(--muted-2); }
#search:focus { border-color: rgba(217, 180, 90, 0.55); box-shadow: 0 0 0 3px rgba(217, 180, 90, 0.1); }
.search-kbd {
  position: absolute;
  right: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  pointer-events: none;
}
.sort-wrap { display: flex; align-items: center; gap: 8px; }
.sort-wrap label { font-size: 11.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.08em; }
select {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 10px 12px;
  outline: none;
  cursor: pointer;
}
select:focus { border-color: rgba(217, 180, 90, 0.55); }

/* ---------------- filters ---------------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 4px; }
.chip {
  --c: var(--gold);
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 7px 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.14s;
}
.chip::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c);
  opacity: 0.75;
}
.chip[data-cat="ALL"]::before { display: none; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.is-active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 13%, var(--panel));
}
.chip-count { font-size: 10.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.chip.is-active .chip-count { color: var(--muted); }

.catalog-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 2px 12px;
  font-size: 12px;
  color: var(--muted-2);
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
#resultCount { color: var(--muted); font-weight: 550; }
.catalog-meta-hint { text-align: right; }

/* ---------------- entries ---------------- */
.entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.entry {
  --c: var(--gold);
  position: relative;
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: border-color 0.16s, transform 0.16s;
  overflow: hidden;
}
.entry::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--c), transparent 140%);
}
.entry:hover { border-color: var(--line-2); }
.entry.is-open { border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 10px; }
.pid {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--c);
  letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.entry h3 { margin: 0; font-size: 15.5px; font-weight: 620; line-height: 1.35; letter-spacing: -0.005em; }
.pen { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}
.pill.he { color: #ffb4a8; border-color: rgba(239, 107, 107, 0.3); background: rgba(239, 107, 107, 0.08); }
.pill.fine { color: var(--gold-2); border-color: rgba(217, 180, 90, 0.32); background: rgba(217, 180, 90, 0.08); }
.pill.pts { color: #9ee7cf; border-color: rgba(79, 209, 165, 0.3); background: rgba(79, 209, 165, 0.08); }
.pill.zero { opacity: 0.55; }
.desc { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.entry-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.entry-foot .spacer { flex: 1; }

/* ---------------- buttons ---------------- */
.btn {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-2);
  background: var(--panel-3);
  color: var(--text);
  transition: all 0.14s;
  white-space: nowrap;
}
.btn:hover { border-color: #3a4d68; background: #1a2740; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: #b8933f;
  color: #1a1305;
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(180deg, #f7dc9d, #e3c069); border-color: #c9a24a; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.04); }
.btn.danger { color: #ff9b9b; border-color: rgba(239, 107, 107, 0.3); }
.btn.danger:hover { background: rgba(239, 107, 107, 0.1); }
.btn-add {
  --c: var(--gold);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border-color: color-mix(in srgb, var(--c) 42%, transparent);
  color: var(--c);
  font-weight: 700;
}
.btn-add:hover { background: color-mix(in srgb, var(--c) 24%, transparent); }
.btn-add.is-added {
  background: transparent;
  border-color: var(--line-2);
  color: var(--muted);
}
.btn-icon { padding: 8px 9px; }

/* ---------------- notes ---------------- */
.note {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  border-left: 2px solid color-mix(in srgb, var(--c) 60%, transparent);
  padding: 2px 0 2px 10px;
  display: none;
}
.note b { color: var(--text); font-weight: 650; }
.entry.is-open .note { display: block; }
.note-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c);
  font-weight: 700;
  margin-right: 6px;
}

/* ---------------- empty ---------------- */
.empty, .calc-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  color: var(--gold);
  font-size: 20px;
  margin-bottom: 14px;
  font-family: var(--mono);
}
.empty h3, .calc-empty h3 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.empty p, .calc-empty p { margin: 0 auto 16px; font-size: 13px; max-width: 44ch; line-height: 1.6; }

/* ---------------- section head ---------------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 18px 0 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- calculator ---------------- */
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
}
.calc-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.calc-list-head h2 { margin: 0; font-size: 14px; letter-spacing: 0.01em; }
.calc-list { display: flex; flex-direction: column; gap: 8px; }
.calc-item {
  --c: var(--gold);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--c);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.calc-item-main { flex: 1; min-width: 0; }
.calc-item-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; flex-wrap: wrap; }
.calc-item-title .pid { font-size: 11px; }
.calc-item-pen { display: flex; gap: 10px; font-size: 11.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.calc-item-pen .reduced { color: var(--gold-2); }
.calc-item-pen s { color: var(--muted-2); text-decoration-color: rgba(239, 107, 107, 0.6); }
.attempt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: all 0.14s;
  white-space: nowrap;
}
.attempt:hover { color: var(--text); border-color: var(--line-2); }
.attempt input { accent-color: var(--gold); width: 14px; height: 14px; cursor: pointer; }
.attempt input:checked + span { color: var(--gold-2); }
.attempt[data-disabled="1"] { opacity: 0.35; cursor: not-allowed; }
.icon-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-2);
  border-radius: 7px;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.14s;
}
.icon-btn:hover { color: var(--danger); background: rgba(239, 107, 107, 0.1); border-color: rgba(239, 107, 107, 0.25); }

.calc-empty { border: 1px dashed var(--line-2); border-radius: var(--radius); background: rgba(14, 22, 34, 0.4); }
.calc-add {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.calc-add label { display: block; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; }
#calcSearch {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 11px 13px;
  outline: none;
}
#calcSearch:focus { border-color: rgba(217, 180, 90, 0.5); }
.calc-add-results { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.add-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.14s, background 0.14s;
}
.add-result:hover { border-color: var(--line-2); background: var(--panel-3); }
.add-result .pid { font-size: 10.5px; }
.add-result .add-result-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-result .add-result-pen { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.add-result-hint { font-size: 11.5px; color: var(--muted-2); padding: 4px 2px; }

/* ---------------- summary ---------------- */
.summary {
  position: sticky;
  top: 84px;
  background: linear-gradient(170deg, #131d2d, #0c1420);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 26px 60px -30px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.summary-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.summary-head h2 { margin: 0; font-size: 14px; }
.summary-tag {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(217, 180, 90, 0.3);
  background: var(--gold-dim);
  padding: 3px 7px;
  border-radius: 5px;
  font-weight: 700;
}
.metric { padding: 12px 0; border-top: 1px solid var(--line); }
.metric:first-of-type { border-top: 0; padding-top: 0; }
.metric-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.metric-label { font-size: 12px; color: var(--muted); }
.metric-value { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.metric-value strong { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.metric-value small { font-size: 11px; color: var(--muted-2); font-weight: 600; }
.bar {
  height: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  margin: 9px 0 6px;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold), #f2d492);
  transition: width 0.3s ease;
}
.bar.is-capped span { background: linear-gradient(90deg, #ef6b6b, #ffa36b); }
.metric-sub { font-size: 11px; color: var(--muted-2); }
.metric-sub.is-capped { color: #ff9b9b; font-weight: 600; }
.metric-compact .metric-value strong { font-size: 21px; }
.flags { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 2px; }
.flag {
  font-size: 11.5px;
  line-height: 1.45;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid rgba(217, 180, 90, 0.22);
  background: rgba(217, 180, 90, 0.08);
  color: #e8ce8f;
}
.flag.is-alert { border-color: rgba(239, 107, 107, 0.28); background: rgba(239, 107, 107, 0.09); color: #ffb0b0; }
.flag.is-info { border-color: var(--line-2); background: rgba(255, 255, 255, 0.03); color: var(--muted); }
.summary-actions { display: flex; gap: 8px; margin-top: 14px; }
.summary-actions .btn { flex: 1; justify-content: center; }
.summary-foot { margin: 12px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--muted-2); }

/* ---------------- rules ---------------- */
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.rule {
  border: 1px solid var(--line);
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border-radius: var(--radius);
  padding: 18px 20px;
}
.rule-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.rule-id { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--gold); }
.rule h3 { margin: 0; font-size: 14px; font-weight: 620; }
.rule p { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--muted); }

/* ---------------- examples ---------------- */
.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.example {
  border: 1px solid var(--line);
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.example h3 { margin: 0; font-size: 15px; font-weight: 620; }
.example-ids { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.example-plus { color: var(--muted-2); font-size: 12px; }
.example-text { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.example-result {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.example-note { font-size: 11px; color: var(--gold); }

/* ---------------- footer ---------------- */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: rgba(6, 10, 16, 0.7);
}
.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted-2);
}
.footer strong { color: var(--muted); font-weight: 600; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: #131d2d;
  border: 1px solid var(--line-2);
  color: var(--text);
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s;
  z-index: 100;
  max-width: min(90vw, 480px);
  text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- category colors ---------------- */
[data-cat="P"] { --c: #ff6b7f; }
[data-cat="E"] { --c: #f2a65a; }
[data-cat="S"] { --c: #6ea8fe; }
[data-cat="V"] { --c: #4fd1a5; }
[data-cat="W"] { --c: #b78cff; }
[data-cat="D"] { --c: #f472b6; }
[data-cat="F"] { --c: #56d4dd; }
[data-cat="O"] { --c: #9aa8bd; }

/* ---------------- responsive ---------------- */
@media (max-width: 1080px) {
  .calc-grid { grid-template-columns: 1fr; }
  .summary { position: static; }
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .stat:first-child { grid-column: auto; }
  .topbar-inner { flex-wrap: wrap; gap: 10px 16px; padding: 10px 18px; }
  .tabs { margin-left: 0; order: 3; width: 100%; overflow-x: auto; }
  .version-chip { margin-left: auto; }
  .toolbar { top: 108px; }
  .howto ol { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  main { padding: 20px 16px 60px; }
  .topbar-inner { padding: 10px 16px; }
  .version-chip { display: none; }
  .brand-sub { font-size: 13.5px; }
  .hero { padding-top: 8px; }
  .hero-stats { grid-template-columns: 1fr; }
  .hero-stats .stat { flex-direction: row; align-items: baseline; justify-content: space-between; padding: 12px 15px; }
  .stat-value { font-size: 21px; }
  .toolbar { position: static; flex-direction: column; align-items: stretch; background: none; }
  .sort-wrap { justify-content: space-between; }
  .sort-wrap select { flex: 1; }
  .entries, .rules, .examples { grid-template-columns: 1fr; }
  .catalog-meta-hint { display: none; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .section-actions { width: 100%; }
  .section-actions .btn { flex: 1; justify-content: center; }
  .calc-item { flex-wrap: wrap; }
  .attempt { order: 4; }
  .summary-actions { flex-direction: column; }
  .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------- print ---------------- */
@media print {
  body { background: #fff; color: #111; }
  body::before, .topbar, .footer, .toast, .calc-list-wrap .calc-add,
  .section-head .section-actions, .summary-actions, #view-rechner .section-head .lede { display: none !important; }
  main { max-width: none; padding: 0; }
  .summary { position: static; background: #fff; border: 1px solid #999; box-shadow: none; color: #111; }
  .summary-head h2, .metric-value strong { color: #111; }
  .summary-tag { color: #333; border-color: #999; background: none; }
  .metric-label, .metric-sub, .summary-foot { color: #444; }
  .bar { background: #e5e5e5; }
  .bar span { background: #333; }
  .flag { color: #333; background: #f4f4f4; border-color: #bbb; }
  .flag.is-alert { color: #111; background: #fbeaea; }
  html, body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
