/* ==========================================================================
   sim-ai.org — Surreal Simulation Laboratory · 1930s Art Deco
   Palette: Forest Green (#1B3A2D base) + Deco Gold accents
   ========================================================================== */

:root {
    --c-bg-deep: #1B3A2D;       /* Evergreen Abyss */
    --c-bg-mid: #152E23;        /* darker liminal */
    --c-bg-deepest: #0D1A14;    /* Darkroom Black */
    --c-canopy: #2E7D32;        /* Forest Canopy */
    --c-lichen: #A8D5A2;        /* Pale Lichen */
    --c-phosphor: #D4E7C5;      /* Phosphor Green */
    --c-gold: #C9A84C;          /* Deco Gold */
    --c-parchment: #E8E0D0;     /* Aged Parchment */
    --c-sepia: #8B7355;         /* Daguerreotype Brown */
    --c-terminal: #66BB6A;      /* Terminal Green */

    --f-display: 'Poiret One', 'Cormorant Garamond', serif;
    --f-secondary: 'Josefin Sans', 'Inter', sans-serif;
    --f-body: 'Spectral', Georgia, serif;
    --f-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --gap: 4px;
    --border-hairline: 1px solid rgba(46, 125, 50, 0.4);
}

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

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

body {
    font-family: var(--f-body);
    background: var(--c-bg-deep);
    color: var(--c-parchment);
    overflow-x: hidden;
    line-height: 1.55;
    min-height: 100vh;
    position: relative;
    background-image:
        radial-gradient(ellipse at 20% 10%, rgba(46, 125, 50, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(46, 125, 50, 0.06) 0%, transparent 60%);
}

/* ---------- Flowing curves background layer ---------- */
.flowing-layer {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 300vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0.2;
    transition: opacity 1.2s ease;
}
.tray-2-active .flowing-layer { opacity: 0.32; }
.tray-3-active .flowing-layer { opacity: 0.42; }

.flowing-layer path {
    stroke-dasharray: 20 80;
    animation: dash-flow 12s linear infinite;
}
.curve-helix-a { animation-duration: 14s; }
.curve-helix-b { animation-duration: 14s; animation-direction: reverse; }
.curve-dendrite-1 { animation-duration: 9s; }
.curve-dendrite-2 { animation-duration: 9s; animation-delay: -2s; }
.curve-dendrite-3 { animation-duration: 11s; animation-delay: -4s; }
.curve-dendrite-4 { animation-duration: 11s; animation-delay: -6s; }
.curve-dendrite-5 { animation-duration: 7s; }
.curve-dendrite-6 { animation-duration: 7s; animation-direction: reverse; }
.curve-sine { animation-duration: 18s; }

@keyframes dash-flow {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -100; }
}

/* ---------- Vignette ---------- */
.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background:
        radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(13, 26, 20, 0.45) 90%),
        repeating-linear-gradient(0deg, rgba(0,0,0,0.05) 0 1px, transparent 1px 3px);
    mix-blend-mode: multiply;
}

/* ---------- Top brand strip ---------- */
.top-brand {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px 10px;
    background: linear-gradient(180deg, rgba(13, 26, 20, 0.85) 0%, rgba(13, 26, 20, 0.0) 100%);
    border-bottom: 1px solid rgba(201, 168, 76, 0.18);
}
.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-rosette {
    width: 28px;
    height: 28px;
    animation: rosette-spin 60s linear infinite;
}
@keyframes rosette-spin {
    to { transform: rotate(360deg); }
}
.brand-name {
    font-family: var(--f-display);
    font-size: 1.4rem;
    color: var(--c-phosphor);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(46, 125, 50, 0.5);
}
.brand-dot { color: var(--c-gold); }
.brand-tld {
    font-size: 0.85rem;
    color: var(--c-lichen);
    margin-left: 4px;
    letter-spacing: 0.1em;
}
.brand-meta {
    font-family: var(--f-mono);
    font-size: 0.7rem;
    color: var(--c-lichen);
    letter-spacing: 0.12em;
    display: flex;
    gap: 14px;
    text-transform: uppercase;
}
.brand-meta em {
    color: var(--c-gold);
    font-style: italic;
    font-family: var(--f-body);
    font-size: 0.78rem;
    margin-right: 2px;
}
.meta-divider { opacity: 0.4; }
.meta-status {
    color: var(--c-terminal);
    animation: status-blink 2s ease-in-out infinite;
}
@keyframes status-blink {
    0%, 70%, 100% { opacity: 1; }
    80% { opacity: 0.3; }
}

