:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #1f2630;
  --border: #2a3340;
  --text: #e6edf3;
  --text-dim: #9ba3ad;
  --accent: #7c3aed;
  --accent-2: #22d3ee;
  --good: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
}

/* Standard Minecraft default font (local TTF). Force the bundled file —
   `local()` removed so a system-installed font with the same name can't
   shadow our specific TTF. */
@font-face {
  font-family: 'Minecraft';
  src: url('./fonts/Minecraft.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Visually hidden but available to screen readers. */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Skip link for keyboard users. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  z-index: 1000;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 12px;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Visible keyboard focus indicators on every interactive control. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* Honor user preferences for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124,58,237,0.18), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(34,211,238,0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
  background: rgba(13,17,23,0.7);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.tagline {
  font-size: 11px;
  color: var(--text-dim);
  margin: 3px 0 0;
  font-weight: 500;
}
@media (max-width: 640px) { .tagline { display: none; } }
.logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  box-shadow: 0 4px 12px rgba(124,58,237,0.35);
}
.grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  gap: 20px;
  padding: 20px 28px 60px;
  max-width: 1500px;
  margin: 0 auto;
}
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

.ghost-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }

/* Editor */
/* Line group — flach statt verschachtelter Cards */
.line-group {
  margin-bottom: 18px;
}
.line-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 2px;
}
.line-title { font-weight: 600; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }
.align-row { display: inline-flex; gap: 2px; background: var(--bg); padding: 2px; border-radius: 7px; border: 1px solid var(--border); }
.align-row button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}
.align-row button.active { background: var(--accent); color: #fff; }

/* Segment — eine kompakte Zeile */
.segment {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.segment:hover { border-color: #3a4452; }
.segment.dragging { opacity: 0.4; }
.segment.drag-over { border-color: var(--accent); }

.drag-handle {
  color: var(--text-dim);
  cursor: grab;
  user-select: none;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}
.drag-handle:active { cursor: grabbing; }

.seg-text {
  flex: 1 1 140px;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 9px;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
}
.seg-text:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.color-stops { display: inline-flex; align-items: center; gap: 4px; }
.color-stop {
  position: relative;
  width: 22px; height: 22px;
  border-radius: 5px;
  overflow: visible;
  border: 1.5px solid rgba(255,255,255,0.15);
  cursor: pointer;
}
.color-stop .swatch {
  position: absolute; inset: 0;
  border-radius: 3px;
  pointer-events: none;
}
.color-stop input[type="color"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  border: none; padding: 0; cursor: pointer; background: none;
}
.color-stop .remove {
  position: absolute; top: -5px; right: -5px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--danger); color: #fff; border: none; cursor: pointer;
  font-size: 10px; line-height: 1; padding: 0;
  display: none;
  z-index: 2;
}
.color-stop:hover .remove { display: block; }
.add-stop {
  width: 22px; height: 22px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.add-stop:hover { border-color: var(--accent); color: var(--accent); }

.fmt-toggles { display: inline-flex; gap: 2px; }
.fmt-toggles button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  width: 22px; height: 22px;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 0;
}
.fmt-toggles button:hover { color: var(--text); border-color: var(--border); }
.fmt-toggles button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.fmt-toggles button[data-fmt="italic"] { font-style: italic; }
.fmt-toggles button[data-fmt="underline"] { text-decoration: underline; }
.fmt-toggles button[data-fmt="strike"] { text-decoration: line-through; }

.seg-del {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  width: 22px; height: 22px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-left: auto;
}
.seg-del:hover { color: var(--danger); border-color: var(--danger); }

.add-segment {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  padding: 6px;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.add-segment:hover { border-color: var(--accent); color: var(--accent); }

.footnote { color: var(--text-dim); font-size: 12px; margin: 4px 2px 0; }

/* Preview */
.bg-toggle { display: inline-flex; gap: 4px; background: var(--bg); padding: 2px; border-radius: 8px; border: 1px solid var(--border); }
.bg-toggle button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
}
.bg-toggle button.active { background: var(--accent); color: #fff; }

.server-list {
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  background-color: #2b2b2b;
  background-image:
    linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)),
    repeating-conic-gradient(#5a3d1f 0% 25%, #6b4825 0% 50%);
  background-size: auto, 16px 16px;
  image-rendering: pixelated;
}
.server-list.bg-stone {
  background-color: #555;
  background-image:
    linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)),
    repeating-conic-gradient(#6e6e6e 0% 25%, #7d7d7d 0% 50%);
}
.server-list.bg-dark {
  background-color: #0a0a0a;
  background-image: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4));
}
.server-row {
  display: flex;
  gap: 10px;
  background: rgba(0,0,0,0.55);
  padding: 6px;
  border: 2px solid #aaa;
  border-color: rgba(255,255,255,0.25);
}
.server-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  border-radius: 2px;
  flex-shrink: 0;
  image-rendering: pixelated;
}
.server-meta { flex: 1; min-width: 0; }
.server-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.server-name {
  font-family: 'Pixelify Sans', monospace;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}
