:root {
    --card-width: 70px;
    --card-height: 98px;
    --card-gap: 6px;
    --selected-color: #ffd700;
    --valid-color: #4ade80;
}

* {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

.game-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: transparent;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.game-nav a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all var(--transition-normal);
}

.game-nav a:hover {
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
}

.game-nav a.active {
    color: var(--accent-gold);
    font-weight: var(--font-weight-bold);
}

.game-nav .nav-divider {
    color: var(--text-primary);
    opacity: 0.5;
}

.game-nav .nav-home {
    font-size: 1.1rem;
}

* {
    margin: 0;
    padding: 0;
}

.game-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: transparent;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.game-nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.game-nav a:hover {
    color: var(--accent-color);
    background: rgba(212, 175, 55, 0.1);
}

.game-nav a.active {
    color: var(--accent-color);
    font-weight: 600;
}

.game-nav .nav-divider {
    color: var(--text-color);
    opacity: 0.5;
}

.game-nav .nav-home {
    font-size: 1.1rem;
}
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1a3d2e 0%, #0d1f16 50%, #1a2f23 100%);
    min-height: 100vh;
    color: var(--text-color);
    overflow-x: hidden;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 15px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--accent-color);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.controls {
    display: flex;
    gap: 8px;
}

.controls button {
    padding: 8px 14px;
    background: var(--button-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: white;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.controls button:hover {
    background: var(--button-hover);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.controls button:active {
    transform: scale(0.95);
}

.score {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
}

.game-board {
    background: var(--table-color);
    border: 2px solid var(--table-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stock-waste {
    display: flex;
    gap: var(--card-gap);
}

.stock, .waste {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: 6px;
    position: relative;
}

.stock {
    background: var(--card-back);
    border: 2px solid #5a4a3a;
    cursor: pointer;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
}

.stock:empty, .stock.empty {
    cursor: default;
    opacity: 0.3;
    background: rgba(0, 0, 0, 0.2);
    border-color: #555;
}

.stock.empty::after {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: #888;
}

.waste {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background: rgba(0,0,0,0.15);
}

.info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.info span {
    color: var(--accent-color);
    font-weight: 600;
}

.peaks-container {
    position: relative;
    min-height: 420px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding-top: 20px;
}

.peaks-row {
    display: flex;
    justify-content: center;
    position: absolute;
    gap: var(--card-gap);
}

.card {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover:not(.covered):not(.removed) {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), 0 4px 8px rgba(0, 0, 0, 0.4);
}

.card.valid-move {
    box-shadow: 0 0 0 3px var(--valid-color), 0 4px 8px rgba(0, 0, 0, 0.4);
    animation: pulse-valid 1.5s ease-in-out infinite;
}

.card.dragging {
    opacity: 0.5;
}

.card[draggable="true"] {
    cursor: grab;
}

.card[draggable="true"]:active {
    cursor: grabbing;
}
}

@keyframes pulse-valid {
    0%, 100% { 
        box-shadow: 0 0 0 3px var(--valid-color), 0 4px 8px rgba(0, 0, 0, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 4px var(--valid-color), 0 6px 12px rgba(0, 0, 0, 0.5);
    }
}

.card.covered {
    cursor: not-allowed;
    opacity: 0.7;
}

.card.removed {
    visibility: hidden;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    font-size: 0.7rem;
    font-weight: 600;
}

.card-front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--card-bg);
    border-radius: 10px;
    z-index: 2;
}

.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--card-back);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(255, 255, 255, 0.05) 8px,
        rgba(255, 255, 255, 0.05) 16px
    );
    border: 2px solid #5a4a3a;
    border-radius: 10px;
    z-index: 1;
}

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

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

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

.card.red {
    color: #d62828;
}

.card.black {
    color: #1a1a1a;
}

.win-overlay, .rules-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.win-overlay.show, .rules-overlay.show {
    display: flex;
}

.win-message, .rules-content {
    background: linear-gradient(145deg, #2d3a2d 0%, #1a2a1a 100%);
    border: 2px solid var(--accent-color);
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    animation: popIn 0.3s ease-out;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.2);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.win-message h2, .rules-content h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--accent-color);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.win-message p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.win-message button, .rules-content button {
    padding: 12px 30px;
    background: var(--button-bg);
    border: 1px solid var(--accent-color);
    border-radius: 6px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.win-message button:hover, .rules-content button:hover {
    background: var(--button-hover);
}

.rules-content {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: left;
}

.rules-content h2 {
    text-align: center;
}

.rules-section {
    margin-bottom: 20px;
}

.rules-section h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--accent-color);
}

.rules-section p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #ccc;
}

.rules-section ul {
    margin-left: 20px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #ccc;
}

.rules-section li {
    margin-bottom: 4px;
}

.rules-content button {
    display: block;
    width: 100%;
    margin-top: 20px;
}

@media (max-width: 700px) {
    :root {
        --card-width: 50px;
        --card-height: 70px;
        --card-gap: 4px;
    }

    .game-header {
        justify-content: center;
    }

    .game-header h1 {
        width: 100%;
        text-align: center;
    }

    .card-face {
        padding: 2px;
        font-size: 0.5rem;
    }

    .card-center {
        font-size: 0.9rem;
    }

    .peaks-container {
        min-height: 220px;
    }
}
