/* Shared design tokens, fonts, buttons, modals, leaderboard */
@import url('../shared.css');

:root {
    --bg-color: #000000;
    --error-color: #ef4444;
    --ui-bg: rgba(0, 0, 0, 0.97);
    --primary: #3b82f6;
    --accent: #38bdf8;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: white;
    font-family: 'Courier Prime', monospace;
    overflow: hidden;
    touch-action: none;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    padding-bottom: 0;
}

/* Header */
#header {
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    z-index: 10;
}

/* Sound Toggle Button */
.sound-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #1e293b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.sound-toggle:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.1);
    transform: scale(1.1);
}

.sound-toggle:active {
    transform: scale(0.95);
}

.sound-toggle.muted {
    opacity: 0.4;
}

#header-level-name {
    color: var(--accent);
}

.hdot {
    color: #334155;
    margin: 0 4px;
}

#timer {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#timer.warning {
    color: var(--error-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.05);
    }
}

/* Game Grid Container */
#game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 52px 16px;
    overflow: hidden;
    position: relative;
}

#grid {
    display: grid;
    gap: 0;
    position: relative;
}

.cell {
    position: relative;
}

/* Bus Styles */
.bus-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    z-index: 1;
    /* Add variables for rotation and scale to keep orientation during animations */
    --rot: 0deg;
    --scl: 1;
    transform: rotate(var(--rot)) scaleX(var(--scl));
}

.bus-canvas {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: block;
}

.bus-wrapper:hover {
    z-index: 10;
}

.bus-wrapper:hover .bus-canvas {
    transform: scale(1.3);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

/* Orientations: Base drawing faces LEFT */
.dir-L {
    --rot: 0deg;
    --scl: 1;
}

.dir-U {
    --rot: 90deg;
    --scl: 1;
}

.dir-R {
    --rot: 0deg;
    --scl: -1;
}

/* Flip horizontally instead of rotating 180deg */
.dir-D {
    --rot: -90deg;
    --scl: 1;
}

/* Animations */
.bus-tap {
    animation: busTap 0.25s ease-out forwards;
}

@keyframes busTap {
    0% {
        transform: translate(0, 0) rotate(var(--rot)) scaleX(var(--scl)) scale(1);
    }
    20% {
        transform: translate(1px, -1px) rotate(var(--rot)) scaleX(var(--scl)) scale(1.35);
    }
    40% {
        transform: translate(-1px, 1px) rotate(var(--rot)) scaleX(var(--scl)) scale(1.35);
    }
    60% {
        transform: translate(0px, 0px) rotate(var(--rot)) scaleX(var(--scl)) scale(1.25);
    }
    100% {
        transform: translate(0, 0) rotate(var(--rot)) scaleX(var(--scl)) scale(1);
    }
}

.shake {
    animation: vibrate 0.25s linear both;
}

.shake .bus-canvas {
    filter: sepia(1) hue-rotate(-50deg) saturate(5) drop-shadow(0 0 5px red);
}

@keyframes vibrate {

    /* Preserve the bus orientation while translating */
    0%,
    100% {
        transform: translate(0, 0) rotate(var(--rot)) scaleX(var(--scl));
    }

    20% {
        transform: translate(-3px, 0px) rotate(var(--rot)) scaleX(var(--scl));
    }

    40% {
        transform: translate(3px, -2px) rotate(var(--rot)) scaleX(var(--scl));
    }

    60% {
        transform: translate(-3px, 2px) rotate(var(--rot)) scaleX(var(--scl));
    }

    80% {
        transform: translate(3px, 0px) rotate(var(--rot)) scaleX(var(--scl));
    }
}

.flying {
    z-index: 1000 !important;
    pointer-events: none;
    /* Keep rotational transform and add transition for layout movement */
    transition: top 0.5s cubic-bezier(0.5, 0, 1, 0.5), left 0.5s cubic-bezier(0.5, 0, 1, 0.5);
}

.flying .bus-canvas {
    transform: scale(1.5);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--ui-bg);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
    text-align: center;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* Start page bus image entrance animation */
#start-bus-img {
    width: 200px;
    height: auto;
    animation: busEntrance 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    margin-bottom: 6px;
    filter: drop-shadow(0 8px 28px rgba(56, 189, 248, 0.35));
}

