/* ================================================================
   CHESS PUZZLE SYSTEM - STYLES
   Premium styling for the puzzle section
   ================================================================ */

/* ================================================================
   CHESSGROUND INTEGRATION
   ================================================================ */

/* Import Chessground CSS */
@import url('https://unpkg.com/chessground@9.1.1/assets/chessground.base.css');
@import url('https://unpkg.com/chessground@9.1.1/assets/chessground.brown.css');
@import url('https://unpkg.com/chessground@9.1.1/assets/chessground.cburnett.css');

/* Permet le scroll sur la page puzzles */
body:has(#section-puzzles.active) {
    overflow: auto !important;
    position: relative;
}

.puzzle-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .puzzle-container {
        grid-template-columns: 1fr 380px;
        gap: 3rem;
        padding: 0 2rem 3rem 2rem;
    }
}

/* Difficulty Change Button (top-left corner) */
.puzzle-difficulty-btn {
    position: fixed;
    top: 5rem;
    left: 1.5rem;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(168, 85, 247, 0.1) 100%);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 10px;
    color: #c084fc;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: 'Oswald', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.puzzle-difficulty-btn:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3) 0%, rgba(168, 85, 247, 0.2) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.puzzle-difficulty-btn i {
    font-size: 0.9rem;
}

/* ================================================================
   PUZZLE BOARD AREA
   ================================================================ */

.puzzle-board-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.puzzle-board-area>div:first-child {
    margin-top: 0;
    padding-top: 0;
}

.puzzle-board-area h1 {
    margin-top: 0;
    padding-top: 0;
}

.puzzle-board-wrapper {
    position: relative;
    width: 100%;
    max-width: 504px;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.4),
        0 0 0 4px rgba(168, 85, 247, 0.3),
        inset 0 0 80px rgba(168, 85, 247, 0.05);
    background: #312e2b;
}

/* Chessground container */
.puzzle-board-wrapper cg-board {
    background-color: #dee3e6 !important;
    /* Light grey base */
    /* Override the default brown theme with a high-contrast light theme (ice blue) */
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4IDgiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyI+CjxnIGlkPSJhIj4KICA8ZyBpZD0iYiI+CiAgICA8ZyBpZD0iYyI+CiAgICAgIDxnIGlkPSJkIj4KICAgICAgICA8cmVjdCB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSIjZmZmZmZmIi8+CiAgICAgICAgPHJlY3QgeD0iMSIgeT0iMSIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0iI2ZmZmZmZiIvPgogICAgICAgIDxyZWN0IHk9IjEiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IiM3NzlhYjciLz4KICAgICAgICA8cmVjdCB4PSIxIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSIjNzc5YWI3Ii8+CiAgICAgIDwvZz4KICAgICAgPHVzZSB4PSIyIiBocmVmPSIjZCIvPgogICAgPC9nPgogICAgPHVzZSB4PSI0IiBocmVmPSIjYyIvPgogIDwvZz4KICA8dXNlIHk9IjIiIGhyZWY9IiNiIi8+CjwvZz4KPHVzZSB5PSI0IiBocmVmPSIjYSIvPgo8L3N2Zz4=') !important;
}

/* Custom board colors */
.puzzle-board-wrapper .cg-wrap {
    width: 100%;
    height: 100%;
}

/* Light squares - fallback for browsers that don't use SVG */
.puzzle-board-wrapper cg-board square.white {
    background: #ffffff !important;
}

/* Dark squares - fallback for browsers that don't use SVG */
.puzzle-board-wrapper cg-board square.black {
    background: #779ab7 !important;
}

/* Selected square */
.puzzle-board-wrapper cg-board square.selected {
    background: rgba(168, 85, 247, 0.5) !important;
}

/* Last move highlight */
.puzzle-board-wrapper cg-board square.last-move {
    background: rgba(168, 85, 247, 0.4) !important;
}

/* Move destination */
.puzzle-board-wrapper cg-board square.move-dest {
    background: radial-gradient(circle, rgba(168, 85, 247, 0.6) 20%, transparent 21%);
}

/* Premove */
.puzzle-board-wrapper cg-board square.premove-dest {
    background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 20%, transparent 21%);
}

/* Correct move animation */
.puzzle-board-wrapper.correct {
    animation: correctPulse 0.6s ease-out;
}

@keyframes correctPulse {
    0% {
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(34, 197, 94, 0.8);
    }

    50% {
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 40px rgba(34, 197, 94, 0.6);
    }

    100% {
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(168, 85, 247, 0.3);
    }
}

/* Incorrect move animation */
.puzzle-board-wrapper.incorrect {
    animation: incorrectShake 0.5s ease-out;
}

@keyframes incorrectShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-8px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(8px);
    }
}

/* Side to move indicator */
.puzzle-side-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Animation for attention */
.puzzle-side-indicator.pulse {
    animation: sideIndicatorPulse 1.5s ease-in-out;
}

