html, body {
    font-family: 'Malgun Gothic', 'Segoe UI', sans-serif;
    overscroll-behavior: none;
}

.dhmath-app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 로딩 화면 */
.dhmath-loading {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #1e2a38;
    color: white;
}

.dhmath-loading-title {
    font-size: 42px;
    font-weight: bold;
    letter-spacing: 2px;
}

.dhmath-loading-tagline {
    font-size: 14px;
    opacity: 0.75;
    letter-spacing: 0.5px;
    margin-top: -4px;
}

.dhmath-loading-sub {
    opacity: 0.8;
}

.dhmath-loading-company {
    margin-top: 18px;
    font-size: 13px;
    letter-spacing: 1px;
    opacity: 0.65;
}

.dhmath-loading-bar {
    width: 260px;
}

/* 워크시트 레이아웃 */
.dhmath-toolbar {
    flex: 0 0 auto;
    border-bottom: 1px solid #d0d0d0;
    background: #f5f6f8;
}

.dhmath-main {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

.dhmath-canvas-host {
    flex: 1 1 auto;
    min-width: 0;
    background: #808080;
    position: relative;
    outline: none;
}

.dhmath-canvas-host canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.dhmath-side {
    flex: 0 0 340px;
    border-left: 1px solid #d0d0d0;
    padding: 12px;
    overflow-y: auto;
    background: #fafafa;
}

.dhmath-side h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
}

.dhmath-result {
    font-family: 'Cambria Math', 'Cambria', serif;
    font-size: 16px;
    padding: 8px 10px;
    margin: 6px 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    white-space: pre-wrap;
}

.dhmath-result.error {
    color: #c62828;
}

.dhmath-result .unit {
    color: #0000cc;
}

.dhmath-status {
    flex: 0 0 auto;
    padding: 4px 10px;
    font-size: 12px;
    color: #555;
    border-top: 1px solid #d0d0d0;
    background: #f5f6f8;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── 메뉴바 ─────────────────────────────────────────── */
.dhmath-menubar-host {
    flex: 0 0 auto;
    border-bottom: 1px solid #d8d8dc;
    background: #f7f7f9;
}

.dhmath-menubar-host .e-menu-wrapper,
.dhmath-menubar-host .e-menu-wrapper ul.e-menu {
    background: transparent;
    border: none;
    font-size: 13px;
}

/* ── 툴바 ───────────────────────────────────────────── */
.dhmath-toolbar-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1px;
    padding: 3px 6px;
}

.dh-tool {
    min-width: 30px;
    height: 28px;
    padding: 0 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    color: #2b2b2b;
}

.dh-tool:hover {
    background: #e6effb;
    border-color: #b9d4f2;
}

.dh-tool:active,
.dh-tool.active {
    background: #cfe2f8;
    border-color: #8db8e8;
}

.dh-sep {
    width: 1px;
    height: 20px;
    background: #d0d0d5;
    margin: 0 5px;
}

/* ── 기호 팔레트 ────────────────────────────────────── */
.dh-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 8px;
    border-top: 1px solid #e2e2e6;
    background: #fbfbfd;
}

.dh-pal-btn {
    min-width: 28px;
    height: 26px;
    border: 1px solid #dcdce0;
    border-radius: 3px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.dh-pal-btn:hover {
    background: #e6effb;
    border-color: #b9d4f2;
}

.dh-pal-btn.dh-unit {
    color: #0000cc;
    font-weight: 600;
    min-width: 40px;
}

.dhmath-inline-error {
    padding: 6px 10px;
    background: #fdecea;
    color: #b71c1c;
    font-size: 12px;
    border-bottom: 1px solid #f5c6cb;
    word-break: break-all;
}

/* ── 툴바 드롭다운 팔레트 팝업 ─────────────────────── */
.dh-palette-pop {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 8px;
    width: 320px;
    max-height: 260px;
    overflow-y: auto;
    background: white;
}

.dh-palette-pop .dh-pal-btn,
.dh-palette-pop .e-btn.dh-pal-btn {
    min-width: 32px;
    width: 32px;
    height: 30px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    text-transform: none;   /* Syncfusion 기본 대문자 변환 방지 (그리스 소문자 유지) */
    background: #fff;
    border: 1px solid #dcdce0;
    color: #222;
}

.dh-palette-pop .e-btn.dh-pal-btn:hover {
    background: #e6effb;
    border-color: #b9d4f2;
}

.dh-palette-pop .e-btn.dh-unit {
    width: 52px;
    min-width: 52px;
    color: #0000cc;
    font-weight: 600;
    font-size: 13px;
}

.dh-pal-divider {
    flex: 0 0 100%;
    height: 1px;
    background: #e0e0e4;
    margin: 4px 0;
}