@keyframes busEntrance {
    0% {
        transform: scale(4.5);
        opacity: 0;
    }
    35% {
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

h1 {
    margin: 0;
    font-size: 2rem;
    text-transform: uppercase;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

p {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 16px;
    color: #475569;
}

button {
    background: #0a0a0a;
    color: #fff;
    border: 1px solid #1e293b;
    padding: 11px 26px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    margin-top: 10px;
    transition: all 0.1s;
    letter-spacing: 1px;
}

button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

button:active {
    transform: scale(0.95);
}

button.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

button.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

button.leaderboard-btn {
    --border-angle: 0deg;
    background:
        linear-gradient(#0a0a0a, #0a0a0a) padding-box,
        conic-gradient(from var(--border-angle), #1e293b 60%, var(--accent) 80%, #1e293b 100%) border-box;
    border: 2px solid transparent;
    color: var(--accent);
    padding: 9px 20px;
    font-size: 0.85rem;
    margin-top: 14px;
    animation: borderSpin 3s linear infinite;
    letter-spacing: 1px;
}

button.leaderboard-btn:hover {
    background:
        linear-gradient(#060f1e, #060f1e) padding-box,
        conic-gradient(from var(--border-angle), #1e293b 40%, var(--accent) 70%, #1e293b 100%) border-box;
    animation: borderSpin 1.2s linear infinite;
}

input[type="text"] {
    padding: 11px;
    font-size: 1.1rem;
    font-family: inherit;
    border: 1px solid #1e293b;
    background: #0a0a0a;
    color: white;
    border-radius: 8px;
    text-align: center;
    width: 100%;
    outline: none;
    margin-bottom: 6px;
}

input[type="text"]:focus {
    border-color: var(--accent);
}

/* Animated border using @property conic-gradient trick */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes borderSpin {
    to { --border-angle: 360deg; }
}

/* Level select cards */
#level-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin-top: 14px;
}

.level-card {
    --border-angle: 0deg;
    background:
        linear-gradient(#0a0a0a, #0a0a0a) padding-box,
        conic-gradient(from var(--border-angle), #1e293b 60%, var(--accent) 80%, #1e293b 100%) border-box;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 16px 10px;
    cursor: pointer;
    transition: transform 0.1s;
    text-align: center;
    animation: borderSpin 3s linear infinite;
}

.level-card:hover {
    background:
        linear-gradient(#060f1e, #060f1e) padding-box,
        conic-gradient(from var(--border-angle), #1e293b 40%, var(--accent) 70%, #1e293b 100%) border-box;
    transform: scale(1.03);
    animation: borderSpin 1.2s linear infinite;
}

.level-card:active {
    transform: scale(0.97);
}

.lc-name {
    font-size: 1.15rem;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.lc-buses {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.lc-bus-img {
    width: 20%;
    height: auto;
    display: block;
}

/* Result modal stats */

/* Shareable card */
#result-card {
    width: 100%;
    max-width: 360px;
    background: linear-gradient(135deg, #0a0a14 0%, #0c1428 100%);
    border-radius: 20px;
    overflow: hidden;
    margin: 0 0 10px;
    position: relative;
}

#result-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(56,189,248,0.5), rgba(56,189,248,0.1) 50%, rgba(56,189,248,0.4));
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

#result-card.result-lose::before {
    background: linear-gradient(135deg, rgba(239,68,68,0.5), rgba(239,68,68,0.1) 50%, rgba(239,68,68,0.4));
}

#result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: rgba(56,189,248,0.07);
    border-bottom: 1px solid rgba(56,189,248,0.12);
    font-size: 0.78rem;
    letter-spacing: 1px;
}

#result-card.result-lose #result-card-header {
    background: rgba(239,68,68,0.07);
    border-bottom-color: rgba(239,68,68,0.12);
}

#result-card-game {
    font-weight: bold;
    color: var(--accent);
}

#result-card.result-lose #result-card-game {
    color: var(--error-color);
}

#result-card-level {
    color: #475569;
    font-size: 0.72rem;
}

#result-title-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 20px 10px;
}

#result-icon {
    font-size: 1.8rem;
    line-height: 1;
}

#result-title {
    margin: 0;
    font-size: 1.55rem;
    text-shadow: 0 0 20px currentColor;
}

.result-stats {
    display: flex;
    align-items: center;
    padding: 12px 16px 14px;
    gap: 0;
}

.stat-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-divider {
    width: 1px;
    height: 60px;
    background: rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.68rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.7rem;
    font-weight: bold;
    color: var(--accent);
    line-height: 1;
}

.pct-ring-wrap {
    position: relative;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pct-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 68px;
    height: 68px;
    transform: rotate(-90deg);
}

.pct-bg {
    fill: none;
    stroke: #1e293b;
    stroke-width: 6;
}

.pct-arc {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 197.9;
    stroke-dashoffset: 197.9;
    transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.pct-label {
    position: relative;
    font-size: 0.95rem;
    font-weight: bold;
    color: #fff;
    z-index: 1;
}

/* Time row */
#result-time-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 14px 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(74,222,128,0.08);
    border: 1px solid rgba(74,222,128,0.2);
    font-size: 0.85rem;
}

#result-time-icon {
    font-size: 1rem;
}

#result-time-label {
    flex: 1;
    color: #64748b;
    letter-spacing: 0.5px;
}

#result-time-value {
    font-weight: bold;
    font-size: 1.05rem;
    color: #4ade80;
}