/* ---------- Right rosette navigation ---------- */
.rosette-nav {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.rosette {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rosette svg {
    width: 100%;
    height: 100%;
    transition: transform 0.6s ease;
}
.rosette:hover svg {
    transform: rotate(15deg);
}
.rosette:hover {
    filter: drop-shadow(0 0 10px rgba(46, 125, 50, 0.6));
}
.rosette.is-active svg {
    filter: drop-shadow(0 0 8px rgba(102, 187, 106, 0.7));
}
.rosette.is-active .rosette-core {
    animation: core-pulse 2s ease-in-out infinite;
}
@keyframes core-pulse {
    0%, 100% { fill: var(--c-phosphor); r: 2; }
    50% { fill: var(--c-terminal); r: 3.2; }
}
.rosette-label {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    font-family: var(--f-secondary);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    color: var(--c-lichen);
    text-transform: uppercase;
    background: rgba(13, 26, 20, 0.85);
    padding: 4px 10px;
    border: 1px solid rgba(201, 168, 76, 0.4);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.rosette:hover .rosette-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ---------- Trays main container ---------- */
.trays {
    position: relative;
    z-index: 5;
    scroll-snap-type: y proximity;
}
.tray {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    padding: 60px 60px 40px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}

.tray-header {
    display: flex;
    align-items: baseline;
    gap: 24px;
    margin-bottom: 18px;
    padding: 0 6px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.25);
    padding-bottom: 8px;
}
.tray-roman {
    font-family: var(--f-display);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--c-gold);
    letter-spacing: 0.2em;
}
.tray-title {
    font-family: var(--f-display);
    font-size: clamp(2rem, 5vw, 3.6rem);
    color: var(--c-phosphor);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 400;
    text-shadow: 0 0 22px rgba(46, 125, 50, 0.35);
    flex: 1;
}
.tray-tagline {
    font-family: var(--f-secondary);
    font-weight: 300;
    font-size: clamp(0.7rem, 1.1vw, 0.95rem);
    color: var(--c-lichen);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* ---------- Bento generic cell styles ---------- */
.bento {
    flex: 1;
    display: grid;
    gap: var(--gap);
    background: rgba(46, 125, 50, 0.45);
    padding: 1px;
    min-height: 0;
}
.cell {
    position: relative;
    background: var(--c-bg-deep);
    border: var(--border-hairline);
    overflow: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease,
                background 0.4s ease;
    opacity: 0;
    transform: translateY(8px) scale(0.985);
    animation: cell-in 0.6s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
    animation-delay: var(--delay, 0.1s);
}
@keyframes cell-in {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.cell:hover {
    transform: scale(1.018);
    box-shadow: 0 0 18px rgba(46, 125, 50, 0.32),
                inset 0 0 24px rgba(46, 125, 50, 0.12);
    z-index: 6;
}
.indicator-light {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c-canopy);
    box-shadow: 0 0 6px rgba(46, 125, 50, 0.7);
    animation: indicator-pulse 3s ease-in-out infinite;
}
@keyframes indicator-pulse {
    0%, 100% { background: var(--c-bg-deepest); box-shadow: 0 0 2px rgba(46, 125, 50, 0.3); }
    50% { background: var(--c-canopy); box-shadow: 0 0 10px rgba(46, 125, 50, 0.85); }
}

/* ---------- Common typography helpers ---------- */
.josefin-small {
    font-family: var(--f-secondary);
    font-weight: 400;
    font-size: 0.72rem;
    color: var(--c-lichen);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.cell-tag {
    border-bottom: 1px solid rgba(201, 168, 76, 0.3);
    padding-bottom: 6px;
    color: var(--c-gold);
}
.deco-heading {
    font-family: var(--f-display);
    font-size: clamp(1.6rem, 2.6vw, 2.4rem);
    line-height: 1.05;
    color: var(--c-phosphor);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 400;
    text-shadow: 0 0 16px rgba(46, 125, 50, 0.4);
}
.deco-heading-sm {
    font-family: var(--f-display);
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    line-height: 1.05;
    color: var(--c-phosphor);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 400;
}
.cell-body {
    font-family: var(--f-body);
    font-size: clamp(0.78rem, 0.95vw, 0.92rem);
    color: var(--c-parchment);
    line-height: 1.7;
}
.cell-body.italic, .italic { font-style: italic; }
.cell-body.mono, .mono {
    font-family: var(--f-mono);
    color: var(--c-terminal);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}
.signoff {
    margin-top: auto;
    color: var(--c-sepia);
    letter-spacing: 0.1em;
    font-size: 0.68rem;
}
.cell-mono {
    font-family: var(--f-mono);
    color: var(--c-terminal);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-align: center;
}

/* ---------- Vintage photograph treatment ---------- */
.vintage-specimen .photo-svg,
.vintage-specimen.photo-svg {
    filter: sepia(0.4) contrast(1.15) brightness(0.9) saturate(0.7);
    mix-blend-mode: luminosity;
    width: 100%;
    height: 100%;
    display: block;
}
.cell.vintage-specimen { padding: 0; }
.photo-frame {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--c-bg-deep);
}
.photo-base {
    width: 100%;
    height: 100%;
}
.photo-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(232, 224, 208, 0.04) 0%, transparent 1.5%),
        radial-gradient(circle at 70% 60%, rgba(232, 224, 208, 0.03) 0%, transparent 1%),
        radial-gradient(circle at 40% 80%, rgba(139, 115, 85, 0.04) 0%, transparent 1.5%),
        repeating-linear-gradient(45deg, rgba(139, 115, 85, 0.02) 0 1px, transparent 1px 3px);
    mix-blend-mode: overlay;
    opacity: 0.7;
}
.photo-svg .green-intrusion {
    /* counter the parent photo's filter so the intrusion remains saturated */
    filter: saturate(2.4) brightness(1.15);
}
.photo-caption,
.photo-caption-bottom {
    position: absolute;
    left: 0; right: 0;
    bottom: 0;
    padding: 8px 14px;
    background: linear-gradient(to top, rgba(13, 26, 20, 0.92), transparent);
    color: var(--c-parchment);
    font-family: var(--f-body);
    font-size: 0.76rem;
    font-style: italic;
    letter-spacing: 0.04em;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.caption-no {
    font-family: var(--f-mono);
    font-size: 0.65rem;
    color: var(--c-gold);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-style: normal;
}

/* ---------- Sunburst & ornaments ---------- */
.sunburst {
    position: absolute;
    width: 60px;
    height: 60px;
    pointer-events: none;
    opacity: 0.85;
}
.sunburst-tl { top: 6px; left: 6px; }
.sunburst-br { bottom: 6px; right: 6px; }

.fan-arc {
    position: absolute;
    width: 50px;
    height: 50px;
    pointer-events: none;
    animation: arc-rotate 60s linear infinite;
    transform-origin: center;
}
.fan-tl { top: 6px; left: 6px; transform-origin: 0 0; }
.fan-tr { top: 6px; right: 6px; transform-origin: 100% 0; animation-direction: reverse; }
.fan-bl { bottom: 6px; left: 6px; transform-origin: 0 100%; animation-direction: reverse; }
.fan-br { bottom: 6px; right: 6px; transform-origin: 100% 100%; }
@keyframes arc-rotate {
    to { transform: rotate(360deg); }
}

.ziggurat,
.ziggurat-row {
    width: 100%;
    height: 16px;
    margin: 6px 0;
    opacity: 0.7;
}
.ziggurat svg, .ziggurat-row svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   TRAY I — bento-1
   4 cols × 3 rows
   A = dominant 2x2, B = tall, C = tall, D, E, F = small units
   ============================================================ */
.bento-1 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}
.cell-a { grid-column: 1 / span 2; grid-row: 1 / span 2; }
.cell-b { grid-column: 3; grid-row: 1 / span 2; }
.cell-c { grid-column: 4; grid-row: 1 / span 2; }
.cell-d { grid-column: 1; grid-row: 3; align-items: center; justify-content: center; }
.cell-e { grid-column: 2; grid-row: 3; align-items: center; justify-content: center; }
.cell-f { grid-column: 3 / span 2; grid-row: 3; align-items: center; justify-content: center; flex-direction: row; gap: 30px; }