.server-ping { display: inline-flex; align-items: end; gap: 1px; }
.server-ping .bar { display: inline-block; width: 3px; background: #22c55e; }
.server-ping .b1 { height: 4px; }
.server-ping .b2 { height: 6px; }
.server-ping .b3 { height: 8px; }
.server-ping .b4 { height: 10px; }
.server-ping .b5 { height: 12px; }

.motd {
  font-family: 'Minecraft', monospace;
  font-size: 16px;
  line-height: 1.5;
  color: #aaa;
  white-space: pre;
  overflow: hidden;
  letter-spacing: 0;
  width: var(--motd-width, 480px);
  max-width: 100%;
  /* Don't let the browser fake bold/italic — MC has its own rendering. */
  font-synthesis: style;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  font-smooth: never;
  text-rendering: optimizeSpeed;
}
.motd .ml {
  display: block;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  min-height: 1.5em;
}
.motd .mch { white-space: pre; }
/* MC bold = same glyph offset 1 logical MC-pixel to the right, plus an extra
   logical pixel of advance per char (this is exactly how the in-game renderer
   draws bold text). --mc-px is set from JS to match the loaded font's scale. */
.motd .mch.b {
  letter-spacing: var(--mc-px, 2px);
  text-shadow:
    var(--mc-px, 2px) 0 0 currentColor,
    2px 2px 0 rgba(0,0,0,0.5),
    calc(var(--mc-px, 2px) + 2px) 2px 0 rgba(0,0,0,0.5);
}
.motd .mch.i { font-style: italic; }
.motd .mch.u { text-decoration: underline; text-decoration-thickness: 2px; }
.motd .mch.s { text-decoration: line-through; text-decoration-thickness: 2px; }
.motd .mch.us { text-decoration: underline line-through; text-decoration-thickness: 2px; }

/* Output */
.output { margin-top: 6px; }
.output-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 0 2px;
  flex-wrap: wrap;
}
.output-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.output-target {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.output-target:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.output-actions { margin-left: auto; }
.output pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 14px;
  margin: 0;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 12.5px;
  color: #d3dae3;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
}
.copy-btn {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { color: var(--good); border-color: var(--good); }
.output-actions { display: inline-flex; gap: 6px; }
.hint { color: var(--text-dim); font-size: 12px; margin: 8px 2px 0; }

/* Editor head actions */
.head-actions { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.server-loader {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.server-loader input {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  width: 150px;
}
.server-loader input:focus { outline: none; }
.server-loader:focus-within { border-color: var(--accent); }
.server-loader button {
  background: var(--bg-3);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.server-loader button:hover { color: var(--accent); }
.server-loader button:disabled { color: var(--text-dim); cursor: wait; opacity: 0.6; }

/* Color popover */
.color-popover {
  position: absolute;
  z-index: 100;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 220px;
}
.color-popover.hidden { display: none; }
.color-popover input[type="color"] {
  width: 100%;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.cp-hex-row {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
}
.cp-hex-row:focus-within { border-color: var(--accent); }
.cp-hash {
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.cp-hex-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 6px 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cp-hex-row input:focus { outline: none; }
.cp-palette {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}
.palette-swatch {
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  padding: 0;
}
.palette-swatch:hover { transform: scale(1.15); border-color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.hidden { display: none; }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--good); color: var(--good); }

/* SEO Footer — readable content for search engines and humans */
.page-footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  padding: 48px 28px 60px;
}
.footer-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.footer-inner h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 12px;
}
.footer-inner p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  max-width: 760px;
}
.footer-inner strong { color: var(--text); font-weight: 600; }
.footer-inner code {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  color: var(--accent-2);
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 0;
}
.format-grid > div {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.format-grid dt {
  font-weight: 600;
  color: var(--accent-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  margin-bottom: 6px;
}
.format-grid dd {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
}
.format-grid dd strong { color: var(--text); }

.feature-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feature-list li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
}
.feature-list strong { color: var(--text); }

.footer-inner details {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.footer-inner details[open] { border-color: var(--accent); }
.footer-inner summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  font-size: 14px;
  list-style: none;
  position: relative;
  padding-right: 24px;
}
.footer-inner summary::-webkit-details-marker { display: none; }
.footer-inner summary::after {
  content: '+';
  position: absolute;
  right: 0; top: 0;
  color: var(--text-dim);
  font-weight: 400;
  font-size: 18px;
}
.footer-inner details[open] summary::after { content: '−'; }
.footer-inner details p {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.footer-bottom {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin: 20px 0 0;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

/* MOTD accessibility score — Lighthouse-style donut. Color shifts from red →
   amber → green based on the live audit of the current MOTD content. */
.a11y-badge {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px 12px 12px;
  cursor: help;
  transition: border-color 0.2s;
}
.a11y-badge.motd-score {
  margin-top: 14px;
  width: 100%;
}
.a11y-badge:hover,
.a11y-badge:focus-visible { border-color: var(--a11y-color, var(--good)); }
.a11y-circle {
  width: 44px; height: 44px;
  flex-shrink: 0;
}
.a11y-track { stroke: rgba(255,255,255,0.08); }
.a11y-fill {
  stroke: var(--a11y-color, var(--good));
  transition: stroke-dasharray 0.6s ease-out, stroke 0.3s;
}
.a11y-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.a11y-score {
  font-size: 22px;
  font-weight: 700;
  color: var(--a11y-color, var(--good));
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
.a11y-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
  font-weight: 600;
}
.a11y-summary {
  flex: 1;
  margin-left: 12px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}
.a11y-summary strong { color: var(--text); font-weight: 500; }
.a11y-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: 320px;
  white-space: normal;
  text-align: left;
  z-index: 50;
}
.a11y-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}
.a11y-badge:hover .a11y-tooltip,
.a11y-badge:focus-visible .a11y-tooltip { opacity: 1; }
.a11y-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.a11y-list li {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}
.a11y-list li.ok { color: var(--good); }
.a11y-summary .muted { color: var(--text-dim); opacity: 0.7; }

/* Footer legal links */
.footer-legal {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
}
.legal-link {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0 2px;
}
.legal-link:hover, .legal-link:focus-visible { color: var(--accent); }
.legal-sep { color: var(--text-dim); margin: 0 10px; opacity: 0.5; }

/* Modals (Impressum / Datenschutz) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.modal-content {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  overflow: hidden;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 22px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--bg-3); border-color: var(--border); }
.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.modal-body h3 {
  margin: 22px 0 8px;
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.modal-body h3:first-of-type { margin-top: 0; }
.modal-body p, .modal-body ul {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}
.modal-body ul { padding-left: 22px; }
.modal-body li { margin-bottom: 4px; }
.modal-body strong { font-weight: 600; }
.modal-body code {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  color: var(--accent-2);
}
.modal-body a {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.modal-body a:hover { color: var(--accent); }
.legal-notice {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  padding: 12px 14px !important;
  font-size: 13px !important;
  color: var(--text) !important;
}
.legal-notice strong { color: var(--warn); }

/* Consent gate (renamed from .cookie-banner so adblocker rules targeting
   generic "cookie" patterns don't hide it). */
.consent-gate {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 999;
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
}
.consent-gate.show { opacity: 1; transform: translateY(0); }
.consent-gate.hidden { display: none; }
.consent-gate-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}
.consent-gate-text strong { color: var(--accent-2); font-weight: 600; }
.consent-gate-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.consent-gate-more, .consent-gate-accept {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  padding: 8px 14px;
  cursor: pointer;
  border: 1px solid var(--border);
}
.consent-gate-more {
  background: transparent;
  color: var(--text-dim);
}
.consent-gate-more:hover, .consent-gate-more:focus-visible { color: var(--text); border-color: var(--accent); }
.consent-gate-accept {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.consent-gate-accept:hover, .consent-gate-accept:focus-visible { filter: brightness(1.1); }

/* While the user hasn't accepted the consent notice, blur and lock the page —
   only the banner and any open modal stay interactive. External resources
   (Google Fonts, app.js, Google Ads) aren't loaded until consent is granted. */
.noscript-notice {
  background: var(--warn);
  color: #1a1100;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid rgba(0,0,0,0.2);
}
.noscript-notice strong { display: block; font-weight: 700; margin-bottom: 4px; }

body.no-consent {
  overflow: hidden;
}
body.no-consent > *:not(#consent-gate):not(.modal):not(script) {
  filter: blur(8px) saturate(0.7);
  pointer-events: none;
  user-select: none;
  transition: filter 0.4s;
}
body:not(.no-consent) > * {
  transition: filter 0.4s;
}
