/* ============================================================
   judge.bar — Goblin Court HUD Interface
   Aurora Gradient / Crystalline / Goblincore fusion
   ============================================================ */

:root {
    --void: #0d1117;
    --indigo: #1a0a2e;
    --midnight: #0a1628;
    --aurora-green: #6bffb8;
    --aurora-violet: #c4a0ff;
    --aurora-cyan: #4ecdc4;
    --aurora-pink: #ff6b9d;
    --fog: #b8c4d0;
    --stone: #5c6370;
    --moss-brown: #a89070;
    --moss-green: #4a6b3a;
    --quartz: #e8f0f8;

    --aurora-sweep: linear-gradient(135deg, #0d1117 0%, #1a0a2e 40%, #0a1628 70%, #0d1117 100%);
    --crystal-edge: linear-gradient(90deg, #6bffb8, #4ecdc4, #c4a0ff);
    --mineral-vein: linear-gradient(180deg, rgba(107, 255, 184, 0.15), rgba(196, 160, 255, 0.05));

    --hud-font: 'JetBrains Mono', ui-monospace, monospace;
    --display-font: 'Sono', 'JetBrains Mono', ui-monospace, monospace;
    --hand-font: 'Caveat', cursive;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--void);
    color: var(--fog);
    font-family: var(--hud-font);
    font-size: clamp(13px, 0.9vw, 16px);
}

body {
    position: relative;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(196, 160, 255, 0.08), transparent 55%),
        radial-gradient(ellipse at 85% 80%, rgba(107, 255, 184, 0.06), transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(78, 205, 196, 0.04), transparent 60%),
        var(--void);
}

/* ============================================================
   Noise + Scanline Layers
   ============================================================ */
.texture-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    filter: url(#noise);
    opacity: 0.6;
    mix-blend-mode: overlay;
}

.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(107, 255, 184, 0.03) 2px,
        rgba(107, 255, 184, 0.03) 4px
    );
    mix-blend-mode: screen;
}

/* ============================================================
   HUD FRAME
   ============================================================ */
.hud-frame {
    position: fixed;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 60px;
    height: 60px;
    opacity: 0;
    animation: corner-in 400ms ease-out forwards;
}
.corner::before,
.corner::after {
    content: '';
    position: absolute;
    background: var(--aurora-green);
    box-shadow: 0 0 8px rgba(107, 255, 184, 0.5);
    opacity: 0.6;
}
.corner--tl { top: 18px; left: 18px; animation-delay: 100ms; }
.corner--tl::before { top: 0; left: 0; width: 60px; height: 2px; }
.corner--tl::after  { top: 0; left: 0; width: 2px; height: 60px; }

.corner--tr { top: 18px; right: 18px; animation-delay: 300ms; }
.corner--tr::before { top: 0; right: 0; width: 60px; height: 2px; }
.corner--tr::after  { top: 0; right: 0; width: 2px; height: 60px; }

.corner--br { bottom: 18px; right: 18px; animation-delay: 500ms; }
.corner--br::before { bottom: 0; right: 0; width: 60px; height: 2px; }
.corner--br::after  { bottom: 0; right: 0; width: 2px; height: 60px; }

.corner--bl { bottom: 18px; left: 18px; animation-delay: 700ms; }
.corner--bl::before { bottom: 0; left: 0; width: 60px; height: 2px; }
.corner--bl::after  { bottom: 0; left: 0; width: 2px; height: 60px; }

@keyframes corner-in {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: scale(1); }
}

