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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    color: #718096;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.controls {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
}

.dice-selector, .dice-count {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

select, input[type="number"] {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    min-width: 150px;
}

select:hover, input[type="number"]:hover {
    border-color: #cbd5e0;
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.roll-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.roll-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.roll-button:active {
    transform: translateY(0);
}

.roll-icon {
    font-size: 1.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.canvas-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    height: 500px;
}

#diceCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: #718096;
    font-weight: 500;
}

.results {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.results h2 {
    color: #4a5568;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.result-display {
    text-align: center;
    padding: 2rem;
    background: #f7fafc;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.waiting {
    color: #a0aec0;
    font-size: 1.2rem;
}

.rolling {
    color: #667eea;
    font-size: 1.5rem;
    font-weight: 600;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.dice-results {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.dice-result {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
    animation: resultPop 0.5s ease-out;
}

@keyframes resultPop {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.total {
    font-size: 1.3rem;
    color: #4a5568;
}

.total strong {
    color: #667eea;
    font-size: 2rem;
}

.history {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e2e8f0;
}

.history h3 {
    color: #4a5568;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

#historyList {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

#historyList li {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: #f7fafc;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    0% { 
        opacity: 0;
        transform: translateX(-20px);
    }
    100% { 
        opacity: 1;
        transform: translateX(0);
    }
}

.history-time {
    color: #718096;
    font-size: 0.85rem;
}

.history-type {
    color: #667eea;
    font-weight: 600;
}

.history-results {
    color: #4a5568;
    flex-grow: 1;
}

.history-total {
    color: #4a5568;
    font-weight: 600;
}

.features {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.features h2 {
    color: #4a5568;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.features ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.features li {
    padding: 1rem;
    background: #f7fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: #4a5568;
    transition: all 0.3s ease;
}

.features li:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

footer p {
    color: #718096;
    margin-bottom: 1rem;
}

.language-selector {
    display: inline-block;
}

.language-selector select {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .controls {
        padding: 1.5rem;
    }
    
    .roll-button {
        width: 100%;
        justify-content: center;
    }
    
    .canvas-container {
        height: 400px;
    }
    
    .dice-result {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .features ul {
        grid-template-columns: 1fr;
    }
}

/* スクロールバーのスタイリング */
#historyList::-webkit-scrollbar {
    width: 6px;
}

#historyList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#historyList::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

#historyList::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}