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

body {
    font-family: 'Inter', sans-serif;
    background-color: #FEEFDF;
    background-image: 
        linear-gradient(rgba(0,0,0,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.08) 1px, transparent 1px);
    background-size: 40px 40px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 1000px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    text-align: center;
    padding: 40px 20px 30px;
    background: linear-gradient(135deg, #FEEFDF 0%, #f5e6d3 100%);
    color: #8B4513;
    cursor: pointer;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.title:hover {
    opacity: 0.8;
}

.brain-emoji {
    font-size: 2rem;
}

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

main {
    padding: 40px 20px;
}

.search-section {
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 15px;
    padding: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.input-group:focus-within {
    border-color: #D2691E;
    box-shadow: 0 4px 20px rgba(210, 105, 30, 0.2);
}

.at-symbol {
    padding: 0 15px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #D2691E;
}

.username-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 15px 10px;
    font-size: 1.1rem;
    font-weight: 500;
    background: transparent;
    display: flex;
    align-items: center;
    min-height: 100%;
}

.username-input::placeholder {
    color: #9ca3af;
}

.clear-btn {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 50%;
    margin-right: 5px;
}

.check-btn {
    background: #8B4513;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-section {
    margin-top: 30px;
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 20px 16px 34px 16px;
    border: 1px solid #d1d5db;
    margin-bottom: 30px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.result-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}



.result-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

#iq-score {
    color: #dc2626;
    font-weight: 800;
}

.classification {
    font-size: 1.125rem;
    color: #374151;
    font-weight: 700;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.iq-image {
    height: 28px;
    width: auto;
    border-radius: 6px;
    box-shadow: none;
    margin-top: 0;
}

#bell-curve {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
    transform: scale(1.15);
}

.error-section {
    margin-top: 30px;
    display: none;
}

.error-card {
    background: #fff1f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.error-card h3 {
    margin: 0 0 6px 0;
    font-size: 1.25rem;
}

.error-hint {
    margin: 0;
    color: #b91c1c;
}

.curve-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding: 0 20px;
    font-size: 1.125rem;
    color: #dd0000;
    font-weight: 600;
}

.domain-text {
    font-size: 0.875rem;
    color: rgba(0, 0, 0, 0.25);
    font-weight: 500;
    white-space: nowrap;
    margin-top: 8px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    background: #8B4513;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-section {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #D2691E;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-section p {
    color: #6b7280;
    font-size: 1.1rem;
    font-weight: 500;
}

.follow-check-section {
    margin-top: 30px;
}

.follow-check-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.follow-check-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: #1f2937;
}

.follow-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.follow-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    justify-content: center;
}

.yes-btn {
    background: #10b981;
    color: white;
}

