/* Nocturne Regelwerk – öffentliche Seite (+ Grundlage für den Editor) */
html { scroll-behavior: smooth; }
body { position: relative; min-height: 100vh; }

/* ── Hintergrund ───────────────────────────────────────────── */
.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--bg); }
.bg-grid {
    position: absolute; inset: -1px;
    background-image:
        linear-gradient(rgba(201,206,214,.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201,206,214,.045) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
}
.bg-glow {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 55% 40% at 50% -8%, rgba(214, 220, 228, .16), transparent 70%),
        radial-gradient(ellipse 35% 30% at 85% 30%, rgba(111, 118, 128, .10), transparent 70%),
        radial-gradient(ellipse 35% 30% at 10% 60%, rgba(111, 118, 128, .07), transparent 70%);
}

/* ── Kopfleiste ────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    height: 60px; padding: 0 max(16px, calc((100vw - 1080px) / 2));
    background: rgba(10, 12, 13, .78); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid rgba(201,206,214,.08);
}
.brand { display: flex; align-items: center; gap: .65rem; color: var(--white); text-decoration: none; font: 600 1.12rem/1 var(--display); letter-spacing: .1em; text-transform: uppercase; }
.brand img { border-radius: 8px; border: 1px solid var(--line-strong); box-shadow: 0 0 1rem rgba(201,206,214,.12); }
.brand b { color: var(--accent); font-weight: 700; }
.topnav { display: flex; gap: 1.2rem; align-items: center; }
.topnav a { display: inline-flex; align-items: center; gap: .4rem; color: var(--soft); text-decoration: none; font: 600 .95rem/1 var(--display); letter-spacing: .1em; text-transform: uppercase; }
.topnav a:hover { color: var(--white); }
.ico { width: 1.15em; height: 1.15em; flex: none; }
.ico.big { width: 44px; height: 44px; color: var(--accent); }

/* ── Hero ──────────────────────────────────────────────────── */
.hero { position: relative; max-width: 1080px; margin: 0 auto; padding: 3.2rem 16px 2rem; text-align: center; }
.hero.small { padding: 2.6rem 16px 1.6rem; }
.hero-mark {
    position: absolute; left: 50%; top: 50%; width: 360px; max-width: 80vw; transform: translate(-50%, -50%);
    opacity: .05; filter: blur(1px) grayscale(1); z-index: -1; pointer-events: none;
}
.hero h1 {
    margin: .6rem 0 .5rem;
    font: 700 clamp(2.3rem, 6.5vw, 4rem)/1 var(--display); letter-spacing: .07em; text-transform: uppercase;
    background: linear-gradient(180deg, #ffffff 15%, #9ea5ae 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
    text-shadow: 0 0 40px rgba(201,206,214,.12);
}
.hero .tagline { margin: 0 auto; max-width: 560px; color: var(--soft); font-size: 1.05rem; }
.chips { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: 1.4rem; }
.chip {
    display: inline-flex; align-items: center; padding: .38rem .8rem; border-radius: 999px;
    background: rgba(19,22,23,.8); border: 1px solid var(--line-strong); color: var(--soft);
    font: 500 .86rem/1 var(--body); font-variant-numeric: tabular-nums; text-decoration: none;
}
a.chip.link { color: var(--white); border-color: var(--accent-mid); }
a.chip.link:hover { border-color: var(--accent); box-shadow: 0 0 1rem var(--accent-glow); }

/* ── Reiter ────────────────────────────────────────────────── */
.sticky-tabs { position: sticky; top: 60px; z-index: 20; padding: .7rem 16px; pointer-events: none; }
.sticky-tabs .tabs { pointer-events: auto; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs {
    display: flex; gap: .35rem; max-width: 640px; margin: 0 auto; padding: .35rem;
    background: rgba(15,18,19,.9); border: 1px solid var(--line-strong); border-radius: 14px;
    box-shadow: 0 .8rem 2rem rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.03);
}
.tab {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 44px; padding: .5rem .6rem; border-radius: 10px;
    color: var(--muted); text-decoration: none; font: 700 1rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase;
    transition: color .15s, background .15s, box-shadow .15s;
}
.tab:hover { color: var(--white); background: rgba(201,206,214,.05); }
.tab.active {
    color: #0b0d0e; background: linear-gradient(180deg, #eef1f4, #aeb5be);
    box-shadow: 0 0 1.4rem rgba(201,206,214,.25), inset 0 1px 0 rgba(255,255,255,.6);
}

/* ── Inhalt ────────────────────────────────────────────────── */
.rb-main { max-width: 900px; margin: 0 auto; padding: 1rem 16px 2rem; }
.toolbar { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.search {
    flex: 1 1 320px; position: relative; display: flex; align-items: center;
    background: rgba(19,22,23,.9); border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 .9rem;
    transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search .ico { color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 48px; padding: 0 .7rem; background: none; border: 0; color: var(--white); font: inherit; font-size: 1rem; outline: none; }
.search kbd { padding: .1rem .45rem; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); font: 600 .8rem/1.3 var(--body); }
.toolbar-btns { display: flex; gap: .5rem; }

.chapters { display: grid; gap: .8rem; }
.chapter {
    background: linear-gradient(180deg, rgba(22,25,27,.92), rgba(16,19,20,.92));
    border: 1px solid var(--line); border-radius: 14px; overflow: hidden; scroll-margin-top: 140px;
    transition: border-color .2s, box-shadow .2s;
}
.chapter[open] { border-color: var(--line-strong); box-shadow: 0 1rem 2.5rem rgba(0,0,0,.3); }
.chapter > summary {
    display: flex; align-items: center; gap: 1rem; padding: 1rem 1.15rem; cursor: pointer; list-style: none; user-select: none;
}
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary:hover { background: rgba(201,206,214,.03); }
.ch-num {
    display: inline-grid; place-items: center; min-width: 52px; height: 40px; padding: 0 .5rem; border-radius: 10px;
    background: linear-gradient(180deg, #e9ecf0, #9aa1aa); color: #0b0d0e;
    font: 700 1.1rem/1 var(--display); letter-spacing: .04em; box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 0 1rem rgba(201,206,214,.15);
}
.ch-title { flex: 1; min-width: 0; font: 700 clamp(1.15rem, 3vw, 1.45rem)/1.15 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--white); }
.ch-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.chev { color: var(--muted); transition: transform .2s; }
.chapter[open] .chev { transform: rotate(180deg); color: var(--accent); }
.ch-body { padding: 0 1.15rem 1.1rem; display: grid; gap: .6rem; }
.chapter[open] .ch-body { animation: open .22s ease-out; }
@keyframes open { from { opacity: 0; transform: translateY(-4px); } }

.rule { scroll-margin-top: 140px; padding: .95rem 1.05rem; background: rgba(10,12,13,.55); border: 1px solid var(--line); border-radius: 11px; position: relative; }
.rule::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, var(--accent), transparent); opacity: .35; }
.rule:target { animation: flash 2.2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 2px var(--accent), 0 0 1.6rem var(--accent-glow); } to { box-shadow: none; } }
.rule header { display: flex; align-items: center; gap: .7rem; margin-bottom: .45rem; }
.rule-num {
    flex: none; padding: .2rem .5rem; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--tile);
    color: var(--accent); text-decoration: none; font: 700 .95rem/1.2 var(--display); letter-spacing: .04em; font-variant-numeric: tabular-nums;
}
.rule-num:hover { border-color: var(--accent); color: var(--white); }
.rule h3 { flex: 1; min-width: 0; margin: 0; font: 700 1.14rem/1.3 var(--display); letter-spacing: .03em; color: var(--white); }
.copy-link { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; opacity: .55; transition: opacity .15s, color .15s, border-color .15s; }
.rule:hover .copy-link, .copy-link:focus-visible { opacity: 1; }
.copy-link:hover { color: var(--white); border-color: var(--line-strong); }
.copy-link.done { color: var(--ok); opacity: 1; }

