/* Regelwerk | Mulaga City - öffentliche Leseansicht in Mulaga-Form:
   Nacht-Petrol, Verlauf Blau -> Türkis -> Mint, Baloo 2, runde Formen,
   Logo + Pillen-Navigation oben, Palme als Wasserzeichen. */

:root {
  --blau:#3FB8F5; --tuerkis:#6FE6D8; --mint:#CFF6B2;
  --nacht:#0b1f2e; --tief:#081723; --grund:#061019;
  --flaeche:rgba(9,30,44,.88); --feld:rgba(4,14,22,.7);
  --rand:rgba(111,230,216,.16); --rand-stark:rgba(111,230,216,.4);
  --text:#effbff; --leise:#9cc0cf; --blass:#7d9fae; --dunkel:#062236;
  --verlauf:linear-gradient(90deg,var(--blau),var(--tuerkis) 55%,var(--mint));
  --top:84px;
  --font:"Baloo 2",system-ui,-apple-system,"Segoe UI",sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 500 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden;
  background: radial-gradient(ellipse at 20% -10%, #1f3a4a 0%, var(--nacht) 42%, var(--grund) 100%) fixed;
}
body::after {
  content: ""; position: fixed; right: -90px; bottom: -100px; width: 480px; height: 480px; z-index: 0; pointer-events: none;
  background: url("/regelwerk-assets/palme.png") right bottom / contain no-repeat; opacity: .07; transform: scaleX(-1) rotate(-6deg);
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(111,230,216,.35); color: #fff; }
:focus-visible { outline: 2px solid var(--tuerkis); outline-offset: 2px; }
* { scrollbar-color: #1c3d52 transparent; scrollbar-width: thin; }

.skip { position: fixed; top: -80px; left: 16px; z-index: 50; padding: 10px 18px; border-radius: 999px; background: var(--verlauf); color: var(--dunkel); font-weight: 800; }
.skip:focus { top: 12px; }

/* ---------- Kopf: Logo, Pillen-Navigation, Stand ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  height: var(--top); padding: 0 32px;
  background: rgba(6,16,25,.86); border-bottom: 1px solid var(--rand);
  backdrop-filter: blur(0px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.brand img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 .3rem .8rem rgba(30,143,224,.4)); }
.brand strong { font-size: 24px; font-weight: 800; line-height: 1; }

.nav { display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: rgba(4,14,22,.6); border: 1px solid var(--rand); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-item {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 42px; padding: 0 18px; border-radius: 999px;
  font-size: 16px; font-weight: 600; color: var(--leise); white-space: nowrap;
  transition: color 120ms, background 120ms;
}
.nav-item small { font-size: 12px; font-weight: 700; padding: 0 8px; border-radius: 999px; background: rgba(63,184,245,.14); color: #bfeff8; line-height: 20px; }
.nav-item:hover { color: var(--text); }
.nav-item.active { background: var(--verlauf); color: var(--dunkel); font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 .4rem 1rem rgba(63,184,245,.3); }
.nav-item.active small { background: rgba(6,34,54,.16); color: var(--dunkel); }

.topbar-meta { margin-left: auto; display: flex; gap: 8px; flex: none; }
.topbar-meta span { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 999px; background: rgba(4,14,22,.6); border: 1px solid var(--rand); font-size: 14px; color: var(--leise); white-space: nowrap; }
.topbar-meta strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Raster ---------- */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 36px;
  max-width: 1320px; margin: 0 auto; padding: 0 32px;
}
main { min-width: 0; padding: 40px 0 40px; }

/* Titel mit geschwungenem Band wie im Spiel */
.head { position: relative; padding: 6px 0 4px; }
.head::before {
  content: ""; position: absolute; left: 34%; right: -40px; top: -18px; height: 150px; opacity: .55; pointer-events: none; z-index: -1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 300' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='b' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%233FB8F5' stop-opacity='0'/%3E%3Cstop offset='.3' stop-color='%233FB8F5'/%3E%3Cstop offset='.6' stop-color='%236FE6D8'/%3E%3Cstop offset='.9' stop-color='%23CFF6B2'/%3E%3Cstop offset='1' stop-color='%23CFF6B2' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M-20 230 C 300 40, 620 300, 940 150 S 1450 20, 1640 120' fill='none' stroke='url(%23b)' stroke-width='8' stroke-linecap='round'/%3E%3Cpath d='M-20 252 C 320 70, 640 320, 960 172 S 1460 50, 1640 142' fill='none' stroke='url(%23b)' stroke-width='2.5' stroke-opacity='.6'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.eyebrow { font-size: 16px; font-weight: 700; color: var(--tuerkis); }
h1 { margin-top: 2px; font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -.01em; overflow-wrap: anywhere; }
.intro { margin-top: 10px; max-width: 760px; color: var(--leise); font-size: 18px; line-height: 1.5; }

/* Suche */
.tools { margin-top: 26px; }
.search {
  display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 10px 0 20px; cursor: text;
  border-radius: 999px; background: var(--feld); border: 1px solid var(--rand); transition: border-color 120ms;
}
.search:focus-within { border-color: var(--tuerkis); }
.search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--blass); stroke-width: 2; stroke-linecap: round; }
.search:focus-within svg { stroke: var(--tuerkis); }
.search input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: 0; font-size: 17px; font-weight: 500; }
.search input::placeholder { color: var(--blass); }
.search input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); cursor: pointer; }
.key { flex: none; min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--leise); font: 700 14px var(--font); }
.search:focus-within .key { display: none; }

