* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

.game-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 15px;
    max-width: 1200px;
    width: 100%;
}

.panels-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.panel {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    min-height: 400px;
}

.panel-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.left-panel {
    align-items: center;
    justify-content: flex-start;
}

.center-panel {
    align-items: center;
    justify-content: center;
}

.right-panel {
    align-items: center;
    justify-content: flex-start;
}

header {
    text-align: center;
    margin-bottom: 15px;
}

header h1 {
    color: #e74c3c;
    font-size: 1.8em;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #7f8c8d;
    font-size: 0.9em;
}

.current-player {
    font-size: 1em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
}

.dice-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    justify-content: center;
    width: 100%;
    margin-bottom: 20px;
}

.dice-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.9em;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.dice-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.dice-btn:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.dice-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.7);
}

.dice-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    animation: buttonPress 0.2s;
}

@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.dice-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dice-result {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #2c3e50;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    perspective: 1000px;
}

.dice-face {
    width: 100%;
    height: 100%;
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 8px;
    gap: 4px;
}

.dice-dot {
    width: 10px;
    height: 10px;
    background: #2c3e50;
    border-radius: 50%;
    margin: auto;
}

.dice-dot.center {
    grid-column: 2;
    grid-row: 2;
}

.dice-dot.top-left {
    grid-column: 1;
    grid-row: 1;
}

.dice-dot.top-right {
    grid-column: 3;
    grid-row: 1;
}

.dice-dot.middle-left {
    grid-column: 1;
    grid-row: 2;
}

.dice-dot.middle-right {
    grid-column: 3;
    grid-row: 2;
}

.dice-dot.bottom-left {
    grid-column: 1;
    grid-row: 3;
}

.dice-dot.bottom-right {
    grid-column: 3;
    grid-row: 3;
}

.dice-face.rolling {
    animation: diceRoll 0.5s infinite;
}

@keyframes diceRoll {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    25% { transform: rotateX(90deg) rotateY(90deg); }
    50% { transform: rotateX(180deg) rotateY(180deg); }
    75% { transform: rotateX(270deg) rotateY(270deg); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

.scores {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-bottom: 20px;
}

.score-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.score-card.player2 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.score-card h3 {
    margin-bottom: 10px;
    font-size: 1.1em;
}

.score {
    font-size: 1.2em;
    font-weight: bold;
    transition: all 0.3s;
}

.score-card:hover .score {
    transform: scale(1.1);
    color: #fff;
}

.score-card .score.updated {
    animation: scoreUpdate 0.5s ease-in-out;
}

@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: #ffd700; }
    100% { transform: scale(1); }
}

.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.game-board {
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
    background: #ecf0f1;
    padding: 8px;
    border-radius: 10px;
    max-width: 420px;
    width: 100%;
}

.board-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
}

.board-row.odd-row {
    display: flex;
    flex-direction: row-reverse;
    gap: 5px;
}

.board-row.odd-row .cell {
    flex: 1;
}

.cell {
    aspect-ratio: 1;
    background: white;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid #ddd;
    padding: 3px;
}

.cell-number {
    font-size: 0.6em;
    color: #666;
    font-weight: bold;
    position: absolute;
    top: 2px;
    left: 3px;
}

.cell-icon {
    font-size: 1.2em;
    margin-top: 5px;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cell.start {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    font-weight: bold;
}

.cell.cherry {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    animation: cherryPulse 2s infinite;
}

@keyframes cherryPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 107, 107, 0.4);
    }
    50% { 
        transform: scale(1.15);
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
    }
}

.cell.end {
    background: linear-gradient(135deg, #fad961 0%, #f76b1c 100%);
    font-weight: bold;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.cell.player1 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: 3px solid #e74c3c;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
    animation: playerMove 0.3s ease-in-out;
}

.cell.player2 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: 3px solid #3498db;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
    animation: playerMove 0.3s ease-in-out;
}

@keyframes playerMove {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.cell.both-players {
    background: linear-gradient(135deg, #f093fb 0%, #4facfe 100%);
    border: 3px solid #9b59b6;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: auto;
}

.btn {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 18px;
    font-size: 0.85em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn:hover {
    background: #7f8c8d;
}

.game-message {
    text-align: center;
    font-size: 0.9em;
    font-weight: bold;
    min-height: 60px;
    color: #2c3e50;
    padding: 12px;
    border-radius: 8px;
    background: #ecf0f1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    word-wrap: break-word;
}

.game-message.winner {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    animation: celebrate 0.5s ease-in-out;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.footer-credit {
    text-align: center;
    color: white;
    font-size: 0.9em;
    padding: 15px 10px 20px 10px;
    opacity: 0.8;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
}

@media (max-width: 1024px) {
    .panels-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .panel {
        min-height: auto;
    }
    
    .left-panel, .right-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: center;
    }
    
    .panel-title {
        width: 100%;
    }
    
    .scores {
        flex-direction: row;
        width: auto;
    }
    
    .score-card {
        width: auto;
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .game-container {
        max-width: 100%;
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .left-panel, .right-panel {
        flex-direction: column;
    }
    
    .scores {
        flex-direction: column;
        width: 100%;
    }
}
