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

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Yu Gothic', sans-serif;
    background: linear-gradient(135deg, #fc466b 0%, #3f5efb 100%);
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding: 20px;
}

.game-container {
    width: 100%;
    max-width: 700px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.screen {
    display: none;
    animation: fadeIn 0.5s;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* タイトル画面 */
.game-title {
    text-align: center;
    margin-bottom: 20px;
}

.title-main {
    display: block;
    font-size: 48px;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5),
                 0 0 40px rgba(252, 70, 107, 0.5);
    letter-spacing: 4px;
}

.title-sub {
    display: block;
    font-size: 16px;
    letter-spacing: 8px;
    margin-top: 10px;
    opacity: 0.8;
}

.game-description {
    text-align: center;
    margin-bottom: 40px;
    font-size: 18px;
    opacity: 0.9;
}

.mode-selection h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mode-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    color: #fff;
    text-align: left;
}

.mode-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.mode-name {
    display: block;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.mode-desc {
    display: block;
    font-size: 14px;
    opacity: 0.8;
}

/* ゲーム画面 */
.game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 10px;
}

.stat {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
}

.board-container {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#board {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.controls {
    text-align: center;
    margin-bottom: 20px;
}

.roll-btn {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    border: none;
    border-radius: 15px;
    padding: 20px 40px;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.roll-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.roll-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 28px;
}

.dice-result {
    margin-top: 15px;
    font-size: 48px;
    font-weight: bold;
    min-height: 60px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.event-message {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    font-size: 18px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-message.good {
    background: rgba(74, 222, 128, 0.3);
    border: 2px solid rgba(74, 222, 128, 0.5);
}

.event-message.bad {
    background: rgba(248, 113, 113, 0.3);
    border: 2px solid rgba(248, 113, 113, 0.5);
}

/* 結果画面 */
.result-title {
    text-align: center;
    font-size: 36px;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.result-stats {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
}

.result-stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-stat:last-child {
    border-bottom: none;
}

.result-stat.high-score {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.2));
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

.result-stat.high-score .result-value {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.result-label {
    font-size: 18px;
    opacity: 0.8;
}

.result-value {
    font-size: 24px;
    font-weight: bold;
}

.result-rank {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.rank-label {
    display: block;
    font-size: 18px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.rank-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

.retry-btn,
.back-btn {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.retry-btn {
    background: linear-gradient(135deg, #fc466b 0%, #3f5efb 100%);
    color: #fff;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.retry-btn:hover,
.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .title-main {
        font-size: 36px;
    }

    #board {
        width: 100%;
    }
}

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

    .roll-btn {
        padding: 15px 30px;
        font-size: 18px;
    }

    .dice-result {
        font-size: 36px;
    }
}
