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

body {
    font-family: 'Hiragino Kaku Gothic Pro', 'メイリオ', sans-serif;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    touch-action: manipulation;
}

.game-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: center;
    position: relative;
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

h1 {
    margin-bottom: 0;
    color: #333;
}

.score-board {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.score-label {
    font-size: 1rem;
    color: #555;
    margin-bottom: 5px;
}

.score-value {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

.score-divider {
    height: 40px;
    width: 1px;
    background-color: #ddd;
    margin: 0 20px;
}

.reset-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 12px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.reset-btn:hover {
    background-color: #0b7dda;
}

.coin-container {
    position: relative;
    height: 200px;
    margin: 20px auto;
    perspective: 1000px;
    cursor: pointer;
}

.coin {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
    transform-style: preserve-3d;
    transition: none;
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.heads {
    background: linear-gradient(45deg, #f8d43a, #ffc107);
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.heads::after {
    content: "表";
    color: #5a3300;
}

.tails {
    background: linear-gradient(45deg, #e6c127, #d4af37);
    transform: rotateY(180deg);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.tails::after {
    content: "裏";
    color: #5a3300;
}

.flipping {
    animation: none;
}

.instruction {
    color: #777;
    margin-top: 30px;
    font-size: 0.9rem;
}

.auto-toss-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.toss-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

#toss-count, #toss-speed {
    width: 60px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#auto-toss-btn, #stop-toss-btn {
    padding: 6px 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

#auto-toss-btn:hover, #stop-toss-btn:hover {
    background-color: #45a049;
}

#stop-toss-btn {
    background-color: #f44336;
}

#stop-toss-btn:hover {
    background-color: #d32f2f;
}

.toss-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #f1f1f1;
    border-radius: 5px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background-color: #4CAF50;
    transition: width 0.3s;
}

#toss-status {
    font-size: 0.9rem;
    color: #555;
}

.hidden {
    display: none;
}

@keyframes flip {
    0% { transform: translateY(0) rotateX(0); }
    50% { transform: translateY(-100px) rotateX(540deg); }
    100% { transform: translateY(0) rotateX(1080deg); }
}