/* ==========================================================================
   POLISH LAYER (loaded last)
   An editorial type system for a literature portfolio, calmer labels,
   smoother motion and the styles for the reworked widgets.
   ========================================================================== */

:root {
    --font-epic: 'Newsreader', 'Iowan Old Style', Georgia, serif;
    --font-sci: 'Newsreader', 'Iowan Old Style', Georgia, serif;
    --font-sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
    --ink: #eef3f8;
    --ink-soft: #c9d4df;
    --ink-dim: #93a4b5;
    --gold-soft: #dcc48f;
    --line: rgba(160, 190, 215, .16);
    --ease-out: cubic-bezier(.2, .75, .25, 1);
    --radius-card: 20px;
}

body {
    font-family: var(--font-sans);
    font-feature-settings: 'ss01', 'cv11';
    letter-spacing: .003em;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
::selection { background: color-mix(in srgb, var(--saber-core) 40%, transparent); color: #fff; }

/* ---------- Headings: serif, sentence case, softer weight ---------- */
:is(.panel-title, .vader-heading, .section-main-title, .sector-hero-heading, .chamber-title,
    .grievous-info h4, .yoda-left h4, .matchday-crests-col h4, .atlas-display h4, .museum-heading h3,
    .museum-detail h4, .caption-name, .orbit-window-title, .epic-hero-title) {
    font-family: var(--font-epic);
    font-optical-sizing: auto;
    font-weight: 500;
    letter-spacing: -.012em;
    color: var(--ink);
}
.epic-hero-title {
    font-size: clamp(2.6rem, 5.4vw, 4.5rem);
    font-weight: 400;
    line-height: 1.03;
    letter-spacing: -.028em;
    margin-bottom: 1.4rem;
    max-width: 14ch;
}
.epic-hero-title em { font-style: italic; font-weight: 400; }
.hero-hello {
    display: block;
    width: fit-content;
    font-size: .42em;
    font-style: italic;
    letter-spacing: 0;
    color: var(--gold-soft);
    margin-bottom: .45em;
}
.text-saber-glow { color: color-mix(in srgb, var(--saber-core) 45%, #ffffff); text-shadow: 0 0 30px color-mix(in srgb, var(--saber-core) 40%, transparent); }
.sector-hero-heading { font-size: clamp(2.2rem, 4.6vw, 3.6rem); font-weight: 400; line-height: 1.08; letter-spacing: -.025em; }
.section-main-title { font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 400; letter-spacing: -.02em; }
.panel-title { font-size: clamp(1.45rem, 2.2vw, 1.75rem); line-height: 1.25; }
.vader-heading { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 400; line-height: 1.15; }
.orbit-window-title { font-style: italic; font-weight: 400; font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.2; }
.caption-name { font-size: 1.3rem; }
.section-sub { max-width: 60ch; margin-top: .6rem; color: var(--ink-dim); font-size: .95rem; line-height: 1.7; }
.section-heading-block { margin-bottom: 1.8rem; }

/* Body copy */
:is(.hero-lead-text, .holocron-panel p, .vader-literary-info p, .grievous-info p, .yoda-left p, .matchday-crests-col p,
    .maul-intro, .maul-side-box p, .atlas-display p, .council-closing-text, .widget-helper-desc, .chamber-desc,
    .museum-heading p, .museum-detail p) { color: var(--ink-soft); }
:is(.holocron-panel, .vader-literary-info, .council-module) strong { color: var(--ink); font-weight: 650; }
.hero-lead-text { font-size: 1.08rem; line-height: 1.8; }

/* ---------- Brand ---------- */
.brand-title { font-family: var(--font-epic); font-size: 1.12rem; font-weight: 600; letter-spacing: -.005em; text-transform: none; }
.brand-subtitle { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .12em; color: var(--ink-dim); }
.nav-link { font-weight: 550; letter-spacing: .005em; white-space: nowrap; }
@media (min-width: 1281px) and (max-width: 1440px) {
    .nav-link { font-size: .76rem; padding-inline: .4rem; }
    .brand-title { font-size: 1rem; }
    .brand-subtitle { letter-spacing: .06em; }
}
.btn-hyperdrive-toggle { font-family: var(--font-mono); letter-spacing: .06em; }

/* ---------- Quieter technical labels ---------- */
:is(.telemetry-strip, .panel-code, .kicker-mono, .terminal-top-bar, .terminal-footer-bar, .module-top-ribbon, .yoda-tag,
    .q-header, .atlas-coord, .chamber-code, .chamber-status-pill, .m-side-tag, .jump-small, .pod-caption, .caption-stars,
    .theater-top-hud, .vader-kicker, .hallway-prompt-badge, .db-counter, .orbit-eyebrow, .orbit-window-meta, .hyper-tag, .c-lbl,
    .holocron-badge-pill, .museum-kicker, .case-era, .base-location, .base-status) {
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 500;
    letter-spacing: .1em;
}
.kicker-mono { color: var(--gold-soft); margin-bottom: .7rem; display: inline-flex; align-items: center; gap: .7rem; }
.kicker-mono::before { content: ''; width: 26px; height: 1px; background: currentColor; opacity: .7; }
.panel-code { color: var(--ink-dim); }
.panel-tag {
    font-family: var(--font-sans);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: none;
    border-radius: 99px;
    padding: .2rem .7rem;
}
.module-top-ribbon { color: var(--ink-dim); border-bottom-color: var(--line); gap: 1rem; }
.module-top-ribbon > span:first-child { color: var(--ink-soft); }
.holocron-badge-pill { display: inline-flex; align-items: center; gap: .6rem; padding: .45rem .9rem; border-radius: 99px; color: var(--ink-soft); }
.badge-icon { width: 7px; height: 7px; border-radius: 50%; background: var(--saber-core); box-shadow: 0 0 10px var(--saber-core); flex: 0 0 7px; }
.telemetry-strip { color: var(--ink-dim); border-radius: 14px; }
.caption-stars { color: var(--gold-soft); }

/* ---------- Card surfaces ---------- */
:is(.holocron-panel, .holocron-terminal-card, .special-sector-module) {
    border-radius: var(--radius-card);
    border-color: var(--line);
    background:
        radial-gradient(520px circle at var(--mx, -400px) var(--my, -400px), rgba(190, 220, 245, .055), transparent 45%),
        linear-gradient(160deg, rgba(19, 30, 46, .96), rgba(7, 13, 24, .97) 55%, rgba(6, 11, 21, .97));
    box-shadow: 0 1px 0 rgba(220, 235, 250, .05) inset, 0 24px 60px -30px rgba(0, 0, 0, .8);
}
.panel-nerazzurri-accent { width: 3px; opacity: .55; }

/* ---------- Hero buttons ---------- */
.btn-holocron { border-radius: 12px; font-weight: 600; letter-spacing: .01em; transition: transform .25s var(--ease-out), box-shadow .25s ease, background .25s ease; }
.btn-holocron .btn-arrow, .btn-holocron .btn-key { transition: transform .25s var(--ease-out); display: inline-block; }
@media (hover: hover) and (pointer: fine) {
    .btn-holocron:hover { transform: translateY(-2px); }
    .btn-holocron:hover .btn-arrow { transform: translateX(4px); }
    .btn-holocron:hover .btn-key { transform: rotate(90deg); }
}
.btn-holocron:active { transform: translateY(0) scale(.98); }

kbd {
    font: 600 .7em var(--font-mono);
    padding: .1em .45em;
    margin-left: .35em;
    border: 1px solid currentColor;
    border-radius: 4px;
    opacity: .7;
}

/* ---------- Placeholder archives: honest and calm ---------- */
.holocron-standby-chamber.grand-chamber, .theater-screen-standby.grand-chamber {
    border: 1px dashed rgba(170, 200, 225, .28);
    background:
        repeating-linear-gradient(135deg, transparent 0 14px, rgba(160, 190, 215, .025) 14px 15px),
        radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--saber-core) 10%, transparent), transparent 65%),
        rgba(4, 9, 18, .82);
    border-radius: var(--radius-card);
}
.chamber-laser-sweep { opacity: .35; }
.grand-chamber .chamber-title { font-weight: 400; font-style: italic; }
.chamber-code { color: var(--ink-dim); }
.chamber-status-pill {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    border-radius: 99px;
    padding: .4rem .95rem;
    color: var(--gold-soft);
    border: 1px solid rgba(220, 196, 143, .35);
    background: rgba(220, 196, 143, .07);
}
.chamber-status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: softPulse 2.4s ease-in-out infinite; }
@keyframes softPulse { 50% { opacity: .3; } }