.vertical-text {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    padding: 4px;
}
.gauge-line {
    display: flex;
    gap: 6px;
    margin: 8px 0;
}
.gauge-tick {
    width: 12px;
    height: 4px;
    background: var(--c-bg-deepest);
    border: 1px solid var(--c-canopy);
}
.gauge-tick.gauge-active {
    background: var(--c-terminal);
    box-shadow: 0 0 8px var(--c-terminal);
}

/* Animated gear */
.anim-gear {
    width: 70%;
    max-width: 100px;
    animation: gear-rotate 4s linear infinite;
}
@keyframes gear-rotate {
    to { transform: rotate(360deg); }
}

/* Breath orb */
.breath-orb {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.breath-ring,
.breath-core {
    position: absolute;
    border-radius: 50%;
}
.breath-core {
    width: 14px; height: 14px;
    background: radial-gradient(circle, var(--c-phosphor) 0%, var(--c-canopy) 70%);
    box-shadow: 0 0 10px var(--c-canopy);
    animation: breath-core 3s ease-in-out infinite;
}
.breath-ring {
    border: 1px solid var(--c-canopy);
    animation: breath-ring 3s ease-in-out infinite;
}
.breath-ring-1 { width: 30px; height: 30px; }
.breath-ring-2 { width: 50px; height: 50px; animation-delay: -0.6s; }
@keyframes breath-core {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.8; }
}
@keyframes breath-ring {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 0.2; }
}