.body { color: var(--text); overflow-wrap: anywhere; }
.body p { margin: 0 0 .7rem; }
.body p:last-child, .body ul:last-child, .body ol:last-child { margin-bottom: 0; }
.body ul, .body ol { margin: 0 0 .7rem; padding-left: 1.35rem; }
.body li { margin: .2rem 0; }
.body li::marker { color: var(--accent-mid); }
.body strong { color: var(--white); }
.body a.ref { font-weight: 600; text-decoration: none; border-bottom: 1px dashed var(--accent-mid); }
.body .note { margin: .5rem 0 .8rem; padding: .7rem .9rem; border: 1px solid rgba(201,206,214,.14); border-left: 3px solid var(--accent); background: rgba(201,206,214,.05); border-radius: 0 10px 10px 0; color: var(--soft); }
mark { background: rgba(230, 180, 80, .32); color: inherit; border-radius: 3px; padding: 0 .05em; }
.muted { color: var(--muted); }

.no-hits { color: var(--muted); padding: .4rem 0 1rem; }
.elsewhere { margin-bottom: 1rem; padding: .9rem 1rem; background: rgba(19,22,23,.85); border: 1px dashed var(--line-strong); border-radius: 12px; }
.elsewhere h4 { margin: 0 0 .5rem; font: 700 .9rem/1.2 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.elsewhere ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.elsewhere a { color: var(--soft); text-decoration: none; }
.elsewhere a:hover { color: var(--white); }
.elsewhere .bk { display: inline-block; min-width: 76px; margin-right: .5rem; padding: .05rem .4rem; border-radius: 5px; background: var(--tile); border: 1px solid var(--line-strong); color: var(--accent); font: 700 .75rem/1.5 var(--display); letter-spacing: .1em; text-transform: uppercase; text-align: center; }

.empty-card {
    max-width: 560px; margin: 2rem auto; padding: 2.4rem 1.6rem; text-align: center;
    background: linear-gradient(180deg, rgba(22,25,27,.92), rgba(16,19,20,.92)); border: 1px solid var(--line-strong); border-radius: 16px;
}
.empty-card h1, .empty-card h2 { margin: .8rem 0 .4rem; font: 700 1.6rem/1.1 var(--display); letter-spacing: .07em; text-transform: uppercase; color: var(--white); }
.empty-card p { color: var(--soft); margin: .4rem 0; }
.empty-card.msg { text-align: left; }
.id-box code { display: inline-block; padding: .5rem .8rem; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 8px; font: 600 1.1rem/1 ui-monospace, Consolas, monospace; color: var(--white); user-select: all; }

/* ── Änderungsverlauf ──────────────────────────────────────── */
.version { padding: 1.15rem 1.25rem; margin: 0 0 .8rem; background: linear-gradient(180deg, rgba(22,25,27,.92), rgba(16,19,20,.92)); border: 1px solid var(--line); border-radius: 14px; }
.version header { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.version h2 { margin: 0; font: 700 1.3rem/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--white); }
.version .when { margin-left: auto; color: var(--muted); font-size: .88rem; }
.book-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 999px; background: var(--tile); border: 1px solid var(--line-strong); color: var(--accent); font: 700 .8rem/1 var(--display); letter-spacing: .12em; text-transform: uppercase; }
.version .note-text { color: var(--soft); margin: .7rem 0 0; white-space: pre-line; }
.items { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; gap: .35rem; }
.items li { font-size: .95rem; color: var(--soft); }
.items a { color: var(--white); font-weight: 600; text-decoration: none; }
.items a:hover { text-decoration: underline; }
.tag { display: inline-block; min-width: 82px; text-align: center; margin-right: .5rem; padding: .1rem .45rem; border-radius: 5px; font: 600 .76rem/1.5 var(--display); letter-spacing: .1em; text-transform: uppercase; background: var(--tile); border: 1px solid var(--line-strong); color: var(--soft); }
.k-added .tag { color: var(--add-fg); border-color: rgba(111,207,151,.4); }
.k-removed .tag { color: var(--del-fg); border-color: rgba(229,105,92,.4); }
.k-changed .tag { color: var(--warn); border-color: rgba(230,180,80,.4); }
.was { color: var(--muted); }

