* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', Arial, sans-serif;
    background-color: #666;
    color: white;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.screen {
    display: none;
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* タイトル画面 */
#title-screen h1 {
    font-size: 4rem;
    margin-bottom: 3rem;
    font-weight: bold;
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.main-button {
    background-color: #ccc;
    color: #333;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    min-width: 200px;
}

.main-button:hover {
    background-color: #bbb;
}

.settings-display {
    font-size: 1.2rem;
    text-align: center;
}

/* ゲーム画面 */
.problem-display {
    margin-bottom: 2rem;
}

#problem-text {
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
}

.soroban-container {
    margin-bottom: 2rem;
}

.soroban {
    display: flex;
    justify-content: center;
    align-items: center;
}

.soroban-frame {
    background-color: #888;
    border: 4px solid #555;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upper-beads,
.lower-beads {
    display: flex;
    gap: 5px;
}

.column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 60px;
}

.divider {
    height: 4px;
    background-color: #555;
    margin: 5px 0;
}

.bead {
    width: 40px;
    height: 25px;
    background-color: #e6e6e6;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #ccc;
    position: relative;
}

.bead:hover {
    background-color: #ddd;
}

.bead.active {
    background-color: #ffeb3b;
    border-color: #fbc02d;
}

.upper-bead {
    margin-bottom: 10px;
}

.lower-bead {
    margin-bottom: 5px;
}

.timer-display {
    font-size: 1.5rem;
    text-align: center;
}

/* 結果画面 */
#result-screen h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
}

.result-info {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 3rem;
}

.result-info p {
    margin-bottom: 1rem;
}

/* 設定画面 */
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 400px;
}

.setting-item label {
    font-size: 1.5rem;
    font-weight: bold;
    min-width: 120px;
}

.number-input {
    display: flex;
    align-items: center;
    background-color: white;
    border-radius: 5px;
    overflow: hidden;
}

.number-input input {
    border: none;
    padding: 10px 15px;
    font-size: 1.2rem;
    text-align: center;
    color: #333;
    width: 60px;
    background: transparent;
}

.number-input input:focus {
    outline: none;
}

.spinner {
    display: flex;
    flex-direction: column;
}

.spinner-btn {
    background-color: #888;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.3s;
}

.spinner-btn:hover {
    background-color: #777;
}

.operation-buttons {
    display: flex;
    gap: 10px;
}

.operation-btn {
    background-color: #888;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.operation-btn:hover {
    background-color: #777;
}

.operation-btn.active {
    background-color: white;
    color: #333;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #title-screen h1 {
        font-size: 3rem;
    }

    #problem-text {
        font-size: 2rem;
    }

    .bead {
        width: 30px;
        height: 20px;
    }

    .column {
        width: 45px;
    }

    .main-button {
        font-size: 1.2rem;
        padding: 0.8rem 2rem;
    }

    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .setting-item label {
        min-width: auto;
    }
}

/* アニメーション */
@keyframes correct {
    0% {
        background-color: #ffeb3b;
    }

    50% {
        background-color: #4caf50;
    }

    100% {
        background-color: #ffeb3b;
    }
}

.bead.correct-animation {
    animation: correct 0.5s ease-in-out;
}

/* 正解時のハイライト */
.problem-display.correct {
    color: #ff5722;
}

.problem-display.correct #problem-text::after {
    content: " = " attr(data-answer);
    color: #ff5722;
}