
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Arial", "Noto Sans JP", sans-serif;
    background: #111323;
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 共通 */

.step-label {
    color: #9b8cff;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

h1, h2 {
    font-weight: 700;
}

/* ホーム画面 */

#homeScreen {
    background:
        radial-gradient(circle at 50% 35%, #292c50 0%, #111323 65%);
}

.home-content {
    width: 100%;
    max-width: 480px;
    padding: 30px 24px;
    text-align: center;
}

.music-icon {
    font-size: 70px;
    color: #a99aff;
    margin-bottom: 15px;
}

.home-content h1 {
    font-size: 32px;
    letter-spacing: 2px;
}

.subtitle {
    color: #a5a8bd;
    margin-top: 12px;
    font-size: 14px;
}

.difficulty-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 45px;
}

.difficulty-button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 24px;
    border-radius: 15px;
    color: white;
    text-align: left;
    transition: transform 0.2s, filter 0.2s;
}

.difficulty-button:hover {
    transform: translateY(-3px);
    filter: brightness(1.15);
}

.difficulty-button:active {
    transform: scale(0.98);
}

.difficulty-name {
    font-size: 21px;
    font-weight: bold;
}

.difficulty-detail {
    font-size: 13px;
    margin-top: 5px;
    opacity: 0.8;
}

