:root {
    --neon-blue: #00f3ff;
    --neon-purple: #bc13fe;
    --deep-bg: #050510;
    --panel-bg: rgba(20, 20, 40, 0.85);
    /* Slightly more opaque for readability over image */

    /* Card category colours, matching the printed TFTF deck */
    --cat-arc: #8cc63f;
    --cat-terrain: #29abe2;
    --cat-object: #ef5a5a;
    --cat-mood: #b08fd0;

    /* Corner radii: everything with a frame uses one of these */
    --r-sm: 8px;
    /* chips, list items, small controls */
    --r-md: 12px;
    /* buttons, inputs, cards */
    --r-lg: 16px;
    /* panels, boxes */
    --r-xl: 20px;
    /* full-width surfaces, modal */
}

* {
    font-family: 'Orbitron', sans-serif;
}

/* Optional: Dark Overlay */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    /* Darkens the background image */
    z-index: -1;
}

body {
    background: url('background.png') no-repeat center center fixed;
    background-color: var(--deep-bg);
    /* Fallback */
    background-size: cover;
    color: white;
    font-family: 'Orbitron', sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin-top: 50px;
    text-align: center;
}

h1 {
    font-size: 3rem;
    text-shadow: 0 0 10px var(--neon-blue);
    margin-bottom: 40px;
}

.cyber-btn {
    background: transparent;
    border: 2px solid var(--neon-blue);
    border-radius: var(--r-md);
    color: var(--neon-blue);
    padding: 15px 30px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    margin: 10px;
}

.cyber-btn:hover {
    background: var(--neon-blue);
    color: black;
    box-shadow: 0 0 20px var(--neon-blue);
}

.cyber-btn.green {
    border-color: #0f0;
    color: #0f0;
    box-shadow: 0 0 10px #0f0;
}

.cyber-btn.green:hover {
    background: #00ff00;
    color: black;
    box-shadow: 0 0 20px #00ff00;
}

.cyber-btn.red {
    border-color: #f00;
    color: #f00;
    box-shadow: 0 0 10px #f00;
    font-size: 0.8rem;
    padding: 5px 15px;
    border-radius: var(--r-sm);
}

/* ---- Back / leave navigation ----
   Calm ghost button for BACK and LEAVE. Going back is not destructive, so it
   drops the alarming solid-red look and stays quiet at rest, lighting up in
   neon only on hover/focus. The arrow nudges left to reinforce "go back", and
   the target is tall enough (>=40px) to tap comfortably on a phone. */
.back-btn {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    box-sizing: border-box;
    min-height: 40px;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--r-md);
    color: #cfe1ee;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.back-btn .back-arrow {
    font-size: 1.05em;
    line-height: 1;
    transition: transform 0.2s ease;
}

.back-btn:hover,
.back-btn:focus-visible {
    color: var(--neon-blue);
    border-color: var(--neon-blue);
    background: rgba(0, 243, 255, 0.10);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.35);
    outline: none;
}

.back-btn:hover .back-arrow,
.back-btn:focus-visible .back-arrow {
    transform: translateX(-3px);
}

.back-btn:active {
    transform: translateY(1px);
}

/* Leaving a room deletes the player entry, so this variant tints red — but only
   on intent (hover/focus), as a light caution rather than a constant warning. */
.back-btn.danger:hover,
.back-btn.danger:focus-visible {
    color: #ff6b6b;
    border-color: #ff6b6b;
    background: rgba(255, 60, 60, 0.10);
    box-shadow: 0 0 12px rgba(255, 60, 60, 0.35);
}

/* Top-of-panel BACK link: sit at the left with breathing room below. */
.back-btn.back-top {
    margin-bottom: 20px;
}

.cyber-input {
    background: rgba(0, 20, 40, 0.8);
    /* Darker, slightly blueish background */
    border: 2px solid var(--neon-blue);
    border-radius: var(--r-md);
    color: #fff;
    padding: 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    outline: none;
    text-align: center;
    width: 280px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.cyber-input:focus {
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
    background: rgba(0, 30, 60, 0.9);
}

.login-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    /* Consistent spacing */
    padding: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
    border-radius: var(--r-lg);
    backdrop-filter: blur(5px);
}

.cyber-btn.yellow {
    border-color: #ffff00;
    color: #ffff00;
}

/* ---- Teacher sign-in steps ---- */
.input-with-action {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
}

.input-with-action .cyber-input {
    width: 220px;
}

.cyber-btn.icon {
    margin: 0;
    padding: 0 18px;
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.step-title {
    font-size: 1.1rem;
    color: var(--neon-blue);
    letter-spacing: 0.08em;
    margin: 0 0 8px;
}

.step-hint {
    font-size: 0.8rem;
    color: #9fb3bf;
    margin: 0 0 18px;
    max-width: 320px;
}

.step-user {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--neon-blue);
    margin: 0 0 16px;
}

