@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');

body {
    font-family: 'Orbitron', sans-serif;
    background-color: #0c0a1e;
}

.aspect-ratio-container {
    position: relative;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-wrapper {
    position: relative;
    width: min(100vw, 56.25vh);
    height: min(177.78vw, 100vh);
    max-width: 400px;
    max-height: 100vh;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a2e;
    border-radius: 1rem;
    border: 2px solid #9a7fde;
}

.overlay {
    background-color: rgba(12, 10, 30, 0.95);
    backdrop-filter: blur(10px);
}

.character-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(138, 127, 222, 0.2);
    border-radius: 0.5rem;
    border: 1px solid #9a7fde;
}

@keyframes slideUpFade {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    10% {
        transform: translateY(0);
        opacity: 1;
    }
    80% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-30px);
        opacity: 0;
    }
}

.reward-popup {
    animation: slideUpFade 2s ease-out forwards;
}

/* Slot rack — capture mechanic (Waves 1-5) */
.slot-rack .slot {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(138, 127, 222, 0.08);
    border: 2px dashed rgba(154, 127, 222, 0.4);
}

.slot-rack .slot.filled {
    border-style: solid;
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
    animation: slotDrop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.slot-rack .slot.wide-content {
    font-size: 1rem;
}

/* Pronoun-block Slot Rack additions (Waves 18-21, js/game.js/js/systems/ui.js) — an empty slot
   shows a lowercase pronoun hint (he/she/they) until filled, so the player knows which pattern
   each slot is waiting for even in a mixed wave (Wave 21). .slot-partial is the THEY pair's
   "one half caught" state — purple like THEY's Vocabulary Card colour, dimmer than .filled. */
.slot-rack .slot .slot-hint {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(196, 181, 253, 0.7);
}

.slot-rack .slot.slot-partial {
    border-style: solid;
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.15);
    opacity: 0.75;
}

@keyframes slotDrop {
    0% {
        transform: translateY(-18px) scale(0.7);
        opacity: 0;
    }
    60% {
        transform: translateY(4px) scale(1.08);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Victory-flash beat (fills the pause before the Wave Complete modal): a brief diagnostic
   pulse on the just-filled slot, then on the shield bar — the silent, visual version of
   ARIA's Shield Recharge Revelation line ("reading a spike... correlating with your last
   capture"). Layered on top of the existing slotDrop animation, not a replacement for it. */
.slot-rack .slot.filled.diagnostic-pulse {
    animation: slotDrop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), diagnosticPulse 0.6s ease-out;
}

#shield-bar.diagnostic-pulse {
    animation: diagnosticPulse 0.6s ease-out;
}

/* Jackpot payline: fired once when a 5-hit capture streak lands (js/game.js's
   resolveCorrectCapture()), cascaded slot-by-slot left to right like a slot-machine payline
   rather than all five flashing at once — same trick as diagnosticPulse above, gold instead
   of cyan, and layered onto whichever slots are already .filled at that moment. */
.slot-rack .slot.filled.jackpot-pulse {
    animation: slotDrop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), jackpotPulse 0.5s ease-out;
}

@keyframes jackpotPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.9);
        filter: brightness(1);
    }
    40% {
        box-shadow: 0 0 22px 8px rgba(250, 204, 21, 0.95);
        filter: brightness(1.9);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0);
        filter: brightness(1);
    }
}

@keyframes diagnosticPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.9);
        filter: brightness(1);
    }
    40% {
        box-shadow: 0 0 18px 6px rgba(56, 189, 248, 0.85);
        filter: brightness(1.5);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
        filter: brightness(1);
    }
}

/* Checkpoint 3 (Family) — family-tree layout, built by renderFamilyTreePuzzle() in
   js/game.js. MOTHER/FATHER sit above a fixed non-interactive ME anchor, SISTER/BROTHER
   below it, joined by plain CSS lines (no SVG). All widths/gaps are CSS variables so the
   connector lines (drawn as absolutely-positioned bars, not measured at runtime) line up
   exactly under each tier's node centers. */
.family-tree {
    --tree-node-w: 5.5rem;
    --tree-gap: 2rem;
    --tree-tier-w: calc(var(--tree-node-w) * 2 + var(--tree-gap));
    /* Siblings tier grew from 2 nodes to 3 (BABY added, 2026-08-31, matching Family's
       vocabulary depth up to 5 words like Animals I/Colors) — its own width variable so the
       parents tier (still 2 nodes: MOTHER/FATHER) doesn't stretch to match. */
    --tree-tier-w-3: calc(var(--tree-node-w) * 3 + var(--tree-gap) * 2);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.family-tree .tree-tier {
    display: flex;
    gap: var(--tree-gap);
    width: var(--tree-tier-w);
}

.family-tree .tree-tier-siblings {
    width: var(--tree-tier-w-3);
}

.family-tree .tree-node {
    width: var(--tree-node-w);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.family-tree .tree-node select {
    width: 100%;
    box-sizing: border-box;
}

.family-tree .tree-node-label {
    color: #67e8f9;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.03em;
}

.family-tree .tree-node-me {
    margin: 0.15rem 0;
}

.family-tree .tree-node-me-emoji {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 9999px;
    background: rgba(34, 211, 238, 0.15);
    border: 2px solid #22d3ee;
}

/* Connector between two tiers: a horizontal bar (::before) spanning between the two
   node centers of whichever tier is on the "pair" side, plus a vertical stub (::after)
   the full height of the connector reaching the single node (ME) on the other side.
   Default orientation puts the bar at the top (pair tier above, ME below); the
   .tree-connector-reverse modifier flips it (ME above, pair tier below). */
.family-tree .tree-connector {
    position: relative;
    width: var(--tree-tier-w);
    height: 1.25rem;
}

.family-tree .tree-connector::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc(var(--tree-node-w) / 2);
    right: calc(var(--tree-node-w) / 2);
    height: 2px;
    background: #22d3ee;
}

.family-tree .tree-connector::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: #22d3ee;
    transform: translateX(-50%);
}

.family-tree .tree-connector-reverse {
    /* Only this connector (ME -> siblings tier) needs the 3-node width — the other
       (parents tier -> ME) still spans just MOTHER/FATHER at the default 2-node width. */
    width: var(--tree-tier-w-3);
}

.family-tree .tree-connector-reverse::before {
    top: auto;
    bottom: 0;
}




