/* ============================================================
   LORCANA MARKET — Ink Rush ⚡ Speed Match Mini-Game
   ============================================================ */

/* ── Modal Overlay (reuses game-modal pattern) ────────── */
.rush-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 8, 14, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.rush-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ── Modal Container ──────────────────────────────────── */
.rush-modal {
    position: relative;
    width: 92%;
    max-width: 460px;
    max-height: 92vh;
    background: linear-gradient(
        160deg,
        rgba(22, 27, 34, 0.97) 0%,
        rgba(13, 17, 23, 0.99) 100%
    );
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: 20px;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: none;
    touch-action: none;
    transform: translateY(30px) scale(0.92);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(251, 191, 36, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.rush-modal-overlay.active .rush-modal {
    transform: translateY(0) scale(1);
}

/* ── Header ────────────────────────────────────────────── */
.rush-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.rush-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rush-title-icon {
    -webkit-text-fill-color: initial;
    font-size: 1rem;
}

.rush-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary, #8b949e);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.rush-close:hover {
    background: rgba(255, 80, 80, 0.15);
    border-color: rgba(255, 80, 80, 0.3);
    color: #ff6b6b;
}

/* ── Stats Row ─────────────────────────────────────────── */
.rush-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.rush-stat {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    background: rgba(251, 191, 36, 0.04);
    border: 1px solid rgba(251, 191, 36, 0.08);
    border-radius: 10px;
}

.rush-stat-label {
    display: block;
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #6e7681);
    margin-bottom: 2px;
}

.rush-stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #fbbf24;
    font-variant-numeric: tabular-nums;
}

.rush-stat-best .rush-stat-value {
    color: var(--ice-blue, #a5d8ff);
}

/* Combo badge */
.rush-combo {
    position: absolute;
    top: 70px;
    right: 24px;
    font-size: 0.9rem;
    font-weight: 800;
    color: #fbbf24;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
}

.rush-combo.active {
    opacity: 1;
    transform: scale(1);
}

/* ── Timer Bar ─────────────────────────────────────────── */
.rush-timer {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    margin-bottom: 18px;
    overflow: hidden;
}

.rush-timer-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #34d399, #a5d8ff);
    border-radius: 3px;
    transition: width 0.05s linear;
}

/* ── Card Display Area ─────────────────────────────────── */
.rush-game-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    min-height: 280px;
    position: relative;
}

/* Previous card (small) */
.rush-prev-slot {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.rush-prev-label {
    font-size: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #6e7681);
}

.rush-prev-mini {
    width: 72px;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    position: relative;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.rush-prev-mini[data-ink="amber"]    { border-color: rgba(251, 191, 36, 0.3); }
.rush-prev-mini[data-ink="amethyst"] { border-color: rgba(155, 93, 229, 0.3); }
.rush-prev-mini[data-ink="emerald"]  { border-color: rgba(45, 158, 79, 0.3); }
.rush-prev-mini[data-ink="ruby"]     { border-color: rgba(230, 57, 70, 0.3); }
.rush-prev-mini[data-ink="sapphire"] { border-color: rgba(0, 150, 199, 0.3); }
.rush-prev-mini[data-ink="steel"]    { border-color: rgba(139, 158, 176, 0.3); }

.rush-prev-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

.rush-prev-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.4rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    padding: 3px 2px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    text-transform: uppercase;
}

.rush-prev-placeholder {
    width: 72px;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    border: 1.5px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6e7681);
    font-size: 1.2rem;
}

/* Arrow between cards */
.rush-arrow {
    font-size: 1.2rem;
    color: rgba(251, 191, 36, 0.4);
    flex-shrink: 0;
}

/* Current card (large) */
.rush-card-slot {
    flex: 1;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.rush-current-label {
    font-size: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #6e7681);
}

.rush-card {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(251, 191, 36, 0.2);
    position: relative;
    background: linear-gradient(160deg, rgba(30, 40, 55, 0.97), rgba(22, 27, 34, 0.99));
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: default;
}

/* Ink color accents */
.rush-card[data-ink="amber"]    { border-color: rgba(251, 191, 36, 0.35); }
.rush-card[data-ink="amethyst"] { border-color: rgba(155, 93, 229, 0.35); }
.rush-card[data-ink="emerald"]  { border-color: rgba(45, 158, 79, 0.35); }
.rush-card[data-ink="ruby"]     { border-color: rgba(230, 57, 70, 0.35); }
.rush-card[data-ink="sapphire"] { border-color: rgba(0, 150, 199, 0.35); }
.rush-card[data-ink="steel"]    { border-color: rgba(139, 158, 176, 0.35); }

.rush-card-enter {
    transform: scale(0.7) translateY(20px);
    opacity: 0;
}

.rush-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    pointer-events: none;
    user-select: none;
}