/* Helix mini */
.anim-helix {
    width: 50%;
    max-width: 80px;
    height: auto;
}
.helix-path-a, .helix-path-b {
    animation: dash-flow 6s linear infinite;
}
.helix-path-b { animation-direction: reverse; }

/* ============================================================
   Liminal zones
   ============================================================ */
.liminal {
    position: relative;
    height: 20vh;
    min-height: 120px;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: linear-gradient(180deg, var(--c-bg-deep) 0%, var(--c-bg-mid) 100%);
    border-top: 1px solid rgba(201, 168, 76, 0.18);
    border-bottom: 1px solid rgba(201, 168, 76, 0.18);
    overflow: hidden;
}
.liminal-2 {
    background: linear-gradient(180deg, var(--c-bg-mid) 0%, var(--c-bg-deepest) 100%);
}
.chevron-band {
    width: 200%;
    height: 30px;
    display: block;
}
.chev-march {
    animation: chev-march 8s linear infinite;
}
.chev-march-rev {
    animation: chev-march 10s linear infinite reverse;
}
@keyframes chev-march {
    from { transform: translateX(0); }
    to { transform: translateX(-24px); }
}
.liminal-label {
    font-family: var(--f-secondary);
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--c-gold);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0.6;
}

/* ============================================================
   TRAY II — bento-2
   3 cols × 4 rows
   timeline = full-height left col
   right side: 6 staggered cells
   ============================================================ */
.bento-2 {
    grid-template-columns: 1.1fr 1.4fr 1fr;
    grid-template-rows: repeat(4, 1fr);
}
.cell-timeline { grid-column: 1; grid-row: 1 / span 4; overflow-y: auto; }
.cell-note-1 { grid-column: 2; grid-row: 1; }
.cell-diagram { grid-column: 3; grid-row: 1 / span 2; align-items: center; justify-content: center; }
.cell-note-2 { grid-column: 2; grid-row: 2; }
.cell-panel { grid-column: 2 / span 2; grid-row: 3 / span 2; padding: 0; }
.cell-note-3 { grid-column: 2; grid-row: 2; display: none; } /* hidden duplicate slot */
.cell-tag-deco { grid-column: 3; grid-row: 2 / span 1; display: none; } /* placeholder removed */

/* re-arrange properly */
.bento-2 .cell-note-2 { grid-column: 2; grid-row: 2; display: flex; }
/* For 3 columns: timeline (col 1) all rows; col 2 row 1 = note-1, row 2 = note-2; col 3 rows 1-2 = diagram; rows 3-4 col 2-3 = panel. note-3 and tag-deco */

