/* Solitaire Game Styles - losmochOS Theme */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #000;
    color: #0f0;
    overflow: hidden;
    user-select: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #001100 0%, #000800 50%, #000000 100%);
    position: relative;
}

/* Header del juego */
#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 255, 0, 0.1);
    border-bottom: 2px solid rgba(0, 255, 0, 0.3);
    box-shadow: 0 2px 10px rgba(0, 255, 0, 0.2);
}

#game-info {
    display: flex;
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
}

.info-label {
    font-weight: bold;
    margin-bottom: 2px;
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.7);
}

#time-display, #moves-display, #score-display {
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
    color: #00ff00;
}

#game-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.game-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.2) 0%, rgba(0, 255, 0, 0.1) 100%);
    border: 2px solid rgba(0, 255, 0, 0.5);
    border-radius: 6px;
    color: #0f0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.7);
}

.game-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.3) 0%, rgba(0, 255, 0, 0.2) 100%);
    border-color: rgba(0, 255, 0, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.4);
    transform: translateY(-1px);
}

.game-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.4);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Draw Mode Controls */
.draw-mode-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 2px solid rgba(0, 255, 0, 0.3);
}

.draw-mode-label {
    color: #0f0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.7);
}

.draw-mode-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.1) 0%, rgba(0, 255, 0, 0.05) 100%);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 4px;
    color: #0f0;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.5);
}

.draw-mode-btn:hover {
    border-color: rgba(0, 255, 0, 0.6);
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

.draw-mode-btn.active {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.3) 0%, rgba(0, 255, 0, 0.2) 100%);
    border-color: rgba(0, 255, 0, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.4);
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

/* Área de juego */
#game-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 60px; /* Aumentado de 40px a 60px */
}

/* Stock y Waste piles */
#stock-container {
    display: flex;
    gap: 15px;
    height: min(17vw, 170px); /* Altura responsiva para coincidir con las cartas */
}

.card-pile {
    width: min(12vw, 120px); /* Mismo tamaño que las cartas */
    height: min(17vw, 170px); /* Mismo tamaño que las cartas */
    border: 2px dashed rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.card-pile:hover {
    border-color: rgba(0, 255, 0, 0.6);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.card-pile.has-cards {
    border-style: solid;
    border-color: rgba(0, 255, 0, 0.5);
}

/* Waste pile specific styles for overlapping cards */
#waste-pile {
    position: relative;
    overflow: visible;
}

#waste-pile .card {
    position: absolute;
    top: 0;
}

/* Foundation piles */
#foundation-container {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    height: 120px;
}

.foundation-pile {
    width: min(12vw, 120px); /* Mismo tamaño que las cartas */
    height: min(17vw, 170px); /* Mismo tamaño que las cartas */
    border: 2px dashed rgba(0, 255, 0, 0.3);
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 10px;
}

.foundation-pile:hover {
    border-color: rgba(0, 255, 0, 0.6);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.foundation-pile.can-drop {
    border-color: rgba(0, 255, 0, 0.8);
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}

/* Cartas fantasma para fundaciones vacías - Estilo tapete */
.ghost-card {
    background: transparent !important;
    border: 2px solid rgba(0, 255, 0, 0.4) !important;
    opacity: 0.8 !important;
    pointer-events: none !important;
    user-select: none !important;
    cursor: default !important;
}

.ghost-card .card-face {
    background: transparent !important;
}

.ghost-card .rank,
.ghost-card .suit,
.ghost-card .suit-symbol {
    color: #00ff00 !important; /* Verde brillante */
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.6) !important;
    font-weight: bold !important;
}

.ghost-card:hover {
    opacity: 0.9 !important;
    border-color: rgba(0, 255, 0, 0.6) !important;
}

.ghost-card:hover .rank,
.ghost-card:hover .suit,
.ghost-card:hover .suit-symbol {
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8) !important;
}

/* Tableau piles */
#tableau-container {
    display: flex;
    gap: 10px;
    flex: 1;
    align-items: flex-start;
}

.tableau-pile {
    flex: 1;
    min-height: 200px;
    border: 2px dashed rgba(0, 255, 0, 0.2);
    border-radius: 8px;
    position: relative;
    padding: 12px;
    transition: all 0.3s ease;
    min-width: 110px;
}

.tableau-pile:hover {
    border-color: rgba(0, 255, 0, 0.4);
}

.tableau-pile.can-drop {
    border-color: rgba(0, 255, 0, 0.8);
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}

/* Cartas - Diseño Premium */
.card {
    width: min(12vw, 120px); /* Responsive con máximo */
    height: min(17vw, 170px); /* Mantiene proporción 12:17 */
    border: 2px solid rgba(0, 255, 0, 0.6);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 240, 240, 0.9) 100%);
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Times New Roman', serif;
    user-select: none;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 255, 0, 0.4);
    border-color: rgba(0, 255, 0, 0.8);
}