.link-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    color: #9fb3bf;
    text-decoration: underline;
    cursor: pointer;
}

.link-btn:hover {
    color: var(--neon-blue);
}

.auth-msg {
    min-height: 1.2em;
    margin: 16px 0 0;
    font-size: 0.82rem;
    line-height: 1.45;
    max-width: 320px;
    color: #ff6b6b;
}

.auth-msg.ok {
    color: #46e08a;
}

.hidden {
    display: none !important;
}

.neon-text {
    color: var(--neon-purple);
    font-weight: bold;
    font-size: 2rem;
    text-shadow: 0 0 10px var(--neon-purple);
}

.players-panel {
    background: var(--panel-bg);
    padding: 20px;
    border: 1px solid var(--neon-blue);
    margin-top: 30px;
    border-radius: var(--r-lg);
}

#players-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.player-card {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--neon-blue);
    padding: 10px 20px;
    border-radius: var(--r-md);
    min-width: 100px;
}

/* CARDS PREVIEW */
.cards-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.game-card {
    --card-accent: #fff;
    width: 150px;
    height: 220px;
    border: 2px solid var(--card-accent);
    color: var(--card-accent);
    border-radius: var(--r-lg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    text-align: center;
    text-transform: uppercase;
}

/* Room History Styles */
.room-history {
    list-style: none;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
    border-top: 1px solid #333;
    padding-top: 10px;
    text-align: left;
}

.history-item {
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 1px solid #222;
    border-radius: var(--r-sm);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    transition: background 0.3s, border-color 0.3s;
}

.history-item:hover {
    border-color: rgba(0, 243, 255, 0.4);
}

.history-item:hover {
    background: rgba(0, 255, 255, 0.1);
}

.history-code {
    color: var(--neon-blue);
    font-weight: bold;
}

.history-date {
    color: #888;
    font-size: 0.8em;
}

/* RESULT GALLERY */
/* RESULT GALLERY CAROUSEL */
#gallery-grid {
    display: flex;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding: 20px 0;
    cursor: grab;
    width: 100%;
    align-items: stretch;
    scrollbar-width: none;
    /* Firefox */
}

#gallery-grid::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

#gallery-grid:active {
    cursor: grabbing;
}

.result-card {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--neon-blue);
    border-radius: var(--r-lg);
    padding: 10px;

    /* Carousel sizing */
    flex: 0 0 auto;
    scroll-snap-align: center;
    width: 85vw;
    /* Mobile: 1 card visible */
    max-width: 500px;
    /* Cap size */

    text-align: center;
    transition: transform 0.3s ease;
}

/* Desktop: 3 cards visible */
@media (min-width: 1024px) {
    .result-card {
        width: calc((100% - 40px) / 3);
        /* 3 cards minus gap */
    }
}

.result-image-container {
    border-radius: var(--r-md);
}

.result-image-container img {
    max-width: 100%;
    height: auto;
    border-radius: var(--r-sm);
    border: 1px solid #333;
}

.result-info h3 {
    margin: 5px 0 0;
    font-size: 1rem;
    color: var(--neon-blue);
}

.result-info p {
    font-size: 0.8rem;
    color: #ddd;
    font-style: italic;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Canvas specific */
#drawing-canvas {
    cursor: crosshair;
}

/* Player View Adjustments */
/* Two per row on a phone, all four side by side from tablet up. The width is
   what decides, not the device: four cards need roughly 600px to stay legible. */
#active-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
}

@media (min-width: 600px) {
    #active-cards-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }
}

/* Same anatomy as the cards in the teacher's result modal: coloured accent on
   top, small category label, then the value as the thing you actually read. */
.active-card {
    --card-accent: #ccc;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid color-mix(in srgb, var(--card-accent) 55%, transparent);
    border-top: 3px solid var(--card-accent);
    border-radius: var(--r-md);
    padding: 14px 16px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    text-align: left;
    min-width: 0;
    box-shadow: 0 0 14px color-mix(in srgb, var(--card-accent) 18%, transparent);
    transition: transform 0.2s, box-shadow 0.2s;
}

.active-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px color-mix(in srgb, var(--card-accent) 30%, transparent);
}

.active-card h3 {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--card-accent) 80%, #fff);
    opacity: 0.9;
}

/* Fluid size instead of hyphenation: a long subcategory like TRANSFORM has to
   shrink to fit a narrow column rather than break across two lines. */
.active-card .card-content {
    font-size: clamp(0.95rem, 1.55vw, 1.25rem);
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
    overflow-wrap: break-word;
}