/* Override: restore note-3 / tag-deco visible */
.cell-note-3 { display: flex !important; grid-column: 3; grid-row: 1; } /* swap */
.cell-tag-deco { display: flex !important; grid-column: 3; grid-row: 2; }
/* And diagram occupies note-1+note-2 region's third col? Let's keep it simpler */

/* Final clean placement (override all above) */
.cell-timeline { grid-column: 1; grid-row: 1 / span 4; }
.cell-note-1   { grid-column: 2; grid-row: 1; display: flex; }
.cell-diagram  { grid-column: 3; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: center; }
.cell-note-2   { grid-column: 2; grid-row: 2; display: flex; }
.cell-panel    { grid-column: 2 / span 2; grid-row: 3 / span 2; display: flex; padding: 0; }
.cell-note-3   { display: none !important; }
.cell-tag-deco { display: none !important; }

/* timeline list */
.timeline-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-right: 8px;
    margin-top: 8px;
    overflow-y: auto;
    flex: 1;
}
.timeline-list::-webkit-scrollbar { width: 4px; }
.timeline-list::-webkit-scrollbar-thumb { background: var(--c-canopy); }
.timeline-list::-webkit-scrollbar-track { background: var(--c-bg-mid); }

.timeline-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 14px;
    border-bottom: 1px dashed rgba(201, 168, 76, 0.2);
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.timeline-item.is-revealed {
    opacity: 1;
    transform: translateX(0);
}
.timeline-photo {
    width: 100%;
    aspect-ratio: 200 / 140;
    overflow: hidden;
    border: 1px solid rgba(139, 115, 85, 0.4);
}
.timeline-photo svg {
    filter: sepia(0.4) contrast(1.15) brightness(0.9) saturate(0.7);
    mix-blend-mode: luminosity;
    width: 100%; height: 100%;
}
.timeline-date {
    color: var(--c-gold);
    font-size: 0.66rem;
    letter-spacing: 0.18em;
}
.timeline-note {
    font-family: var(--f-body);
    font-style: italic;
    font-size: 0.78rem;
    color: var(--c-parchment);
    line-height: 1.5;
}

/* neural diagram */
.neural-diagram {
    width: 90%;
    max-width: 280px;
    height: auto;
}
.diagram-pulse {
    transform-origin: 220px 80px;
    animation: diagram-pulse 2.6s ease-in-out infinite;
}
@keyframes diagram-pulse {
    0%, 100% { r: 7; opacity: 1; }
    50% { r: 10; opacity: 0.7; }
}

/* simulation panel */
.cell-panel { background: var(--c-bg-deepest); }
.panel-frame {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 36px 44px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.panel-title {
    font-family: var(--f-display);
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    color: var(--c-phosphor);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 400;
    text-shadow: 0 0 16px rgba(102, 187, 106, 0.4);
}
.panel-subtitle {
    color: var(--c-gold);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}
.gauges {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-top: 8px;
    flex: 1;
    align-content: center;
}
.gauge {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid rgba(46, 125, 50, 0.4);
    background: rgba(27, 58, 45, 0.3);
    position: relative;
    min-height: 120px;
}
.gauge::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 14px;
    height: 14px;
    border-top: 1px solid var(--c-gold);
    border-left: 1px solid var(--c-gold);
}
.gauge::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 14px;
    height: 14px;
    border-bottom: 1px solid var(--c-gold);
    border-right: 1px solid var(--c-gold);
}
.gauge-label {
    color: var(--c-lichen);
    font-size: 0.66rem;
}
.gauge-value {
    font-family: var(--f-mono);
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    color: var(--c-terminal);
    text-shadow: 0 0 10px rgba(102, 187, 106, 0.5);
    letter-spacing: 0.04em;
    margin: 4px 0;
    font-variant-numeric: tabular-nums;
}
.gauge-unit {
    color: var(--c-sepia);
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.ring-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 4px auto;
}
.ring-svg { width: 100%; height: 100%; }
.ring-progress {
    transition: stroke-dashoffset 2s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 0 5px rgba(102, 187, 106, 0.6));
}
.ring-percent {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--c-terminal);
    font-size: 1.2rem;
    text-shadow: 0 0 8px rgba(102, 187, 106, 0.5);
}
.panel-readout {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 10px;
    border-top: 1px solid rgba(201, 168, 76, 0.3);
}
.readout-line {
    color: var(--c-terminal);
    font-size: 0.7rem;
    opacity: 0.85;
}
.readout-line:nth-child(1) { animation: readout-blink 4s steps(1, end) infinite; }
.readout-line:nth-child(2) { animation: readout-blink 4s steps(1, end) infinite 1.2s; }
.readout-line:nth-child(3) { animation: readout-blink 4s steps(1, end) infinite 2.4s; }
@keyframes readout-blink {
    0%, 70%, 100% { opacity: 0.85; }
    75% { opacity: 0.3; }
}

