/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
        sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2d3748;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
    position: relative;
}

.bagel-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    animation: float 3s ease-in-out infinite;
}

.bagel-logo:first-child {
    animation-delay: -1.5s;
}

.title-section h1 {
    font-size: 3.5rem;
    font-weight: 900;
    color: #2d3748;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.1rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.3rem;
    color: #718096;
    font-weight: 400;
    opacity: 0.8;
}

/* Game Area */
.game-area {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Difficulty Section */
.difficulty-section {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.difficulty-toggle {
    display: inline-block;
}

.toggle-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.difficulty-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    transition: all 0.3s ease;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-slider {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

.toggle-input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.difficulty-description {
    font-size: 0.95rem;
    color: #718096;
    text-align: center;
    transition: all 0.3s ease;
}

/* Rules Section */
.rules-section {
    margin-bottom: 3rem;
}

.rules-section h2 {
    color: #2d3748;
    margin-bottom: 2rem;
    font-size: 1.8rem;
    text-align: center;
    font-weight: 700;
}

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

.rule-card {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.rule-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.rule-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.rule-card h3 {
    color: #2d3748;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.rule-card p {
    color: #4a5568;
    line-height: 1.5;
}

/* Clues Explanation */
.clues-explanation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.clue-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.clue-badge {
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.clue-item.fermi .clue-badge {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.clue-item.pico .clue-badge {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.clue-item.bagels .clue-badge {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.clue-text {
    color: #4a5568;
    font-weight: 500;
    flex: 1;
}

/* Example Section Container */
.example-section-container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Example Section */
.example-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.example-section h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
}

.example-intro {
    color: #4a5568;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
}

.example-game {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.example-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f7fafc;
    border-radius: 12px;
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.example-guess {
    font-weight: 600;
    color: #2d3748;
}

.example-hidden {
    color: #a0aec0;
    font-style: italic;
    font-size: 0.9rem;
}

.example-result {
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.example-result.bagels {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.example-result.pico {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.example-result.mixed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.example-result.winner {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #744210;
    animation: pulse 2s infinite;
}

.example-explanation {
    color: #4a5568;
    line-height: 1.6;
    text-align: center;
    font-style: italic;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Game Controls */
.game-controls {
    text-align: center;
    margin-bottom: 3rem;
}

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

.input-label {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

#guessInput {
    font-size: 2rem;
    padding: 1rem 1.5rem;
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    text-align: center;
    letter-spacing: 0.5rem;
    width: 160px;
    background: white;
    font-weight: 700;
    color: #2d3748;
    transition: all 0.3s ease;
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
}

#guessInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
    transform: scale(1.02);
}

#guessInput::placeholder {
    color: #a0aec0;
    opacity: 0.7;
}

button {
    font-size: 1rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

#submitGuess {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
}

#submitGuess:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.4);
}

#submitGuess:active {
    transform: translateY(0);
}

#submitGuess:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.new-game-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
}

.new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(72, 187, 120, 0.4);
}

/* Game Status */
.game-status {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

#statusMessage {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
}

.game-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    color: #718096;
}

.separator {
    opacity: 0.5;
}

/* Game History */
.game-history h3 {
    color: #2d3748;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
}

#guessHistory {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 16px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.empty-message {
    text-align: center;
    color: #a0aec0;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.guess-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.8rem;
    background: white;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    animation: slideIn 0.4s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.guess-item:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.guess-number {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.2rem;
    color: #2d3748;
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
}

.guess-result {
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.result-fermi {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.result-pico {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.result-bagels {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.result-winner {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #744210;
    animation: pulse 2s infinite;
    font-size: 1.1rem;
    padding: 0.6rem 1.2rem;
}

/* Tips Section */
.tips-section {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tips-details summary {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    cursor: pointer;
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    list-style: none;
    text-align: center;
}

.tips-details summary::-webkit-details-marker {
    display: none;
}

.tips-details summary:hover {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.tips-content {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.tip-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tip-card h4 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.tip-card ul {
    list-style: none;
    padding: 0;
}

.tip-card li {
    color: #4a5568;
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
    position: relative;
    line-height: 1.5;
}

.tip-card li::before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

kbd {
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
    font-family: monospace;
}

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

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

@keyframes float {
    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

/* Custom Scrollbar */
#guessHistory::-webkit-scrollbar {
    width: 6px;
}

#guessHistory::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#guessHistory::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

#guessHistory::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
    }

    .bagel-logo {
        width: 60px;
        height: 60px;
    }

    .title-section h1 {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .game-area,
    .example-section-container {
        padding: 1.5rem;
    }

    .example-section {
        padding: 1.5rem;
    }

    .toggle-label {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .difficulty-text {
        font-size: 1.1rem;
    }

    .rules-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .clues-explanation {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .input-group {
        flex-direction: column;
        gap: 1rem;
    }

    #guessInput {
        width: 140px;
        font-size: 1.8rem;
        padding: 0.8rem 1rem;
    }

    button {
        width: 100%;
        max-width: 280px;
        padding: 1rem;
    }

    .example-line {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .guess-item {
        flex-direction: column;
        gap: 0.8rem;
        text-align: center;
        padding: 1.2rem;
    }

    .tips-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .game-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .title-section h1 {
        font-size: 2rem;
    }

    .game-area,
    .tips-section,
    .example-section-container {
        padding: 1rem;
    }

    .header-content {
        padding: 1rem;
    }

    .toggle-label {
        flex-direction: column;
        gap: 0.8rem;
    }

    #guessInput {
        width: 120px;
        font-size: 1.6rem;
        letter-spacing: 0.3rem;
    }

    .guess-number {
        font-size: 1.2rem;
    }

    #guessHistory {
        max-height: 250px;
    }
}
