/* Solitaire - Classic Card Game */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Nunito:wght@400;600;700&display=swap');

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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #0d4f0d 0%, #1a6b1a 50%, #0d4f0d 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.back-btn {
    display: inline-block;
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 10px;
    transition: color 0.3s;
}

.back-btn:hover {
    color: #fff;
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 10px;
}

.game-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    letter-spacing: 4px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 215, 0, 0.1);
    padding: 6px 15px;
    border-radius: 8px;
    border: 2px solid #ffd700;
}

.stat-label {
    color: #ccc;
    font-size: 0.65rem;
    margin-right: 5px;
}

.stat-item span:last-child {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px;
}

.screen.hidden {
    display: none;
}

/* Start Screen */
.cards-art {
    margin-bottom: 20px;
}

.card-fan {
    display: flex;
    justify-content: center;
    position: relative;
    height: 100px;
    width: 180px;
}

.art-card {
    width: 50px;
    height: 70px;
    background: #fff;
    border-radius: 5px;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.art-card.spade {
    transform: rotate(-20deg);
    left: 0;
}

.art-card.spade::after {
    content: '♠';
    color: #000;
}

.art-card.heart {
    transform: rotate(-7deg);
    left: 35px;
}

.art-card.heart::after {
    content: '♥';
    color: #e74c3c;
}

.art-card.diamond {
    transform: rotate(7deg);
    left: 70px;
}

.art-card.diamond::after {
    content: '♦';
    color: #e74c3c;
}

.art-card.club {
    transform: rotate(20deg);
    left: 105px;
}

.art-card.club::after {
    content: '♣';
    color: #000;
}

#startScreen h2 {
    font-size: 1.2rem;
    color: #ffd700;
    margin-bottom: 10px;
}

.instructions {
    color: #ccc;
    margin-bottom: 15px;
    font-size: 0.9rem;
    max-width: 350px;
}

.control-hint {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #ffd700;
    border-radius: 8px;
    padding: 10px 20px;
    margin-bottom: 15px;
}

.control-hint p {
    font-size: 0.85rem;
    margin: 3px 0;
}

/* High Scores Panel */
.high-scores-panel {
    background: rgba(255, 215, 0, 0.05);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 20px;
    min-width: 250px;
}

.high-scores-panel h3 {
    font-family: 'Orbitron', sans-serif;
    color: #ffd700;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.high-scores-panel ol {
    list-style: none;
    text-align: left;
}

.high-scores-panel li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    font-size: 0.8rem;
}

.high-scores-panel li:last-child {
    border-bottom: none;
}

.high-scores-panel .score-name {
    color: #fff;
}

.high-scores-panel .score-value {
    color: #ffd700;
    font-weight: 700;
}

/* Buttons */
.play-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #000;
    border: none;
    padding: 12px 35px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
    font-family: 'Orbitron', sans-serif;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.5);
}

.play-btn:active {
    transform: scale(0.98);
}

.menu-btn {
    display: inline-block;
    background: transparent;
    color: #ffd700;
    border: 2px solid #ffd700;
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    margin-left: 15px;
}

.menu-btn:hover {
    background: #ffd700;
    color: #000;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.control-btn {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #ffd700;
    border-radius: 5px;
    padding: 6px 15px;
    color: #ffd700;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn:hover {
    background: #ffd700;
    color: #000;
}

.control-btn.hidden {
    display: none;
}

/* Game Board */
#gameBoard {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.top-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 5px;
}

.stock-waste {
    display: flex;
    gap: 10px;
}

.spacer {
    flex: 1;
}

.foundations {
    display: flex;
    gap: 10px;
}

.tableau-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 0 5px;
}

/* Piles */
.pile {
    width: 70px;
    min-height: 95px;
    position: relative;
    border-radius: 8px;
}

.empty-slot {
    width: 70px;
    height: 95px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.3);
}

.stock-pile .empty-slot {
    cursor: pointer;
}

.foundation .empty-slot {
    color: rgba(255, 255, 255, 0.2);
}

.foundation[data-suit="heart"] .empty-slot,
.foundation[data-suit="diamond"] .empty-slot {
    color: rgba(231, 76, 60, 0.3);
}

