:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
}

body {
    font-family: 'Segoe UI', system-ui;
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #f8f9fa;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    width: 95%;
    margin: 2rem auto;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.coin-wrapper {
    perspective: 1000px;
    margin: 2rem auto;
    width: 200px;
    height: 200px;
}

.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s ease-out;
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 2.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
}

.tails {
    transform: rotateY(180deg);
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
}

.flipping {
    animation: flip 1.2s cubic-bezier(0.4, 0.2, 0.2, 1);
}

@keyframes flip {
    0% { transform: rotateY(0) scale(1); }
    50% { transform: rotateY(1800deg) scale(1.1); }
    100% { transform: rotateY(3600deg) scale(1); }
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
    margin-top: 2rem;
}

.history-item {
    padding: 0.5rem;
    text-align: center;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    font-weight: bold;
}

.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    background: var(--secondary);
    color: white;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

button:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.stats {
    display: flex;
    justify-content: space-around;
    margin: 1rem 0;
    padding: 1rem;
    background: #f1f1f1;
    border-radius: 8px;
}