.no-btn {
    background: #ef4444;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
        align-items: center;
        min-height: 100vh;
    }
    
    .container {
        margin: 0;
        border-radius: 15px;
        max-width: 100%;
        display: flex;
        flex-direction: column;
    }
    
    header {
        padding: 25px 15px 20px;
        cursor: pointer;
    }
    
    .title {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 8px;
        line-height: 1.2;
        cursor: pointer;
        transition: opacity 0.2s ease;
    }
    
    .title:hover {
        opacity: 0.8;
    }
    
    .brain-emoji {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    main {
        padding: 20px 15px;
        display: flex;
        flex-direction: column;
    }
    
    .search-section {
        margin-bottom: 25px;
        display: block;
        order: -1;
    }
    
    .input-group {
        flex-direction: row;
        gap: 8px;
        padding: 8px;
        border-radius: 12px;
        align-items: center;
    }
    
    .at-symbol {
        display: none;
    }
    
    .username-input {
        padding: 16px 12px;
        font-size: 1.1rem;
        text-align: left;
        border-radius: 8px;
        background: transparent;
        border: none;
        min-height: 48px;
        flex: 1;
    }
    
    .username-input:focus {
        background: transparent;
        border: none;
        outline: none;
    }
    
    .clear-btn {
        display: none;
    }
    
    .check-btn {
        width: auto;
        justify-content: center;
        padding: 16px 20px;
        font-size: 1.1rem;
        border-radius: 8px;
        min-height: 48px;
        white-space: nowrap;
    }
    
    .result-section {
        margin-top: 20px;
        display: flex;
        flex-direction: column;
    }
    
    .result-card {
        padding: 20px 15px 25px;
        border-radius: 12px;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .result-card h2 {
        font-size: 1.3rem;
        line-height: 1.3;
        text-align: center;
        display: block;
        margin: 0 auto;
    }
    
    .classification {
        font-size: 1rem;
        gap: 8px;
    }
    
    .iq-image {
        height: 24px;
    }
    
    #bell-curve {
        width: 100%;
        height: auto;
        max-width: 350px;
        transform: scale(1);
        margin-top: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-top: 20px;
    }
    
    .action-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
        padding: 14px 20px;
        font-size: 1rem;
        min-height: 48px;
        border-radius: 10px;
    }
    
    .follow-check-section {
        margin-top: 20px;
    }
    
    .follow-check-card {
        padding: 20px 15px;
        border-radius: 12px;
    }
    
    .follow-check-card h3 {
        font-size: 1.1rem;
        margin-bottom: 20px;
        line-height: 1.4;
    }
    
    .follow-buttons {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .follow-btn {
        width: 100%;
        max-width: 280px;
        padding: 14px 20px;
        font-size: 1rem;
        min-height: 48px;
        border-radius: 10px;
    }
    
    .curve-labels {
        font-size: 0.75rem;
        padding: 0 8px;
        margin-top: 10px;
    }
    
    .loading-section {
        padding: 30px 15px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .loading-section p {
        font-size: 1rem;
        margin-top: 15px;
    }
    
    .error-section {
        margin-top: 20px;
    }
    
    .error-card {
        padding: 20px 15px;
        border-radius: 12px;
    }
    
    .error-card h3 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
    
    .error-hint {
        font-size: 0.95rem;
    }
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Improve touch targets */
    .clear-btn:hover,
    .check-btn:hover,
    .action-btn:hover,
    .follow-btn:hover {
        transform: none;
    }
    
    .clear-btn:active,
    .check-btn:active,
    .action-btn:active,
    .follow-btn:active {
        transform: scale(0.98);
    }
    
    /* Better scrolling */
    .container {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent zoom on input focus */
    .username-input {
        font-size: 16px;
    }
    
    /* Better focus states for mobile */
    .check-btn:focus,
    .action-btn:focus,
    .follow-btn:focus {
        outline: 2px solid #D2691E;
        outline-offset: 2px;
    }
    
    /* Improve button spacing for thumb navigation */
    .action-buttons {
        padding-bottom: 20px;
    }
    
    /* Better visual hierarchy */
    .result-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    /* Optimize bell curve for mobile viewing */
    #bell-curve {
        touch-action: manipulation;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        border-radius: 12px;
    }
    
    header {
        padding: 20px 12px 15px;
    }
    
    .title {
        font-size: 1.6rem;
    }
    
    .brain-emoji {
        font-size: 1.3rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    main {
        padding: 15px 12px;
    }
    
    .input-group {
        padding: 6px;
        gap: 6px;
    }
    
    .username-input {
        padding: 14px 10px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    .check-btn {
        padding: 14px 16px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    .result-card {
        padding: 18px 12px 22px;
    }
    
    .result-card h2 {
        font-size: 1.2rem;
        text-align: center;
        display: block;
        margin: 0 auto;
    }
    
    .classification {
        font-size: 0.95rem;
    }
    
    .action-btn {
        max-width: 260px;
        padding: 12px 18px;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    .follow-btn {
        max-width: 260px;
        padding: 12px 18px;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    #bell-curve {
        max-width: 300px;
    }
}