.tableau {
    min-height: 300px;
}

/* Cards */
.card {
    width: 70px;
    height: 95px;
    border-radius: 8px;
    position: absolute;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    -webkit-user-select: none;
}

.card.face-down {
    background: linear-gradient(135deg, #1a3a5c 0%, #2c5282 100%);
    border: 2px solid #4a7cb4;
}

.card.face-down::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(255, 255, 255, 0.05) 5px,
        rgba(255, 255, 255, 0.05) 10px
    );
}

.card.face-up {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card.face-up .card-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
}

.card.face-up .card-corner {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.card.face-up .card-corner.bottom {
    align-self: flex-end;
    transform: rotate(180deg);
}

.card.face-up .card-rank {
    font-size: 1rem;
    font-weight: 700;
}

.card.face-up .card-suit {
    font-size: 0.9rem;
}

.card.face-up .card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
}

.card.red {
    color: #e74c3c;
}

.card.black {
    color: #000;
}

.card.selected {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    transform: translateY(-5px);
}

.card.dragging {
    z-index: 1000 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    cursor: grabbing;
}

.card:hover:not(.face-down) {
    transform: translateY(-3px);
}

/* Stock pile cards */
.stock-pile .card {
    cursor: pointer;
}

/* Win Screen */
#winTitle {
    font-family: 'Orbitron', sans-serif;
    color: #ffd700;
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.final-stat {
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 15px 20px;
    min-width: 110px;
}

.final-value {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: #ffd700;
}

.final-label {
    display: block;
    font-size: 0.75rem;
    color: #ccc;
    margin-top: 5px;
}

/* New High Score */
.new-high-score {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 170, 0, 0.1) 100%);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 15px 25px;
    margin-bottom: 20px;
    animation: glow-gold 1s ease-in-out infinite;
}

@keyframes glow-gold {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
}

.new-high-score p {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: #ffd700;
    margin-bottom: 12px;
}

.new-high-score input {
    background: #0a2a0a;
    border: 2px solid #ffd700;
    border-radius: 5px;
    padding: 10px 15px;
    color: #ffd700;
    font-size: 1rem;
    width: 150px;
    text-align: center;
    margin-right: 10px;
}

.new-high-score input::placeholder {
    color: #555;
}

.save-btn {
    background: #ffd700;
    color: #000;
    border: none;
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.save-btn:hover {
    background: #ffaa00;
    transform: translateY(-2px);
}

.game-over-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* Responsive */
@media (max-width: 600px) {
    .game-header h1 {
        font-size: 1.5rem;
    }

    .stats-bar {
        gap: 8px;
    }

    .stat-item {
        padding: 5px 10px;
    }

    .pile {
        width: 45px;
        min-height: 62px;
    }

    .empty-slot {
        width: 45px;
        height: 62px;
        font-size: 1.3rem;
    }

    .card {
        width: 45px;
        height: 62px;
        border-radius: 5px;
    }

    .card.face-up .card-rank {
        font-size: 0.7rem;
    }

    .card.face-up .card-suit {
        font-size: 0.6rem;
    }

    .card.face-up .card-center {
        font-size: 1.2rem;
    }

    .card.face-up .card-content {
        padding: 3px;
    }

    .top-row {
        margin-bottom: 15px;
    }

    .stock-waste {
        gap: 5px;
    }

    .foundations {
        gap: 5px;
    }

    .tableau-row {
        gap: 4px;
    }

    .game-over-buttons {
        flex-direction: column;
    }

    .menu-btn {
        margin-left: 0;
    }
}

@media (max-width: 400px) {
    .pile {
        width: 38px;
        min-height: 52px;
    }

    .empty-slot {
        width: 38px;
        height: 52px;
        font-size: 1rem;
    }

    .card {
        width: 38px;
        height: 52px;
    }

    .card.face-up .card-rank {
        font-size: 0.6rem;
    }

    .card.face-up .card-suit {
        font-size: 0.5rem;
    }

    .card.face-up .card-center {
        font-size: 1rem;
    }
}