@keyframes sideIndicatorPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    25% {
        transform: scale(1.05);
        box-shadow: 0 0 15px 5px rgba(239, 68, 68, 0.5);
    }

    50% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
    }

    75% {
        transform: scale(1.05);
        box-shadow: 0 0 15px 5px rgba(239, 68, 68, 0.5);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.puzzle-side-indicator .side-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.3);
    flex-shrink: 0;
}

.puzzle-side-indicator .side-dot.white {
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
}

.puzzle-side-indicator .side-dot.black {
    background: linear-gradient(135deg, #3a3a3a 0%, #1a1a1a 100%);
}

/* ================================================================
   PUZZLE CONTROLS
   ================================================================ */

.puzzle-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.puzzle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: 'Oswald', sans-serif;
}

.puzzle-btn-hint {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.1) 100%);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.puzzle-btn-hint:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.3) 0%, rgba(251, 191, 36, 0.2) 100%);
    transform: translateY(-2px);
}

.puzzle-btn-hint:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.puzzle-btn-skip {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.puzzle-btn-skip:hover {
    background: rgba(148, 163, 184, 0.3);
    transform: translateY(-2px);
}

.puzzle-btn-restart {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.puzzle-btn-restart:hover {
    background: rgba(148, 163, 184, 0.3);
    transform: translateY(-2px);
}

.hint-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    font-size: 0.75rem;
}

/* ================================================================
   PUZZLE SIDEBAR
   ================================================================ */

.puzzle-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Score card */
.puzzle-score-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.puzzle-score-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #a855f7, #fbbf24, #22c55e);
}

.puzzle-score-card h3 {
    font-size: 1rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    margin-top: 0;
    font-weight: 500;
}

.puzzle-score-main {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    margin-bottom: 1rem;
}

.puzzle-score-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.puzzle-stat {
    text-align: center;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.puzzle-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.puzzle-stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Streak display */
.puzzle-streak {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.1) 100%);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 10px;
    color: #fbbf24;
    font-weight: 600;
}

.puzzle-streak.inactive {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
    color: #64748b;
}

/* ================================================================
   PUZZLE INFO CARD
   ================================================================ */

.puzzle-info-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
}

.puzzle-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.puzzle-info-row:last-child {
    border-bottom: none;
}

.puzzle-info-label {
    color: #94a3b8;
    font-size: 0.875rem;
}

.puzzle-info-value {
    font-weight: 600;
    color: white;
}

.puzzle-rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3) 0%, rgba(168, 85, 247, 0.2) 100%);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #c084fc;
}

/* Themes */
.puzzle-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.puzzle-theme-tag {
    padding: 0.25rem 0.6rem;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 6px;
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: capitalize;
}

/* ================================================================
   LEVEL SELECTOR MODAL
   ================================================================ */

.puzzle-level-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.puzzle-level-modal.active {
    display: flex;
}

.puzzle-level-content {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.puzzle-level-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 50%;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.puzzle-level-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    transform: rotate(90deg);
}

.puzzle-level-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #a855f7, #fbbf24);
}

.puzzle-level-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.puzzle-level-content p {
    color: #94a3b8;
    margin-bottom: 2rem;
}

.puzzle-level-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.puzzle-level-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.puzzle-level-btn:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateX(4px);
}

.puzzle-level-btn .level-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
}

.puzzle-level-btn .level-rating {
    font-size: 0.875rem;
    color: #94a3b8;
}

.puzzle-level-btn .level-icon {
    font-size: 1.5rem;
}

/* ================================================================
   STATS PANEL
   ================================================================ */

.puzzle-stats-panel {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 0.875rem 1.25rem;
}

.puzzle-stats-panel h4 {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stats-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
}

.stats-item-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.stats-item-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
}

/* ================================================================
   BADGES SECTION
   ================================================================ */

.puzzle-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.puzzle-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    color: #c084fc;
}

.puzzle-badge.locked {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
    color: #475569;
}

/* New badge notification */
.badge-notification {
    position: fixed;
    top: 120px;
    right: 20px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.95) 0%, rgba(124, 58, 237, 0.95) 100%);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 2000;
    animation: slideInRight 0.5s ease, fadeOut 0.5s ease 3s forwards;
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.4);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.badge-notification-icon {
    font-size: 1.5rem;
}

.badge-notification-text {
    font-weight: 600;
    color: white;
}

/* ================================================================
   FEEDBACK OVERLAY
   ================================================================ */

.puzzle-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1500;
    pointer-events: none;
}

.puzzle-feedback-icon {
    font-size: 5rem;
    animation: feedbackPop 0.6s ease-out forwards;
}

.puzzle-feedback-icon.correct {
    color: #22c55e;
}

.puzzle-feedback-icon.incorrect {
    color: #ef4444;
}

@keyframes feedbackPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

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

/* ================================================================
   LOADING STATE
   ================================================================ */

.puzzle-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1rem;
}

.puzzle-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(168, 85, 247, 0.2);
    border-top-color: #a855f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.puzzle-loading-text {
    color: #94a3b8;
    font-size: 1rem;
}

/* ================================================================
   MOBILE RESPONSIVE
   ================================================================ */

/* Full-height layout for puzzle section */
#section-puzzles.active {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

#section-puzzles .puzzle-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

