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

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
}

.game-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.left-panel {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
}

header {
    text-align: center;
    margin-bottom: 16px;
}

header h1 {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #666;
    font-size: 0.88em;
    margin-bottom: 10px;
}

.btn-back {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.game-board-container {
    position: relative;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    min-height: 100px;
}

.game-board {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.board-square {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    border: 2.4px solid #667eea;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.96em;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 1.6px 4px rgba(0, 0, 0, 0.1);
}

.board-square.current {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-color: #e17055;
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(225, 112, 85, 0.4);
}

.board-square.goal {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    border-color: #d63031;
}

.character {
    position: absolute;
    font-size: 2em;
    z-index: 10;
    transition: all 0.5s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.character.dog {
    bottom: 16px;
    left: 16px;
}

.character.cat {
    bottom: 16px;
    right: 16px;
}

.game-controls {
    margin-bottom: 16px;
}

.dice-container {
    text-align: center;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    position: sticky;
    top: 20px;
}

.dice-container h2 {
    color: #667eea;
    margin-bottom: 12px;
    font-size: 1.2em;
}

.dice-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.dice {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: transform 0.3s ease;
}

.dice:hover {
    transform: scale(1.05);
}

.dice.rolling {
    animation: roll 0.5s ease-in-out;
}

@keyframes roll {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(270deg); }
}

.dice-face {
    font-size: 2em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}


.math-problem-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.math-problem-container h2 {
    color: #667eea;
    margin-bottom: 12px;
    text-align: center;
    font-size: 1.2em;
}

.math-problem {
    font-size: 2em;
    text-align: center;
    color: #333;
    margin-bottom: 16px;
    font-weight: bold;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-input {
    text-align: center;
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6.4px;
    margin-bottom: 16px;
    max-width: 100%;
}

.number-btn {
    padding: 10px 8px;
    font-size: 1.04em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2.4px 6.4px rgba(102, 126, 234, 0.3);
}

.number-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(102, 126, 234, 0.4);
}

.number-btn:active {
    transform: translateY(0);
}

.answer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.answer-display {
    background: white;
    border: 2.4px solid #667eea;
    border-radius: 8px;
    padding: 12px;
    display: inline-block;
    min-width: 160px;
}

.answer-label {
    font-size: 0.72em;
    color: #666;
    margin-bottom: 4px;
}

.answer-value {
    font-size: 1.6em;
    font-weight: bold;
    color: #667eea;
}

.answer-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: 9.6px 24px;
    font-size: 0.96em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2.4px 6.4px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

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

.feedback {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    min-height: 32px;
    padding: 8px;
    border-radius: 8px;
    margin-top: 12px;
    transition: all 0.3s ease;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.feedback.hidden {
    opacity: 0;
    visibility: hidden;
}

.game-info {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
}

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    color: #666;
    font-size: 0.72em;
    margin-bottom: 4px;
}

.info-value {
    display: block;
    font-size: 1.44em;
    font-weight: bold;
    color: #667eea;
}

/* Win message */
.win-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 1000;
    display: none;
}

.win-message.show {
    display: block;
    animation: popIn 0.5s ease;
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.win-message h2 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 15px;
}

.win-message p {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .dice-container {
        position: relative;
        top: 0;
    }

    .dice-wrapper {
        flex-direction: row;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.6em;
    }

    .number-buttons {
        grid-template-columns: repeat(6, 1fr);
    }

    .math-problem {
        font-size: 1.6em;
    }

    .board-square {
        width: 32px;
        height: 32px;
        font-size: 0.8em;
    }
}

