* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 95%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 2rem;
}

.mode-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    background-color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background-color: #4CAF50;
    color: white;
}

.mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.problem-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
}

.multiplication-grid {
    font-size: 2rem;
    font-family: monospace;
    border-collapse: collapse;
    margin: 0 auto;
}

.multiplication-grid td {
    padding: 0.25rem 0;
    text-align: right;
    vertical-align: middle;
}

.number-row {
    white-space: nowrap;
}

.spacer {
    width: 2ch;
}

.operation {
    font-size: 1.5rem;
    text-align: right;
    padding-right: 1ch;
}

.digit {
    display: inline-block;
    width: 1ch;
    cursor: pointer;
    user-select: none;
    text-align: center;
}

.digit.selectable {
    color: #2196F3;
}

.digit.selected {
    color: #4CAF50;
}

.digit.incorrect {
    animation: shake 0.2s ease-in-out 0s 2;
    color: #ff0000;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

.horizontal-line {
    height: 2px;
    background-color: #333;
    width: 100%;
    margin: 0.25rem 0;
}

.carry-row td {
    height: 1.5rem;
    vertical-align: bottom;
}

.digit-input {
    width: 1ch;
    height: 1.5em;
    font-size: inherit;
    padding: 0;
    text-align: center;
    border: 1px solid #ccc;
    font-family: inherit;
    background: transparent;
    margin: 0 0.25ch;
}

.digit-input:focus {
    outline: none;
    border-color: #2196F3;
}

.digit-input.carry {
    font-size: 0.8em;
    height: 1.2em;
    color: #666;
    cursor: pointer;
}

.digit-input.carry.crossed {
    text-decoration: line-through;
    color: #999;
}

.digit-input.carry.filled:not(.crossed) {
    border-color: transparent;
}

.digit-input:disabled {
    background: transparent;
    border-color: transparent;
    color: inherit;
}

.digit-input.correct {
    background-color: #e6ffe6;
    border-color: #4CAF50;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.control-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    background-color: #2196F3;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background-color: #1976D2;
}

.message {
    text-align: center;
    margin: 1rem 0 2rem 0;
    min-height: 2rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: #2196F3;
    background-color: #e3f2fd;
    padding: 0.75rem;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
    transition: all 0.3s ease;
}

.message:empty {
    display: none;
}

.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.splash-screen.active {
    display: flex;
}

.splash-content {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
}

.splash-content h2 {
    color: #4CAF50;
    margin-bottom: 1rem;
}

.splash-content button {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.splash-content button:hover {
    background-color: #388E3C;
}

.final-answer {
    margin-top: 0.5rem;
    display: grid;
    grid-auto-flow: column;
    gap: 1ch;
    justify-content: end;
    min-height: 2.5rem;
    margin-left: 3ch;
} 