/* Moss patches */
.moss {
    position: absolute;
    width: 38px;
    height: 38px;
    pointer-events: none;
    opacity: 0.35;
    background-image:
        radial-gradient(circle at 20% 30%, var(--moss-green) 0 2.5px, transparent 3px),
        radial-gradient(circle at 60% 50%, var(--moss-green) 0 2px, transparent 2.5px),
        radial-gradient(circle at 35% 70%, var(--moss-green) 0 2px, transparent 2.5px),
        radial-gradient(circle at 80% 20%, var(--moss-green) 0 1.5px, transparent 2px),
        radial-gradient(circle at 50% 85%, var(--moss-brown) 0 1.5px, transparent 2px);
}
.moss--tl { top: 28px; left: 90px; }
.moss--tr { top: 28px; right: 90px; }
.moss--bl { bottom: 28px; left: 90px; }
.moss--br { bottom: 28px; right: 90px; }

/* Cracks SVG */
.cracks {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Status bars */
.status-bar {
    position: absolute;
    left: 95px;
    right: 95px;
    height: 26px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--hud-font);
    font-size: clamp(0.68rem, 0.82vw, 0.82rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--aurora-green);
    opacity: 0;
    animation: bar-in 600ms ease-out 1000ms forwards;
}

.status-bar--top {
    top: 28px;
    border-bottom: 1px solid rgba(107, 255, 184, 0.25);
    padding-bottom: 4px;
}
.status-bar--bottom {
    bottom: 28px;
    border-top: 1px solid rgba(107, 255, 184, 0.25);
    padding-top: 4px;
    justify-content: flex-start;
}

.status-sep {
    color: rgba(107, 255, 184, 0.4);
}

.status-item {
    color: var(--fog);
    white-space: nowrap;
}
.status-item:first-child,
.status-bar--bottom .status-item:first-child {
    color: var(--aurora-green);
    font-weight: 700;
}

.hud-help {
    color: var(--stone);
    margin-left: auto;
}

.cursor-blink {
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: var(--aurora-green);
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

@keyframes bar-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Edge labels (left vertical + right state) */
.edge-label {
    position: absolute;
    font-family: var(--hud-font);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--aurora-green);
    opacity: 0.6;
    pointer-events: none;
}

.edge-label--left {
    left: 30px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: left center;
    white-space: nowrap;
}

.edge-label--right {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    pointer-events: auto;
}

.state-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 300ms ease, transform 300ms ease;
}
.state-dot::before {
    content: '';
    width: 10px;
    height: 10px;
    background: transparent;
    border: 1px solid var(--aurora-green);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    transition: background 250ms ease, transform 300ms ease;
}
.state-dot.is-current {
    opacity: 1;
    transform: scale(1.1);
}
.state-dot.is-current::before {
    background: var(--aurora-green);
    box-shadow: 0 0 12px rgba(107, 255, 184, 0.75);
}
.state-num {
    font-size: 0.58rem;
    color: var(--stone);
    letter-spacing: 0.1em;
}
.state-dot.is-current .state-num {
    color: var(--aurora-green);
}

/* ============================================================
   STAGE + STATE containers
   ============================================================ */
.stage {
    position: absolute;
    inset: 70px 110px 70px 110px;
    z-index: 5;
}

.state {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.985);
    transition: opacity 500ms ease, transform 600ms ease;
    overflow: hidden;
}
.state.is-active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* ============================================================
   STATE 01 — SUMMONS
   ============================================================ */
.state--01 .summons-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.summons-crystal {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(44vw, 520px);
    height: auto;
    transform: translate(-50%, -52%) scale(1);
    filter: drop-shadow(0 0 28px rgba(107, 255, 184, 0.25))
            drop-shadow(0 0 60px rgba(196, 160, 255, 0.18));
    animation: crystal-pulse 4.5s ease-in-out infinite;
}

.summons-crystal .crystal-core {
    transform-origin: center;
    animation: crystal-core-fade 1200ms ease-out 600ms backwards;
}

.summons-crystal .crystal-facet {
    transform-origin: 200px 250px;
    animation: facet-grow 900ms cubic-bezier(.2,.7,.3,1) backwards;
}
.summons-crystal .facet-a { animation-delay: 900ms; }
.summons-crystal .facet-b { animation-delay: 1150ms; }
.summons-crystal .facet-c { animation-delay: 1350ms; }

