:root {
    color-scheme: dark;
    --bg: #06101d;
    --panel: rgba(10, 25, 42, 0.88);
    --panel-strong: #0c1d31;
    --line: rgba(157, 184, 211, 0.18);
    --line-strong: rgba(157, 184, 211, 0.34);
    --text: #f4f8fc;
    --muted: #9fb1c5;
    --blue: #39a7ff;
    --cyan: #58e4df;
    --yellow: #ffd166;
    --red: #ff665e;
    --green: #62d89f;
    --orange: #ff9e5b;
    --radius: 22px;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
    --container: min(1440px, calc(100vw - 48px));
    font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background:
        radial-gradient(circle at 75% 2%, rgba(31, 124, 202, 0.17), transparent 36rem),
        radial-gradient(circle at 12% 24%, rgba(24, 198, 183, 0.09), transparent 31rem),
        var(--bg);
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }

.container { width: var(--container); margin-inline: auto; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 10px 16px;
    background: #fff;
    color: #07111f;
    border-radius: 8px;
    transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
    position: sticky;
    z-index: 100;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 10px max(24px, calc((100vw - 1440px) / 2));
    border-bottom: 1px solid var(--line);
    background: rgba(6, 16, 29, 0.86);
    backdrop-filter: blur(20px);
}

.brand { display: inline-flex; gap: 12px; align-items: center; }
.brand-ball {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(88, 228, 223, 0.28);
    border-radius: 50%;
    background: rgba(88, 228, 223, 0.08);
    font-size: 23px;
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: 0.04em; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: 0.06em; }

.site-nav { display: flex; align-items: center; gap: 7px; }
.site-nav a {
    padding: 9px 13px;
    color: var(--muted);
    border-radius: 10px;
    font-size: 14px;
    transition: 160ms ease;
}
.site-nav a:hover, .site-nav a:focus-visible, .site-nav a.active {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 42px;
    min-height: 0;
    padding-block: 44px 40px;
}
.eyebrow {
    margin: 0 0 13px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 760;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 5px rgba(255, 102, 94, 0.12);
}
.hero h1, .relation-intro h1 {
    max-width: 980px;
    margin: 0;
    font-size: clamp(44px, 6.2vw, 88px);
    line-height: 1.03;
    letter-spacing: -0.055em;
}
.hero h1 span, .relation-intro h1 span { color: var(--blue); }
.hero h1 {
    max-width: none;
    font-size: clamp(38px, 5vw, 68px);
    line-height: 1.05;
    letter-spacing: -0.045em;
}
.hero-summary, .relation-summary {
    max-width: 770px;
    margin: 28px 0 0;
    color: var(--muted);
    font-size: clamp(16px, 1.3vw, 20px);
}
.hero-summary { margin-top: 15px; font-size: 16px; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; }
.visitor-summary {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 11px;
    margin-top: 17px;
    padding: 8px 12px;
    border: 1px solid rgba(88, 228, 223, .18);
    border-radius: 999px;
    background: rgba(7, 19, 31, .58);
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.visitor-summary strong { margin-left: 3px; color: #f5fbff; font-size: 13px; }
.visitor-summary-label { display: inline-flex; align-items: center; gap: 6px; color: var(--cyan); }
.visitor-summary-label i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(88, 228, 223, .08);
}
.visitor-summary[data-state="loading"] .visitor-summary-label i { animation: visitor-pulse 1.4s ease-in-out infinite; }
.visitor-summary[data-state="unavailable"] { border-color: rgba(255, 209, 102, .18); }
.visitor-summary[data-state="unavailable"] .visitor-summary-label { color: var(--gold); }
.visitor-summary-divider { width: 1px; height: 12px; background: var(--line); }
@keyframes visitor-pulse { 50% { opacity: .38; transform: scale(.72); } }
.primary-action, .secondary-action, .relation-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    font-weight: 680;
}
.primary-action { color: #06101d; border-color: var(--cyan); background: var(--cyan); }
.secondary-action { background: rgba(255, 255, 255, 0.035); }

.relation-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(10, 25, 42, 0.64);
    box-shadow: var(--shadow);
}
.relation-stats div { padding: 26px; }
.relation-stats div:nth-child(odd) { border-right: 1px solid var(--line); }
.relation-stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
.relation-stats dt { font-size: 35px; font-weight: 780; line-height: 1; }
.relation-stats dd { margin: 8px 0 0; color: var(--muted); font-size: 12px; letter-spacing: 0.05em; }
.hero-stats {
    display: flex;
    align-items: center;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(10, 25, 42, 0.58);
}
.hero-stats div { min-width: 112px; padding: 15px 18px; }
.hero-stats div + div { border-left: 1px solid var(--line); }
.hero-stats dt { font-size: 25px; font-weight: 780; line-height: 1; }
.hero-stats dd { margin: 5px 0 0; color: var(--muted); font-size: 10px; letter-spacing: .04em; }

