/*
  The journey map — the player's own and the admin wall version.

  These live here rather than in a scoped .razor.css because the shell renders its markers through
  a RenderFragment supplied by the player and admin components, and CSS isolation would scope the
  rules to the wrong component.

  Everything faction-coloured is written once against the --faction-* variables and themed by a
  data-faction attribute on the marker. See tokens/factions.css.
*/

/* ── Page frames ────────────────────────────────────────── */

/* The map fills whatever is left below the player top bar, which is 62px. */
.ach-map-page {
    height: calc(100vh - 62px);
    min-height: 520px;
}

/* Fullscreen puts the map on the wall: the chrome goes away and it takes the whole display. */
.ach-map-page:fullscreen {
    height: 100vh;
}

/* ── Shell ──────────────────────────────────────────────── */

.ach-map {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 520px;
    overflow: hidden;
    font-family: var(--font-body);
    color: var(--color-silver-100);
}

/*
  Drained, and how far back the Desync ritual has pushed it. --ach-void-energy is 0 while the map
  simply sits at the final node, and climbs to 1 as the six sigils are sealed, so the colour comes
  back one seal at a time rather than all at once when the ritual closes. The map draws no ground
  of its own, so the roads are what drains. See JourneyMapShell.
*/
.ach-map--void .ach-map__trails {
    filter: grayscale(calc(0.95 - (0.95 * var(--ach-void-energy, 0))))
            brightness(calc(0.6 + (0.4 * var(--ach-void-energy, 0))));
}

.ach-map__vignette {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 70% 60% at 50% 50%, transparent 40%, rgb(7 9 24 / 0.6) 100%);
}

/* ── Headline ───────────────────────────────────────────── */

.ach-map__title {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    padding: var(--space-3) var(--space-6) 2px;
    text-align: center;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3.2vw, 2rem);
    line-height: var(--leading-none);
    color: var(--color-white);
    text-shadow: 0 0 22px rgb(0 0 0 / 0.6);
}

/* ── Field ──────────────────────────────────────────────── */

.ach-map__field {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    width: 100%;
    max-width: 1220px;
    min-height: 0;
    margin: 0 auto;
    padding: 0 30px;
}

.ach-map__trails {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Matches the terrain's, so the two drain together when the void opens. */
    transition: filter 3.5s ease;
}

/* ── The void ───────────────────────────────────────────── */

.ach-map__void {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 3s ease;
}

/* The tide recedes with it — fully out at six sigils, so the burst lands on a map that is back. */
.ach-map--void .ach-map__void { opacity: calc(1 - (0.8 * var(--ach-void-energy, 0))); }

.ach-map__void-tide,
.ach-map__void-shock {
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 50%;
}

.ach-map__void-tide {
    width: 1700px;
    height: 1700px;
    margin: -850px 0 0 -850px;
    background: radial-gradient(circle at center,
            rgb(0 0 0 / 0.97) 0%, rgb(0 0 0 / 0.92) 18%, rgb(0 0 0 / 0.72) 32%,
            rgb(0 0 0 / 0.4) 44%, rgb(0 0 0 / 0.1) 54%, rgb(0 0 0 / 0) 60%);
    animation: ach-void-breathe 10s ease-in-out infinite;
}

.ach-map__void-shock {
    width: 340px;
    height: 340px;
    margin: -170px 0 0 -170px;
    border: 1px solid rgb(226 232 240 / 0.22);
    animation: ach-void-shock 7s ease-out infinite;
}

.ach-map__void-shock--late { animation-delay: 3.5s; }

@keyframes ach-void-breathe {
    0%, 100% { transform: scale(0.9); opacity: 0.82; }
    50%      { transform: scale(1.2); opacity: 1; }
}

@keyframes ach-void-shock {
    0%   { transform: scale(0.2); opacity: 0.4; }
    60%  { opacity: 0.12; }
    100% { transform: scale(2.6); opacity: 0; }
}

/* ── Markers ────────────────────────────────────────────── */

/*
  A marker is a zero-size anchor placed by percentage; everything inside is positioned relative to
  it, so the disc, its label and its hover card all move together.
*/
.ach-map__marker {
    position: absolute;
    width: 0;
    height: 0;
}