@keyframes facet-grow {
    from { opacity: 0; transform: scale(0.1); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes crystal-core-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes crystal-pulse {
    0%, 100% { transform: translate(-50%, -52%) scale(1); filter: drop-shadow(0 0 28px rgba(107, 255, 184, 0.25)) drop-shadow(0 0 60px rgba(196, 160, 255, 0.18)); }
    50%      { transform: translate(-50%, -52%) scale(1.02); filter: drop-shadow(0 0 40px rgba(107, 255, 184, 0.4)) drop-shadow(0 0 80px rgba(196, 160, 255, 0.24)); }
}

.lens-flare--apex {
    position: absolute;
    top: calc(50% - 210px);
    left: 50%;
    width: 240px;
    height: 240px;
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    background: radial-gradient(circle at center,
        rgba(107, 255, 184, 0.6) 0%,
        rgba(196, 160, 255, 0.25) 30%,
        transparent 65%);
    pointer-events: none;
    animation: flare-bloom 800ms ease-out 1800ms forwards,
               lens-pulse 4s ease-in-out 2600ms infinite;
}

@keyframes flare-bloom {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes lens-pulse {
    0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.15); }
}

.summons-text {
    position: relative;
    z-index: 3;
    text-align: center;
    mix-blend-mode: screen;
    pointer-events: none;
}

.all-rise {
    font-family: var(--display-font);
    font-weight: 300;
    font-size: clamp(2.8rem, 8vw, 6.5rem);
    color: var(--aurora-green);
    letter-spacing: -0.02em;
    line-height: 1;
    text-shadow:
        0 0 22px rgba(107, 255, 184, 0.55),
        0 0 52px rgba(196, 160, 255, 0.35);
}

.court-intro {
    margin-top: 1.25rem;
    font-family: var(--hud-font);
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--fog);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    min-height: 1.6em;
}

.summons-field-note {
    position: absolute;
    bottom: 8%;
    right: 7%;
    font-family: var(--hand-font);
    font-size: clamp(0.95rem, 1.3vw, 1.2rem);
    color: var(--moss-brown);
    opacity: 0;
    animation: note-fade 800ms ease-out 3200ms forwards;
    transform: rotate(-4deg);
}
.caveat {
    font-family: var(--hand-font);
    color: var(--moss-brown);
}

@keyframes note-fade {
    from { opacity: 0; transform: rotate(-4deg) translateY(10px); }
    to   { opacity: 0.9; transform: rotate(-4deg) translateY(0); }
}

/* Character reveal spans */
.ch {
    display: inline-block;
    opacity: 0;
    animation: char-appear 120ms ease-out forwards;
}
@keyframes char-appear {
    from { opacity: 0; transform: translateY(4px); filter: blur(4px); }
    to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

/* ============================================================
   STATE 02 — DOCKET
   ============================================================ */
.docket-layout {
    display: grid;
    grid-template-columns: minmax(340px, 40%) 1fr;
    gap: 24px;
    width: 100%;
    height: 100%;
    padding: 8px 4px;
}

.case-files,
.evidence-chamber {
    position: relative;
    background: var(--mineral-vein);
    border: 1px solid rgba(107, 255, 184, 0.18);
    border-radius: 0;
    clip-path: polygon(
        0 6px, 6px 0,
        calc(100% - 6px) 0, 100% 6px,
        100% calc(100% - 6px), calc(100% - 6px) 100%,
        6px 100%, 0 calc(100% - 6px)
    );
    padding: 18px 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(107, 255, 184, 0.22);
    margin-bottom: 12px;
    font-family: var(--hud-font);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.panel-title {
    color: var(--aurora-green);
    font-weight: 700;
}
.panel-meta {
    color: var(--stone);
}

.case-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}
.case-list::-webkit-scrollbar { width: 4px; }
.case-list::-webkit-scrollbar-thumb { background: rgba(107, 255, 184, 0.35); }

.case-row {
    display: grid;
    grid-template-columns: 10px 72px 1fr auto 94px;
    gap: 10px;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(107, 255, 184, 0.03);
    border: 1px solid rgba(107, 255, 184, 0.15);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--fog);
    cursor: pointer;
    position: relative;
    transition: border-color 250ms ease, background 250ms ease, transform 250ms ease;
}