/* ============================================================
   TRAY III — bento-3
   5 cols × 2 rows, alternating tall/short via grid-row spans
   ============================================================ */
.bento-3 {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 7fr 3fr;
}
/* zigzag pattern: cells alternating tall/short positions */
.cell-photo-1  { grid-column: 1; grid-row: 1; }       /* tall first row */
.cell-poster   { grid-column: 2; grid-row: 1 / span 1; align-self: start; height: 30%; }
.cell-vortex   { grid-column: 3; grid-row: 1; }
.cell-eye      { grid-column: 4; grid-row: 1 / span 1; align-self: start; height: 30%; }
.cell-portal   { grid-column: 5; grid-row: 1; }
.cell-quote    { grid-column: 1; grid-row: 2; align-self: end; height: 100%; }
.cell-photo-2  { grid-column: 2; grid-row: 1 / span 2; }     /* this overrides */
.cell-flow     { grid-column: 3; grid-row: 2; align-self: end; height: 100%; }
.cell-stats    { grid-column: 4; grid-row: 1 / span 2; }
.cell-end      { grid-column: 5; grid-row: 2; align-self: end; height: 100%; }

/* Force final placement override (zigzag): tall cells span both rows; short cells take only one row at top or bottom */
.cell-photo-1  { grid-column: 1; grid-row: 1 / span 2; }
.cell-poster   { grid-column: 2; grid-row: 1; align-self: start; }
.cell-photo-2  { grid-column: 2; grid-row: 2; align-self: end; }
.cell-vortex   { grid-column: 3; grid-row: 1 / span 2; }
.cell-eye      { grid-column: 4; grid-row: 1; align-self: start; }
.cell-flow     { grid-column: 4; grid-row: 2; align-self: end; }
.cell-portal   { grid-column: 5; grid-row: 1 / span 2; }
.cell-quote    { display: none !important; }
.cell-stats    { display: none !important; }
.cell-end      { display: none !important; }

/* Better: switch to a 6-column zigzag for richer rhythm */
.bento-3 {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: 7fr 3fr;
}
.cell-photo-1  { grid-column: 1; grid-row: 1 / span 2; }
.cell-poster   { grid-column: 2; grid-row: 1; }
.cell-quote    { display: flex !important; grid-column: 2; grid-row: 2; }
.cell-vortex   { grid-column: 3; grid-row: 1 / span 2; }
.cell-eye      { grid-column: 4; grid-row: 1; }
.cell-photo-2  { grid-column: 4; grid-row: 2; }
.cell-stats    { display: flex !important; grid-column: 5; grid-row: 1 / span 2; }
.cell-flow     { grid-column: 6; grid-row: 1; }
.cell-end      { display: flex !important; grid-column: 6; grid-row: 2; }
.cell-portal   { display: none !important; }