.ach-map__disc-wrap {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    width: 72px;
    height: 72px;
    transform: translate(-50%, -50%);
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Nodes are buttons: opening one stores it as the current challenge before navigating. */
button.ach-map__disc-wrap {
    display: block;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.ach-map__disc {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 50%;
    border: 1.5px solid rgb(var(--faction-accent-rgb) / 0.5);
    background: radial-gradient(circle at 34% 28%,
            rgb(var(--faction-accent-rgb) / 0.3), var(--faction-accent-deep) 72%);
    box-shadow: 0 0 14px rgb(var(--faction-accent-rgb) / 0.28);
}

.ach-map__marker--active .ach-map__disc {
    border-width: 2px;
    border-color: rgb(var(--faction-accent-rgb) / 0.9);
    box-shadow: 0 0 24px rgb(var(--faction-accent-rgb) / 0.5);
}

.ach-map__marker--locked .ach-map__disc-wrap {
    filter: grayscale(1) brightness(0.85);
    opacity: 0.5;
}

/*
  The halo that marks where the team is standing.

  A gradient rather than a round border, like every pulsing ring here. Firefox draws a border-radius
  circle as four corner pieces meeting on the centre lines, and under an animated scale the seams
  between them flash across the ring as a crosshair. A gradient is drawn in one piece.
*/
.ach-map__ring {
    position: absolute;
    inset: -8px;
    background: radial-gradient(closest-side,
            transparent calc(100% - 2.25px),
            rgb(var(--faction-highlight-rgb) / 0.7) calc(100% - 1.5px),
            rgb(var(--faction-highlight-rgb) / 0.7) calc(100% - 0.5px),
            transparent 100%);
    animation: ach-active-ring 2.6s ease-in-out infinite;
}

@keyframes ach-active-ring {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50%      { transform: scale(1.2); opacity: 0.1; }
}

.ach-map__glyph {
    display: block;
    pointer-events: none;
}

.ach-map__glyph--rune {
    font-size: 48px;
    line-height: 1;
    transform: translateY(-3px);
}

/*
  The infinity mark is short and wide, so at the rune size it reads as a smudge. This size fills
  the disc the way the other sigils do; the nudge puts its ink on the disc's centre line, since the
  glyph sits a touch below the middle of its own line box.
*/
.ach-map__glyph--loom {
    font-size: 76px;
    transform: translateY(-4px);
}

/* The tick / padlock pinned to the marker's shoulder. */
.ach-map__badge {
    position: absolute;
    left: 25px;
    top: -25px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.ach-map__badge--done {
    background: var(--pur-400);
    border: 1.5px solid var(--pur-100);
}

.ach-map__badge--locked {
    background: #1c2434;
    border: 1.5px solid rgb(148 163 184 / 0.5);
}

/* ── Marker label ───────────────────────────────────────── */

.ach-map__label {
    position: absolute;
    left: 0;
    width: 172px;
    text-align: center;
}

.ach-map__label--below {
    top: 42px;
    transform: translate(-50%, 0);
}

.ach-map__label--above {
    top: -42px;
    transform: translate(-50%, -100%);
}

/* The name and its caption are spans inside a span, so each has to claim its own line. */
.ach-map__label-name {
    display: block;
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wide);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    color: var(--faction-highlight);
}

.ach-map__marker--locked .ach-map__label-name { color: #8a97ab; }

.ach-map__caption {
    display: block;
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--faction-highlight);
    opacity: 0.72;
}

.ach-map__marker--locked .ach-map__caption { color: var(--color-silver-300); }

/* ── Hover card ─────────────────────────────────────────── */

.ach-map__card {
    position: absolute;
    z-index: 9;
    width: 248px;
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    border: 1px solid rgb(var(--faction-accent-rgb) / 0.45);
    background: linear-gradient(150deg, rgb(var(--faction-accent-rgb) / 0.2) 0%, rgb(10 14 28 / 0.96) 65%);
    box-shadow: 0 8px 28px rgb(0 0 0 / 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s;
}

.ach-map__marker--open > .ach-map__card,
.ach-map__marker:hover > .ach-map__card,
.ach-map__marker:focus-within > .ach-map__card {
    opacity: 1;
}

.ach-map__card--above { bottom: 50px; transform: translate(-50%, 0); left: 0; }
.ach-map__card--below { top: 50px; transform: translate(-50%, 0); left: 0; }

/* Nudged inward at the ends of a road so the card never hangs off the field. */
.ach-map__card--start { transform: translate(-18%, 0); }
.ach-map__card--end { transform: translate(-82%, 0); }

.ach-map__card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.ach-map__card-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    line-height: var(--leading-tight);
    color: var(--faction-highlight);
}

.ach-map__card-chip {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-wider);
    font-size: 10px;
}

.ach-map__card-chip--done {
    background: var(--faction-accent);
    color: var(--faction-on-accent);
}

.ach-map__card-chip--active {
    background: var(--faction-highlight);
    color: var(--faction-on-accent);
}

.ach-map__card-chip--locked {
    border-color: rgb(148 163 184 / 0.5);
    color: var(--color-silver-200);
}

.ach-map__card-meta {
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--faction-highlight);
    opacity: 0.75;
}