.case-row:hover,
.case-row.is-active {
    border-color: var(--aurora-green);
    background: rgba(107, 255, 184, 0.08);
    transform: translateX(2px);
    box-shadow: inset 2px 0 0 var(--aurora-green), 0 0 18px rgba(107, 255, 184, 0.15);
}
.case-row:hover::before,
.case-row.is-active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    width: 40px;
    height: 40px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(107, 255, 184, 0.55) 0%, transparent 65%);
    pointer-events: none;
}

.case-status {
    width: 10px;
    height: 10px;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    background: var(--stone);
}
.case-status--green { background: var(--aurora-green); box-shadow: 0 0 8px rgba(107, 255, 184, 0.65); }
.case-status--amber { background: #ffcc66; box-shadow: 0 0 8px rgba(255, 204, 102, 0.55); }
.case-status--red   { background: var(--aurora-pink); box-shadow: 0 0 8px rgba(255, 107, 157, 0.55); }

.case-id { color: var(--aurora-cyan); font-weight: 700; }
.case-name { color: var(--fog); text-transform: none; letter-spacing: 0.02em; }
.case-date { color: var(--stone); font-size: 0.68rem; }
.case-state { color: var(--aurora-violet); font-size: 0.65rem; text-align: right; }

.panel-footnote {
    margin-top: 12px;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--moss-brown);
    opacity: 0.85;
    transform: rotate(-1.2deg);
    padding-left: 8px;
}

/* Evidence chamber */
.evidence-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    position: relative;
}

.evidence-rotator {
    position: relative;
    width: min(360px, 48%);
    aspect-ratio: 1 / 1;
    transform-style: preserve-3d;
    perspective: 800px;
}

.evidence-svg {
    width: 100%;
    height: 100%;
    animation: evidence-spin 20s linear infinite;
    transform-style: preserve-3d;
    filter: drop-shadow(0 0 18px rgba(107, 255, 184, 0.22));
}

.evidence-vertex {
    transition: fill 400ms ease;
}

#evidencePolygon,
#evidencePolygonInner {
    transition: points 600ms cubic-bezier(.25,.8,.25,1);
}

.evidence-flare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 45%, rgba(196, 160, 255, 0.25) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 400ms ease;
}
.evidence-rotator.is-lit .evidence-flare {
    opacity: 1;
}

@keyframes evidence-spin {
    from { transform: rotateY(0deg); }
    to   { transform: rotateY(360deg); }
}

.evidence-readout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.readout-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed rgba(107, 255, 184, 0.2);
    padding: 6px 0;
}
.readout-label { color: var(--stone); }
.readout-value { color: var(--aurora-green); font-weight: 700; }

/* ============================================================
   STATE 03 — VERDICT CHAMBER
   ============================================================ */
.state--03 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.verdict-aurora {
    position: absolute;
    inset: 0;
    background: var(--aurora-sweep);
    background-size: 260% 260%;
    animation: aurora-shift 14s ease-in-out infinite;
    z-index: 0;
}
.verdict-aurora::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 25% 30%, rgba(107, 255, 184, 0.15), transparent 55%),
        radial-gradient(circle at 80% 70%, rgba(196, 160, 255, 0.2), transparent 55%);
}

@keyframes aurora-shift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

.verdict-scene {
    position: relative;
    z-index: 2;
    width: min(720px, 85%);
    height: min(520px, 78%);
    perspective: 1400px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}
.verdict-scene:active { cursor: grabbing; }

.verdict-rotator {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(-4deg) rotateY(var(--rotation, 0deg));
    transition: transform 60ms linear;
    animation: verdict-auto-spin 40s linear infinite;
}