.scene-section {
    padding-block: 54px 58px;
    border-block: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(19, 39, 62, 0.44), rgba(4, 12, 23, 0.18)),
        repeating-linear-gradient(90deg, transparent 0 79px, rgba(255,255,255,0.015) 80px);
}
.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 20px;
}
.section-heading h2 { margin: 0; font-size: clamp(28px, 3.2vw, 44px); line-height: 1.1; letter-spacing: -0.035em; }
.section-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }
.camera-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.camera-controls button, .chapter-filters button, .graph-chapters button {
    padding: 7px 12px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,0.025);
    cursor: pointer;
}
.camera-controls button:hover, .camera-controls button.active,
.chapter-filters button:hover, .chapter-filters button.active,
.graph-chapters button:hover, .graph-chapters button.active {
    color: #06101d;
    border-color: var(--cyan);
    background: var(--cyan);
}

.scene-layout { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(330px, 0.72fr); align-items: start; gap: 18px; }
.scene-card, .rule-inspector {
    height: clamp(620px, 72vh, 760px);
    min-height: 620px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}
.scene-card { position: relative; overflow: hidden; }
#rules-scene { display: block; width: 100%; height: 100%; min-height: 0; cursor: grab; }
#rules-scene:active { cursor: grabbing; }
.scene-loading, .scene-fallback {
    position: absolute;
    z-index: 6;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 14px;
    background: #071420;
    color: var(--muted);
}
.scene-loading[hidden], .scene-fallback[hidden] { display: none; }
.loader-ring {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.fallback-court { position: relative; width: 250px; aspect-ratio: 2; border: 3px solid white; background: #d28b40; }
.fallback-line { position: absolute; top: 0; bottom: 0; border-left: 2px solid white; }
.fallback-line.attack-left { left: 33.333%; }
.fallback-line.net-line { left: 50%; border-color: #17263a; }
.fallback-line.attack-right { left: 66.666%; }
.scene-hud {
    position: absolute;
    z-index: 5;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(5, 14, 24, 0.72);
    backdrop-filter: blur(10px);
    pointer-events: none;
}
.scene-hud.top-left { top: 16px; left: 16px; }
.scene-hud.bottom-left { bottom: 16px; left: 16px; color: var(--muted); font-size: 11px; }
.hud-label { display: block; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.scene-reset { position: absolute; z-index: 5; top: 16px; right: 16px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(5,14,24,.7); cursor: pointer; }
.scene-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px rgba(3, 12, 23, .2); border-radius: inherit; }
.scene-playback { position: absolute; z-index: 5; right: 16px; bottom: 16px; width: min(370px, calc(100% - 32px)); padding: 12px 14px; border: 1px solid rgba(137, 214, 230, .24); border-radius: 14px; background: rgba(6, 20, 33, .92); backdrop-filter: blur(16px); box-shadow: 0 8px 28px rgba(0, 0, 0, .2); }
.scene-playback[hidden] { display: none; }
.playback-topline, .playback-controls { display: flex; align-items: center; gap: 10px; }
.playback-topline { margin-bottom: 8px; font-size: 11px; color: #c0e8ec; }
.playback-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 9px rgba(88, 228, 223, .55); }
.playback-caption { margin-left: auto; font-size: 10px; color: var(--muted); }
.playback-controls button, .playback-controls select { min-height: 36px; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; background: #142e42; color: #e9f5ff; font: inherit; font-size: 12px; cursor: pointer; }
.playback-controls button { min-width: 50px; }
.playback-controls button:hover { border-color: var(--cyan); }
.playback-controls :focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
#scene-timeline { flex: 1; min-width: 0; height: 32px; margin: 0; accent-color: var(--cyan); cursor: ew-resize; }
.playback-speed { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
html[data-rules-violation-state] .scene-hud.bottom-left { display: none; }

.rule-inspector { padding: 25px; overflow: auto; }
.inspector-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.target-kind {
    display: inline-flex;
    padding: 4px 8px;
    color: var(--cyan);
    border: 1px solid rgba(88,228,223,.24);
    border-radius: 6px;
    background: rgba(88,228,223,.08);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
}
.unlock-button { color: var(--muted); border: 0; background: none; cursor: pointer; }
.rule-inspector h3 { margin: 20px 0 6px; font-size: 28px; line-height: 1.18; }
.inspector-hint { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.inspector-rule {
    margin-top: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.026);
}
.inspector-rule header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rule-number { color: var(--yellow); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.source-page { color: var(--muted); font-size: 10px; white-space: nowrap; }
.inspector-rule h4 { margin: 7px 0; font-size: 15px; }
.inspector-rule p { margin: 0; color: #d3deea; font-size: 13px; white-space: pre-line; }
.rule-ref-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.rule-chip { padding: 2px 6px; color: var(--blue); border: 1px solid rgba(57,167,255,.24); border-radius: 5px; background: rgba(57,167,255,.06); font-size: 10px; }

.violation-panel {
    margin-top: 16px;
    padding: 17px;
    border: 1px solid rgba(255, 100, 92, .24);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 91, 82, .075), rgba(9, 23, 39, .78) 42%);
}
.violation-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.violation-heading h3 { margin: 3px 0 4px; font-size: 19px; }
.violation-heading p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.violation-stop {
    flex: 0 0 auto;
    padding: 9px 13px;
    color: #ffd8d5;
    border: 1px solid rgba(255, 112, 102, .42);
    border-radius: 10px;
    background: rgba(255, 82, 73, .09);
    cursor: pointer;
}
.violation-list { display: flex; gap: 8px; margin-top: 13px; padding-bottom: 2px; overflow-x: auto; scrollbar-width: thin; }
.violation-button {
    display: grid;
    flex: 0 0 auto;
    min-width: 138px;
    gap: 3px;
    padding: 10px 12px;
    color: var(--text);
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255,255,255,.025);
    cursor: pointer;
}
.violation-button:hover { border-color: rgba(255, 112, 102, .58); background: rgba(255, 82, 73, .07); }
.violation-button.active { border-color: #ff7066; background: rgba(255, 82, 73, .16); box-shadow: inset 0 0 0 1px rgba(255,112,102,.2); }
.violation-category { color: #ff9d96; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.violation-button strong { font-size: 12px; }

.hotspot-strip { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 9px; margin-top: 16px; }
.hotspot-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.hotspot-list::-webkit-scrollbar { display: none; }
.hotspot-button, .strip-scroll {
    flex: 0 0 auto;
    padding: 9px 13px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.025);
    cursor: pointer;
}
.hotspot-button:hover, .hotspot-button.active { color: var(--text); border-color: var(--cyan); background: rgba(88,228,223,.1); }
.strip-scroll { width: 38px; padding: 0; font-size: 22px; }

.catalog-section, .glossary-section { padding-block: 64px; }
.relation-link { color: var(--cyan); white-space: nowrap; }
.catalog-toolbar { position: sticky; z-index: 30; top: 83px; display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 2fr); gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: rgba(6,16,29,.92); backdrop-filter: blur(18px); }
.search-field, .graph-search { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.035); }
.search-field svg { width: 17px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search-field input, .graph-search input { width: 100%; height: 38px; color: var(--text); outline: 0; border: 0; background: transparent; }
.search-field input::placeholder, .graph-search input::placeholder { color: #71859c; }
.search-field:focus-within, .graph-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(57,167,255,.12); }
.search-field kbd { color: var(--muted); font-size: 10px; white-space: nowrap; }
.chapter-filters { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chapter-filters button { flex: 0 0 auto; padding: 6px 10px; font-size: 11px; }
.search-result { min-height: 20px; margin: 9px 3px 5px; color: var(--muted); font-size: 12px; }

.chapter-block { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(10,25,42,.48); }
.chapter-block > header { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.chapter-index { display: grid; width: 27px; height: 27px; place-items: center; color: #07111f; border-radius: 7px; background: var(--cyan); font-size: 10px; font-weight: 800; }
.chapter-block h3 { margin: 0; font-size: 16px; }
.main-rule { border-top: 1px solid var(--line); }
.main-rule:first-of-type { border-top: 0; }
.main-rule > summary { display: grid; grid-template-columns: 48px minmax(0,1fr) auto 20px; align-items: center; gap: 9px; padding: 12px 14px; cursor: pointer; list-style: none; }
.main-rule > summary::-webkit-details-marker { display: none; }
.main-rule > summary::after { content: "+"; justify-self: end; color: var(--muted); font-size: 19px; line-height: 1; }
.main-rule[open] > summary::after { content: "−"; }
.main-rule > summary:hover { background: rgba(255,255,255,.028); }
.main-rule-number { color: var(--yellow); font-size: 15px; font-weight: 800; }
.main-rule-title { font-size: 15px; font-weight: 680; }
.main-rule-count { color: var(--muted); font-size: 10px; }
.clauses { padding: 0 14px 12px 62px; }
.clause { padding: 11px 0; border-top: 1px solid var(--line); scroll-margin-top: 140px; }
.clause:first-child { border-top: 0; }
.clause-head { display: flex; align-items: baseline; gap: 12px; }
.clause h4 { margin: 0; font-size: 13px; }
.clause p { margin: 5px 0 0; color: #cad7e4; font-size: 13px; line-height: 1.55; white-space: pre-line; }
.clause-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 9px; }
.empty-state { padding: 60px 20px; color: var(--muted); text-align: center; border: 1px dashed var(--line-strong); border-radius: 18px; }

.signals-section { padding-block: 64px; border-block: 1px solid var(--line); background: rgba(15,35,57,.34); }
.signal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 11px; }
.signal-card { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: rgba(6,16,29,.62); transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.signal-card:hover { border-color: rgba(71,190,255,.42); box-shadow: 0 18px 34px rgba(0,0,0,.24), 0 0 28px rgba(38,169,255,.08); transform: translateY(-3px); }
.signal-figure { display: grid; min-height: 142px; place-items: center; margin-bottom: 13px; overflow: hidden; border: 1px solid rgba(87,184,255,.12); border-radius: 11px; background: #071522; }
.signal-sprite { width: min(100%, 190px); aspect-ratio: 1; background-image: var(--signal-image); background-repeat: no-repeat; background-position: var(--signal-x) var(--signal-y); background-size: var(--signal-size-x) var(--signal-size-y); filter: saturate(1.04) contrast(1.02); transition: filter .2s ease, transform .25s ease; }
.signal-card:hover .signal-sprite { filter: saturate(1.1) contrast(1.04) drop-shadow(0 9px 14px rgba(0,0,0,.28)); transform: scale(1.025); }
.signal-sprite--r1-r5 { --signal-image: url("assets/signals/referee-r1-r5.png"); }
.signal-sprite--r6-r10 { --signal-image: url("assets/signals/referee-r6-r10.png"); }
.signal-sprite--r11-r20 { --signal-image: url("assets/signals/referee-r11-r20.png"); }
.signal-sprite--r11-eight { --signal-image: url("assets/signals/referee-r11-eight-fingers.png"); }
.signal-sprite--r21-l5 { --signal-image: url("assets/signals/official-r21-l5.png"); }
.signal-card h3 { margin: 0; font-size: 14px; line-height: 1.3; }
.signal-card p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.signal-code { color: var(--yellow); font-size: 10px; font-weight: 800; }

.fold-section > summary { list-style: none; }
.fold-section > summary::-webkit-details-marker { display: none; }
.fold-summary { margin-bottom: 0; cursor: pointer; user-select: none; }
.fold-summary:focus-visible { outline: 2px solid var(--yellow); outline-offset: 6px; border-radius: 10px; }
.fold-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 86px;
    min-height: 38px;
    justify-content: center;
    color: var(--cyan);
    border: 1px solid rgba(88,228,223,.3);
    border-radius: 10px;
    background: rgba(88,228,223,.06);
    font-size: 12px;
    font-weight: 700;
}
.fold-label::before { content: "展开"; }
.fold-chevron { font-size: 19px; line-height: 1; transition: transform .2s ease; }
.fold-section[open] .fold-label::before { content: "收起"; }
.fold-section[open] .fold-chevron { transform: rotate(180deg); }
.fold-section[open] .fold-content { padding-top: 20px; }
.fold-summary:hover .fold-control { border-color: var(--cyan); background: rgba(88,228,223,.11); }

.glossary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.glossary-item { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.glossary-item h3 { margin: 0 0 7px; color: var(--cyan); font-size: 16px; }
.glossary-item p { margin: 0; color: var(--muted); font-size: 13px; }

.site-footer { padding-block: 38px; border-top: 1px solid var(--line); background: #040b13; }
.footer-grid { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.site-footer p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.footer-links { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }

@media (min-width: 1101px) {
    .chapter-block { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chapter-block > header { grid-column: 1 / -1; }
    .main-rule:nth-of-type(odd) { border-right: 1px solid var(--line); }
    .main-rule:nth-of-type(2) { border-top: 0; }
    .main-rule[open] { grid-column: 1 / -1; border-right: 0; }
    .main-rule[open] .clauses { max-width: 1080px; }
}

@media (max-width: 1100px) {
    .hero { grid-template-columns: 1fr; gap: 22px; min-height: 0; padding-block: 38px; }
    .hero-stats { max-width: 650px; }
    .scene-layout { grid-template-columns: 1fr; }
    .scene-card { height: 590px; min-height: 590px; }
    #rules-scene { min-height: 0; }
    .rule-inspector { height: auto; min-height: 0; max-height: 600px; }
    .signal-grid { grid-template-columns: repeat(3, 1fr); }
    .glossary-grid { grid-template-columns: repeat(2, 1fr); }
    .catalog-toolbar { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    :root { --container: min(100% - 28px, 1440px); }
    .site-header { position: relative; align-items: flex-start; padding: 13px 14px; }
    .brand strong { font-size: 13px; }
    .brand small { font-size: 9px; }
    .brand-ball { width: 37px; height: 37px; font-size: 19px; }
    .site-nav { justify-content: flex-end; flex-wrap: wrap; gap: 2px; }
    .site-nav a { padding: 6px 7px; font-size: 11px; }
    .hero { padding-block: 32px; }
    .hero h1, .relation-intro h1 { font-size: clamp(38px, 10.7vw, 50px); }
    .hero-summary { font-size: 14px; }
    .hero-actions { align-items: stretch; }
    .hero-stats div { min-width: 0; padding: 12px 14px; }
    .hero-stats dt { font-size: 23px; }
    .scene-section, .catalog-section, .signals-section, .glossary-section { padding-block: 48px; }
    .section-heading { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 16px; }
    .camera-controls { justify-content: flex-start; }
    .scene-card { height: 480px; min-height: 480px; }
    #rules-scene { min-height: 0; }
    .scene-hud.bottom-left { display: none; }
    .violation-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    .violation-stop { align-self: flex-start; }
    .catalog-toolbar { position: static; }
    .main-rule > summary { grid-template-columns: 50px minmax(0,1fr) auto; gap: 8px; padding-inline: 13px; }
    .main-rule-count { display: none; }
    .clauses { padding-left: 18px; }
    .signal-grid { grid-template-columns: repeat(2, 1fr); }
    .glossary-grid { grid-template-columns: 1fr; }
    .footer-grid { align-items: flex-start; flex-direction: column; }
    .footer-links { flex-wrap: wrap; }
}

@media (max-width: 430px) {
    .site-header { flex-direction: column; gap: 10px; }
    .site-nav { width: 100%; justify-content: flex-start; }
    .hero-stats { width: 100%; }
    .hero-stats div { flex: 1; padding-inline: 10px; }
    .scene-card { height: 420px; min-height: 420px; }
    #rules-scene { min-height: 0; }
    .signal-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
