* {
    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;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    max-width: 1200px;
    width: 90%;
    margin: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

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

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

.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

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

label {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
}

select {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:hover {
    border-color: #cbd5e0;
}

select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

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

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

.roll-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-icon {
    font-size: 1.5rem;
}

.canvas-container {
    width: 100%;
    height: 500px;
    position: relative;
    background: #f7fafc;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

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

.results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-item {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.result-label {
    display: block;
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 0.5rem;
}

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #4a5568;
}

.result-value.total {
    color: #667eea;
    font-size: 2.5rem;
}

.history {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
}

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

.history-results {
    color: #4a5568;
    font-weight: 500;
}

.history-total {
    color: #667eea;
    font-weight: 700;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

footer p {
    color: #718096;
    font-size: 0.9rem;
}

footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #764ba2;
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        width: 100%;
    }
    
    .dice-selector, .dice-type {
        width: 100%;
    }
    
    select {
        width: 100%;
    }
    
    .canvas-container {
        height: 400px;
    }
    
    .results {
        grid-template-columns: 1fr;
    }
    
    .history-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}