@font-face{font-family:PaperMath;src:url('assets/fonts/DejaVuMathTeXGyre.ttf') format('truetype');font-display:swap}
.math-card{margin:24px 0;max-width:100%;min-width:0}
.math-open{display:block;width:100%;min-height:100px;padding:23px 20px 15px;background:#f6f2e8;color:#202d3a;border:1px solid #d4c7ab;border-radius:9px;box-shadow:0 5px 0 #c8bfa41c,0 12px 22px #0001;cursor:zoom-in;text-align:left;overflow:hidden}
.math-open:hover{background:#fffaf0;border-color:#e7c78d;box-shadow:0 5px 0 #c8bfa422,0 12px 28px #0002}
.math-open:focus-visible{outline:3px solid #8febe2;outline-offset:5px}
.math-card-top{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:22px;color:#576568;font-family:system-ui,sans-serif;font-size:11px;line-height:1.5;letter-spacing:.09em;text-transform:uppercase}
.math-card-hint{display:flex;justify-content:flex-end;align-items:center;gap:8px;font-size:12px;line-height:1.5;margin-top:23px;color:#4e625f}
.math-stage{display:flex;justify-content:center;align-items:center;min-width:0;max-width:100%;font-size:calc(var(--reading-size) + 9px);color:#1c2b37;overflow-x:auto;overflow-y:hidden;padding:6px 0 10px}
.math-stage math{font-family:PaperMath,math,serif;font-weight:400;font-size:1em;letter-spacing:normal;line-height:normal;flex:none;margin:0;max-width:none}
.math-stage mtable{margin:0}.math-stage mtd{padding:.2em .3em}
.math-dialog{box-sizing:border-box;width:min(800px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);margin:auto;padding:0;background:#f7f3e9;color:#1c2b37;border:1px solid #d0c2a2;border-radius:15px;box-shadow:0 30px 120px #0009;overflow:auto}
.math-dialog::backdrop{background:#020815d9;backdrop-filter:blur(5px)}
.math-dialog-top{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:18px 28px;border-bottom:1px solid #d7cdb8;background:#eee8da;border-radius:14px 14px 0 0}
.math-dialog-kicker{font-family:system-ui,sans-serif;color:#536961;font-size:11px;letter-spacing:.15em;text-transform:uppercase;line-height:1.6}
.math-dialog-close{display:flex;justify-content:center;align-items:center;min-width:44px;min-height:44px;padding:8px 13px;color:#263c3a;background:#fffaf0;border:1px solid #acb6a7;border-radius:8px;cursor:pointer;font-size:14px;line-height:1.4;gap:9px}
.math-dialog-close:hover,.math-back:hover{background:#e2eadf}
.math-dialog :focus-visible{outline:3px solid #226c68;outline-offset:4px}
.math-sheet{padding:28px 44px 36px;background:linear-gradient(90deg,transparent 0,transparent 25px,#b5524f19 25px,#b5524f19 26px,transparent 26px)}
.math-dialog h2{font-family:system-ui,sans-serif;color:#263c3a;font-size:24px;font-weight:600;line-height:1.4;letter-spacing:-.01em;margin:0 0 30px}
.math-dialog .math-stage{font-size:calc(var(--reading-size) + 20px);min-height:130px;padding:20px 0 34px;margin:0 0 25px;border-bottom:1px solid #c9cbbb}
.math-dialog .math-meaning{font-family:system-ui,sans-serif;color:#334343;font-size:var(--reading-size);line-height:1.85;letter-spacing:.01em;margin:0;max-width:65ch;overflow-wrap:anywhere}
.math-back{display:inline-flex;align-items:center;gap:12px;min-height:44px;margin-top:28px;padding:10px 16px;border:1px solid #93a79a;border-radius:8px;background:transparent;color:#244a43;font-family:system-ui,sans-serif;font-size:14px;line-height:1.4;cursor:pointer}
html.math-is-open{overflow:hidden}
@media(max-width:540px){.math-open{padding:20px 14px 14px}.math-card-top{font-size:10px;letter-spacing:.05em;margin-bottom:17px}.math-card-hint{font-size:11px}.math-stage{font-size:calc(var(--reading-size) + 4px)}.math-dialog{width:calc(100vw - 20px);max-height:calc(100dvh - 20px);border-radius:12px}.math-dialog-top{padding:12px 18px}.math-sheet{padding:25px 22px 28px;background:none}.math-dialog h2{font-size:21px;margin-bottom:20px}.math-dialog .math-stage{font-size:calc(var(--reading-size) + 10px);min-height:105px;padding:18px 0 27px;margin-bottom:22px}}
@media print{.math-open{box-shadow:none;border-color:#b8b8b8;break-inside:avoid}.math-card-hint{display:none}.math-dialog{display:none!important}.math-stage{overflow:visible}}
