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

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

/* Animated background circles */
.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s infinite ease-in-out;
}

.bg-circle:nth-child(1) {
    width: 300px;
    height: 300px;
    top: -150px;
    left: -150px;
    animation-delay: 0s;
}

.bg-circle:nth-child(2) {
    width: 200px;
    height: 200px;
    bottom: -100px;
    right: -100px;
    animation-delay: 2s;
}

.bg-circle:nth-child(3) {
    width: 150px;
    height: 150px;
    top: 50%;
    right: 10%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-30px) rotate(120deg); }
    66% { transform: translateY(20px) rotate(240deg); }
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 100;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background: rgba(255, 255, 255, 0.3);
}

.info-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 100;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.info-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
}

/* Info Modal */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeInModal 0.3s ease-out;
    overflow-y: auto;
    padding: 20px;
}

.info-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.5s ease-out;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.info-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.info-close:hover {
    transform: scale(1.1) rotate(90deg);
    background: #ee5a6f;
}

.info-content h2 {
    color: #667eea;
    text-align: center;
    margin-bottom: 25px;
    font-size: 2em;
}

.info-section {
    margin-bottom: 25px;
}

.info-section h3 {
    color: #764ba2;
    margin-bottom: 12px;
    font-size: 1.3em;
}

.info-section p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.info-section ol {
    color: #666;
    line-height: 1.8;
    padding-left: 25px;
}

.info-section ol li {
    margin-bottom: 8px;
}

.score-formula {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1em;
    margin: 15px 0;
}

.score-example {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.05em;
    color: #333;
    margin: 10px 0;
}

.score-tip {
    background: linear-gradient(135deg, #ffd89b, #19547b);
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95em;
    margin-top: 15px;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    position: relative;
    z-index: 10;
    animation: slideIn 0.5s ease-out;
}

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

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

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95em;
}

/* Difficulty Selection */
.difficulty-section {
    margin-bottom: 30px;
}

