:root { --view-bg: #ffffff; }
.mx-logo-mark { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; font: 700 30px var(--math); padding: 8px 22px; border-left: 3px solid #fff; border-right: 3px solid #fff; border-radius: 22px / 50%; }

.mx-view { flex: 1; min-height: 0; overflow: auto; background: var(--view-bg); padding-top: 14px; }
.mx-rows { min-width: min-content; }
.mx-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); min-height: 64px; }
.mx-row.sel { background: color-mix(in srgb, var(--primary) 7%, transparent); box-shadow: inset 0 0 0 2px var(--primary); }
.mx-tab { width: 44px; flex: none; display: flex; align-items: center; justify-content: center; border: 0; border-right: 1px solid var(--line); background: rgba(0,0,0,.03); color: var(--muted); font-size: 13px; }
.mx-tab.err { background: var(--danger); color: #fff; font-weight: 900; font-size: 22px; cursor: pointer; }
.mx-tab:not(.err) { cursor: default; }
.mx-content { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 16px; font: 24px var(--math); white-space: nowrap; cursor: text; min-width: 0; }
.mx-name { font-style: italic; }
.mx-eq { margin: 0 2px; }
.mx-hint { color: var(--muted); font: 15px var(--ui); }

/* 행렬: 위아래로 긴 소괄호 + 자릿수 맞춤(오른쪽 정렬) */
.mx-mat { display: inline-grid; gap: 6px 18px; padding: 6px 12px; border-left: 2px solid currentColor; border-right: 2px solid currentColor; border-radius: 14px / 50%; align-items: center; justify-items: end; vertical-align: middle; }
.mx-mat .c { min-width: 1.1em; text-align: right; display: inline-flex; align-items: center; justify-content: flex-end; }
.mx-mat.edit .c { min-width: 1.800em; min-height: 1.5em; padding: 0 5px; border-radius: 6px; border: 1px dashed transparent; cursor: text; }
.mx-mat.edit .c:hover { border-color: var(--line); }
.mx-mat.edit .c.act { border: 1px solid var(--primary); background: #fff; }
.mx-mat.edit .c.bad { color: var(--danger); }
.mx-mat.locked { color: var(--text); opacity: .85; }
.mx-frac { display: inline-flex; flex-direction: column; align-items: center; font-size: .78em; line-height: 1.15; vertical-align: middle; }
.mx-frac .n { border-bottom: 1.5px solid currentColor; padding: 0 3px; }
.mx-frac .d { padding: 0 3px; }
.mx-num { display: inline-flex; align-items: center; }

.mx-expr { display: inline-flex; align-items: baseline; min-height: 1.4em; min-width: 8px; }
.mx-expr .tk { padding: 0 1px; }
.mx-expr .tk.nm { font-style: italic; }
.mx-expr .tk.op { padding: 0 5px; }
.mx-expr sup { font-size: .62em; line-height: 1; display: inline-flex; align-items: baseline; min-width: .5em; position: relative; top: -.72em; margin-left: 1px; }
.mx-expr sup.empty { border: 1px dashed var(--muted); min-width: .8em; height: 1em; margin-left: 2px; }
.mx-row.err { position: relative; }
.mx-row.err:hover::after { content: attr(data-err); position: absolute; left: 52px; top: calc(100% - 6px); z-index: 20; max-width: min(520px, calc(100% - 64px)); padding: 8px 12px; border-radius: 8px; background: #2a3347; color: #fff; font: 14px/1.5 var(--ui); white-space: normal; box-shadow: 0 6px 18px rgba(0,0,0,.25); pointer-events: none; }
.mx-row.err:last-child:hover::after, .mx-row.err:nth-last-child(2):hover::after { top: auto; bottom: calc(100% - 6px); }
.mx-caret { display: inline-block; width: 2px; height: 1.1em; background: var(--primary); margin: 0 -1px; vertical-align: text-bottom; align-self: center; animation: mxblink 1s steps(1) infinite; }
sup .mx-caret { height: 1em; }
@keyframes mxblink { 50% { opacity: 0; } }
.mx-result { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; padding-left: 24px; }

.mx-kbar { display: flex; justify-content: center; height: 22px; border-top: 1px solid var(--line); background: var(--panel); flex: none; }
.mx-ktoggle { border: 0; background: none; color: var(--muted); display: flex; align-items: center; gap: 4px; padding: 0 16px; font-size: 12px; }
.mx-ktoggle svg { width: 20px; height: 20px; }
.mx-keypad { background: #e3e7ee; padding: 6px 8px 8px; flex: none; }
.mx-keypad.hide { display: none; }
/* 탭이 '행렬' 하나뿐이라(문자·more 미개발) 탭 줄을 숨긴다 */
.mx-khead { display: none !important; }
.mx-khead-off { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.mx-khead .tab { height: 32px; padding: 0 16px; border-radius: 8px; border: 0; background: transparent; font-weight: 700; color: var(--muted); }
.mx-khead .tab.sel { background: #fff; color: var(--primary); }
.mx-khead .more { margin-left: auto; height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.mx-kcols { display: grid; grid-template-columns: 4fr 4fr 3fr; gap: 12px; max-width: 980px; margin: 0 auto; }
.mx-kcol { display: grid; gap: 5px; grid-auto-rows: 44px; }
.mx-kcol.c1, .mx-kcol.c2 { grid-template-columns: repeat(4, 1fr); }
.mx-kcol.c3 { grid-template-columns: repeat(3, 1fr); }
.mx-key { border: 0; border-radius: 8px; background: var(--key); font-size: 19px; box-shadow: 0 1px 0 rgba(0,0,0,.18); display: flex; align-items: center; justify-content: center; user-select: none; touch-action: manipulation; padding: 0; }
.mx-key:active:not(:disabled) { transform: translateY(1px); background: #f1f3f7; }
.mx-key.fn { background: var(--key-fn); }
.mx-key.nm { font: italic 22px var(--math); }
.mx-key.math { font: 21px var(--math); }
.mx-key.hot { background: var(--accent); color: #fff; font-weight: 800; }
.mx-key.txt { font-size: 15px; font-weight: 700; }
.mx-key.w2 { grid-column: span 2; }
.mx-key.w3 { grid-column: span 3; }
.mx-key.w4 { grid-column: span 4; }
.mx-key.div-top { margin-top: 5px; }
.mx-key sup { font-size: .62em; }
.mx-key .box { display: inline-block; width: .62em; height: .78em; border: 1.5px dashed currentColor; opacity: .7; }
.mx-key sup .box { width: .6em; height: .6em; }
.mx-void { visibility: hidden; }
@media (max-width: 700px) {
  .mx-kcols { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mx-kcol.c3 { grid-column: 1 / -1; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 40px; }
  .mx-kcol.c3 .mx-void { display: none; }
  .mx-kcol.c3 { grid-template-areas: 'clear clear back . up .' 'enter enter enter left down right'; }
  .mx-kcol.c3 .ka-clear { grid-area: clear; } .mx-kcol.c3 .ka-back { grid-area: back; } .mx-kcol.c3 .ka-up { grid-area: up; } .mx-kcol.c3 .ka-left { grid-area: left; } .mx-kcol.c3 .ka-down { grid-area: down; } .mx-kcol.c3 .ka-right { grid-area: right; } .mx-kcol.c3 .ka-enter { grid-area: enter; }
  .mx-kcol { grid-auto-rows: 40px; }
  .mx-content { font-size: 20px; padding: 10px; }
  .mx-key { font-size: 17px; }
}

/* 행렬의 꼴 팝업 */
.mx-shape { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.mx-steppers { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.mx-stepper { display: flex; align-items: center; gap: 8px; }
.mx-stepper button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 20px; }
.mx-stepper output { min-width: 28px; text-align: center; font-weight: 800; font-size: 20px; }
.mx-grid { display: inline-grid; grid-template-columns: repeat(5, 34px); gap: 5px; padding: 8px 14px; border-left: 2px solid var(--text); border-right: 2px solid var(--text); border-radius: 18px / 50%; touch-action: none; }
.mx-grid i { width: 34px; height: 34px; border-radius: 6px; background: #e9edf4; display: block; }
.mx-grid i.on { background: var(--primary); }
.mx-swatches { display: inline-flex; gap: 6px; }
.mx-swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); padding: 0; }
.mx-swatches button.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-weak); }
.mx-info { text-align: center; line-height: 1.800; }
.mx-info b { font-size: 20px; }

/* 좌측 메뉴를 없앴으므로 프로그램 이름(정보 버튼)을 상단 바 왼쪽에 둔다 */
.ez-top .ez-logo { margin: 0 auto 0 0; text-align: left; }
