/* --- HTML Encoder Wrapper --- */
#he-wrapper {
    font-family: 'Press Start 2P', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background-color: #111827;
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 2px solid #374151;
    color: white;
}

/* --- Controls --- */
.he-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    background-color: #1f2937;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #374151;
    margin-bottom: 20px;
}

@media (min-width: 600px) {
    .he-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.he-toggle-group {
    display: flex;
    background: #000;
    border-radius: 4px;
    padding: 4px;
    gap: 4px;
    flex: 1;
    max-width: 300px;
}

.he-toggle-btn {
    flex: 1;
    background: transparent;
    color: #666;
    border: none;
    padding: 10px;
    font-family: 'Press Start 2P', monospace, sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
}

.he-toggle-btn.active {
    background: #374151;
    color: #F472B6; /* Pink-400 */
}

.he-option-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.he-label {
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
}

/* --- IO Areas --- */
.he-io-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .he-io-container {
        grid-template-columns: 1fr 1fr;
    }
}

.he-pane {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.he-textarea {
    width: 100%;
    height: 300px;
    background-color: #050505;
    color: #d1d5db;
    border: 1px solid #333;
    padding: 15px;
    font-family: 'Press Start 2P', monospace, sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    border-radius: 6px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    white-space: pre-wrap;
    word-break: break-all;
}

.he-textarea:focus {
    border-color: #F472B6;
    box-shadow: 0 0 10px rgba(244, 114, 182, 0.2);
}

.he-textarea.readonly {
    background-color: #111;
    color: #34D399; /* Green */
}

/* --- Actions --- */
.he-actions {
    display: flex;
    width: 100%;
    gap: 15px;
}

.he-btn {
    padding: 12px 20px;
    font-family: inherit;
    font-size: 0.7rem;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s ease;
    border-bottom: 4px solid rgba(0,0,0,0.3);
    flex: 1;
}

.he-btn:active {
    transform: translateY(4px);
    border-bottom: none;
    margin-top: 4px;
}

.he-btn-process {
    background-color: #DB2777; /* Pink-600 */
    color: white;
    border-bottom-color: #9D174D;
}
.he-btn-process:hover { background-color: #EC4899; }

.he-btn-copy {
    background-color: #374151;
    color: white;
    border-bottom-color: #1f2937;
}
.he-btn-copy:hover { background-color: #4b5563; }

.he-btn-clear {
    background-color: #7f1d1d;
    color: #fca5a5;
    border-bottom-color: #590d0d;
}
.he-btn-clear:hover { background-color: #991b1b; color: white; }

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #he-wrapper { padding: 15px; }
    .he-textarea { height: 200px; }
    .he-actions { flex-direction: column; }
}