/* But the spec wants exit portal as final cell. Let's restore portal in last column row 2 and put end inside it */
.bento-3 {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 7fr 3fr;
}
.cell-photo-1  { grid-column: 1; grid-row: 1 / span 2; }   /* tall left photo */
.cell-poster   { grid-column: 2; grid-row: 1; align-self: stretch; }
.cell-quote    { display: flex !important; grid-column: 2; grid-row: 2; align-self: stretch; }
.cell-vortex   { grid-column: 3; grid-row: 1 / span 2; }   /* tall vortex */
.cell-eye      { grid-column: 4; grid-row: 1; }
.cell-photo-2  { grid-column: 4; grid-row: 2; align-self: stretch; }
.cell-stats    { display: flex !important; grid-column: 1 / span 5; grid-row: 3; display: none !important; } /* not used */
.cell-flow     { grid-column: 5; grid-row: 1; align-self: stretch; }
.cell-portal   { display: flex !important; grid-column: 5; grid-row: 2; align-self: stretch; }
.cell-end      { display: none !important; }

/* Tray III cell content */
.cell-poster {
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(180deg, #1B3A2D 0%, #152E23 100%);
    position: relative;
}
.sunburst-poster {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 80%;
    pointer-events: none;
}
.poster-title {
    font-family: var(--f-display);
    font-size: clamp(1.4rem, 2.4vw, 2.2rem);
    color: var(--c-gold);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.05;
    text-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
    z-index: 2;
    position: relative;
}
.poster-byline {
    margin-top: 10px;
    color: var(--c-lichen);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    z-index: 2;
    position: relative;
}

.cell-vortex {
    align-items: center;
    justify-content: center;
}
.vortex-svg {
    width: 90%;
    max-width: 240px;
    height: auto;
}
.vortex-path-a, .vortex-path-b, .vortex-path-c {
    animation: dash-flow 9s linear infinite;
    transform-origin: center;
}
.vortex-path-a { animation-duration: 9s; }
.vortex-path-b { animation-duration: 11s; animation-direction: reverse; }
.vortex-path-c { animation-duration: 13s; }
.vortex-path-d {
    animation: vortex-pulse 4s ease-in-out infinite;
    transform-origin: 120px 160px;
}
@keyframes vortex-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}
.vortex-core {
    animation: core-twinkle 2s ease-in-out infinite;
}
@keyframes core-twinkle {
    0%, 100% { r: 4; opacity: 1; }
    50% { r: 6; opacity: 0.7; }
}

.cell-eye .photo-caption-bottom { font-size: 0.7rem; }
.eye-pupil {
    animation: eye-blink 5s ease-in-out infinite;
    transform-origin: 120px 50px;
}
@keyframes eye-blink {
    0%, 92%, 100% { transform: scale(1); }
    96% { transform: scaleY(0.1); }
}

.cell-quote {
    align-items: flex-start;
    justify-content: center;
    background: linear-gradient(135deg, #1B3A2D 0%, #0D1A14 100%);
}
.dream-quote {
    font-family: var(--f-body);
    font-style: italic;
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    color: var(--c-parchment);
    line-height: 1.5;
}
.quote-attrib {
    margin-top: 12px;
    color: var(--c-sepia);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
}

.cell-flow {
    padding: 14px;
    align-items: stretch;
    justify-content: space-between;
}
.micro-flow {
    width: 100%;
    height: 60%;
}
.flow-1 { animation: dash-flow 6s linear infinite; }
.flow-2 { animation: dash-flow 8s linear infinite reverse; }
.flow-3 { animation: dash-flow 10s linear infinite; }

/* Exit portal */
.cell-portal {
    background: radial-gradient(circle at 50% 50%, #0D1A14 0%, #050a08 80%);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.4s ease;
}
.portal-tag { color: var(--c-canopy); }
.portal-void {
    position: relative;
    width: 75%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-ring,
.portal-dot {
    position: absolute;
    border-radius: 50%;
}
.portal-ring {
    border: 1px solid rgba(46, 125, 50, 0.4);
    width: 100%; height: 100%;
}
.portal-ring-1 { animation: portal-ring 4s ease-in-out infinite; }
.portal-ring-2 {
    width: 70%; height: 70%;
    animation: portal-ring 4s ease-in-out infinite -1.3s;
}
.portal-ring-3 {
    width: 40%; height: 40%;
    animation: portal-ring 4s ease-in-out infinite -2.6s;
}
@keyframes portal-ring {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(0.1); opacity: 0; }
}
.portal-dot {
    width: 8px; height: 8px;
    background: var(--c-terminal);
    box-shadow:
        0 0 10px var(--c-terminal),
        0 0 20px rgba(102, 187, 106, 0.5),
        0 0 40px rgba(102, 187, 106, 0.3);
    animation: portal-pulse 3s ease-in-out infinite;
    transition: transform 0.6s ease, box-shadow 0.6s ease;
}
@keyframes portal-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}
.portal-caption {
    margin-top: 12px;
    color: var(--c-canopy);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
}
.tray-3.portal-active .cell:not(.cell-portal) {
    opacity: 0.3;
}
.tray-3.portal-active .cell-portal .portal-dot {
    transform: scale(2.4);
    box-shadow:
        0 0 20px var(--c-terminal),
        0 0 50px var(--c-terminal),
        0 0 90px rgba(102, 187, 106, 0.6);
}

.tray-3 .cell { transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                            box-shadow 0.25s ease,
                            opacity 0.6s ease,
                            background 0.4s ease; }

/* ---------- Footer strip ---------- */
.bottom-strip {
    position: relative;
    z-index: 5;
    background: var(--c-bg-deepest);
    border-top: 1px solid rgba(201, 168, 76, 0.25);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    color: var(--c-sepia);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
}
.footer-mark {
    font-family: var(--f-mono);
}

/* ---------- Stat list (used in deleted variant; preserved for safety) ---------- */
.stat-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 6px;
}
.stat-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(201, 168, 76, 0.3);
    padding: 6px 10px;
}
.stat-list .mono { font-size: 1.2rem; color: var(--c-gold); }