/* ── Fuß ───────────────────────────────────────────────────── */
.foot { margin-top: 3rem; padding: 2rem 16px 2.6rem; text-align: center; color: var(--muted); font-size: .86rem; border-top: 1px solid rgba(201,206,214,.08); background: rgba(10,12,13,.6); }
.foot nav { display: flex; gap: .4rem 1.2rem; justify-content: center; flex-wrap: wrap; margin-bottom: .6rem; }
.foot a { color: var(--soft); text-decoration: none; }
.foot a:hover { color: var(--white); text-decoration: underline; }
.foot a.quiet { color: var(--muted); }
.foot p { margin: 0; }

@media (max-width: 640px) {
    .hide-sm { display: none !important; }
    .hero { padding-top: 2.2rem; }
    .tab { font-size: .88rem; letter-spacing: .08em; gap: .35rem; }
    .chapter > summary { gap: .7rem; padding: .85rem .9rem; }
    .ch-num { min-width: 44px; height: 36px; font-size: 1rem; }
    .ch-count { display: none; }
    .ch-body { padding: 0 .8rem .9rem; }
    .rule { padding: .85rem .85rem; }
    .toolbar-btns { width: 100%; }
    .toolbar-btns .btn { flex: 1; }
    .brand span { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .chapter[open] .ch-body, .rule:target { animation: none; }
}

/* Änderungsverlauf: Details pro Änderung */
.items { display: grid; gap: .45rem; margin-top: .9rem; }
.item { background: rgba(10,12,13,.5); border: 1px solid var(--line); border-radius: 10px; }
.item-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; padding: .55rem .75rem; list-style: none; color: var(--soft); font-size: .95rem; }
details.item > summary { cursor: pointer; }
details.item > summary::-webkit-details-marker { display: none; }
details.item > summary:hover { background: rgba(201,206,214,.03); }
.item-head a { color: var(--white); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
.item-head a:hover { text-decoration: underline; }
.item-head s { color: var(--del-fg); font-weight: 700; }
.item-head .ttl { color: var(--text); }
.item-head .more { margin-left: auto; color: var(--muted); font-size: .8rem; }
.item-head .more::after { content: ' ▾'; }
details.item[open] .more::after { content: ' ▴'; }
.item-head .tag { margin-right: 0; }
.item-body { padding: 0 .85rem .8rem; }
.item-body .dl { margin: .5rem 0 .3rem; color: var(--muted); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; font-family: var(--display); font-weight: 700; }
.item-body .legend { margin-left: .5rem; text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 400; }
.item-body .diff { padding: .6rem .75rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; color: var(--soft); }
.rule-text { padding: .6rem .8rem; border-radius: 8px; border: 1px solid var(--line); }
.rule-text.added { border-left: 3px solid var(--ok); background: rgba(111,207,151,.05); }
.rule-text.removed { border-left: 3px solid var(--bad); background: rgba(229,105,92,.05); color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(229,105,92,.5); }
.rule-text p:last-child, .rule-text ul:last-child { margin-bottom: 0; }
ins { background: var(--add-bg); color: var(--add-fg); text-decoration: none; border-radius: 3px; padding: 0 .1em; }
del { background: var(--del-bg); color: var(--del-fg); text-decoration: line-through; border-radius: 3px; padding: 0 .1em; }