@keyframes verdict-auto-spin {
    from { transform: rotateX(-4deg) rotateY(var(--rotation, 0deg)); }
    to   { transform: rotateX(-4deg) rotateY(calc(var(--rotation, 0deg) + 360deg)); }
}

.verdict-face {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 460px;
    height: 360px;
    margin-left: -230px;
    margin-top: -180px;
    padding: 36px 40px;
    background:
        linear-gradient(135deg, rgba(13, 17, 23, 0.8), rgba(26, 10, 46, 0.65)),
        var(--mineral-vein);
    border: 1px solid rgba(107, 255, 184, 0.45);
    backdrop-filter: blur(8px) brightness(1.1);
    -webkit-backdrop-filter: blur(8px) brightness(1.1);
    box-shadow:
        0 0 30px rgba(107, 255, 184, 0.25),
        inset 0 0 30px rgba(196, 160, 255, 0.12);
    clip-path: polygon(
        8% 0, 92% 0,
        100% 16%, 100% 84%,
        92% 100%, 8% 100%,
        0 84%, 0 16%
    );
    display: flex;
    flex-direction: column;
    gap: 14px;
    backface-visibility: hidden;
}

.face-front { transform: rotateY(0deg) translateZ(300px); }
.face-right { transform: rotateY(90deg) translateZ(300px); }
.face-back  { transform: rotateY(180deg) translateZ(300px); }
.face-left  { transform: rotateY(-90deg) translateZ(300px); }

.face-tag {
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--aurora-cyan);
    border-bottom: 1px solid rgba(78, 205, 196, 0.35);
    padding-bottom: 6px;
}

.verdict-title {
    font-family: var(--display-font);
    font-weight: 300;
    font-size: clamp(1.4rem, 2.6vw, 2.3rem);
    color: var(--aurora-green);
    letter-spacing: -0.01em;
    line-height: 1.05;
    text-shadow: 0 0 18px rgba(107, 255, 184, 0.45);
}

.verdict-body {
    font-family: var(--hud-font);
    color: var(--fog);
    line-height: 1.6;
    font-size: clamp(0.78rem, 0.95vw, 0.95rem);
    letter-spacing: 0.02em;
}
.verdict-body em {
    color: var(--aurora-violet);
    font-style: normal;
    text-decoration: underline wavy rgba(196, 160, 255, 0.45);
    text-underline-offset: 4px;
}

.verdict-hint {
    position: absolute;
    bottom: -48px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: var(--moss-brown);
    white-space: nowrap;
    opacity: 0.85;
}

.verdict-meta {
    position: absolute;
    left: 16px;
    bottom: 12px;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 10px 28px;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.meta-block { display: flex; flex-direction: column; gap: 2px; }
.meta-label { color: var(--stone); }
.meta-value { color: var(--aurora-green); font-weight: 700; }

/* Verdict vertex lens flares */
.verdict-scene::before,
.verdict-scene::after {
    content: '';
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(107, 255, 184, 0.45), transparent 65%);
    pointer-events: none;
    animation: lens-pulse 4s ease-in-out infinite;
}
.verdict-scene::before { top: -20px; left: 20%; }
.verdict-scene::after  { bottom: -10px; right: 18%; background: radial-gradient(circle at center, rgba(196, 160, 255, 0.4), transparent 65%); }

/* ============================================================
   STATE 04 — ARCHIVE
   ============================================================ */
.state--04 {
    padding-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-family: var(--hud-font);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 6px 4px 10px;
    border-bottom: 1px solid rgba(107, 255, 184, 0.22);
}

.hex-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    padding: 8px 4px 4px;
    align-content: start;
    overflow-y: auto;
}
.hex-grid::-webkit-scrollbar { width: 4px; }
.hex-grid::-webkit-scrollbar-thumb { background: rgba(107, 255, 184, 0.35); }