#result-time-row.result-time-timeout {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.2);
}

#result-time-row.result-time-timeout #result-time-value {
    color: var(--error-color);
}

#result-video {
    width: 100%;
    max-width: 320px;
    margin: 8px 0;
}

#result-video iframe {
    border-radius: 10px;
    width: 100%;
}

#result-name-row {
    width: 100%;
    max-width: 320px;
}

#result-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 280px;
    margin-top: 4px;
}

#result-buttons button {
    margin-top: 0;
    width: 100%;
}

button.share-btn {
    background: rgba(56,189,248,0.1);
    color: var(--accent);
    border: 1px solid rgba(56,189,248,0.35);
    letter-spacing: 1px;
}

button.share-btn:hover {
    background: rgba(56,189,248,0.2);
    border-color: var(--accent);
    color: #fff;
}

/* Leaderboard */
.leaderboard-container {
    width: 100%;
    max-width: 400px;
    background: #0a0a0a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 12px;
    margin-top: 12px;
    max-height: 50vh;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid #0d0d0d;
}

th {
    color: #334155;
    font-size: 0.85rem;
}

td.time-col {
    text-align: right;
    color: var(--accent);
    font-weight: bold;
}

tr.highlight {
    background: rgba(56, 189, 248, 0.08);
}

#lb-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 12px;
}

#lb-tabs button {
    font-size: 0.8rem;
    padding: 6px 14px;
    margin-top: 0;
}

#lb-tabs button.active {
    border-color: var(--accent);
    color: var(--accent);
}

/* Footer */
#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 24px 20px;
    text-align: center;
    z-index: 999;
    display: none;
}

#footer.visible {
    display: block;
}

#footer p {
    margin: 0;
    font-size: 1rem;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

#footer strong {
    color: var(--accent);
    font-weight: bold;
}

/* ─── COUNTDOWN OVERLAY ─────────────────────────────────────────── */
#countdown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    overflow: hidden;
}

