:root { --bg:#f3f4f6; --calc:#ffffff; --key:#eef0f3; --keyText:#111827; --fn:#d9dde3; --op:#c8102e; --opText:#fff; --muted:#6b7280; }
@media (prefers-color-scheme: dark) {
  :root { --bg:#0f1115; --calc:#1a1d23; --key:#2a2e36; --keyText:#f3f4f6; --fn:#3a3f49; --muted:#9ca3af; }
}
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; display:grid; place-items:center; background:var(--bg); font-family:system-ui,-apple-system,"Segoe UI",sans-serif; padding:16px; }
.calc { width:100%; max-width:340px; background:var(--calc); border-radius:24px; padding:20px; box-shadow:0 10px 40px rgba(0,0,0,.15); }
.display { text-align:right; padding:12px 8px 20px; min-height:110px; display:flex; flex-direction:column; justify-content:flex-end; }
.history { color:var(--muted); font-size:1rem; min-height:1.4em; word-break:break-all; }
.current { color:var(--keyText); font-size:2.8rem; font-weight:300; word-break:break-all; line-height:1.1; }
.keys { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
button { aspect-ratio:1; border:0; border-radius:50%; font-size:1.5rem; background:var(--key); color:var(--keyText); cursor:pointer; transition:filter .1s, transform .05s; font-family:inherit; }
button:hover { filter:brightness(.95); }
button:active { transform:scale(.94); }
button:focus-visible { outline:3px solid var(--op); outline-offset:2px; }
.fn { background:var(--fn); font-size:1.2rem; }
.op, .eq { background:var(--op); color:var(--opText); }
.op.active { background:var(--opText); color:var(--op); box-shadow:inset 0 0 0 2px var(--op); }

/* Insluitmodus (?embed): vult het hele iframe, bijv. in Canvas */
.embed body { padding:0; min-height:0; height:100vh; place-items:stretch; background:transparent; }
.embed .calc { max-width:none; height:100vh; display:flex; flex-direction:column; border-radius:16px; padding:clamp(10px,2vw,20px); box-shadow:none; border:1px solid var(--fn); }
.embed .display { min-height:0; padding:4px 8px 12px; }
.embed .current { font-size:clamp(2rem,5vw,3.5rem); }
.embed .keys { flex:1; grid-template-rows:repeat(5,1fr); }
.embed button { aspect-ratio:auto; border-radius:14px; font-size:clamp(1.2rem,2.5vw,1.8rem); }
