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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    position: relative;
}

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

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

.language-switch {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.lang-btn.active,
.lang-btn:hover {
    background: #667eea;
    color: white;
}

.game-info {
    text-align: center;
    margin-bottom: 2rem;
}

#description {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #4a5568;
}

.stats {
    font-size: 1rem;
    color: #718096;
}

.input-section {
    margin-bottom: 2rem;
}

.number-input {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

#guess-input {
    padding: 1rem;
    font-size: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    text-align: center;
    width: 150px;
    letter-spacing: 0.5rem;
    transition: border-color 0.3s ease;
}

#guess-input:focus {
    outline: none;
    border-color: #667eea;
}

#submit-btn {
    padding: 1rem 2rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 500;
}

#submit-btn:hover {
    background: #5a67d8;
}

#submit-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.number-pad {
    display: flex;
    justify-content: center;
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 200px;
}

.num-btn,
#clear-btn,
#backspace-btn {
    padding: 1rem;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.num-btn:hover,
#clear-btn:hover,
#backspace-btn:hover {
    background: #f7fafc;
    border-color: #667eea;
}

#clear-btn,
#backspace-btn {
    background: #fed7d7;
    border-color: #fc8181;
    color: #c53030;
}

#clear-btn:hover,
#backspace-btn:hover {
    background: #feb2b2;
}

.results-section {
    margin-bottom: 2rem;
}

.legend {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f7fafc;
    border-radius: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.hit-indicator,
.blow-indicator {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.hit-indicator {
    background: #48bb78;
}

.blow-indicator {
    background: #ed8936;
}

.history {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: #f7fafc;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.guess-number {
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 0.2rem;
}

.result {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.hit-count,
.blow-count {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: bold;
}

.hit-count {
    color: #48bb78;
}

.blow-count {
    color: #ed8936;
}

.new-game-btn {
    width: 100%;
    padding: 1rem;
    background: #38a169;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 500;
}

.new-game-btn:hover {
    background: #2f855a;
}

/* 勝利アニメーション */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

.celebration.hidden {
    display: none;
}

.celebration-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    position: relative;
    animation: bounceIn 0.8s ease;
}

.celebration-content h2 {
    font-size: 2.5rem;
    color: #48bb78;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.celebration-content p {
    font-size: 1.2rem;
    color: #4a5568;
}

/* 紙吹雪アニメーション */
.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.confetti::before,
.confetti::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #667eea;
    animation: confetti-fall 3s linear infinite;
}

.confetti::before {
    left: 20%;
    animation-delay: 0s;
    background: #48bb78;
}

.confetti::after {
    left: 80%;
    animation-delay: 1s;
    background: #ed8936;
}

/* 花火アニメーション */
.fireworks {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: firework 2s ease-out infinite;
}

.firework:nth-child(1) {
    top: 20%;
    left: 30%;
    background: #667eea;
    animation-delay: 0.5s;
}

.firework:nth-child(2) {
    top: 30%;
    left: 70%;
    background: #48bb78;
    animation-delay: 1s;
}

.firework:nth-child(3) {
    top: 50%;
    left: 50%;
    background: #ed8936;
    animation-delay: 1.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes firework {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(20);
        opacity: 0.5;
    }
    100% {
        transform: scale(40);
        opacity: 0;
    }
}

/* レスポンシブデザイン */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .number-input {
        flex-direction: column;
        align-items: center;
    }
    
    #guess-input {
        width: 100%;
        max-width: 200px;
        margin-bottom: 1rem;
    }
    
    .legend {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .celebration-content {
        padding: 2rem;
        margin: 1rem;
    }
    
    .celebration-content h2 {
        font-size: 2rem;
    }
}