.card.face-up {
    background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
    border-color: rgba(0, 0, 0, 0.3);
}

.card.face-down {
    background: linear-gradient(145deg, rgba(0, 50, 0, 0.9) 0%, rgba(0, 80, 0, 0.8) 100%);
    border-color: rgba(0, 255, 0, 0.8);
}

/* Card Face Design */
.card-face {
    width: 100%;
    height: 100%;
    position: relative;
    padding: 3px;
    box-sizing: border-box;
}

.card-corner {
    position: absolute;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    line-height: 1;
}

.card-corner.top-left {
    top: 5px;
    left: 5px;
}

.card-corner.bottom-right {
    bottom: 5px;
    right: 5px;
    transform: rotate(180deg);
}

.card-corner .rank {
    font-size: min(3.5vw, 28px); /* Más grande y responsivo */
    font-weight: bold;
    margin-bottom: 2px;
}

.card-corner .suit {
    font-size: min(3vw, 24px); /* Más grande y responsivo */
}

.card-center {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Red and Black Card Colors */
.card.red .rank,
.card.red .suit,
.card.red .suit-symbol,
.card.red .ace-center,
.card.red .royal {
    color: #dc143c;
}

.card.black .rank,
.card.black .suit,
.card.black .suit-symbol,
.card.black .ace-center,
.card.black .royal {
    color: #000000;
}

/* Suit Pattern Positions */
.suit-pattern {
    position: relative;
    width: 100%;
    height: 100%;
}

.suit-symbol {
    position: absolute;
    font-size: min(4vw, 32px); /* Más grande para mejor visibilidad */
    font-weight: bold;
    transform: translate(-50%, -50%);
}

/* Position definitions for suit symbols */
.pos-center { top: 50%; left: 50%; }
.pos-top { top: 20%; left: 50%; }
.pos-bottom { top: 80%; left: 50%; }
.pos-top-left { top: 20%; left: 25%; }
.pos-top-right { top: 20%; left: 75%; }
.pos-bottom-left { top: 80%; left: 25%; }
.pos-bottom-right { top: 80%; left: 75%; }
.pos-middle-left { top: 50%; left: 25%; }
.pos-middle-right { top: 50%; left: 75%; }
.pos-middle-center { top: 50%; left: 50%; }
.pos-top-center { top: 20%; left: 50%; }
.pos-bottom-center { top: 80%; left: 50%; }
.pos-middle-center-top { top: 35%; left: 50%; }
.pos-middle-center-bottom { top: 65%; left: 50%; }

/* Ace special styling */
.ace-center {
    font-size: min(10vw, 80px); /* Más grande y responsivo */
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
}

/* Ace especial para cartas fantasma - aún más prominente */
.ghost-card .ace-center {
    font-size: min(12vw, 90px); /* Extra grande para cartas fantasma */
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.8) !important; /* Brillo más intenso */
}

/* Royal cards styling */
.royal {
    font-size: min(9vw, 70px); /* Más grande para mejor visibilidad */
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
}

/* Card back design */
.card-back {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.back-pattern {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.back-design {
    color: rgba(0, 255, 0, 0.8);
    font-family: 'Courier New', monospace;
    font-size: 8px;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0, 255, 0, 0.6);
    margin-bottom: 8px;
    transform: rotate(-45deg);
}

.back-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    width: 40px;
    height: 40px;
}

.grid-dot {
    width: 4px;
    height: 4px;
    background: rgba(0, 255, 0, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 255, 0, 0.4);
}

/* Drag states */
.card.dragging {
    transform: rotate(3deg) scale(1.05);
    opacity: 0.9;
    box-shadow: 0 10px 30px rgba(0, 255, 0, 0.6);
    z-index: 10000;
}

.card.selected {
    border-color: rgba(0, 255, 0, 1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
    transform: translateY(-5px);
}

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: bold;
}

/* Victory overlay */
#victory-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#victory-modal {
    background: linear-gradient(135deg, rgba(0, 50, 0, 0.95) 0%, rgba(0, 30, 0, 0.95) 100%);
    border: 3px solid rgba(0, 255, 0, 0.8);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
    min-width: 300px;
}

#victory-modal h2 {
    color: #00ff00;
    font-size: 24px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}

#victory-modal p {
    margin-bottom: 20px;
    font-size: 16px;
}

#victory-stats {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

#victory-stats div {
    margin-bottom: 5px;
    font-weight: bold;
}