#countdown-number {
    font-size: clamp(90px, 20vw, 240px);
    font-weight: 700;
    color: var(--accent);
    text-shadow:
        0 0 40px rgba(56, 189, 248, 0.9),
        0 0 90px rgba(56, 189, 248, 0.35);
    letter-spacing: -4px;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.count-pop {
    animation: countPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes countPop {
    0%   { transform: scale(2.2); opacity: 0; }
    100% { transform: scale(1);   opacity: 1; }
}

#countdown-number.go-text {
    color: #4ade80;
    font-size: clamp(55px, 13vw, 160px);
    letter-spacing: 0;
    text-shadow:
        0 0 40px rgba(74, 222, 128, 0.85),
        0 0 80px rgba(74, 222, 128, 0.3);
}

/* ─── COUNTDOWN INTRO (tap-to-start bus) ─────────────────────────── */
#countdown-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

#countdown-bus-wrap {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 6px 24px rgba(56, 189, 248, 0.4));
    transition: filter 0.2s;
}

#countdown-bus-wrap:hover {
    filter: drop-shadow(0 8px 32px rgba(56, 189, 248, 0.75));
}

#countdown-start-label {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    letter-spacing: 5px;
    text-transform: uppercase;
    animation: pulse 1.1s ease-in-out infinite;
}

.countdown-bus-tap {
    animation: cdBusTap 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cdBusTap {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.55); }
    100% { transform: scale(1.35); }
}

.countdown-bus-fly {
    animation: cdBusFly 0.85s cubic-bezier(0.4, 0, 1, 0.55) forwards;
}

@keyframes cdBusFly {
    0%   { transform: scale(1.35) translateX(0);      opacity: 1; }
    100% { transform: scale(1.35) translateX(130vw);  opacity: 0.15; }
}

.label-fade-out {
    animation: labelFadeOut 0.3s ease forwards;
}

@keyframes labelFadeOut {
    to { opacity: 0; transform: translateY(10px); }
}

/* ─── TIMER ENTRANCE (big → settles) ────────────────────────────── */
.timer-enter {
    animation: timerEnter 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes timerEnter {
    0%   { transform: scale(5);    opacity: 0; }
    55%  { transform: scale(1.18); opacity: 1; }
    100% { transform: scale(1); }
}

/* ─── TIMER CRITICAL POP (last 5 s) ─────────────────────────────── */
.timer-critical-pop {
    animation: timerCritical 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes timerCritical {
    0%   { transform: scale(1); }
    40%  { transform: scale(2.1); }
    100% { transform: scale(1); }
}

/* ─── SHAPED GRID CELLS ─────────────────────────────────────────── */

/* Cells outside the active shape — completely invisible and non-interactive */
.cell-inactive {
    background: transparent;
    pointer-events: none;
    /* ensure no hover/tap bleed from adjacent buses */
    z-index: 0;
}

/* Active but empty cells — faint dot to reveal the shape outline */
.cell-empty {
    background:
        radial-gradient(circle, rgba(255,255,255,0.055) 1.5px, transparent 1.5px)
        center / 5px 5px no-repeat;
}

/* ─── FREE-BUS GLOW (Easy mode only) ────────────────────────────── */
.bus-free .bus-canvas {
    filter: drop-shadow(0 0 5px rgba(74, 222, 128, 0.75));
    animation: freePulse 1.8s ease-in-out infinite;
}

@keyframes freePulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.5)); }
    50%       { filter: drop-shadow(0 0 11px rgba(74, 222, 128, 1.0)); }
}

/* ─── HINT BUS — glow + vibrate hint ──────────────────────────── */
.bus-hint {
    animation: hintVibrate 0.45s ease-in-out infinite;
}
.bus-hint .bus-canvas {
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.9));
    animation: hintGlow 1.2s ease-in-out infinite;
}

@keyframes hintGlow {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.6)); }
    50%       { filter: drop-shadow(0 0 18px rgba(251, 191, 36, 1.0)); }
}

@keyframes hintVibrate {
    0%, 100% { transform: translate(0,  0)   rotate(var(--rot)) scaleX(var(--scl)) scale(1.08); }
    25%       { transform: translate(-2px, 0) rotate(var(--rot)) scaleX(var(--scl)) scale(1.08); }
    75%       { transform: translate( 2px, 0) rotate(var(--rot)) scaleX(var(--scl)) scale(1.08); }
}

