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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.game-board {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* ゲーム情報 */
.game-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.info-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: transform 0.2s ease;
}

.info-card:hover {
    transform: translateY(-2px);
}

.info-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

.info-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

/* ルール説明 */
.rules-section {
    margin-bottom: 25px;
}

.rules-toggle {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rules-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.rules-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
}

.rules-content.active {
    max-height: 300px;
    padding: 20px;
}

.rules-content h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.rules-content ul {
    list-style-position: inside;
    color: #555;
    line-height: 1.8;
}

.rules-content li {
    margin-bottom: 8px;
}

/* 入力エリア */
.input-section {
    margin-bottom: 30px;
}

.input-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.digit-input {
    width: 60px;
    height: 70px;
    font-size: 2rem;
    text-align: center;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: bold;
    color: #333;
}

.digit-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.digit-input::-webkit-inner-spin-button,
.digit-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 履歴エリア */
.history-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 20px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

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

.history-guess {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    letter-spacing: 3px;
}

.history-result {
    display: flex;
    gap: 15px;
}

.result-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.hit-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.blow-badge {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    animation: scaleIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.celebration {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

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

.modal-content h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2rem;
}

.modal-content p {
    color: #666;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.answer {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin: 20px 0;
}

.answer span {
    color: #667eea;
    letter-spacing: 5px;
}

.attempts-display {
    font-size: 1.2rem;
    color: #764ba2;
    margin-bottom: 25px;
}

.play-again-btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.play-again-btn:hover {
    transform: scale(1.05);
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }

    .game-board {
        padding: 20px;
    }

    .digit-input {
        width: 50px;
        height: 60px;
        font-size: 1.5rem;
    }

    .game-info {
        grid-template-columns: 1fr;
    }

    .history-guess {
        font-size: 1.1rem;
    }

    .modal-content {
        padding: 30px 20px;
        margin: 20px;
    }
}
