/* ========================================
   Match 3 Game - Premium UI
   ======================================== */

.match3-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    max-width: 100%;
    background: linear-gradient(180deg, rgba(15, 15, 26, 0.8) 0%, rgba(15, 15, 26, 0.4) 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.match3-header {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.match3-score-box,
.match3-moves-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 14px 28px;
    min-width: 110px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.15);
    backdrop-filter: blur(10px);
}

.match3-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.match3-score-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(6, 182, 212, 0.3);
}

.match3-moves-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.match3-board-wrapper {
    position: relative;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
    border-radius: 20px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.match3-canvas-container {
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.match3-canvas-container canvas {
    display: block;
}

.match3-game-over {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(15, 15, 35, 0.95) 100%);
    border-radius: 20px;
    padding: 32px;
    animation: fadeInScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.match3-game-over h3 {
    font-family: var(--font-display);
    font-size: 36px;
    margin-bottom: 16px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.match3-game-over .final-score {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.match3-game-over .pax-summary {
    font-size: 20px;
    color: #4ade80;
    margin-bottom: 24px;
    font-weight: 600;
}

.match3-hint {
    margin-top: 18px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    text-align: center;
    letter-spacing: 0.3px;
}

/* Match 3 Ready Screen */
.match3-ready-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
    border-radius: 20px;
    padding: 48px 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.ready-content {
    text-align: center;
}

.ready-title {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #fff;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
}

.ready-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 24px;
}

.ready-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.ready-rules span {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-lg {
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 700;
}

/* Word Search Ready Screen */
.ws-ready-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
    border-radius: 20px;
    padding: 48px 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ========================================
   Word Search Game - Premium UI
   ======================================== */

.ws-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    max-width: 100%;
    background: linear-gradient(180deg, rgba(15, 15, 26, 0.8) 0%, rgba(15, 15, 26, 0.4) 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ws-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 420px;
    margin-bottom: 18px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.ws-theme {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ws-theme-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.ws-theme-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ws-progress {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ws-words {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 420px;
    margin-bottom: 18px;
}

.ws-word {
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1.2px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.ws-word.found {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.2) 0%, rgba(34, 197, 94, 0.15) 100%);
    border-color: rgba(74, 222, 128, 0.5);
    color: #4ade80;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    transform: scale(0.95);
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.2);
}

.ws-board-wrapper {
    position: relative;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
    border-radius: 20px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ws-canvas-container {
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ws-canvas-container canvas {
    display: block;
}

.ws-complete {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(15, 15, 35, 0.95) 100%);
    border-radius: 20px;
    padding: 32px;
    animation: fadeInScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    z-index: 20;
    transition: opacity 0.3s ease;
}

.ws-complete h3 {
    font-family: var(--font-display);
    font-size: 36px;
    margin-bottom: 16px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.ws-time {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.ws-pax {
    font-size: 24px;
    font-weight: 700;
    color: #4ade80;
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

.ws-hint {
    margin-top: 18px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    text-align: center;
    letter-spacing: 0.3px;
    line-height: 1.5;
}

.ws-hint strong {
    color: #4ade80;
    font-weight: 700;
}

/* ========================================
   Shared Animations
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 480px) {

    .match3-container,
    .ws-container {
        padding: 16px;
        border-radius: 20px;
    }

    .match3-header {
        gap: 12px;
    }

    .match3-score-box,
    .match3-moves-box {
        padding: 10px 18px;
        min-width: 85px;
        border-radius: 12px;
    }

    .match3-score-value,
    .match3-moves-value {
        font-size: 26px;
    }

    .match3-label {
        font-size: 10px;
    }

    .ws-header {
        padding: 10px 16px;
        margin-bottom: 14px;
    }

    .ws-theme-name {
        font-size: 16px;
    }

    .ws-progress {
        font-size: 18px;
    }

    .ws-word {
        padding: 6px 10px;
        font-size: 11px;
    }

    .ws-words {
        gap: 8px;
        margin-bottom: 14px;
    }

    .match3-board-wrapper,
    .ws-board-wrapper {
        padding: 8px;
        border-radius: 16px;
        transform: scale(0.95);
        transform-origin: center top;
        margin-bottom: -15px;
        /* Offset scale pull */
    }

    .match3-canvas-container canvas,
    .ws-canvas-container canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    .match3-hint,
    .ws-hint {
        font-size: 12px;
        margin-top: 14px;
    }
}

@media (max-width: 380px) {

    .match3-board-wrapper,
    .ws-board-wrapper {
        transform: scale(0.85);
        margin-bottom: -40px;
    }
}

/* ========================================
   Premium Button Styling
   ======================================== */

.match3-game-over .btn,
.ws-complete .btn {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.match3-game-over .btn:hover,
.ws-complete .btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.match3-game-over .btn:active,
.ws-complete .btn:active {
    transform: translateY(0) scale(0.98);
}