/* ===== RESET AND BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c5530, #1a3d1f);
    color: white;
    min-height: 100vh;
    padding: 20px;
}

/* ===== MAIN CONTAINER ===== */
.game-container {
    max-width: 1600px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2.5em;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

/* ===== CRIBBAGE BOARD ===== */
.board-wrapper {
    background: linear-gradient(135deg, #8B4513 0%, #D2691E 50%, #8B4513 100%);
    padding: 40px;
    border-radius: 15px;
    margin: 0 auto 20px auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 3px solid #654321;
    width: fit-content;
}

.cribbage-board {
    background: linear-gradient(to right, #CD853F, #DEB887, #CD853F);
    width: 1150px;
    height: 320px;
    border-radius: 10px;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid #8B4513;
}

.track {
    position: absolute;
    white-space: nowrap;
}

/* Player 1 tracks (top) */
.track-p1-outer {
    top: 40px;
    left: 40px;
}

.track-p1-inner {
    top: 80px;
    left: 40px;
}

/* Player 2 tracks (bottom) */
.track-p2-outer {
    bottom: 40px;
    left: 40px;
}

.track-p2-inner {
    bottom: 80px;
    left: 40px;
}

/* Starting positions */
.start-hole {
    width: 10px;
    height: 10px;
    background: #654321;
    border-radius: 50%;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    position: absolute;
    left: 10px;
}

.start-hole-p1-outer {
    top: 40px;
}

.start-hole-p1-inner {
    top: 80px;
}

.start-hole-p2-inner {
    bottom: 80px;
}

.start-hole-p2-outer {
    bottom: 40px;
}

.start-peg {
    width: 16px;
    height: 16px;
    position: absolute;
    top: -3px;
    left: -3px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.start-peg-p1 {
    background: radial-gradient(circle at 30% 30%, #6bb6ff, #1971c2);
}

.start-peg-p2 {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #cc0000);
}

.hole {
    width: 10px;
    height: 10px;
    background: #654321;
    border-radius: 50%;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    display: inline-block;
    margin: 0 12px;
    position: relative;
    transition: all 0.2s;
}

.hole.group-end {
    margin-right: 20px;
}

.peg {
    width: 16px;
    height: 16px;
    position: absolute;
    top: -3px;
    left: -3px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
}

.peg-p1 {
    background: radial-gradient(circle at 30% 30%, #6bb6ff, #1971c2);
}

.peg-p2 {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #cc0000);
}

.score-labels {
    position: absolute;
    top: 10px;
    left: 190px;
    font-size: 10px;
    color: #654321;
    font-weight: bold;
    white-space: nowrap;
}

.score-label-num {
    display: inline-block;
    width: 170px;
    text-align: left;
    margin-left: 5px;
}

.score-label-num:first-child {
    margin-left: 0;
}

.game-hole {
    background: gold !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

/* Center board info */
.board-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    gap: 60px;
    z-index: 5;
}

.score-item {
    text-align: center;
    background: rgba(139, 69, 19, 0.8);
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid #654321;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.score-label {
    font-size: 0.9em;
    color: #000000;
    margin-bottom: 5px;
    font-weight: bold;
}

.score-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.dealer-indicator {
    font-size: 0.7em;
    font-weight: bold;
    color: #FF6B35;
    margin-top: 5px;
    display: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.dealer-indicator.active {
    display: block;
}

/* ===== PHASE INDICATOR ===== */
.phase-indicator {
    text-align: center;
    font-size: 1.1em;
    color: #ffd700;
    margin-bottom: 10px;
    font-weight: bold;
}

/* ===== GAME AREA ===== */
.game-area {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.left-column, .center-column, .right-column {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.center-column {
    align-items: center;
}

/* ===== HAND AREAS ===== */
.hand-area {
    margin-bottom: 15px;
    flex: 1;
}

.hand-label {
    font-size: 1em;
    margin-bottom: 8px;
    text-align: center;
}

.cards {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 100px;
    align-items: center;
}

/* ===== CENTER PLAY AREA ===== */
.center-play-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 10px 0;
    flex: 1;
}

.starter-area, .pegging-area {
    text-align: center;
}

/* ===== CRIB AREA ===== */
#crib-area-main {
    margin-bottom: 15px;
    text-align: center;
    flex: 1;
}

#crib-area-main .card {
    width: 45px;
    height: 63px;
    font-size: 0.6em;
    padding: 2px;
}

/* ===== CARDS ===== */
.card {
    width: 65px;
    height: 91px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-weight: bold;
    user-select: none;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.card.selected {
    border-color: #4CAF50;
    background: #e8f5e8;
    transform: translateY(-10px);
}

.card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.card.playable {
    border-color: #2196F3;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

.card-rank {
    font-size: 1.2em;
}

.card-suit {
    font-size: 1.5em;
    text-align: center;
}

.hearts, .diamonds {
    color: #d32f2f;
}

.clubs, .spades {
    color: #333;
}

.card-back {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    text-align: center;
}

/* ===== PEGGING AREA ===== */
.pegging-area {
    text-align: center;
}

.pegging-cards {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    min-height: 110px;
    align-items: center;
    flex-wrap: wrap;
}

.pegging-card {
    width: 70px;
    height: 98px;
    font-size: 1em;
    padding: 6px;
}

.count-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #ffd700;
    margin: 5px 0;
}

/* ===== BUTTONS ===== */
.controls {
    text-align: center;
    margin: 20px 0;
}

.btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1em;
    border-radius: 6px;
    cursor: pointer;
    margin: 0 10px;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #45a049;
}

.btn:disabled {
    background: #666;
    cursor: not-allowed;
}

.btn-secondary {
    background: #2196F3;
}

.btn-secondary:hover {
    background: #1976D2;
}

#continue-btn {
    background: #FF9800;
    font-weight: bold;
}

#continue-btn:hover {
    background: #F57C00;
}

/* ===== GAME LOG ===== */
.game-log {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.game-log h3 {
    margin-bottom: 10px;
    color: #ffd700;
    flex-shrink: 0;
}

#log-entries {
    flex: 1;
    overflow-y: auto;
}

.log-entry {
    margin-bottom: 6px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 0.85em;
    line-height: 1.3;
}

/* ===== CUTTING AREA ===== */
.cutting-area {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #ffd700;
    border-radius: 15px;
    padding: 30px;
    z-index: 1000;
    text-align: center;
}

.cutting-area h3 {
    color: #ffd700;
    margin-bottom: 10px;
}

.cutting-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.cutting-card {
    width: 50px;
    height: 70px;
    font-size: 0.7em;
    padding: 3px;
}

.cut-results {
    margin-top: 15px;
    text-align: center;
}

.cut-result {
    margin: 5px 0;
    padding: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* ===== MODALS ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #2c5530;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    color: #ffd700;
    margin-bottom: 20px;
}

.modal-buttons {
    margin-top: 20px;
}

.difficulty-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid #4CAF50;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.difficulty-btn:hover {
    background: rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

.difficulty-btn.selected {
    background: #4CAF50;
    border-color: #45a049;
}

/* ===== RULES MODAL ===== */
.rules-modal-content {
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: left;
}

.rules-content {
    margin: 20px 0;
}

.rules-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.rules-section:last-child {
    border-bottom: none;
}

.rules-section h3 {
    color: #ffd700;
    font-size: 1.3em;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.rules-section h4 {
    color: #FF6B35;
    font-size: 1.1em;
    margin: 15px 0 8px 0;
}

.rules-section p {
    line-height: 1.6;
    margin-bottom: 10px;
    color: #e0e0e0;
}

.rules-section ul {
    margin-left: 20px;
    line-height: 1.6;
}

.rules-section li {
    margin-bottom: 5px;
    color: #e0e0e0;
}

.rules-section li strong {
    color: #ffd700;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .cards {
        gap: 5px;
    }
    
    .card {
        width: 60px;
        height: 84px;
        font-size: 0.8em;
        padding: 4px;
    }
    
    .center-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .difficulty-options {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .score-value {
        font-size: 1.5em;
    }

    .rules-modal-content {
        max-width: 95%;
        max-height: 90vh;
        padding: 20px;
    }

    .rules-section h3 {
        font-size: 1.2em;
    }

    .rules-section h4 {
        font-size: 1em;
    }
}

/* ===== FEEDBACK SYSTEM STYLES ===== */
.feedback-content {
    max-width: 500px;
}

.feedback-content p {
    color: #ccc;
    margin-bottom: 20px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #fff;
    font-weight: bold;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #555;
    border-radius: 4px;
    background-color: #2a2a2a;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.feedback-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

.feedback-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.feedback-status.sending {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