.ach-map__card-body {
    margin-top: 7px;
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    color: var(--color-silver-200);
}

/* ── The Desync ─────────────────────────────────────────── */

/*
  A button, not a decoration: clicking it opens the Desync ritual. It stays in the markup for a team
  that has not arrived yet, disabled, because the node itself is the tease — see PlayerJourneyMap.
*/
.ach-map__final-disc {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    width: 84px;
    height: 84px;
    padding: 0;
    border: none;
    background: transparent;
    transform: translate(-50%, -50%);
    cursor: pointer;
}

.ach-map__final-disc:disabled { cursor: default; }

.ach-map__final-disc:not(:disabled):hover .ach-map__final-face {
    border-color: var(--color-white);
    box-shadow: 0 0 40px rgb(226 232 240 / 0.6), inset 0 0 22px rgb(0 0 0 / 0.9);
}

.ach-map__final-ring {
    position: absolute;
    inset: -9px;
    /* A gradient, not a round border: see .ach-map__ring. */
    background: radial-gradient(closest-side,
            transparent calc(100% - 1.75px),
            rgb(226 232 240 / 0.4) calc(100% - 1px),
            rgb(226 232 240 / 0.4) calc(100% - 0.5px),
            transparent 100%);
    animation: ach-final-ring 3s ease-in-out infinite;
}

@keyframes ach-final-ring {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%      { transform: scale(1.14); opacity: 0.18; }
}

.ach-map__final-face {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1.5px solid rgb(226 232 240 / 0.7);
    background: radial-gradient(circle at 34% 28%, #3a3f52, #14161f 55%, #05060c 100%);
    box-shadow: 0 0 26px rgb(148 163 184 / 0.4), inset 0 0 22px rgb(0 0 0 / 0.9);
    font-family: var(--font-display);
    font-size: 34px;
    line-height: 1;
    color: var(--color-silver-100);
}

.ach-map__final-name {
    display: block;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    line-height: var(--leading-tight);
    color: var(--color-silver-100);
}

/* The final puzzle's name is a title rather than a label, so it gets room to breathe. */
.ach-map__marker--final .ach-map__label {
    width: 230px;
}

.ach-map__marker--final .ach-map__label--below {
    top: 50px;
}

.ach-map__marker--final .ach-map__caption,
.ach-map__marker--final .ach-map__card-title,
.ach-map__marker--final .ach-map__card-meta {
    color: var(--color-silver-200);
}

.ach-map__marker--final .ach-map__card {
    border-color: rgb(226 232 240 / 0.3);
    background: linear-gradient(150deg, rgb(30 41 59 / 0.6) 0%, rgb(5 6 12 / 0.97) 65%);
}

.ach-map__marker--final .ach-map__card-chip--locked { color: var(--color-silver-100); }

/* ── Empty / loading states ─────────────────────────────── */

.ach-map__notice {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 5;
    transform: translate(-50%, -50%);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: rgb(10 14 28 / 0.9);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-silver-300);
    text-align: center;
}