/* Hinweis */
.notice {
  display: flex; gap: 14px; align-items: baseline; margin-top: 16px; padding: 14px 20px;
  border-radius: 20px; background: rgba(63,184,245,.08); border: 1px solid rgba(63,184,245,.28);
}
.notice-label { flex: none; font-size: 13px; font-weight: 800; padding: 1px 12px; border-radius: 999px; background: var(--verlauf); color: var(--dunkel); }
.notice p { font-size: 16px; line-height: 1.5; }

.toc-mobile { display: none; }
.search-status { margin-top: 20px; font-size: 16px; font-weight: 700; color: var(--tuerkis); }
.search-status:empty { display: none; }
#rules { margin-top: 30px; }
.page-hit { display: flex; align-items: center; gap: 12px; margin: 40px 0 16px; font-size: 24px; font-weight: 800; }
.page-hit::before { content: ""; width: 6px; height: 26px; border-radius: 6px; background: linear-gradient(180deg, var(--mint), var(--blau)); }
.page-hit:first-child { margin-top: 0; }

/* Abschnitte */
.rule-section { margin-bottom: 42px; scroll-margin-top: calc(var(--top) + 20px); }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.section-heading h2 { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.section-heading h2::before { content: ""; flex: none; width: 6px; height: 26px; border-radius: 6px; background: linear-gradient(180deg, var(--mint), var(--blau)); }
.section-heading::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(111,230,216,.35), transparent); order: 1; }
.section-count { order: 2; flex: none; font-size: 13px; font-weight: 700; padding: 2px 12px; border-radius: 999px; background: rgba(255,255,255,.05); border: 1px solid var(--rand); color: var(--leise); }