.end-text {
    font-family: var(--f-display);
    color: var(--c-phosphor);
    font-size: 1.6rem;
    letter-spacing: 0.22em;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
    .tray { padding: 80px 24px 30px; }
    .gauges { grid-template-columns: repeat(2, 1fr); }
    .panel-frame { padding: 28px 28px 18px; }
}
@media (max-width: 800px) {
    .top-brand { padding: 10px 16px; flex-direction: column; gap: 6px; align-items: flex-start; }
    .brand-meta { font-size: 0.6rem; gap: 8px; flex-wrap: wrap; }
    .rosette-nav { right: 8px; gap: 14px; }
    .rosette { width: 28px; height: 28px; }
    .rosette-label { display: none; }

    .tray-header { flex-wrap: wrap; gap: 10px; }
    .tray { padding: 110px 14px 30px; }

    .bento-1 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(5, minmax(140px, auto));
    }
    .cell-a { grid-column: 1 / span 2; grid-row: 1 / span 2; }
    .cell-b { grid-column: 1; grid-row: 3; }
    .cell-c { grid-column: 2; grid-row: 3; }
    .cell-d { grid-column: 1; grid-row: 4; }
    .cell-e { grid-column: 2; grid-row: 4; }
    .cell-f { grid-column: 1 / span 2; grid-row: 5; }

    .bento-2 {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(6, minmax(160px, auto));
    }
    .cell-timeline { grid-column: 1 / span 2; grid-row: 1 / span 2; max-height: 420px; }
    .cell-note-1   { grid-column: 1; grid-row: 3; }
    .cell-note-2   { grid-column: 2; grid-row: 3; }
    .cell-diagram  { grid-column: 1 / span 2; grid-row: 4; }
    .cell-panel    { grid-column: 1 / span 2; grid-row: 5 / span 2; }
    .gauges { grid-template-columns: repeat(2, 1fr); }

    .bento-3 {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(5, minmax(160px, auto));
    }
    .cell-photo-1  { grid-column: 1 / span 2; grid-row: 1; align-self: stretch; }
    .cell-poster   { grid-column: 1; grid-row: 2; align-self: stretch; }
    .cell-quote    { grid-column: 2; grid-row: 2; align-self: stretch; }
    .cell-vortex   { grid-column: 1 / span 2; grid-row: 3; align-self: stretch; }
    .cell-eye      { grid-column: 1; grid-row: 4; align-self: stretch; }
    .cell-photo-2  { grid-column: 2; grid-row: 4; align-self: stretch; }
    .cell-flow     { grid-column: 1; grid-row: 5; align-self: stretch; }
    .cell-portal   { grid-column: 2; grid-row: 5; align-self: stretch; }

    .panel-title { font-size: 1.2rem; }
}
