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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    padding: 20px;
    user-select: none;
}

.game-container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

h1 {
    text-align: center;
    color: #4a5568;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #dee2e6;
}

.info-item {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.info-label {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 600;
}

.info-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #495057;
}

.mode-selector {
    margin-bottom: 30px;
    text-align: center;
}

.mode-selector h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 15px;
    border: 3px solid #dee2e6;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: #007bff;
}

.mode-btn.active {
    border-color: #007bff;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.mode-btn span {
    font-size: 2em;
    display: block;
    margin-bottom: 5px;
}

.mode-btn div {
    font-weight: bold;
    margin-bottom: 3px;
}

.mode-btn small {
    font-size: 0.8em;
    opacity: 0.8;
}

.game-board {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
}

.target-display {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border: 2px solid #dee2e6;
}

.number-placeholder {
    font-size: 1.3em;
    color: #495057;
    font-weight: 600;
}

.timer-display {
    margin-top: 10px;
    font-size: 1.1em;
    color: #dc3545;
    font-weight: bold;
}

.input-section {
    text-align: center;
    margin-bottom: 25px;
}

.guess-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

#guessInput, #mastermindGuess {
    padding: 12px 20px;
    font-size: 1.2em;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
    min-width: 150px;
    transition: border-color 0.3s ease;
}

#guessInput:focus, #mastermindGuess:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.mastermind-input {
    margin-top: 15px;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.hint-display {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
}

.hint-message {
    font-size: 1.1em;
    font-weight: 600;
    color: #856404;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.controls button {
    background: linear-gradient(135deg, #007bff, #0056b3);
    min-width: 100px;
}

.controls button:hover {
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
}

.history-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
}

.history-panel h3 {
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2em;
}

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

.empty-history {
    text-align: center;
    color: #6c757d;
    padding: 20px;
    font-style: italic;
}

.history-item {
    background: white;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guess-info {
    font-weight: bold;
    color: #495057;
}

.guess-result {
    font-weight: 600;
}

.guess-result.too-high {
    color: #dc3545;
}

.guess-result.too-low {
    color: #17a2b8;
}

.guess-result.correct {
    color: #28a745;
}

/* 弹窗样式 */
.victory-popup, .stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.victory-popup.show, .stats-modal.show {
    display: flex;
}

.victory-content, .stats-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.victory-content h2, .stats-content h2 {
    color: #28a745;
    margin-bottom: 20px;
    font-size: 2em;
}

.victory-stats, .stats-grid {
    margin-bottom: 20px;
    text-align: left;
}

.victory-stats div, .stats-grid div {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.victory-stats div:last-child, .stats-grid div:last-child {
    border-bottom: none;
}

.victory-actions, .stats-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.instructions {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
}

.instructions h3 {
    color: #495057;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3em;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.instruction-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #dee2e6;
}

.instruction-card h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.instruction-card p {
    color: #6c757d;
    line-height: 1.5;
    font-size: 0.95em;
}

.tips-section {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #2196f3;
}

.tips-section h4 {
    color: #1565c0;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.tips-section ul {
    list-style: none;
    padding: 0;
}

.tips-section li {
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
    color: #1976d2;
    line-height: 1.4;
}

.tips-section li::before {
    content: "💡";
    position: absolute;
    left: 0;
    top: 0;
}

.tips-section strong {
    color: #0d47a1;
}

/* 动画效果 */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.victory-content.show {
    animation: bounce 0.6s ease-out;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

.mode-btn.active {
    animation: pulse 2s infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .game-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
    
    .mode-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .guess-input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .controls button {
        width: 200px;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .game-info {
        grid-template-columns: 1fr;
    }
    
    .info-item {
        padding: 8px;
    }
    
    .victory-content, .stats-content {
        padding: 20px;
        margin: 20px;
    }
}