/* Absatz-Karte */
.rule {
  margin: 10px 0; padding: 16px 22px 18px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(127,227,240,.06), rgba(255,255,255,.02) 50%), var(--flaeche);
  border: 1px solid var(--rand);
  scroll-margin-top: calc(var(--top) + 20px);
  transition: border-color 120ms;
}
.rule:hover { border-color: rgba(111,230,216,.3); }
.rule.focused, .rule:target { border-color: var(--tuerkis); box-shadow: 0 0 0 3px rgba(111,230,216,.14); }
.rule-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rule-label { font-size: 15px; font-weight: 800; padding: 2px 14px; border-radius: 999px; background: rgba(63,184,245,.16); color: #bfeff8; line-height: 24px; }
.rule-label:hover { background: var(--verlauf); color: var(--dunkel); }
.rule-actions { margin-left: auto; display: flex; gap: 6px; }
.rule-actions button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border: 1px solid var(--rand); border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.04); color: var(--leise); font-size: 13px; font-weight: 700;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.rule-actions button:hover { background: rgba(63,184,245,.14); border-color: var(--rand-stark); color: var(--text); }
.rule-actions button:active { transform: translateY(1px); }
.rule-actions svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rule-text { white-space: pre-line; overflow-wrap: anywhere; color: #d9eef5; font-size: 17px; line-height: 1.6; }
.rule-text strong { color: var(--text); font-weight: 700; }
.rule-text a { color: var(--tuerkis); text-decoration: underline; text-underline-offset: 3px; }
mark { background: rgba(111,230,216,.28); color: #fff; border-radius: 4px; padding: 0 2px; }

.empty { padding: 48px 16px; text-align: center; color: var(--leise); }

.foot {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 48px; padding: 16px 22px;
  border-radius: 999px; background: rgba(4,14,22,.6); border: 1px solid var(--rand); font-size: 15px; color: var(--leise);
}
.foot a { font-weight: 700; color: var(--text); }
.foot a:hover { color: var(--tuerkis); }
.foot-links { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 18px; }

/* Rechte Spalte */
.toc { position: sticky; top: calc(var(--top) + 24px); align-self: start; max-height: calc(100vh - var(--top) - 48px); overflow-y: auto; padding: 40px 0 24px; }
.toc-karte { border-radius: 24px; padding: 18px 16px 14px; background: var(--flaeche); border: 1px solid var(--rand); }
.toc-titel { display: flex; align-items: center; gap: 10px; padding: 0 6px 8px; font-size: 17px; font-weight: 800; }
.toc-titel::before { content: ""; width: 5px; height: 20px; border-radius: 5px; background: linear-gradient(180deg, var(--mint), var(--blau)); }
#toc { display: flex; flex-direction: column; gap: 2px; }
#toc a, #toc-mobile a { display: block; padding: 6px 12px; border-radius: 12px; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--leise); }
#toc a:hover, #toc-mobile a:hover { color: var(--text); background: rgba(63,184,245,.1); }
.toc-hint { margin-top: 14px; padding: 14px 18px; border-radius: 20px; background: rgba(4,14,22,.6); }
.toc-hint strong { font-size: 15px; font-weight: 800; }
.toc-hint p { margin-top: 4px; font-size: 14px; line-height: 1.45; color: var(--leise); }

/* Meldung */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: calc(100vw - 32px);
  padding: 10px 22px; border-radius: 999px; background: var(--nacht); border: 1px solid var(--rand-stark);
  font-size: 15px; font-weight: 700;
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity 160ms, transform 160ms;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mittlere Breite: rechte Spalte weg ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mobile { display: block; }
  .topbar-meta span:last-child { display: none; }
}
.toc-mobile { margin-top: 14px; border-radius: 20px; background: var(--flaeche); border: 1px solid var(--rand); overflow: hidden; }
.toc-mobile summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; cursor: pointer; list-style: none; font-size: 16px; font-weight: 700; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--tuerkis); border-bottom: 2px solid var(--tuerkis); transform: rotate(45deg) translateY(-3px); }
.toc-mobile[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.toc-mobile[open] summary { border-bottom: 1px solid var(--rand); }
#toc-mobile { display: flex; flex-direction: column; padding: 8px 10px 12px; max-height: 60vh; overflow-y: auto; }

/* ---------- Handy ---------- */
@media (max-width: 760px) {
  :root { --top: 64px; }
  .topbar { height: auto; min-height: var(--top); flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px 10px; }
  .brand img { width: 48px; height: 48px; }
  .brand strong { font-size: 20px; }
  .topbar-meta span { height: 30px; font-size: 13px; padding: 0 12px; }
  .nav { order: 3; width: 100%; }
  .nav-item { flex: 1 0 auto; justify-content: center; height: 38px; padding: 0 14px; font-size: 14px; }
  .nav-item small { display: none; }
  .layout { padding: 0 16px; }
  main { padding: 24px 0 28px; }
  .head::before { left: 20%; height: 110px; }
  h1 { font-size: 38px; }
  .intro { font-size: 16px; }
  .notice { flex-direction: column; gap: 6px; padding: 12px 16px; }
  .key { display: none; }
  .section-heading h2 { font-size: 20px; }
  .rule { padding: 14px 16px 16px; border-radius: 20px; }
  .rule-actions button { padding: 0 10px; }
  .rule-actions button span { display: none; }
  .rule-text { font-size: 16px; }
  .foot { flex-direction: column; border-radius: 20px; text-align: center; }
  body::after { width: 280px; height: 280px; }
}

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