/* ── Narrow screens ─────────────────────────────────────── */

@media (max-width: 900px) {
    .ach-map__field {
        padding: 0 14px;
    }

    .ach-map__disc-wrap {
        width: 54px;
        height: 54px;
    }

    .ach-map__label {
        width: 118px;
    }

    .ach-map__label--below { top: 32px; }
    .ach-map__label--above { top: -32px; }

    .ach-map__label-name { font-size: var(--text-xs); }

    .ach-map__card {
        width: 196px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ach-map__ring,
    .ach-map__final-ring,
    .ach-map__void-tide,
    .ach-map__void-shock,
    .ach-ritual__orbit,
    .ach-ritual__hot,
    .ach-ritual__flash,
    .ach-ritual__burst {
        animation: none;
    }
}

/* ── The Desync ritual ──────────────────────────────────── */

/*
  The full-screen act that opens the final challenge, over the map rather than instead of it: the
  scrim is deep but not opaque, and thins as sigils are sealed, so the map is visibly coming back
  underneath. These rules are here rather than in a scoped file for the same reason the rest of
  this stylesheet is — see the header — and because the slot panels are themed by data-faction,
  written once against the --faction-* variables in tokens/factions.css.

  --ach-ritual-energy is sealed sigils over six. The component writes it on the stage; everything
  that grows as the sphere opens reads it from there rather than being interpolated per element.
*/

.ach-ritual {
    /* Above .ach-top (--z-floating) and the Oracle (--z-modal), below the break overlay (2000). */
    position: fixed;
    inset: 0;
    z-index: 210;
    font-family: var(--font-body);
    color: var(--color-silver-100);
}

.ach-ritual__scrim {
    position: absolute;
    inset: 0;
    transition: opacity 1.1s ease;
    background: radial-gradient(ellipse 70% 70% at 50% 52%,
            rgb(1 2 6 / 0.82) 0%, rgb(1 2 6 / 0.95) 55%, rgb(0 1 4 / 0.985) 100%);
}

.ach-ritual__head {
    position: absolute;
    top: 66px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 360px;
    text-align: center;
}

.ach-ritual__title {
    margin-top: 6px;
    font-family: var(--font-display);
    font-size: 40px;
    line-height: 1.02;
    color: var(--color-white);
    text-shadow: 0 0 34px rgb(var(--aug-300-rgb) / 0.45);
}

.ach-ritual__lead {
    margin: 10px 0 0;
    font-size: 12.5px;
    line-height: var(--leading-relaxed);
    color: var(--color-silver-300);
}

.ach-ritual__rule {
    margin: 8px 0 0;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: var(--leading-normal);
    color: var(--color-silver-400);
}

.ach-ritual__count {
    position: absolute;
    top: 72px;
    right: 40px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 14px;
}

.ach-ritual__tally {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.18em;
    color: var(--color-silver-200);
}

.ach-ritual__close {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgb(226 232 240 / 0.35);
    background: transparent;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    color: var(--color-silver-200);
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.ach-ritual__close:hover {
    border-color: var(--color-white);
    color: var(--color-white);
}

/* ── Stage ──────────────────────────────────────────────── */

/*
  Everything below is placed from the centre of the viewport outward, which is where the Desync
  node itself sits on the map: the ritual opens out of it rather than beside it.
*/
.ach-ritual__stage {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.ach-ritual__beams {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1000px;
    height: 640px;
    margin: -320px 0 0 -500px;
    pointer-events: none;
    overflow: visible;
}

.ach-ritual__beam {
    stroke: rgb(148 163 184 / 0.12);
    stroke-width: 1;
    stroke-dasharray: 3 7;
    stroke-linecap: round;
    transition: stroke 0.6s ease, stroke-width 0.6s ease;
}

.ach-ritual__beam--lit {
    stroke: rgb(var(--faction-accent-rgb) / 0.75);
    stroke-width: 2;
    stroke-dasharray: none;
}

.ach-ritual__orbit {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 320px;
    height: 320px;
    margin: -160px 0 0 -160px;
    border-radius: 50%;
    border: 1px dashed rgb(226 232 240 / 0.14);
    pointer-events: none;
    animation: ach-ritual-spin 44s linear infinite;
}

@keyframes ach-ritual-spin {
    to { transform: rotate(360deg); }
}

/* ── The sphere ─────────────────────────────────────────── */

.ach-ritual__core {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 170px;
    height: 170px;
    margin: -85px 0 0 -85px;
    pointer-events: none;
}

.ach-ritual__sphere {
    position: absolute;
    inset: 0;
    transition: transform 1.2s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.ach-ritual__shell {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgb(226 232 240 / 0.28);
    background: radial-gradient(circle at 44% 36%, #2b3141 0%, #141823 42%, #07080f 76%, #04050a 100%);
    transition: box-shadow 1.2s ease;
}

.ach-ritual__cracks {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/*
  Two identical keyframe sets. A crack is traced by animating its dash offset to zero, and re-using
  the same animation name on an element that has already finished it does not restart it — so the
  JS module alternates between these on each seal. See DesyncRitualOverlay.razor.js.
*/
@keyframes ach-ritual-draw-a {
    from { opacity: 1; }
    to   { stroke-dashoffset: 0; opacity: 1; }
}

@keyframes ach-ritual-draw-b {
    from { opacity: 1; }
    to   { stroke-dashoffset: 0; opacity: 1; }
}

/* The white heart of it, visible through the cracks from the first seal on. */
.ach-ritual__hot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border-radius: 50%;
    background: var(--color-white);
    box-shadow: 0 0 22px rgb(255 255 255 / 0.75);
    animation: ach-ritual-throb 2.4s ease-in-out infinite;
}

@keyframes ach-ritual-throb {
    0%, 100% { opacity: 0.75; }
    50%      { opacity: 1; }
}

.ach-ritual__flash {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid rgb(226 232 240 / 0.7);
    animation: ach-ritual-seal 1.1s ease-out forwards;
}

@keyframes ach-ritual-seal {
    0%   { transform: scale(0.15); opacity: 0.85; }
    100% { transform: scale(3.4); opacity: 0; }
}

.ach-ritual__burst {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgb(255 255 255 / 0.85);
    animation: ach-ritual-burst 2.6s ease-out infinite;
}

.ach-ritual__burst--late {
    border-width: 1px;
    border-color: rgb(var(--aug-300-rgb) / 0.7);
    animation-delay: 1.3s;
}

@keyframes ach-ritual-burst {
    0%   { transform: scale(0.1); opacity: 1; }
    100% { transform: scale(4.2); opacity: 0; }
}

/* ── Sigil slots ────────────────────────────────────────── */

.ach-ritual__slot {
    position: absolute;
    width: 186px;
    transform: translate(-50%, -50%);
}

.ach-ritual__slot-name {
    margin-bottom: 7px;
    text-align: center;
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    letter-spacing: 0.08em;
    font-size: var(--text-xs);
    line-height: 1.15;
    color: var(--color-silver-400);
    transition: color 0.6s ease;
}

.ach-ritual__panel {
    position: relative;
    padding: 12px 14px 10px;
    border: 1px solid rgb(148 163 184 / 0.35);
    background: linear-gradient(150deg, rgb(30 41 59 / 0.5) 0%, rgb(5 6 12 / 0.96) 70%);
    box-shadow: 0 10px 34px rgb(0 0 0 / 0.65);
    /* The Achrona cut corner: top-left and bottom-right clipped, as on every other panel. */
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    transition: border-color 0.6s ease, box-shadow 0.6s ease, background 0.6s ease;
}

.ach-ritual__panel--sealed {
    border-color: rgb(var(--faction-accent-rgb) / 0.95);
    background: linear-gradient(150deg, rgb(var(--faction-accent-rgb) / 0.16) 0%, rgb(6 9 20 / 0.95) 70%);
    box-shadow: 0 0 26px rgb(var(--faction-accent-rgb) / 0.45),
                inset 0 0 22px rgb(var(--faction-accent-rgb) / 0.12);
}

.ach-ritual__panel--wrong {
    border-color: rgb(248 113 113 / 0.95);
    animation: ach-ritual-wrong 0.5s ease;
}

@keyframes ach-ritual-wrong {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-7px); }
    45%      { transform: translateX(6px); }
    70%      { transform: translateX(-4px); }
}

.ach-ritual__input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: var(--weight-bold);
    letter-spacing: 0.34em;
    /* Balances the trailing letter-space, so five characters read as centred, not left-leaning. */
    text-indent: 0.34em;
    text-transform: uppercase;
    color: var(--color-silver-100);
}

.ach-ritual__panel--sealed .ach-ritual__input {
    color: rgb(var(--faction-accent-rgb));
    caret-color: transparent;
}

.ach-ritual__status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}

.ach-ritual__pip {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgb(148 163 184 / 0.35);
}

.ach-ritual__panel--sealed .ach-ritual__pip { background: rgb(var(--faction-accent-rgb) / 0.95); }

.ach-ritual__status-text {
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.22em;
    color: var(--color-silver-400);
}

.ach-ritual__panel--sealed .ach-ritual__status-text,
.ach-ritual__slot:has(.ach-ritual__panel--sealed) .ach-ritual__slot-name {
    color: rgb(var(--faction-accent-rgb));
}

/* ── Footer ─────────────────────────────────────────────── */

/*
  The overlay covers the top bar, so the hint and the way to the team own codes live down here: a
  player looking their three up should not have to close the ritual to do it.
*/
.ach-ritual__foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 26px;
    z-index: 3;
    text-align: center;
}