/* ─── ROTATE-REVEAL — announce a forced bus rotation ──────────── */
.bus-rotate-reveal {
    animation: rotateReveal 1.0s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes rotateReveal {
    0%   { transform: rotate(var(--rot)) scaleX(var(--scl)) scale(1);   }
    25%  { transform: rotate(var(--rot)) scaleX(var(--scl)) scale(1.65); }
    60%  { transform: rotate(var(--rot)) scaleX(var(--scl)) scale(1.65); }
    100% { transform: rotate(var(--rot)) scaleX(var(--scl)) scale(1);   }
}

/* ─── TIMER FREEZE / RESUME ────────────────────────────────────── */
#timer.timer-frozen {
    font-weight: 900;
    animation: timerFreeze 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes timerFreeze {
    0%   { transform: scale(1);     color: inherit;   filter: none; }
    40%  { transform: scale(1.45);  color: #fbbf24;   filter: drop-shadow(0 0 8px rgba(251,191,36,0.9)); }
    100% { transform: scale(1.2);   color: #fbbf24;   filter: drop-shadow(0 0 5px rgba(251,191,36,0.6)); }
}

#timer.timer-frozen-hold {
    transform: scale(1.2);
    color: #fbbf24;
    font-weight: 900;
    filter: drop-shadow(0 0 5px rgba(251,191,36,0.6));
    animation: frozenPulse 0.9s ease-in-out infinite;
}

@keyframes frozenPulse {
    0%, 100% { opacity: 1;    filter: drop-shadow(0 0 5px rgba(251,191,36,0.6)); }
    50%       { opacity: 0.6; filter: drop-shadow(0 0 12px rgba(251,191,36,1.0)); }
}

#timer.timer-resume {
    animation: timerResume 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes timerResume {
    0%   { transform: scale(1.2); color: #fbbf24; filter: drop-shadow(0 0 5px rgba(251,191,36,0.6)); }
    50%  { transform: scale(1.5); color: #4ade80; filter: drop-shadow(0 0 14px rgba(74,222,128,0.9)); }
    100% { transform: scale(1);   color: inherit; filter: none; }
}

/* ─── NO-ESCAPE OVERLAY ────────────────────────────────────────── */
#no-escape-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 18, 0.72);
    backdrop-filter: blur(4px);
    z-index: 4000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

#no-escape-overlay.noe-enter {
    opacity: 1;
}

#no-escape-overlay.noe-exit {
    opacity: 0;
    transition: opacity 0.4s ease;
}

#no-escape-overlay.hidden {
    display: none;
}

#no-escape-card {
    background: rgba(15, 8, 35, 0.92);
    border: 1.5px solid rgba(251, 191, 36, 0.65);
    border-radius: 20px;
    padding: 28px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.25), inset 0 0 30px rgba(251,191,36,0.04);
    transform: translateY(0);
    animation: cardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cardPop {
    0%   { transform: translateY(30px) scale(0.85); opacity: 0; }
    100% { transform: translateY(0)    scale(1);    opacity: 1; }
}

#no-escape-icon {
    font-size: 2.4rem;
    animation: busIconBounce 0.8s ease-in-out infinite alternate;
}

@keyframes busIconBounce {
    from { transform: translateY(0); }
    to   { transform: translateY(-6px); }
}

#no-escape-title {
    font-family: 'Courier New', monospace;
    font-size: 1.15rem;
    font-weight: 900;
    color: #fbbf24;
    letter-spacing: 0.06em;
    text-shadow: 0 0 14px rgba(251,191,36,0.7);
}

#no-escape-sub {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #94a3b8;
    letter-spacing: 0.04em;
}

.dot-anim {
    display: inline-block;
    animation: dotFade 1.2s steps(4, end) infinite;
    width: 1.6em;
    overflow: hidden;
}

@keyframes dotFade {
    0%   { width: 0.4em; }
    33%  { width: 0.8em; }
    66%  { width: 1.2em; }
    100% { width: 1.6em; }
}

