/* ===== RESET & BASE ===== */
#scoped *, #scoped *::before, #scoped *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== CSS VARIABLES ===== */
#scoped {
    --primary-color: #2196f3;
    --primary-dark: #1976d2;
    --success: #43a047;
    --danger: #e53935;
    --warning: #fb8c00;
    --purple: #6d0075;
    --dark-bg: #ffffff;
    --light-bg: #f5f5f5;
    --panel-bg: #2d2d2d;
    --border-color: #333;
    --text-main: #000000;
    --text-muted: #666;
    --text-on-dark: #ffffff;
    --shadow: 0 8px 30px rgba(0,0,0,0.3);
    --transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--text-main);
    line-height: 1.5;
}

/* ===== WRAPPER FIX (IMPORTANT) ===== */
#scoped {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(
        135deg,
        #0f2027 0%,
        #203a43 25%,
        #2c5364 50%,
        #4ca1af 75%,
        #c4e0e5 100%
    );
    background-size: 200% 200%;
    animation: gradientShift 12s ease infinite;
    padding: 40px 20px;
    min-height: 100vh;
    width: 100%;
}

/* ✅ NEW: FIX WRAPPER */
#scoped .heebody {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ===== MAIN CONTAINER (FIXED) ===== */
#scoped .heecontainer {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto; /* center horizontally */
    background: #000;
    border: 2px solid #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0,0,0,0.6);

    display: flex;
    flex-direction: column;
}

/* ===== EDITOR ===== */
#scoped .heeeditor-container {
    display: flex;
    flex-direction: column;
    height: 100%;         /* ✅ important */
}

/* ===== SECTION FIX (class mismatch) ===== */
#scoped .heesection {
    display: flex;
    flex-direction: column;
    flex: 1;              /* ✅ fill available space */
    min-height: 0;        /* ✅ prevents overflow gap */
}

#scoped .heebginputoutput {
    background: var(--purple);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

#scoped .heesection:last-child {
    border-bottom: none;
}

/* Notification popup – right middle */
#scoped .heenotification {
    display: none;
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: #800000;  /* Maroon */
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    white-space: nowrap;
    font-family: inherit;
}

#scoped .heenotification.active {
    display: block;
}

/* Mobile adjustment */
@media (max-width: 768px) {
    #scoped .heenotification {
        right: 10px;
        padding: 8px 16px;
        font-size: 12px;
        white-space: nowrap;
    }
}

/* ===== TOOLBAR ===== */
#scoped .heetoolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid var(--border-color);
}

/* ===== TEXTAREA ===== */
#scoped textarea {
    width: 100%;
    min-height: 170px;
    padding: 1.5rem;
    border: none;
    resize: vertical;
    
    /* ✅ FIXES */
    display: block;
    flex: 1;
    background: var(--dark-bg);
    color: var(--text-main);
}

/* ===== CONTROLS ===== */
#scoped .heecontrols {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
}

/* ===== BUTTON FIX ===== */
#scoped .heebtn {
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    background: var(--primary-color, #2196f3);
    border: none;
    color: white;
    font-weight: 600;
    transition: var(--transition, all 0.3s ease);
}

#scoped .heebtn:hover {
    background: var(--primary-dark, #1976d2);
    transform: translateY(-1px);
}

#scoped .heeclear-btn {
    background: var(--danger, #e53935);
}
#scoped .heeclear-btn:hover {
    background: #c62828;
}

#scoped .heecopy-btn {
    background: var(--success, #43a047);
}
#scoped .heecopy-btn:hover {
    background: #2e7d32;
}

/* ===== ANIMATION ===== */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== MOBILE FIX ===== */
@media (max-width: 768px) {
    #scoped {
        padding: 20px 12px;
        display: flex; /* ✅ KEEP FLEX */
        justify-content: center;
    }

    #scoped .heecontainer {
        width: 100%;
        max-width: 100%;
        margin: 0 auto; /* ✅ FIX center */
    }

#scoped .heebtn {
    width: auto;              /* keep natural size */
    justify-content: center;
    padding: 0.45rem 1rem;    /* slightly smaller for mobile */
    font-size: 13px;          /* responsive text */
}

}

/* ===== 480 FIX ===== */
@media (max-width: 480px) {
    #scoped {
        display: flex; /* ✅ KEEP FLEX (was breaking) */
        justify-content: center;
        padding: 15px 10px;
    }

    #scoped .heecontainer {
        width: 100%;
        margin: 0 auto; /* ✅ CRITICAL FIX */
    }
}