/* ---------- Jump bar ---------- */
.btn-jump-prev, .btn-jump-next { border-radius: 16px; border-color: var(--line); transition: transform .3s var(--ease-out), border-color .3s ease, background .3s ease; }
.jump-title { font-family: var(--font-epic); font-weight: 500; font-size: 1.25rem; letter-spacing: -.01em; }
.jump-title small { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); margin-inline: .35rem; vertical-align: middle; }
@media (hover: hover) and (pointer: fine) { .btn-jump-next:hover { transform: translateX(4px); } .btn-jump-prev:hover { transform: translateX(-4px); } }

/* ---------- Databank ---------- */
.db-tab { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; font-family: var(--font-sans); font-weight: 600; letter-spacing: .005em; }
.tab-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--saber-core); box-shadow: 0 0 8px var(--saber-core); }
.tab-dot.inter { background: linear-gradient(90deg, #0b5fd0 50%, #0a0f18 50%); box-shadow: 0 0 0 1px #6f9be0; }
.tab-dot.gold { background: var(--gold-soft); box-shadow: 0 0 8px var(--gold-soft); }
.databank-screen { transition: opacity .2s ease, transform .3s var(--ease-out); border-radius: 14px; touch-action: pan-y; }
.databank-screen.is-changing { opacity: 0; transform: translateY(6px); }
.db-source {
    display: inline-block;
    font: 500 .66rem var(--font-mono);
    letter-spacing: .12em;
    color: var(--saber-core);
    padding: .3rem .6rem;
    margin-bottom: 1rem;
    border: 1px solid color-mix(in srgb, var(--saber-core) 35%, transparent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--saber-core) 8%, transparent);
}
.db-quote-text { font-family: var(--font-epic); font-weight: 400; font-size: clamp(1.3rem, 2.2vw, 1.6rem); line-height: 1.35; letter-spacing: -.01em; color: var(--ink); margin-bottom: .8rem; }
.db-sub-text { color: var(--ink-soft); line-height: 1.75; }
.btn-record-prev { min-width: 46px; font-size: 1.05rem !important; }

/* ---------- Kyber ---------- */
.kyber-btn { font-weight: 600; border-radius: 12px; transition: transform .2s var(--ease-out), border-color .2s ease, background .2s ease; }
.kyber-btn:active { transform: scale(.97); }
.kyber-btn.active .crystal-gem { animation: gemGlow 2.6s ease-in-out infinite; }
@keyframes gemGlow { 50% { filter: brightness(1.35); } }

/* ---------- Yoda glossary ---------- */
.yoda-pills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.yoda-btn { font-weight: 600; border-radius: 10px; text-align: left; }
.yoda-right-screen { position: relative; border-radius: 16px; min-height: 260px; display: flex; flex-direction: column; justify-content: center; }
.yoda-def { font-family: var(--font-epic); font-size: 1.22rem !important; line-height: 1.55 !important; color: var(--ink); margin-top: .7rem; }
.yoda-example { font-size: .95rem; color: #9fdcc0; }
.yoda-count { position: absolute; top: 1rem; right: 1.1rem; font: .66rem var(--font-mono); color: var(--ink-dim); letter-spacing: .1em; }
.is-swapping { animation: swapIn .45s var(--ease-out) both; }
@keyframes swapIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Grievous reading checklist ---------- */
.grievous-grid { align-items: start; }
.lens-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin: 1.2rem 0 1rem; }
.lens-btn {
    display: flex; align-items: center; gap: .65rem;
    min-height: 48px; padding: .6rem .8rem;
    border-radius: 10px; border: 1px solid var(--line);
    background: rgba(8, 15, 26, .8); color: var(--ink-soft);
    font: 600 .88rem var(--font-sans); text-align: left; cursor: pointer;
    transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.lens-btn i { flex: 0 0 22px; height: 3px; border-radius: 3px; background: currentColor; opacity: .5; transition: all .25s var(--ease-out); }
.lens-btn.blue i { color: #64c8ff; }
.lens-btn.green i { color: #65f7a1; }
.lens-btn.active { color: #fff; background: rgba(20, 34, 52, .95); }
.lens-btn.blue.active { border-color: rgba(100, 200, 255, .55); }
.lens-btn.green.active { border-color: rgba(101, 247, 161, .5); }
.lens-btn.active i { opacity: 1; flex-basis: 30px; box-shadow: 0 0 10px currentColor, 0 0 3px #fff inset; background: #effbff; border: 1px solid currentColor; }
.lens-readout { padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; border-left: 2px solid var(--saber-core); border-radius: 0 12px 12px 0; background: rgba(4, 10, 19, .7); }
.lens-question { font-family: var(--font-epic); font-size: 1.2rem !important; line-height: 1.5 !important; color: var(--ink) !important; margin-bottom: .55rem !important; }
.lens-tip { font-size: .9rem !important; color: var(--ink-dim) !important; margin: 0 !important; }
.grievous-cinema { margin: 0; }
.grievous-cinema figcaption {
    position: absolute; left: .8rem; bottom: .7rem; z-index: 2;
    font: .62rem var(--font-mono); letter-spacing: .08em; color: rgba(225, 235, 245, .7);
    padding: .3rem .55rem; border-radius: 5px; background: rgba(3, 7, 13, .65);
}
.g-film-aura path, .g-film-core { transition: opacity .35s ease, stroke-width .35s ease; }
.grievous-saber-rack[data-lens] .g-film-aura path { opacity: .45; }
.grievous-saber-rack[data-lens="0"] .g-film-aura path:nth-child(1),
.grievous-saber-rack[data-lens="1"] .g-film-aura path:nth-child(2),
.grievous-saber-rack[data-lens="2"] .g-film-aura path:nth-child(3),
.grievous-saber-rack[data-lens="3"] .g-film-aura path:nth-child(4) { opacity: 1; stroke-width: 22px; }
.grievous-saber-rack { padding: 0 !important; }

/* ---------- Practice quiz ---------- */
.club-pill { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; }
.club-pill i { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.inter-pill i { background: linear-gradient(90deg, #0b5fd0 50%, #05070c 50%); box-shadow: 0 0 0 1px #6f9be0; }
.olimpia-pill i { background: linear-gradient(90deg, #f4f4f4 50%, #c8102e 50%); box-shadow: 0 0 0 1px #c9c9c9; }
.matchday-quiz-box { border-radius: 16px; }
.q-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.quiz-dots { display: flex; gap: 6px; }
.quiz-dot { width: 22px; height: 4px; border-radius: 4px; background: rgba(160, 190, 215, .2); transition: background .3s ease; }
.quiz-dot.current { background: var(--saber-core); }
.quiz-dot.right { background: #62b994; }
.quiz-dot.wrong { background: #c46b7d; }
.q-text { font-family: var(--font-epic); font-size: 1.22rem !important; line-height: 1.5; color: var(--ink); }
.q-opt-btn { display: flex; align-items: center; gap: .8rem; text-align: left; border-radius: 12px; font-weight: 550; transition: border-color .2s ease, background .2s ease, transform .15s ease; }
.q-opt-btn:not(:disabled):active { transform: scale(.985); }
.q-letter { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; font: 600 .75rem var(--font-mono); background: rgba(160, 190, 215, .1); border: 1px solid var(--line); }
.q-opt-btn.is-correct .q-letter { background: #62b994; color: #04140d; border-color: transparent; }
.q-opt-btn.is-wrong .q-letter { background: #c46b7d; color: #1d060b; border-color: transparent; }
.q-feedback { font-family: var(--font-sans) !important; font-size: .95rem !important; line-height: 1.65 !important; letter-spacing: 0 !important; }
.q-feedback.good { color: #b8ecd3; }
.q-feedback.bad { color: #f2c3cd; }
.quiz-next { border-radius: 12px; font-weight: 600; }

/* ---------- Maul: two sides ---------- */
.maul-topics { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1.2rem 0 .4rem; }
.maul-topic {
    min-height: 44px; padding: .55rem 1rem; border-radius: 99px; cursor: pointer;
    border: 1px solid rgba(220, 120, 135, .28); background: rgba(40, 12, 20, .55); color: #f0d6da;
    font: 600 .88rem var(--font-sans); transition: background .2s ease, border-color .2s ease;
}
.maul-topic.active { background: #5b1724; border-color: #e0707f; color: #fff; box-shadow: 0 0 22px -8px #ff2a36; }
.maul-side-box { border-radius: 16px; }
.maul-side-box p { font-family: var(--font-epic); font-size: 1.12rem !important; line-height: 1.6 !important; color: var(--ink) !important; margin-top: .6rem; }
.maul-side-box:last-child { background: #0f1018; border-color: rgba(150, 165, 190, .25); }
.maul-side-box:last-child .m-side-tag { color: #aab8cc; }
.maul-arena-stage:has(.retracted) ~ .maul-dual-cards { opacity: .45; }
.maul-dual-cards { transition: opacity .3s ease; }
.maul-answer { display: grid; gap: .35rem; margin-top: 1rem; padding: 1rem 1.2rem; border-radius: 14px; border: 1px solid rgba(220, 196, 143, .25); background: rgba(30, 24, 12, .35); color: var(--ink-soft); line-height: 1.7; }
.maul-answer > span:first-child { font: 500 .66rem var(--font-mono); letter-spacing: .12em; color: var(--gold-soft); }

/* ---------- Atlas of settings ---------- */
.atlas-grid { align-items: stretch; }
.atlas-selector { display: grid; gap: .5rem; }
.atlas-btn { display: grid; gap: .1rem; padding: .7rem 1rem; border-radius: 12px; }
.atlas-planet { font-family: var(--font-epic); font-size: 1.12rem; font-weight: 500; color: var(--ink); }
.atlas-place { font: .68rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.atlas-btn.active .atlas-place { color: var(--gold-soft); }
.atlas-display { border-radius: 18px; padding: 1.75rem 1.75rem 6.5rem !important; display: flex; flex-direction: column; transition: background .6s ease; }
.atlas-display h4 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); font-weight: 400; margin: .5rem 0 .8rem; }
.atlas-note { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .95rem !important; }
.atlas-note strong { color: var(--gold-soft); font-weight: 600; }
.atlas-horizon { position: absolute; left: 0; right: 0; bottom: 0; height: 92px; pointer-events: none; transition: background .6s ease; mask-image: linear-gradient(0deg, #000 55%, transparent); -webkit-mask-image: linear-gradient(0deg, #000 55%, transparent); }
.atlas-display[data-world="naboo"] { background: radial-gradient(circle at 88% 8%, #5aa8d640, transparent 45%), #07111f; }
.atlas-display[data-world="naboo"] .atlas-horizon { background: radial-gradient(ellipse 60% 70% at 25% 100%, #1d4d3a, transparent 70%), radial-gradient(ellipse 70% 60% at 80% 100%, #24563f, transparent 70%), linear-gradient(0deg, #12395a 0 30%, #2c6f95 30% 34%, transparent 34%); }
.atlas-display[data-world="mustafar"] { background: radial-gradient(circle at 88% 8%, #ff5a1f30, transparent 45%), #120707; }
.atlas-display[data-world="mustafar"] .atlas-horizon { background: radial-gradient(ellipse 30% 80% at 30% 100%, #ff7a1a, transparent 70%), radial-gradient(ellipse 40% 70% at 75% 100%, #e2361c, transparent 70%), linear-gradient(0deg, #2a0805, transparent); }
.atlas-display[data-world="tatooine"] { background: radial-gradient(circle at 82% 10%, #f6c86a38, transparent 30%), radial-gradient(circle at 92% 16%, #f3a95a30, transparent 22%), #15100b; }
.atlas-display[data-world="tatooine"] .atlas-horizon { background: radial-gradient(ellipse 80% 60% at 20% 100%, #8a5f2c, transparent 70%), radial-gradient(ellipse 70% 50% at 85% 100%, #a8763a, transparent 70%); }
.atlas-display[data-world="scarif"] { background: radial-gradient(circle at 88% 8%, #46e0d038, transparent 45%), #061416; }
.atlas-display[data-world="scarif"] .atlas-horizon { background: linear-gradient(0deg, #0b5c63 0 26%, #2fb7b0 26% 30%, #e7dcb6 30% 34%, transparent 34%); }
.atlas-display[data-world="coruscant"] { background: radial-gradient(circle at 88% 8%, #8f7ad340, transparent 45%), #0b0c1b; }
.atlas-display[data-world="coruscant"] .atlas-horizon { background: radial-gradient(1px 1px at 10% 70%, #ffd98a, transparent), radial-gradient(1px 1px at 22% 55%, #ffd98a, transparent), radial-gradient(1px 1px at 41% 80%, #9fd4ff, transparent), radial-gradient(1px 1px at 63% 62%, #ffd98a, transparent), radial-gradient(1px 1px at 78% 76%, #9fd4ff, transparent), linear-gradient(90deg, #141631 0 6%, transparent 6% 9%, #191b3a 9% 18%, transparent 18% 21%, #12142c 21% 33%, transparent 33% 36%, #1b1d3e 36% 50%, transparent 50% 52%, #15172f 52% 66%, transparent 66% 70%, #1a1c3b 70% 84%, transparent 84% 87%, #13152d 87%); }

/* ---------- Red Five ---------- */
.trench-arena { border-radius: 14px; }
.trench-port { transition: none; }
.trench-arena.locked .trench-port { box-shadow: 0 0 0 6px rgba(242, 214, 144, .12), 0 0 22px #e9cb7599; }
.trench-bolt {
    position: absolute; width: 10px; height: 10px; border-radius: 50%; pointer-events: none;
    transform: translate(-50%, -50%); background: #fff;
    box-shadow: 0 0 10px 4px #8fe7ff, 0 0 28px 10px rgba(80, 200, 255, .5);
    animation: boltOut .6s ease-out forwards;
}
@keyframes boltOut { 0% { transform: translate(-50%, -50%) scale(2.4); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } }
.trench-arena.hit::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255, 220, 150, .35), transparent 60%); animation: flashOut .6s ease-out forwards; pointer-events: none; }
.trench-arena.miss { animation: nudge .3s ease; }
@keyframes flashOut { to { opacity: 0; } }
@keyframes nudge { 30% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }

/* ---------- Museum ---------- */
.museum-detail-number { font-family: var(--font-epic); font-weight: 400; font-style: italic; }
.museum-heading h3 { font-weight: 400; }

/* ---------- Closing note ---------- */
.council-closing-text { font-family: var(--font-epic); font-size: clamp(1.2rem, 2vw, 1.45rem) !important; line-height: 1.6 !important; color: var(--ink) !important; max-width: 52ch; }
.council-sign { margin-top: 1rem; font-family: var(--font-epic); font-style: italic; font-size: 1.3rem; color: var(--gold-soft); }

/* ---------- Hyperspace HUD ---------- */
.hyper-dest { font-family: var(--font-epic); font-weight: 400; font-style: italic; font-size: 1.5rem; letter-spacing: 0; text-transform: none; }
.orb-sys-name { font-family: var(--font-epic); font-weight: 400; font-style: italic; letter-spacing: .02em; text-transform: none; }

/* ---------- Reveal on scroll (only when JS enabled it and motion is allowed) ---------- */
html.reveal-ready :is(.sector-top-banner, .holocron-panel, .holocron-terminal-card, .special-sector-module, .holocron-standby-chamber,
    .holocron-theater-frame, .vader-corridor-section, .institutional-base, .inter-museum, .section-heading-block, .telemetry-strip, .sector-jump-bar) {
    transition: opacity .8s var(--ease-out), transform .8s var(--ease-out), border-color .25s ease, box-shadow .25s ease;
}
html.reveal-ready :is(.sector-top-banner, .holocron-panel, .holocron-terminal-card, .special-sector-module, .holocron-standby-chamber,
    .holocron-theater-frame, .vader-corridor-section, .institutional-base, .inter-museum, .section-heading-block, .telemetry-strip, .sector-jump-bar):not(.is-visible) {
    opacity: 0;
    transform: translateY(22px);
}
.sector-page.active .hero-left-col > * { animation: heroRise .9s var(--ease-out) both; }
.sector-page.active .hero-left-col > *:nth-child(2) { animation-delay: .08s; }
.sector-page.active .hero-left-col > *:nth-child(3) { animation-delay: .16s; }
.sector-page.active .hero-left-col > *:nth-child(4) { animation-delay: .24s; }
.sector-page.active .hero-left-col > *:nth-child(5) { animation-delay: .32s; }
.sector-page.active .hero-right-col { animation: heroRise 1s .2s var(--ease-out) both; }
@keyframes heroRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
    .epic-hero-title { max-width: none; }
}
@media (max-width: 600px) {
    .epic-hero-title { font-size: clamp(2.3rem, 10.5vw, 3rem); line-height: 1.06; }
    .sector-hero-heading { font-size: clamp(2.1rem, 10vw, 2.7rem); }
    .brand-title { font-size: 1rem; }
    .brand-subtitle { font-size: .55rem; letter-spacing: .08em; }
    :is(.telemetry-strip, .panel-code, .kicker-mono, .terminal-top-bar, .terminal-footer-bar, .module-top-ribbon, .yoda-tag, .q-header,
        .atlas-coord, .chamber-code, .chamber-status-pill, .m-side-tag, .jump-small, .pod-caption, .caption-stars, .theater-top-hud,
        .vader-kicker, .db-counter, .orbit-eyebrow, .orbit-window-meta, .holocron-badge-pill) { font-size: .68rem; letter-spacing: .07em; }
    .orbit-window-title { font-size: 1.55rem; max-width: none; }
    .yoda-pills, .lens-picker { grid-template-columns: 1fr 1fr; }
    .yoda-btn, .lens-btn { font-size: .85rem; padding: .55rem .7rem; }
    .yoda-right-screen { min-height: 0; }
    .db-quote-text { font-size: 1.3rem; }
    .databank-tabs { grid-template-columns: 1fr; }
    .db-tab { justify-content: flex-start; }
    .jump-title { font-size: 1.1rem; }
    .atlas-display { padding: 1.25rem 1.2rem 5.5rem !important; }
    .maul-topic { flex: 1 1 100%; text-align: left; border-radius: 12px; }
    .module-top-ribbon { flex-direction: column; gap: .2rem; }
    .hero-hello { font-size: .5em; }
}
@media (max-width: 380px) {
    .yoda-pills, .lens-picker { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    html.reveal-ready :is(*) { opacity: 1 !important; transform: none !important; }
    .chamber-status-pill::before, .kyber-btn.active .crystal-gem { animation: none; }
}

/* ---------- Background music toggle ---------- */
.sound-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 44px; padding: .35rem .7rem; cursor: pointer;
    border-radius: 7px; border: 1px solid #7894ac4a; background: #101e31; color: #dce9f6;
    font: 600 .72rem var(--font-mono); letter-spacing: .06em;
    transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.sound-icon { width: 20px; height: 20px; flex: 0 0 20px; }
.sound-speaker { fill: currentColor; }
.sound-off { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sound-bars { fill: var(--saber-core); display: none; }
.sound-toggle.playing { border-color: color-mix(in srgb, var(--saber-core) 60%, transparent); color: #fff; background: #12263c; }
.sound-toggle.playing .sound-off { display: none; }
.sound-toggle.playing .sound-bars { display: inline; }
.sound-toggle.playing .sound-bars rect { transform-box: fill-box; transform-origin: center; animation: eqBar 1.1s ease-in-out infinite; }
.sound-toggle.playing .sound-bars rect:nth-child(2) { animation-delay: -.4s; }
.sound-toggle.playing .sound-bars rect:nth-child(3) { animation-delay: -.75s; }
.sound-toggle.remembered:not(.playing) { border-color: rgba(220, 196, 143, .5); }
@keyframes eqBar { 50% { transform: scaleY(.45); } }

/* ---------- Look around panel ---------- */
.orbit-world { display: grid; gap: .15rem; min-width: 0; }
.orbit-world-title { font-family: var(--font-epic); font-style: italic; font-weight: 400; font-size: clamp(1.3rem, 2.6vw, 1.8rem); line-height: 1.2; color: var(--ink); }
.orbit-world p { max-width: 52ch; }
.orbit-controls { animation: orbitPanelIn .6s var(--ease-out) both; border-radius: 16px; background: rgba(4, 10, 20, .7); }
@keyframes orbitPanelIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 600px) {
    .header-right-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px 46px !important; }
    .sound-toggle { padding: 0; width: 46px; min-height: 46px; }
    .sound-label { display: none; }
    .orbit-world-title { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
    .sound-toggle.playing .sound-bars rect, .orbit-controls { animation: none; }
}


/* ---------- Header: hyperspace icon, reading option moved to menu + footer ---------- */
.hyper-icon { display: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.hyper-icon circle { fill: currentColor; stroke: none; }
.nav-reading-item { display: none; }
.reading-size-toggle { gap: .55rem; }
.reading-aa { font: 700 1rem var(--font-epic); }
.reading-text { font: 600 .82rem var(--font-sans); }
.footer-tools { display: flex; justify-content: center; padding-top: .5rem; }
.footer-reading { background: rgba(16, 30, 49, .7); }
@media (max-width: 1280px) {
    .nav-reading-item { display: block; margin-top: .5rem; padding-top: .6rem; border-top: 1px solid var(--line); }
    .nav-reading { width: 100%; justify-content: flex-start; min-height: 48px; padding: .6rem .85rem; }
}

/* ---------- Phones: one compact header row ---------- */
@media (max-width: 600px) {
    .header-container { display: flex !important; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem .9rem !important; }
    .brand-holocron { flex: 1 1 auto; min-width: 0; gap: .55rem !important; }
    .inter-galactic-crest { width: 34px !important; height: 34px !important; flex: 0 0 34px; }
    .brand-meta { min-width: 0; }
    .brand-title { font-size: 1rem !important; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .brand-subtitle { font-size: .52rem !important; letter-spacing: .07em !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-right-controls { display: flex !important; flex: 0 0 auto; width: auto !important; gap: .4rem !important; }
    .header-right-controls > button { width: 42px !important; min-width: 42px !important; height: 42px !important; min-height: 42px !important; padding: 0 !important; border-radius: 10px !important; justify-content: center; }
    .btn-hyperdrive-toggle .hyper-btn-text, .btn-hyperdrive-toggle .hyper-dot { display: none; }
    .btn-hyperdrive-toggle .hyper-icon { display: block; }
    .mobile-menu-btn { flex: 0 0 42px !important; }
    .mobile-menu-btn .saber-bar { width: 19px; }
    .main-nav { max-height: calc(100dvh - 70px) !important; }
    .holocron-badge-pill { font-size: .6rem !important; letter-spacing: .04em !important; padding: .4rem .75rem; }
}
@media (max-width: 350px) {
    .brand-subtitle { display: none; }
}

/* ---------- Soundtrack snackbar ---------- */
.sound-snackbar {
    position: fixed; z-index: 2000; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: .8rem;
    width: min(560px, calc(100% - 1.5rem)); padding: .75rem .75rem .75rem 1rem;
    border-radius: 16px; border: 1px solid rgba(170, 205, 230, .25);
    background: rgba(6, 13, 24, .88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .8);
    transform: translate(-50%, 20px); opacity: 0; transition: transform .45s var(--ease-out), opacity .35s ease;
}
.sound-snackbar.visible { transform: translate(-50%, 0); opacity: 1; }
.sound-snackbar[hidden] { display: none; }
.sound-snackbar p { flex: 1; margin: 0; font-size: .86rem; line-height: 1.45; color: var(--ink-soft); }
.snack-eq { display: flex; align-items: flex-end; gap: 2px; height: 16px; flex: 0 0 auto; }
.snack-eq i { width: 3px; height: 100%; border-radius: 2px; background: var(--saber-core); transform-origin: bottom; animation: eqBar 1s ease-in-out infinite; }
.snack-eq i:nth-child(2) { animation-delay: -.35s; } .snack-eq i:nth-child(3) { animation-delay: -.7s; }
.snack-btn { flex: 0 0 auto; min-height: 40px; padding: .4rem .9rem; border-radius: 10px; border: 1px solid rgba(220, 196, 143, .45); background: rgba(220, 196, 143, .1); color: var(--gold-soft); font: 600 .82rem var(--font-sans); cursor: pointer; }
.snack-close { flex: 0 0 auto; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-dim); font-size: 1.3rem; cursor: pointer; }
body:is(.is-jumping, .is-cruising, .is-observing) .sound-snackbar { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .snack-eq i { animation: none; } .sound-snackbar { transition: none; } }

/* Red Five Arcade */
.trench-module #trenchTitle { text-align: left; margin: 0 0 .4rem; }
.trench-module #trenchHelp { color: var(--text-body); text-align: left; margin-bottom: 1rem; }
.trench-form { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .75rem; text-align: left; }
.trench-form input { box-sizing: border-box; min-height: 44px; width: min(13rem, 100%); padding: .6rem .75rem; background: #111f2b; border: 1px solid #849bad; border-radius: 6px; color: #eef5fa; font: inherit; }
.trench-module .trench-hud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; padding: .8rem 0; text-align: center; }
.trench-hud strong { display: block; color: #fff5df; font-size: 1.18em; font-variant-numeric: tabular-nums; }
.trench-module .trench-arena { touch-action: manipulation; background: radial-gradient(ellipse at 50% 44%, #274657, #081522 59%, #030710 95%); }
.trench-module .trench-port { width: 44px; height: 44px; border-radius: 50%; border-color: #ffdf89; background: radial-gradient(circle, #a56821, #433321 46%, #0c1119 75%); box-shadow: 0 0 21px #eebc6380, inset 0 0 8px #ffec9977; pointer-events: none; z-index: 2; }
.trench-module .trench-port::after { border-radius: 50%; }
.trench-module .trench-aim { z-index: 3; width: 34px; height: 34px; opacity: .78; }
.trench-module .trench-aim::before { width: 46px; top: 16px; left: -7px; }
.trench-module .trench-aim::after { height: 46px; top: -7px; left: 16px; }
.trench-arena [hidden], .arcade-scores [hidden] { display: none; }
.arcade-ready { position: absolute; inset: 0; display: grid; place-items: center; color: #e3eef6; background: #07132191; font-weight: 600; pointer-events: none; }
.arcade-impact { position: absolute; z-index: 4; width: 38px; height: 38px; transform: translate(-50%, -50%); border: 2px solid currentColor; border-radius: 50%; box-shadow: 0 0 18px currentColor; pointer-events: none; }
.arcade-hit { color: #ffdf89; }
.arcade-miss { color: #d98581; }
.trench-module #trenchFeedback { margin: 0; padding: 0; min-height: 1.5em; }
.trench-module :disabled { opacity: .58; cursor: default; }
.arcade-scores { margin: 1rem 0 0; border-top: 1px solid #304653; padding-top: .7rem; text-align: left; }
.arcade-scores summary { cursor: pointer; color: #f0dca8; }
.arcade-scores ol { margin: .5rem 0 0; padding-left: 1.6rem; }
.arcade-scores li { padding: .2rem 0; overflow-wrap: anywhere; }
.arcade-scores li strong { float: right; margin-left: .75rem; font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .trench-module #trenchFire { display: none; } }
@media (max-width: 600px) {
    .trench-form label { flex-basis: 100%; }
    .trench-form input { min-width: 0; flex: 1 1 7rem; }
    .trench-module .trench-port { width: 48px; height: 48px; }
}
