/* Pasianssi.ai - Main Stylesheet */
/* Color Palette: Deep Emerald & Gold */

:root {
    --primary-dark: #0a1628;
    --primary: #0f2744;
    --primary-light: #1a3a5c;
    --accent: #c9a227;
    --accent-light: #e5c35c;
    --accent-dark: #9a7b1d;
    --success: #22c55e;
    --danger: #ef4444;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --card-red: #dc2626;
    --card-black: #1e293b;
    --felt-green: #15803d;
    --felt-dark: #14532d;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.main-header {
    background: rgba(10, 22, 40, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(201, 162, 39, 0.2);
}

.main-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 8px;
    padding: 6px;
}

.logo-icon .suit {
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon .suit::before {
    font-size: 12px;
    line-height: 1;
}

.logo-icon .spade::before { content: '\2660'; color: #1e293b; }
.logo-icon .heart::before { content: '\2665'; color: #dc2626; }
.logo-icon .diamond::before { content: '\2666'; color: #dc2626; }
.logo-icon .club::before { content: '\2663'; color: #1e293b; }

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 8px;
}

.main-nav a {
    display: block;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: var(--transition);
}

.main-nav a:hover {
    color: var(--accent);
    background: rgba(201, 162, 39, 0.1);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--accent);
    border-radius: 3px;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    padding: 140px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
}

.hero-content h1 .highlight {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.hero-features {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.feature-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--accent-light);
}

.feature-badge svg {
    width: 18px;
    height: 18px;
}

/* Floating Cards Animation */
.hero-cards {
    position: relative;
    height: 400px;
}

.floating-card {
    position: absolute;
    width: 120px;
    height: 170px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: float 6s ease-in-out infinite;
}

.floating-card::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 24px;
    font-weight: bold;
}

.floating-card::after {
    position: absolute;
    font-size: 48px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card-1 {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    transform: rotate(-15deg);
}
.card-1::before { content: 'A'; color: #dc2626; }
.card-1::after { content: '\2665'; color: #dc2626; }

.card-2 {
    top: 30%;
    left: 40%;
    animation-delay: 1s;
    transform: rotate(5deg);
    z-index: 1;
}
.card-2::before { content: 'K'; color: #1e293b; }
.card-2::after { content: '\2660'; color: #1e293b; }

.card-3 {
    top: 50%;
    left: 20%;
    animation-delay: 2s;
    transform: rotate(-5deg);
}
.card-3::before { content: 'Q'; color: #dc2626; }
.card-3::after { content: '\2666'; color: #dc2626; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(var(--rotation, 0deg)); }
    50% { transform: translateY(-20px) rotate(var(--rotation, 0deg)); }
}

/* Section Styles */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 50px;
}

/* Games Section */
.games-section {
    padding: 80px 0;
    background: linear-gradient(180deg, transparent 0%, rgba(21, 128, 61, 0.1) 50%, transparent 100%);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

/* Game Card */
.game-card {
    perspective: 1000px;
    height: 400px;
    cursor: pointer;
}

.game-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.game-card-front,
.game-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.game-card-front {
    background: linear-gradient(145deg, var(--primary-light) 0%, var(--primary) 100%);
    border: 1px solid rgba(201, 162, 39, 0.2);
}

.game-card-back {
    background: linear-gradient(145deg, var(--accent-dark) 0%, var(--accent) 100%);
    transform: rotateY(180deg);
    color: var(--primary-dark);
}

.game-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Klondike Icon */
.stacked-cards {
    position: relative;
    width: 60px;
    height: 80px;
}

.stacked-cards .mini-card {
    position: absolute;
    width: 50px;
    height: 70px;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    border-radius: 6px;
    border: 2px solid var(--accent);
}

.stacked-cards .mini-card:nth-child(1) { top: 0; left: 0; }
.stacked-cards .mini-card:nth-child(2) { top: 5px; left: 5px; }
.stacked-cards .mini-card:nth-child(3) { top: 10px; left: 10px; }

/* Spider Icon */
.spider-svg {
    width: 70px;
    height: 70px;
    color: var(--accent);
}

/* FreeCell Icon */
.freecell-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.free-cell {
    width: 30px;
    height: 40px;
    background: rgba(201, 162, 39, 0.2);
    border: 2px dashed var(--accent);
    border-radius: 6px;
}

/* Pyramid Icon */
.pyramid-shape {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pyramid-row {
    display: flex;
    gap: 4px;
}

.pyramid-row span {
    width: 20px;
    height: 28px;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    border-radius: 4px;
    border: 1px solid var(--accent);
}

.game-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--accent-light);
}

.game-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    flex-grow: 1;
}

.difficulty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.diff-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.diff-dots {
    display: flex;
    gap: 5px;
}

.diff-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(201, 162, 39, 0.3);
}

.diff-dots .dot.filled {
    background: var(--accent);
}

.game-card-back h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.game-card-back ul {
    list-style: none;
    flex-grow: 1;
}

.game-card-back li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(10, 22, 40, 0.2);
    font-size: 0.95rem;
}

.game-card-back li:last-child {
    border-bottom: none;
}

.play-btn {
    display: block;
    text-align: center;
    padding: 14px 28px;
    background: var(--primary-dark);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    margin-top: 15px;
}

.play-btn:hover {
    background: var(--primary);
    transform: translateY(-2px);
}

/* Features Section */
.features-section {
    padding: 80px 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.feature-item {
    text-align: center;
    padding: 30px;
    background: rgba(15, 39, 68, 0.5);
    border-radius: var(--border-radius);
    border: 1px solid rgba(201, 162, 39, 0.1);
    transition: var(--transition);
}

.feature-item:hover {
    transform: translateY(-5px);
    border-color: rgba(201, 162, 39, 0.3);
}

.feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon svg {
    width: 28px;
    height: 28px;
    color: var(--primary-dark);
}

.feature-item h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--accent-light);
}

.feature-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* How to Play Section */
.how-to-play {
    padding: 80px 0;
    background: linear-gradient(180deg, transparent 0%, rgba(21, 128, 61, 0.05) 100%);
}

.how-to-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.how-to-item {
    text-align: center;
    position: relative;
}

.step-number {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.how-to-item h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--accent-light);
}

.how-to-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Footer */
.main-footer {
    background: rgba(10, 22, 40, 0.9);
    padding: 60px 0 30px;
    border-top: 1px solid rgba(201, 162, 39, 0.2);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand p {
    color: var(--text-secondary);
    margin-top: 15px;
    font-size: 0.9rem;
}

.footer-links h4 {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 15px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(201, 162, 39, 0.1);
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .games-grid,
    .features-grid,
    .how-to-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-features {
        justify-content: center;
    }

    .hero-cards {
        display: none;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .main-nav {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(10, 22, 40, 0.98);
        padding: 20px;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
    }

    .main-nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }

    .main-nav a {
        padding: 15px;
        border-bottom: 1px solid rgba(201, 162, 39, 0.1);
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .section-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 640px) {
    .games-grid,
    .features-grid,
    .how-to-grid {
        grid-template-columns: 1fr;
    }

    .game-card {
        height: 350px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }
}

/* Game Page Styles */
.game-header {
    background: rgba(10, 22, 40, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(201, 162, 39, 0.2);
}

.game-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.game-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-light);
}

.game-controls {
    display: flex;
    gap: 10px;
}

.game-btn {
    padding: 8px 16px;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.3);
    color: var(--accent);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-btn:hover {
    background: rgba(201, 162, 39, 0.2);
}

.game-btn.primary {
    background: var(--accent);
    color: var(--primary-dark);
    border-color: var(--accent);
}

.game-btn.primary:hover {
    background: var(--accent-light);
}

.game-btn svg {
    width: 16px;
    height: 16px;
}

.game-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.stat-item span {
    color: var(--accent-light);
    font-weight: 600;
}

/* Game Container */
.game-container {
    padding: 80px 20px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: radial-gradient(ellipse at center, var(--felt-green) 0%, var(--felt-dark) 100%);
    border-radius: var(--border-radius);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
}

/* Card Styles */
.card {
    width: 80px;
    height: 112px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: absolute;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    padding: 5px;
}

.card.face-down {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: 2px solid var(--accent);
}

.card.face-down::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: repeating-linear-gradient(
        45deg,
        var(--accent) 0px,
        var(--accent) 2px,
        transparent 2px,
        transparent 8px
    );
    border-radius: 4px;
    opacity: 0.3;
}

.card.dragging {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.card.red {
    color: var(--card-red);
}

.card.black {
    color: var(--card-black);
}

.card-rank {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.card-suit {
    font-size: 14px;
    line-height: 1;
}

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

/* Pile Styles */
.pile {
    position: relative;
    width: 80px;
    height: 112px;
}

.pile-empty {
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.pile-foundation {
    background: rgba(201, 162, 39, 0.1);
    border: 2px dashed var(--accent);
}

/* Tableau */
.tableau {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.tableau-pile .card {
    margin-top: -85px;
}

.tableau-pile .card:first-child {
    margin-top: 0;
}

/* Stock and Waste */
.stock-waste {
    display: flex;
    gap: 20px;
}

/* Foundations */
.foundations {
    display: flex;
    gap: 15px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: linear-gradient(145deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: var(--border-radius);
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(201, 162, 39, 0.3);
    transform: scale(0.9);
    transition: var(--transition);
}

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

.modal h2 {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 15px;
}

.modal p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.modal-stat {
    background: rgba(201, 162, 39, 0.1);
    padding: 15px;
    border-radius: 8px;
}

.modal-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.modal-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(10, 22, 40, 0.98);
    border-radius: var(--border-radius);
    padding: 20px;
    width: 280px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    z-index: 1500;
    transform: translateX(120%);
    transition: var(--transition);
}

.settings-panel.active {
    transform: translateX(0);
}

.settings-panel h3 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.setting-item select {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.setting-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-switch {
    width: 50px;
    height: 26px;
    background: var(--primary);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-switch.active {
    background: var(--accent);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle-switch.active::after {
    left: 26px;
}

/* Hint Highlight */
.card.hint {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(201, 162, 39, 0); }
}

/* Auto-complete animation */
.card.auto-moving {
    transition: all 0.3s ease;
}

/* Confetti */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 3000;
}

/* Touch device adjustments */
@media (hover: none) and (pointer: coarse) {
    .card {
        touch-action: none;
    }
}
