/* Phone-style calculator, scoped to avoid affecting the lesson controls. */
dialog.phone-calculator{width:420px;max-width:calc(100vw - 24px);padding:20px;background:var(--bg);border:1px solid var(--line);border-radius:28px;max-height:96dvh;overflow:auto;line-height:1.3;box-shadow:0 22px 80px #0005}.phone-calculator header{padding:0;display:flex;justify-content:space-between;align-items:center}.phone-calculator header h2{font-size:16px;font-weight:700;color:var(--muted);margin:0}.phone-calculator header .sheet-close{position:static;background:var(--surface);border-radius:50%;width:40px;height:40px;min-height:40px;font-size:26px;box-shadow:none;line-height:1;margin:0;padding:0}.phone-calculator .calc-display{display:flex;flex-direction:column;justify-content:flex-end;min-height:176px;padding:20px 2px 10px;gap:8px}.phone-calculator #calc-input{border:0;outline:0;box-shadow:none;background:transparent;padding:0;width:100%;font-size:34px;min-height:48px;font-weight:500;letter-spacing:-.6px;caret-color:transparent;text-align:right;color:var(--ink);font-variant-numeric:tabular-nums}.phone-calculator #calc-result{font-size:26px;color:var(--muted);min-height:36px;padding:0;line-height:1.35;overflow-wrap:anywhere;text-align:right;user-select:text}.phone-calculator[data-evaluated=true] #calc-result{font-size:38px;color:var(--ink);font-weight:700}.phone-calculator[data-evaluated=true] #calc-input{font-size:22px;color:var(--muted)}.phone-calculator #calc-status{min-height:18px;font-size:12px;text-align:right;color:var(--muted);overflow-wrap:anywhere}.phone-calculator .calc-toolbar{display:flex;align-items:center;justify-content:flex-start;gap:8px;flex-wrap:nowrap;border-bottom:1px solid var(--line);padding-bottom:12px;margin:0 0 14px}.phone-calculator .calc-toolbar button{min-width:42px;min-height:42px;border:0;border-radius:12px;background:transparent;color:var(--ink);padding:6px;font-size:21px;font-weight:600}.phone-calculator .calc-toolbar #calc-copy{font-size:12px;margin-left:auto}.phone-calculator .calc-toolbar #calc-mode{font-size:12px}.phone-calculator .calc-toolbar [aria-pressed=true],.phone-calculator .calc-toolbar [aria-expanded=true]{background:var(--soft);color:var(--accent)}.phone-calculator .calc-keys{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.phone-calculator .calc-keys button{height:64px;min-height:48px;border:0;border-radius:50%;background:var(--surface);font-size:27px;font-weight:500;padding:0;color:var(--ink);box-shadow:0 2px 0 color-mix(in srgb,var(--line),transparent 45%)}.phone-calculator .calc-keys .calc-operator{color:#219bd0;background:color-mix(in srgb,var(--surface),#20b8e7 10%)}.phone-calculator .calc-keys .calc-clear{color:#e57c75}.phone-calculator .calc-keys .calc-equals{background:linear-gradient(135deg,#31bbe9,#6972f5);color:#fff;font-weight:700}.phone-calculator .calc-keys button:active,.phone-calculator .calc-scientific button:active{transform:scale(.93);background:color-mix(in srgb,var(--surface),#20b8e7 20%)}.phone-calculator .calc-scientific{grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin-bottom:12px}.phone-calculator .calc-scientific button{border:0;border-radius:12px;min-height:40px;background:var(--soft);color:var(--ink);font-size:16px;padding:7px 0}.phone-calculator[data-scientific=true] .calc-display{min-height:108px;padding-top:8px}.phone-calculator[data-scientific=true] .calc-keys button{height:48px;font-size:23px}.phone-calculator .calc-note{font-size:11px;color:var(--muted);margin-top:14px}.phone-calculator .calc-note summary{cursor:pointer;min-height:28px;text-align:center}.phone-calculator .calc-note p{font-size:12px;line-height:1.6}.phone-calculator #calc-history{height:365px;overflow:auto}.phone-calculator #calc-history header{position:sticky;top:0;background:var(--bg);padding:0 0 8px;z-index:2}.phone-calculator #calc-history h3{margin:0;font-size:16px}.phone-calculator #calc-clear-history{font-size:13px;color:var(--accent);min-height:44px}.phone-calculator #calc-history>p{font-size:12px;margin:4px 0 15px}.phone-calculator #calc-history-list button{text-align:right;padding:14px 4px;color:var(--muted)}.phone-calculator #calc-history-list button>span{display:block;font-size:17px}.phone-calculator #calc-history-list strong{display:block;font-size:27px;font-weight:600;color:var(--ink);margin-top:6px}.phone-calculator #calc-history-list small{display:inline;font-size:10px;margin-left:6px}.phone-calculator .calc-empty{font-size:14px;text-align:center;padding:50px 12px}.phone-calculator [hidden]{display:none!important}
html[data-theme=light] .phone-calculator .calc-operator{color:#087ba7}html[data-theme=light] .phone-calculator .calc-clear{color:#b53b38}
@media(max-width:600px){dialog.phone-calculator{width:100vw;max-width:100vw;margin:auto auto 0;border-radius:28px 28px 0 0;padding:16px 20px max(12px,env(safe-area-inset-bottom))}.phone-calculator .calc-keys button{height:62px}}
@media(max-height:720px){.phone-calculator .calc-display{min-height:105px;padding-top:4px}.phone-calculator .calc-keys button{height:48px;min-height:42px}.phone-calculator[data-scientific=true] .calc-display{min-height:80px}.phone-calculator .calc-scientific{gap:5px;margin-bottom:8px}.phone-calculator .calc-scientific button{min-height:32px;padding:4px;font-size:14px}.phone-calculator .calc-keys{gap:6px}.phone-calculator[data-scientific=true] .calc-keys button{height:40px;min-height:38px}.phone-calculator .calc-toolbar{padding-bottom:6px;margin-bottom:8px}.phone-calculator .calc-note{margin-top:8px}.phone-calculator #calc-input{font-size:28px}.phone-calculator #calc-history{height:270px}}
@media(min-width:700px) and (max-height:600px){dialog.phone-calculator{width:700px}.phone-calculator[data-scientific=true] .calc-keyboard{display:grid;grid-template-columns:1fr 1fr;gap:16px}.phone-calculator .calc-display{min-height:90px}.phone-calculator .calc-scientific{margin:0}}
.phone-calculator #calc-status:empty{display:none}.phone-calculator[data-scientific=true] #calc-input{min-height:32px;font-size:25px}.phone-calculator[data-scientific=true] #calc-result{min-height:30px}.phone-calculator[data-scientific=true][data-evaluated=true] #calc-result{font-size:30px}
@media(max-height:720px){.phone-calculator[data-scientific=true] .calc-display{padding:6px 0;gap:4px;min-height:76px}.phone-calculator[data-scientific=true] .calc-keys button{height:38px;min-height:38px}.phone-calculator[data-scientific=true] .calc-note{margin-top:4px}}
@media(min-width:700px) and (max-height:600px){dialog.phone-calculator{padding:10px 18px;max-height:98dvh}.phone-calculator header .sheet-close{height:30px;min-height:30px;width:30px}.phone-calculator header{min-height:30px}.phone-calculator .calc-display,.phone-calculator[data-scientific=true] .calc-display{flex-direction:row;align-items:center;min-height:48px;gap:12px;padding:4px 0}.phone-calculator #calc-input{min-height:32px;font-size:24px;flex:1}.phone-calculator #calc-result{font-size:24px;flex:1;min-height:30px}.phone-calculator .calc-toolbar button{min-height:32px}.phone-calculator .calc-toolbar{margin-bottom:8px;padding-bottom:4px}.phone-calculator .calc-keys button,.phone-calculator[data-scientific=true] .calc-keys button{min-height:32px;height:32px;font-size:21px}.phone-calculator .calc-note{margin-top:2px}.phone-calculator .calc-note summary{min-height:22px}.phone-calculator #calc-history{height:200px}}