.difficulty-title {
    text-align: center;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.difficulty-btn {
    padding: 15px 10px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: bold;
}

.difficulty-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.difficulty-btn.easy {
    border-color: #4ecdc4;
    color: #4ecdc4;
}

.difficulty-btn.easy.selected {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    border-color: #4ecdc4;
}

.difficulty-btn.medium {
    border-color: #f9ca24;
    color: #f9ca24;
}

.difficulty-btn.medium.selected {
    background: linear-gradient(135deg, #f9ca24, #f0932b);
    color: white;
    border-color: #f9ca24;
}

.difficulty-btn.hard {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.difficulty-btn.hard.selected {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border-color: #ff6b6b;
}

.difficulty-btn .diff-label {
    font-size: 1em;
    display: block;
    margin-bottom: 5px;
}

.difficulty-btn .diff-details {
    font-size: 0.75em;
    opacity: 0.8;
}

.difficulty-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    margin-bottom: 15px;
}

.difficulty-badge.easy {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
}

.difficulty-badge.medium {
    background: linear-gradient(135deg, #f9ca24, #f0932b);
    color: white;
}

.difficulty-badge.hard {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
}

/* High Score Display */
.high-score-section {
    background: linear-gradient(135deg, #ffd89b, #19547b);
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.high-score-label {
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.high-score-value {
    font-size: 2em;
    font-weight: bold;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 1s linear;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.game-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.info-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 20px 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.info-item:hover {
    transform: translateY(-5px);
}

.info-label {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
}

.guess-history {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.guess-history-title {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

#historyItems {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.history-item {
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.input-group {
    margin-bottom: 20px;
}

input[type="number"] {
    width: 100%;
    padding: 18px;
    font-size: 1.2em;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

button {
    width: 100%;
    padding: 18px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hint {
    margin-top: 20px;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease-out;
}

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

.hint.too-high {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

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

.hint.correct {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

footer {
    margin-top: 30px;
    text-align: center;
    color: #999;
    font-size: 0.9em;
}

/* Celebration Modal */
.celebration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeInModal 0.3s ease-out;
}

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

.celebration-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: bounceIn 0.6s ease-out;
    position: relative;
    max-width: 400px;
    width: 90%;
}

.celebration-content.game-over {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

@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; }
}

.celebration-content h2 {
    color: white;
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.celebration-content p {
    color: white;
    font-size: 1.3em;
    margin-bottom: 10px;
}

.celebration-stats {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.stat-item {
    color: white;
    font-size: 1.1em;
    margin: 10px 0;
}

.new-high-score {
    background: linear-gradient(135deg, #ffd89b, #19547b);
    padding: 10px 20px;
    border-radius: 20px;
    margin: 15px 0;
    font-size: 1em;
    color: white;
    font-weight: bold;
    animation: pulse 1s infinite;
}

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

.celebration-content button {
    margin-top: 20px;
    padding: 15px 40px;
    font-size: 1.1em;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.celebration-content button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.4);
}

/* Confetti */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #f0f;
    position: absolute;
    animation: confetti-fall 3s linear forwards;
}

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

.firework {
    position: fixed;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    animation: explode 1s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y));
        opacity: 0;
    }
}

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.dark-mode .container {
    background: rgba(30, 30, 46, 0.95);
    color: #e0e0e0;
}

body.dark-mode h1 {
    color: #9d9dff;
}

body.dark-mode .subtitle,
body.dark-mode .info-label {
    color: #b0b0b0;
}

body.dark-mode .info-item {
    background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
}

body.dark-mode .info-value {
    color: #9d9dff;
}

body.dark-mode .guess-history {
    background: #1a1a2e;
}

body.dark-mode input[type="number"] {
    background: #2d2d44;
    color: #e0e0e0;
    border-color: #3d3d5c;
}

body.dark-mode .history-item,
body.dark-mode .difficulty-btn {
    background: #2d2d44;
    color: #e0e0e0;
}

body.dark-mode footer {
    color: #666;
}

body.dark-mode .info-content {
    background: rgba(30, 30, 46, 0.98);
    color: #e0e0e0;
}

body.dark-mode .info-content h2 {
    color: #9d9dff;
}

body.dark-mode .info-section h3 {
    color: #b19cd9;
}

body.dark-mode .info-section p,
body.dark-mode .info-section ol,
body.dark-mode .info-section ol li {
    color: #b0b0b0;
}

body.dark-mode .score-example {
    background: #2d2d44;
    color: #e0e0e0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 25px;
        border-radius: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
        top: 15px;
        right: 15px;
    }

    .info-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
        top: 15px;
        left: 15px;
    }

    .info-content {
        padding: 30px 20px;
        max-height: 85vh;
    }

    .info-content h2 {
        font-size: 1.6em;
    }

    .info-section h3 {
        font-size: 1.1em;
    }

    .score-formula {
        font-size: 1em;
        padding: 12px 15px;
    }

    .difficulty-buttons {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .difficulty-btn {
        padding: 18px 15px;
    }

    .game-info {
        gap: 10px;
    }

    .info-item {
        padding: 15px 8px;
    }

    .info-label {
        font-size: 0.65em;
    }

    .info-value {
        font-size: 1.5em;
    }

    input[type="number"] {
        padding: 16px;
        font-size: 1.1em;
    }

    button {
        padding: 16px;
        font-size: 1.1em;
    }

    .celebration-content {
        padding: 30px 20px;
    }

    .celebration-content h2 {
        font-size: 2em;
    }

    .celebration-content p {
        font-size: 1.1em;
    }

    .stat-item {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8em;
    }

    .info-value {
        font-size: 1.3em;
    }

    .high-score-value {
        font-size: 1.5em;
    }
}

/* Landscape mode on mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        padding: 20px;
    }

    .game-info {
        margin-bottom: 20px;
    }

    .guess-history {
        margin-bottom: 20px;
    }
}