@media (min-width: 1024px) {
    #section-puzzles .puzzle-container {
        display: grid;
        grid-template-columns: 1fr 340px;
        align-items: start;
    }
}

/* Small laptops and tablets (height < 800px) */
@media (max-height: 800px) {
    .puzzle-board-wrapper {
        max-width: min(420px, 45vh);
    }

    .puzzle-board-area {
        gap: 0.75rem;
    }

    .puzzle-board-area h1 {
        font-size: 1.5rem !important;
    }

    .puzzle-board-area p {
        font-size: 0.85rem;
    }

    .puzzle-controls {
        gap: 0.5rem;
    }

    .puzzle-btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
    }

    .puzzle-sidebar {
        gap: 0.6rem;
    }

    .puzzle-score-card {
        padding: 0.75rem 1rem;
    }

    .puzzle-score-main {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .puzzle-score-stats {
        gap: 0.5rem;
    }

    .puzzle-stat {
        padding: 0.5rem;
    }

    .puzzle-stat-value {
        font-size: 1.1rem;
    }

    .puzzle-info-card,
    .puzzle-stats-panel {
        padding: 0.75rem 1rem;
    }

    .stats-grid {
        gap: 0.5rem;
    }

    .puzzle-badges {
        margin-top: 0.5rem;
    }
}

/* Very small screens (height < 700px) */
@media (max-height: 700px) {
    .puzzle-board-wrapper {
        max-width: min(360px, 40vh);
    }

    .puzzle-board-area h1 {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem !important;
    }

    .puzzle-side-indicator {
        padding: 0.35rem 0.75rem;
        font-size: 0.75rem;
        gap: 0.5rem;
    }

    .puzzle-side-indicator .side-dot {
        width: 10px;
        height: 10px;
    }

    .puzzle-controls {
        gap: 0.35rem;
    }

    .puzzle-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }

    .hint-counter {
        width: 16px;
        height: 16px;
        font-size: 0.65rem;
    }

    .puzzle-difficulty-btn {
        top: 4.5rem;
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    .puzzle-score-main {
        font-size: 1.75rem;
    }

    .puzzle-stat-value {
        font-size: 1rem;
    }

    .puzzle-stat-label,
    .stats-item-label {
        font-size: 0.65rem;
    }

    .puzzle-info-row {
        padding: 0.35rem 0;
    }

    .puzzle-stats-panel h4 {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
}

/* Extra small screens (height < 600px) */
@media (max-height: 600px) {
    .puzzle-board-wrapper {
        max-width: min(300px, 35vh);
    }

    .puzzle-board-area h1 {
        font-size: 1.1rem !important;
    }

    .puzzle-score-card h3 {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }

    .puzzle-score-main {
        font-size: 1.5rem;
        margin-bottom: 0.35rem;
    }

    .puzzle-streak {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .puzzle-info-card,
    .puzzle-stats-panel {
        padding: 0.5rem 0.75rem;
    }

    .stats-item {
        padding: 0.5rem;
    }

    .stats-item-value {
        font-size: 1rem;
    }
}

/* Mobile width responsive */
@media (max-width: 768px) {
    .puzzle-container {
        padding: 0.5rem !important;
        gap: 1rem;
    }

    .puzzle-board-wrapper {
        max-width: min(100%, 85vw, 50vh);
    }

    .puzzle-controls {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        justify-content: flex-start;
    }

    .puzzle-btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .puzzle-score-main {
        font-size: 2rem;
    }

    .puzzle-level-content {
        padding: 1.25rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .puzzle-level-options {
        gap: 0.5rem;
    }

    .puzzle-level-btn {
        padding: 0.75rem 1rem;
    }

    .puzzle-difficulty-btn {
        top: 4.5rem;
        left: 1rem;
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
    }

    .puzzle-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .puzzle-score-card,
    .puzzle-info-card,
    .puzzle-stats-panel {
        flex: 1;
        min-width: 150px;
    }
}

/* ================================================================
   LIGHT MODE SUPPORT
   ================================================================ */

body.light-mode .puzzle-score-card,
body.light-mode .puzzle-info-card,
body.light-mode .puzzle-stats-panel {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 71, 171, 0.2);
}

body.light-mode .puzzle-score-card h3,
body.light-mode .puzzle-info-label,
body.light-mode .puzzle-stats-panel h4 {
    color: #64748b;
}

body.light-mode .puzzle-stat,
body.light-mode .stats-item {
    background: rgba(0, 71, 171, 0.08);
}

body.light-mode .puzzle-stat-value,
body.light-mode .stats-item-value,
body.light-mode .puzzle-info-value {
    color: #1e293b;
}

body.light-mode .puzzle-level-content {
    background: white;
}

body.light-mode .puzzle-level-btn {
    background: rgba(0, 71, 171, 0.05);
    border-color: rgba(0, 71, 171, 0.2);
}

body.light-mode .puzzle-level-btn .level-name {
    color: #1e293b;
}

body.light-mode .puzzle-side-indicator {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 71, 171, 0.2);
    color: #1e293b;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1500;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}