/* ARC carries a subcategory (the shape of the change) plus a time frame. */
.active-card .card-arc-sub {
    display: block;
    color: var(--card-accent);
    text-transform: uppercase;
}

.active-card .card-arc-desc {
    display: block;
    margin-top: 4px;
    font-size: 0.85em;
    font-weight: 400;
    color: #cfd8dd;
}

@media (max-width: 599px) {
    .active-card .card-content {
        font-size: 1.05rem;
    }
}

/* Category accents. One custom property drives border, glow and label colour
   for every card variant, so a colour change lives in :root only. */
.card-ARC { --card-accent: var(--cat-arc); }
.card-TERRAIN { --card-accent: var(--cat-terrain); }
.card-OBJECT { --card-accent: var(--cat-object); }
.card-MOOD { --card-accent: var(--cat-mood); }

/* ============ RESULT MODAL ============ */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: radial-gradient(circle at 50% 40%, rgba(0, 20, 40, 0.88), rgba(0, 0, 0, 0.96));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    animation: modal-fade 0.2s ease-out;
}

.modal-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1180px;
    max-height: calc(100vh - 48px);
    background: linear-gradient(180deg, rgba(0, 24, 44, 0.98), rgba(0, 8, 18, 0.98));
    border: 1px solid rgba(0, 243, 255, 0.5);
    box-shadow: 0 0 0 1px rgba(0, 243, 255, 0.12), 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 45px rgba(0, 243, 255, 0.18);
    border-radius: var(--r-xl);
    overflow: hidden;
    animation: zoom 0.25s ease-out;
}

/* Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 243, 255, 0.22);
    background: rgba(0, 243, 255, 0.04);
    flex-shrink: 0;
}

.modal-title-group {
    display: flex;
    align-items: baseline;
    gap: 14px;
    min-width: 0;
}

.modal-title-group h2 {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
    color: var(--neon-blue);
    text-shadow: 0 0 12px rgba(0, 243, 255, 0.45);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-counter {
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    color: #7c8b95;
    white-space: nowrap;
}

/* Body: image + meta */
.modal-main {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 24px;
    padding: 24px;
    overflow-y: auto;
    /* start, not stretch: rows keep their natural height and the area scrolls
       instead of squashing the drawing under the description */
    align-items: start;
    align-content: start;
    min-height: 0;
}

.modal-figure {
    margin: 0;
    background:
        linear-gradient(rgba(0, 243, 255, 0.045) 1px, transparent 1px) 0 0 / 100% 26px,
        #000;
    border: 1px solid rgba(0, 243, 255, 0.28);
    border-radius: var(--r-lg);
    padding: 10px;
    /* Block, not flex: a flex figure does not contribute the scaled image
       height to its grid row, so the drawing overlapped the description */
    display: block;
    text-align: center;
    font-size: 0;
}

.modal-content {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: min(62vh, 620px);
    object-fit: contain;
    border-radius: var(--r-sm);
}

.modal-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    min-width: 0;
    color: #ccc;
    text-align: left;
}

.modal-description {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.65;
    color: #e6f6ff;
    font-style: italic;
    border-left: 2px solid var(--neon-purple);
    padding-left: 14px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.modal-description:empty {
    display: none;
}

/* Card strip pinned under the header, outside the scrolling area */
.modal-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 243, 255, 0.18);
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.modal-cards .tftf-card {
    flex: 0 1 240px;
}

.tftf-card {
    --card-accent: #ccc;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--card-accent) 55%, transparent);
    border-top: 3px solid var(--card-accent);
    border-radius: var(--r-md);
    background: rgba(0, 0, 0, 0.55);
    text-align: left;
}

.tftf-card-label {
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--card-accent) 80%, #fff);
    opacity: 0.85;
}

.tftf-card-sub {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--card-accent);
    overflow-wrap: anywhere;
    hyphens: auto;
}

.tftf-card-value {
    font-size: 0.9rem;
    line-height: 1.35;
    color: #e8e8e8;
    overflow-wrap: anywhere;
    hyphens: auto;
}

/* Footer nav */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px;
    border-top: 1px solid rgba(0, 243, 255, 0.22);
    background: rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.modal-nav {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    padding: 9px 18px;
    border: 1px solid var(--neon-blue);
    border-radius: var(--r-md);
    background: transparent;
    color: var(--neon-blue);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}

.modal-nav:hover:not(:disabled) {
    background: rgba(0, 243, 255, 0.14);
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.35);
}

.modal-nav:disabled {
    opacity: 0.28;
    cursor: default;
}

.modal-nav.ghost {
    border-color: #445;
    color: #8fa3b0;
}

