.mathe-soft-wrapper {
    /* Biến CSS độc lập */
    --neo-border: 3px solid #111111;
    --neo-shadow: 5px 5px 0px #111111;
    
    --bg-main: #f0f4f8;
    --clr-yellow: #fde74c;
    --clr-cyan: #00f5d4;
    --clr-pink: #f15bb5;
    --clr-white: #ffffff;
    --clr-red: #e63946;
    --clr-text: #111111;

    max-width: 950px; 
    margin: 0 auto;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--clr-text);
    background: var(--bg-main);
    padding: 20px;
    border: var(--neo-border);
    border-radius: 16px;
    box-shadow: 6px 6px 0px #111111;
}

.mathe-soft-wrapper * { box-sizing: border-box; }

.mathe-soft-header {
    background: #111; padding: 20px; color: #fff;
    border: var(--neo-border); border-radius: 12px;
    text-align: center; margin-bottom: 20px; box-shadow: var(--neo-shadow);
}
.mathe-soft-header h2 { margin: 0 0 10px 0; font-size: 1.8rem; font-weight: 900; color: var(--clr-cyan); text-transform: uppercase;}
.mathe-soft-header p { margin: 0; font-weight: 600; font-size: 0.95rem; color: #ccc;}

/* BỐ CỤC 2 CỘT */
.mathe-main-layout { display: flex; flex-direction: column; gap: 20px; }
.mathe-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 768px) { .mathe-main-layout { flex-direction: row; align-items: stretch; } }

/* CARDS */
.mathe-card {
    padding: 20px; border: var(--neo-border); 
    border-radius: 12px; box-shadow: var(--neo-shadow); display: flex; flex-direction: column;
}
.mathe-bg-yellow { background: var(--clr-yellow); }
.mathe-bg-cyan { background: var(--clr-cyan); }
.mathe-bg-white { background: var(--clr-white); }
.mathe-card-title { margin: 0 0 15px 0; font-size: 1.2rem; font-weight: 900; border-bottom: 2px dashed rgba(0,0,0,0.3); padding-bottom: 10px; }

/* INPUT TEXTAREA */
.mathe-textarea {
    width: 100%; min-height: 120px; padding: 15px; font-family: monospace; font-size: 1.2rem;
    font-weight: bold; color: #111; background: #fff; border: 3px solid #111; 
    border-radius: 8px; box-shadow: inset 3px 3px 0px rgba(0,0,0,0.05); resize: vertical; outline: none;
}
.mathe-textarea:focus { border-color: var(--clr-pink); }

.mathe-action-row { display: flex; gap: 10px; margin-top: 15px; }
.mathe-btn-small {
    flex: 1; padding: 10px; background: #fff; border: 2px solid #111; border-radius: 6px;
    font-weight: 900; font-size: 0.95rem; cursor: pointer; box-shadow: 3px 3px 0px #111; transition: 0.1s;
}
.mathe-btn-small:active { transform: translate(3px, 3px); box-shadow: 0px 0px 0px #111; }

/* CHEAT SHEET */
.mathe-cheat-sheet { margin-top: 25px; padding-top: 15px; border-top: 2px dashed #111; }
.mathe-cheat-sheet h4 { margin: 0 0 15px 0; font-size: 1rem; font-weight: 900; }
.mathe-cheat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mathe-badge {
    background: #111; color: var(--clr-yellow); padding: 5px 10px; border-radius: 6px;
    font-family: monospace; font-weight: bold; font-size: 0.9rem; border: 1px solid #111;
    cursor: help; box-shadow: 2px 2px 0px #fff;
}

/* KẾT QUẢ KHỔNG LỒ (HERO RESULT) */
.mathe-result-box {
    background: #111; color: var(--clr-cyan); padding: 25px 20px; border-radius: 8px; border: 3px solid #111;
    text-align: right; box-shadow: inset 4px 4px 0px rgba(0,0,0,0.3); margin-bottom: 20px; overflow-x: auto;
}
.mathe-result-box span { font-size: 2.5rem; font-weight: 900; font-family: monospace; line-height: 1; word-break: break-all; }
.mathe-result-error { color: var(--clr-red) !important; font-size: 1.5rem !important; }

.mathe-btn-main {
    width: 100%; padding: 15px; background: #111; color: #fff; border: 2px solid #111; border-radius: 8px;
    font-weight: 900; font-size: 1.1rem; cursor: pointer; box-shadow: 4px 4px 0px var(--clr-pink); transition: 0.1s; text-transform: uppercase;
}
.mathe-btn-main:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px var(--clr-pink); }

/* HISTORY (LỊCH SỬ) */
.mathe-history-card { flex: 1; display: flex; flex-direction: column; max-height: 350px; }
.mathe-history-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px dashed #111; padding-bottom: 10px; margin-bottom: 15px; }
.mathe-btn-icon { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; transition: 0.1s; }
.mathe-btn-icon:active { transform: scale(0.8); }

.mathe-history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 5px; }
.mathe-history-list::-webkit-scrollbar { width: 6px; }
.mathe-history-list::-webkit-scrollbar-track { background: #eee; border-radius: 10px; }
.mathe-history-list::-webkit-scrollbar-thumb { background: #111; border-radius: 10px; }

.mathe-empty-state { text-align: center; color: #888; font-weight: 600; font-size: 0.9rem; font-style: italic; margin-top: 20px;}

.mathe-hist-item { background: #f8f9fa; border: 2px solid #111; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; transition: 0.1s; }
.mathe-hist-item:hover { background: #e0fbfc; }
.mathe-hist-expr { font-family: monospace; font-size: 1rem; color: #555; font-weight: bold; word-break: break-all; }
.mathe-hist-res { font-family: monospace; font-size: 1.2rem; color: #111; font-weight: 900; text-align: right; }