.rush-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 6px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8) 30%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.rush-card-name {
    font-size: 0.65rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.rush-card-ink {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Answer feedback */
.rush-card.rush-correct {
    border-color: #34d399 !important;
    box-shadow: 0 0 24px rgba(52, 211, 153, 0.3);
    transform: scale(1.04);
}

.rush-card.rush-wrong {
    border-color: #ef4444 !important;
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.3);
    animation: rushShake 0.5s ease-in-out;
}

/* ── Ink Label (shows ink comparison) ──────────────────── */
.rush-ink-label {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary, #8b949e);
    margin-bottom: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    min-height: 1.2em;
}

/* ── Action Buttons ────────────────────────────────────── */
.rush-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.rush-btn {
    flex: 1;
    padding: 14px 8px;
    font-size: 0.9rem;
    font-weight: 800;
    border-radius: 14px;
    cursor: pointer;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 2px solid;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.rush-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), transparent);
    pointer-events: none;
}

.rush-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
}

/* MATCH button — green */
.rush-btn-match {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.3);
    color: #34d399;
}

.rush-btn-match:hover:not(:disabled) {
    background: rgba(52, 211, 153, 0.2);
    border-color: rgba(52, 211, 153, 0.5);
    transform: scale(1.04);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.15);
}

.rush-btn-match:active:not(:disabled) {
    transform: scale(0.96);
}

/* PASS button — red/coral */
.rush-btn-pass {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.rush-btn-pass:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.04);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.rush-btn-pass:active:not(:disabled) {
    transform: scale(0.96);
}

/* Keyboard hint */
.rush-key-hint {
    font-size: 0.45rem;
    font-weight: 600;
    opacity: 0.5;
    display: block;
    margin-top: 2px;
    letter-spacing: 0.04em;
}

/* ── How to Play hint ──────────────────────────────────── */
.rush-howto {
    text-align: center;
    font-size: 0.6rem;
    color: var(--text-muted, #6e7681);
    margin-top: 6px;
    letter-spacing: 0.02em;
}

/* ── Game Over Overlay ─────────────────────────────────── */
.rush-game-over {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: rgba(5, 8, 14, 0.90);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s;
    z-index: 10;
}

.rush-game-over.active {
    opacity: 1;
    visibility: visible;
}

.rush-over-content {
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rush-game-over.active .rush-over-content {
    transform: scale(1);
}

.rush-over-icon {
    font-size: 2.4rem;
    margin-bottom: 8px;
    animation: rushOverPulse 1.5s ease-in-out infinite alternate;
}

.rush-over-reason {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f87171;
    margin-bottom: 4px;
}

.rush-over-content h3 {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 6px;
}

.rush-over-content p {
    color: var(--text-secondary, #8b949e);
    font-size: 0.85rem;
    margin: 0 0 16px;
}

.rush-over-score {
    font-size: 2rem;
    font-weight: 800;
    color: #fbbf24;
    margin: 4px 0 12px;
    font-variant-numeric: tabular-nums;
}

.rush-btn-again {
    padding: 10px 28px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(124, 58, 237, 0.1));
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fbbf24;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rush-btn-again:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(124, 58, 237, 0.15));
    border-color: rgba(251, 191, 36, 0.4);
    box-shadow: 0 0 24px rgba(251, 191, 36, 0.15);
    transform: scale(1.05);
}

/* ── Diamond Reward ────────────────────────────────────── */
.rush-diamond-reward {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fbbf24;
    margin-top: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rush-diamond-reward.show {
    opacity: 1;
    transform: translateY(0);
}

.rush-diamond-reward .diamond-icon {
    margin-right: 4px;
}

/* ── Sparkle ───────────────────────────────────────────── */
.rush-sparkle {
    position: fixed;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    pointer-events: none;
    animation: rushSparkleOut 0.6s ease-out forwards;
    z-index: 200000;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes rushShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

@keyframes rushSparkleOut {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0); }
}

@keyframes rushOverPulse {
    from { filter: brightness(1); transform: scale(1); }
    to   { filter: brightness(1.3); transform: scale(1.1); }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
    .rush-modal {
        padding: 16px;
        border-radius: 16px;
    }
    .rush-title {
        font-size: 1rem;
    }
    .rush-game-area {
        gap: 10px;
        min-height: 220px;
    }
    .rush-prev-slot {
        width: 64px;
    }
    .rush-prev-mini {
        width: 58px;
    }
    .rush-card-slot {
        max-width: 160px;
    }
    .rush-btn {
        padding: 12px 6px;
        font-size: 0.8rem;
    }
    .rush-stats {
        gap: 4px;
    }
    .rush-stat {
        padding: 6px 3px;
    }
}

/* ── Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .rush-card-enter {
        transform: none;
        opacity: 1;
    }
    .rush-sparkle { display: none; }
}