.modal-nav.ghost:hover {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
    box-shadow: 0 0 14px rgba(188, 19, 254, 0.3);
    background: transparent;
}

/* Close button */
.close-modal {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    line-height: 1;
    font-size: 26px;
    font-family: 'Orbitron', sans-serif;
    color: #9fb3bf;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: 0.2s;
}

.close-modal:hover,
.close-modal:focus {
    color: #ff5c5c;
    border-color: #ff5c5c;
    box-shadow: 0 0 12px rgba(255, 92, 92, 0.35);
}

@keyframes modal-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoom {
    from {
        transform: translateY(12px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Modal responsive */
@media (max-width: 900px) {
    .modal {
        padding: 0;
    }

    .modal-body {
        max-width: 100%;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .modal-main {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
        padding: 16px;
    }

    .modal-cards {
        gap: 8px;
        padding: 12px 16px;
    }

    .modal-cards .tftf-card {
        /* Two per row on a phone */
        flex: 1 1 calc(50% - 8px);
    }

    .modal-content {
        max-height: 42vh;
    }

    .modal-title-group h2 {
        font-size: 1.15rem;
    }

    .modal-header,
    .modal-footer {
        padding: 12px 16px;
    }

    .modal-nav {
        padding: 9px 12px;
        font-size: 0.7rem;
    }
}

/* Mini cards (gallery preview) */
.tftf-cards.mini {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

.tftf-cards.mini .tftf-card {
    flex: 1 1 70px;
    max-width: 90px;
    padding: 6px;
    gap: 2px;
    align-items: center;
    text-align: center;
    border-top-width: 2px;
}

.tftf-cards.mini .tftf-card-label {
    font-size: 0.5rem;
    letter-spacing: 0.1em;
}

.tftf-cards.mini .tftf-card-sub {
    font-size: 0.62rem;
}

.tftf-cards.mini .tftf-card-value {
    font-size: 0.58rem;
    line-height: 1.2;
}

/* Responsive Game Header */
.game-header {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
    /* Ensure height matches timer */
}

.game-timer-display {
    position: absolute;
    right: 0;
    font-size: 1.5rem;
    color: #00f3ff;
    font-weight: bold;
    border: 1px solid #bc13fe;
    padding: 5px 10px;
    border-radius: var(--r-md);
    background: rgba(0, 0, 0, 0.8);
    /* Readability */
    z-index: 10;
}

/* Mobile Adjustments for Timer */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 30px;
    }

    .game-timer-display {
        position: static;
        /* Stack naturally */
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        background: rgba(0, 20, 40, 0.9);
    }
}

/* ===== TEMPORAL PORTAL (waiting room) ===== */
.portal-stage {
    position: relative;
    width: 100%;
    max-width: 460px;
    aspect-ratio: 1 / 1;
    margin: 1.5rem auto 1.75rem;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at center, #0a0820 0%, #040312 70%);
    box-shadow:
        0 0 40px rgba(0, 243, 255, 0.25),
        0 0 90px rgba(188, 19, 254, 0.20),
        inset 0 0 60px rgba(0, 243, 255, 0.10);
    /* thin neon rim */
    border: 1px solid rgba(0, 243, 255, 0.35);
}

.portal-stage::after {
    /* rotating conic sheen on the rim */
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(from 0deg,
            var(--neon-blue), var(--neon-purple), var(--cat-object),
            var(--neon-blue));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.55;
    animation: portal-rim-spin 6s linear infinite;
    pointer-events: none;
}

@keyframes portal-rim-spin {
    to { transform: rotate(360deg); }
}

#portal-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.holo-caption {
    margin-top: 1.1rem;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(0.72rem, 2.6vw, 0.95rem);
    letter-spacing: 0.5em;
    text-indent: 0.5em;
    color: var(--neon-blue);
    text-shadow:
        0 0 6px rgba(0, 243, 255, 0.9),
        0 0 18px rgba(0, 243, 255, 0.6),
        0 0 34px rgba(188, 19, 254, 0.45);
}

.holo-caption .dot {
    color: var(--neon-purple);
    text-shadow: 0 0 8px rgba(188, 19, 254, 0.9);
    animation: holo-dot-blink 1.2s steps(1) infinite;
}

.holo-caption .d2 { animation-delay: 0.4s; }
.holo-caption .d3 { animation-delay: 0.8s; }

@keyframes holo-dot-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.15; }
}

.holo-subcap {
    margin-top: 0.4rem;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: 400;
    font-size: clamp(0.5rem, 1.9vw, 0.62rem);
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    color: rgba(188, 19, 254, 0.7);
}

@media (prefers-reduced-motion: reduce) {
    .portal-stage::after { animation: none; }
    .holo-caption .dot { animation: none; opacity: 0.85; }
}