.hex-cell {
    position: relative;
    aspect-ratio: 1 / 1.12;
    cursor: pointer;
    transition: transform 400ms ease, opacity 400ms ease;
}

.hex-cell-outer,
.hex-cell-inner {
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transition: background 300ms ease;
}
.hex-cell-outer {
    background: rgba(107, 255, 184, 0.15);
}
.hex-cell-inner {
    inset: 2px;
    background: rgba(10, 22, 40, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    text-align: center;
    padding: 10px;
}

.hex-mini {
    width: 32px;
    height: 32px;
    clip-path: polygon(50% 5%, 95% 30%, 95% 70%, 50% 95%, 5% 70%, 5% 30%);
    background: linear-gradient(135deg, rgba(107, 255, 184, 0.5), rgba(196, 160, 255, 0.3));
    box-shadow: 0 0 12px rgba(107, 255, 184, 0.35);
}

.hex-ref {
    font-family: var(--hud-font);
    font-size: 0.72rem;
    color: var(--aurora-cyan);
    letter-spacing: 0.1em;
}
.hex-era {
    font-family: var(--hud-font);
    font-size: 0.58rem;
    color: var(--stone);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.hex-cell:hover .hex-cell-outer {
    background: rgba(196, 160, 255, 0.6);
}
.hex-cell:hover .hex-cell-inner {
    background: rgba(26, 10, 46, 0.75);
}
.hex-cell::after {
    content: '';
    position: absolute;
    inset: -8px;
    background: radial-gradient(circle at center, rgba(107, 255, 184, 0.45), transparent 60%);
    opacity: 0;
    transition: opacity 300ms ease;
    pointer-events: none;
    z-index: 2;
}
.hex-cell:hover::after { opacity: 1; }

.hex-cell.is-dimmed {
    opacity: 0.15;
    transform: scale(0.85);
    pointer-events: none;
}

/* Archive modal */
.archive-modal {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: modal-in 400ms ease-out forwards;
}
.archive-modal[hidden] { display: none; }

@keyframes modal-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.archive-modal-inner {
    position: relative;
    width: min(680px, 92%);
    aspect-ratio: 1 / 0.78;
    padding: 40px 52px;
    background:
        linear-gradient(135deg, rgba(13, 17, 23, 0.92), rgba(26, 10, 46, 0.85));
    border: 1px solid var(--aurora-green);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-shadow: 0 0 40px rgba(107, 255, 184, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: hex-expand 600ms cubic-bezier(.2,.7,.3,1) forwards;
}

@keyframes hex-expand {
    from { transform: scale(0.3); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.archive-close {
    position: absolute;
    top: 28%;
    right: 16%;
    background: transparent;
    border: 1px solid rgba(107, 255, 184, 0.45);
    color: var(--aurora-green);
    font-family: var(--hud-font);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    padding: 6px 12px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 200ms ease;
}
.archive-close:hover {
    background: rgba(107, 255, 184, 0.15);
}

.archive-hex-expanded {
    text-align: center;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.expanded-label {
    font-size: 0.7rem;
    color: var(--stone);
    letter-spacing: 0.25em;
    text-transform: uppercase;
}
.expanded-id {
    font-family: var(--display-font);
    font-weight: 300;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    color: var(--aurora-green);
    letter-spacing: 0.04em;
    text-shadow: 0 0 14px rgba(107, 255, 184, 0.45);
}
.expanded-meta {
    font-size: 0.72rem;
    color: var(--aurora-violet);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.expanded-body {
    font-size: 0.82rem;
    color: var(--fog);
    line-height: 1.6;
    letter-spacing: 0.02em;
}
.expanded-note {
    margin-top: 6px;
    font-family: var(--hand-font);
    color: var(--moss-brown);
    font-size: 1.05rem;
    transform: rotate(-1.5deg);
}

/* ============================================================
   SHATTER OVERLAY
   ============================================================ */
.shatter-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 15;
    opacity: 0;
    visibility: hidden;
}
.shatter-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.shard {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28vmax;
    height: 28vmax;
    background: linear-gradient(135deg, rgba(107, 255, 184, 0.22), rgba(196, 160, 255, 0.15));
    border: 1px solid rgba(107, 255, 184, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transform-origin: center;
    opacity: 0;
}
.shatter-overlay.is-active .shard {
    animation: shard-out 900ms cubic-bezier(.3,.7,.3,1) forwards;
}

.shard-1  { clip-path: polygon(50% 0, 100% 40%, 60% 60%, 20% 40%); --dx: -40vw; --dy: -30vh; --rot: -35deg; animation-delay: 0ms; }
.shard-2  { clip-path: polygon(0 20%, 60% 0, 70% 50%, 10% 70%); --dx: 50vw; --dy: -20vh; --rot: 45deg; animation-delay: 40ms; }
.shard-3  { clip-path: polygon(30% 0, 100% 30%, 80% 80%, 20% 60%); --dx: 35vw; --dy: 45vh; --rot: 70deg; animation-delay: 80ms; }
.shard-4  { clip-path: polygon(0 50%, 50% 0, 100% 60%, 40% 100%); --dx: -55vw; --dy: 25vh; --rot: -60deg; animation-delay: 120ms; }
.shard-5  { clip-path: polygon(20% 10%, 90% 20%, 100% 90%, 10% 70%); --dx: 45vw; --dy: 40vh; --rot: 90deg; animation-delay: 160ms; }
.shard-6  { clip-path: polygon(10% 30%, 70% 10%, 80% 90%, 30% 70%); --dx: -30vw; --dy: 50vh; --rot: -80deg; animation-delay: 200ms; }
.shard-7  { clip-path: polygon(40% 0, 100% 50%, 70% 100%, 10% 90%); --dx: 30vw; --dy: -45vh; --rot: 25deg; animation-delay: 60ms; }
.shard-8  { clip-path: polygon(0 0, 60% 30%, 40% 80%, 0 60%); --dx: -45vw; --dy: -50vh; --rot: -110deg; animation-delay: 140ms; }
.shard-9  { clip-path: polygon(30% 20%, 100% 0, 90% 70%, 50% 100%); --dx: 60vw; --dy: 10vh; --rot: 130deg; animation-delay: 100ms; }
.shard-10 { clip-path: polygon(0 40%, 50% 10%, 80% 70%, 20% 100%); --dx: -20vw; --dy: 55vh; --rot: -150deg; animation-delay: 180ms; }

@keyframes shard-out {
    0%   { transform: translate(-50%, -50%) scale(0.35) rotate(0); opacity: 0; }
    15%  { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(var(--rot)); opacity: 0; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .stage {
        inset: 68px 46px 68px 46px;
    }
    .status-bar {
        left: 40px;
        right: 40px;
        font-size: 0.62rem;
    }
    .edge-label--left { left: 12px; }
    .edge-label--right { right: 6px; }
    .docket-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(260px, 48%) 1fr;
    }
    .verdict-face {
        width: 90%;
        height: 84%;
        margin-left: -45%;
        margin-top: -42%;
    }
    .face-front { transform: rotateY(0deg) translateZ(200px); }
    .face-right { transform: rotateY(90deg) translateZ(200px); }
    .face-back  { transform: rotateY(180deg) translateZ(200px); }
    .face-left  { transform: rotateY(-90deg) translateZ(200px); }
}

@media (max-width: 640px) {
    .hud-help { display: none; }
    .corner { width: 34px; height: 34px; }
    .corner--tl::before, .corner--tr::before, .corner--bl::before, .corner--br::before { width: 34px; }
    .corner--tl::after,  .corner--tr::after,  .corner--bl::after,  .corner--br::after  { height: 34px; }
    .case-row {
        grid-template-columns: 10px 60px 1fr;
        grid-template-rows: auto auto;
    }
    .case-date, .case-state { grid-column: 3 / -1; font-size: 0.6rem; }
}