.easy {
    background: linear-gradient(120deg, #277d91, #35a8a0);
}

.normal {
    background: linear-gradient(120deg, #6552ad, #8c68d4);
}

.hard {
    background: linear-gradient(120deg, #a84b68, #dc637c);
}

.expert {
    background: linear-gradient(120deg, #a66b27, #e0a343);
}

/* 音を聞く画面 */

#listenScreen {
    background:
        radial-gradient(circle at 50% 40%, #292c50 0%, #111323 70%);
}

.listen-content {
    width: 100%;
    max-width: 500px;
    padding: 30px 24px;
    text-align: center;
}

.listen-content h2 {
    font-size: 25px;
    margin-bottom: 15px;
}

#listenDifficulty {
    color: #a99aff;
    margin-bottom: 45px;
}

.play-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 220px;
    height: 70px;
    margin: 0 auto;
    border-radius: 50px;
    background: linear-gradient(120deg, #8068e9, #a58aff);
    color: white;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 8px 30px #8068e955;
    transition: 0.2s;
}

.play-button:hover {
    transform: scale(1.05);
}

.play-icon {
    font-size: 22px;
}

.hint {
    color: #85899f;
    font-size: 12px;
    margin-top: 25px;
}

/* 回答画面 */

#gameScreen {
    background: #171a2e;
}

.game-content {
    width: 100%;
    max-width: 700px;
    padding: 24px 18px;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.game-header h2 {
    font-size: 20px;
}

.timer-area {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    color: #aeb1c6;
    font-size: 13px;
}

.timer-area strong {
    font-size: 28px;
    color: #ffffff;
    min-width: 30px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.timer-warning {
    color: #ff657e !important;
}

.game-description {
    color: #a5a8bd;
    font-size: 13px;
    margin-top: 18px;
}

.selection-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 25px;
    margin-bottom: 15px;
    color: #aeb1c6;
    font-size: 14px;
}

.selection-info strong {
    color: #a99aff;
    font-size: 18px;
}

/* ピアノ */

.piano-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 5px 0;
}

.piano {
    position: relative;
    display: flex;
    width: 100%;
    height: clamp(180px, 30vh, 260px);
    background: #080910;
    border: 5px solid #080910;
    border-radius: 8px;
    overflow: hidden;
    user-select: none;
    touch-action: manipulation;
}

/* 白鍵 */

.white-key {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 100%;
    background: linear-gradient(
        to bottom,
        #ffffff 0%,
        #eeeeee 80%,
        #d5d5d5 100%
    );
    border-right: 1px solid #c3c3c3;
    border-radius: 0 0 5px 5px;
    color: #555;
    z-index: 1;
    transition: background 0.1s;
}

.white-key:last-of-type {
    border-right: none;
}

.white-key span {
    position: absolute;
    bottom: 12px;
    left: 0;
    width: 100%;
    font-size: clamp(10px, 2vw, 15px);
    font-weight: bold;
    pointer-events: none;
}

.white-key.selected {
    background: linear-gradient(
        to bottom,
        #c6baff,
        #9076ee
    );
    color: #ffffff;
}

/* 黒鍵 */

.black-key {
    position: absolute;
    top: 0;
    width: 8%;
    height: 60%;
    transform: translateX(-50%);
    background: linear-gradient(
        to right,
        #111111,
        #383838 50%,
        #111111
    );
    border: 1px solid #050505;
    border-radius: 0 0 5px 5px;
    z-index: 2;
    box-shadow: 0 4px 5px #00000066;
}

.black-key.selected {
    background: linear-gradient(
        to bottom,
        #a99aff,
        #6950c9
    );
}

/* 確定ボタン */

.game-footer {
    text-align: center;
    margin-top: 25px;
}

.confirm-button {
    width: 250px;
    max-width: 100%;
    padding: 16px;
    border-radius: 50px;
    background: linear-gradient(120deg, #8068e9, #a58aff);
    color: white;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 5px 20px #8068e944;
}

.confirm-button:hover:not(:disabled) {
    filter: brightness(1.15);
}

.footer-hint {
    color: #777c95;
    font-size: 11px;
    margin-top: 12px;
}

/* 結果画面 */

#resultScreen {
    background:
        radial-gradient(circle at 50% 35%, #292c50 0%, #111323 70%);
}

.result-content {
    width: 100%;
    max-width: 450px;
    padding: 30px 24px;
    text-align: center;
}

.result-icon {
    font-size: 65px;
    margin-bottom: 15px;
}

.result-content h2 {
    font-size: 28px;
}

.score-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 30px 0;
}

.score-area span:first-child {
    color: #a5a8bd;
    font-size: 14px;
}

.score-area strong {
    color: #b5a5ff;
    font-size: 65px;
    line-height: 1.2;
    margin: 8px 0;
}

.score-area span:last-child {
    color: #85899f;
    font-size: 12px;
    letter-spacing: 3px;
}

.result-details {
    background: #ffffff0c;
    border: 1px solid #ffffff15;
    border-radius: 12px;
    padding: 10px 20px;
    margin-bottom: 30px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 13px 0;
    border-bottom: 1px solid #ffffff12;
    font-size: 13px;
    text-align: left;
}

.result-row:last-child {
    border-bottom: none;
}

.result-row span {
    color: #a5a8bd;
}

.result-row strong {
    text-align: right;
    word-break: break-word;
}

.home-button {
    width: 220px;
    padding: 16px;
    border-radius: 50px;
    background: #ffffff18;
    border: 1px solid #ffffff35;
    color: white;
    font-size: 15px;
    font-weight: bold;
}

.home-button:hover {
    background: #ffffff30;
}

/* スマートフォン縦向き */

@media screen and (max-width: 600px) {
    .home-content {
        padding: 24px 20px;
    }

    .home-content h1 {
        font-size: 27px;
    }

    .music-icon {
        font-size: 55px;
        margin-bottom: 10px;
    }

    .difficulty-area {
        gap: 10px;
        margin-top: 30px;
    }

    .difficulty-button {
        padding: 15px 20px;
    }

    .difficulty-name {
        font-size: 19px;
    }

    .difficulty-detail {
        font-size: 12px;
    }

    .game-content {
        padding: 18px 12px;
    }

    .game-header h2 {
        font-size: 16px;
    }

    .game-description {
        margin-top: 12px;
        font-size: 12px;
    }

    .selection-info {
        margin-top: 20px;
        margin-bottom: 12px;
    }

    .piano-wrapper {
        width: 100%;
        padding: 0;
    }

    .piano {
        height: clamp(190px, 29vh, 250px);
    }

    .white-key span {
        font-size: 11px;
        bottom: 10px;
    }

    .black-key {
        width: 8%;
        height: 58%;
    }

    .game-footer {
        margin-top: 20px;
    }

    .confirm-button {
        width: 100%;
        max-width: 320px;
        padding: 15px;
    }

    .footer-hint {
        margin-top: 8px;
    }

    .result-content {
        padding: 24px 18px;
    }

    .result-icon {
        font-size: 50px;
    }

    .score-area {
        margin: 22px 0;
    }

    .score-area strong {
        font-size: 55px;
    }
}

/* 小さいスマートフォン */

@media screen and (max-width: 380px) {
    .game-content {
        padding: 14px 8px;
    }

    .game-header h2 {
        font-size: 14px;
    }

    .timer-area {
        font-size: 11px;
    }

    .timer-area strong {
        font-size: 24px;
    }

    .piano {
        height: 190px;
    }

    .white-key span {
        font-size: 9px;
    }

    .black-key {
        width: 8.5%;
    }
}