.ach-ritual__hint {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.24em;
    color: var(--color-silver-400);
}

.ach-ritual__error {
    margin: 0 auto 10px;
    max-width: 460px;
    font-size: var(--text-sm);
    color: var(--color-ember-200);
}

.ach-ritual__codes-link {
    margin-top: 8px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-decoration: underline;
    text-underline-offset: 3px;
    color: var(--color-silver-300);
    transition: color var(--transition-fast);
}

.ach-ritual__codes-link:hover { color: var(--color-white); }

.ach-ritual__open-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    color: var(--color-white);
    text-shadow: 0 0 28px rgb(var(--aug-300-rgb) / 0.6);
}

.ach-ritual__ally {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-silver-300);
}

.ach-ritual__enter {
    display: inline-block;
    margin-top: 10px;
    padding: 11px 28px;
    border: 1px solid rgb(255 255 255 / 0.75);
    background: rgb(255 255 255 / 0.08);
    font-family: var(--font-heading);
    font-weight: var(--weight-extrabold);
    letter-spacing: 0.22em;
    font-size: var(--text-sm);
    color: var(--color-white);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.ach-ritual__enter:not(:disabled):hover {
    background: var(--color-white);
    color: #05060c;
}

.ach-ritual__enter:disabled {
    cursor: wait;
    opacity: 0.7;
}

/*
  The codes dialog opened from inside the ritual. It wears the shared .ach-login chrome, which sits
  at --z-modal (200) — under the ritual. This lifts that one instance over it.
*/
.ach-ritual__codes .ach-login { z-index: 220; }

/*
  Under about 1100px the slots would sit on top of the sphere, so the stage stops being a ring: the
  sigils stack into one scrolling column and the sphere stays behind them as an atmosphere.
*/
@media (max-width: 1100px) {
    .ach-ritual__beams,
    .ach-ritual__orbit {
        display: none;
    }

    .ach-ritual__stage {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--space-3);
        inset: 150px 16px 110px;
        overflow-y: auto;
    }

    .ach-ritual__core {
        position: fixed;
        opacity: 0.5;
    }

    .ach-ritual__slot {
        position: static;
        flex: 0 0 auto;
        width: min(320px, 100%);
        transform: none;
    }

    .ach-ritual__head {
        top: 20px;
        width: min(360px, calc(100% - 32px));
    }

    .ach-ritual__title { font-size: var(--text-2xl); }

    .ach-ritual__count {
        top: 24px;
        right: 16px;
    }
}