#victory-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    #game-header {
        flex-direction: column;
        gap: 10px;
        padding: 15px 10px;
    }

    #game-info {
        justify-content: space-around;
        width: 100%;
    }

    .info-item {
        font-size: 10px;
    }

    #time-display, #moves-display, #score-display {
        font-size: 14px;
    }

    .game-btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    #game-board {
        padding: 15px 5px;
        gap: 35px; /* Aumentado de 25px a 35px */
    }

    #stock-container, #foundation-container {
        height: 100px;
        gap: 10px;
    }

    .card-pile, .foundation-pile {
        width: 70px;
        height: 95px;
        padding: 6px;
    }

    #tableau-container {
        gap: 5px;
    }

    .card {
        width: min(10vw, 60px); /* Responsive en móvil también */
        height: min(15vw, 90px); /* Responsive en móvil también */
        font-size: min(3vw, 18px); /* Texto más grande en móvil */
        padding: 3px;
    }

    .card-center {
        font-size: min(4vw, 24px); /* Más grande en móvil */
    }

    #victory-modal {
        margin: 20px;
        padding: 20px;
        min-width: auto;
    }

    #victory-modal h2 {
        font-size: 20px;
    }

    #victory-buttons {
        flex-direction: column;
    }
    
    .foundation-suit-icon {
        font-size: 36px !important; /* Más grande que antes para mejor visibilidad */
    }
}

/* Animaciones */
@keyframes cardFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

.card.flipping {
    animation: cardFlip 0.6s ease-in-out;
}

@keyframes victoryGlow {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 0, 0.5); }
    50% { box-shadow: 0 0 50px rgba(0, 255, 0, 0.8); }
}

@keyframes modalEntrance {
    0% { 
        opacity: 0;
        transform: scale(0.3) rotateY(90deg);
    }
    50% {
        transform: scale(1.1) rotateY(0deg);
    }
    100% { 
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

@keyframes crownBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-20px) scale(1.2); }
    60% { transform: translateY(-10px) scale(1.1); }
}

@keyframes firework1 {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }
    15% {
        transform: translate(50px, -100px) scale(0.5);
    }
    30% {
        transform: translate(100px, -200px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(150px, -300px) scale(1.5);
        opacity: 0;
    }
}

@keyframes firework2 {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }
    20% {
        transform: translate(-70px, -120px) scale(0.5);
    }
    40% {
        transform: translate(-140px, -240px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-200px, -350px) scale(1.5);
        opacity: 0;
    }
}

@keyframes firework3 {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }
    25% {
        transform: translate(80px, -80px) scale(0.5);
    }
    50% {
        transform: translate(160px, -160px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(240px, -240px) scale(1.5);
        opacity: 0;
    }
}

@keyframes firework4 {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }
    18% {
        transform: translate(-50px, -150px) scale(0.5);
    }
    36% {
        transform: translate(-100px, -300px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-150px, -450px) scale(1.5);
        opacity: 0;
    }
}

@keyframes firework5 {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 1;
    }
    22% {
        transform: translate(60px, -110px) scale(0.5);
    }
    44% {
        transform: translate(120px, -220px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(180px, -330px) scale(1.5);
        opacity: 0;
    }
}

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

@keyframes overlayFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Victory Animation Styles */
#victory-overlay {
    animation: overlayFadeIn 0.5s ease-in-out;
}

#victory-modal {
    animation: modalEntrance 1s ease-out, victoryGlow 2s infinite;
}

.victory-crown {
    font-size: 48px;
    display: inline-block;
    animation: crownBounce 2s infinite;
    margin-bottom: 10px;
}

/* Fireworks Containers */
.fireworks-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.firework {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,0,0.8) 0%, rgba(255,0,0,0.8) 50%, rgba(0,255,0,0.8) 100%);
    box-shadow: 0 0 20px rgba(255,255,0,0.8);
}

.firework:nth-child(1) { animation: firework1 3s infinite; }
.firework:nth-child(2) { animation: firework2 3s infinite 0.5s; }
.firework:nth-child(3) { animation: firework3 3s infinite 1s; }
.firework:nth-child(4) { animation: firework4 3s infinite 1.5s; }
.firework:nth-child(5) { animation: firework5 3s infinite 2s; }

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

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 4s linear infinite;
}

.confetti-piece:nth-child(odd) {
    background: #ff0080;
    border-radius: 50%;
}

.confetti-piece:nth-child(even) {
    background: #00ff80;
    transform: rotate(45deg);
}

.confetti-piece:nth-child(3n) {
    background: #8000ff;
    border-radius: 3px;
}

.confetti-piece:nth-child(4n) {
    background: #ff8000;
    width: 6px;
    height: 12px;
}

.confetti-piece:nth-child(5n) {
    background: #0080ff;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
