:root {
  --desk: #efe4d4;
  --ink: #2a241e;
  --muted: #6d6256;
  --case: #2c2926;
  --display: #d7e0d2;
  --display-ink: #1c2918;
  --key: #f6f1ea;
  --key-op: #e7d3c0;
  --equals: #c4553a;
  --tape: #f7f1e4;
  --line: #e2d5c4;
  --serif: "Libre Baskerville", Georgia, serif;
  --sans: "Figtree", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top, #f6efe4, var(--desk) 42%); color: var(--ink); font-family: var(--sans); font-size: 1.05rem; line-height: 1.55; }
a { color: #8d3b28; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: white; padding: 0.45rem 0.7rem; }
.skip:focus { top: 1rem; }
.wrap { width: min(1040px, calc(100% - 2rem)); margin: 0 auto; }
.wrap-narrow { width: min(740px, calc(100% - 2rem)); margin: 0 auto; }
.masthead { display: flex; justify-content: space-between; gap: 1rem; align-items: end; padding: 1.2rem 0; }
.brand { text-decoration: none; color: inherit; }
.brand small { display: block; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.72rem; color: var(--muted); }
.brand strong { font-family: var(--serif); font-size: 1.35rem; }
nav { display: flex; gap: 0.95rem; flex-wrap: wrap; }
nav a { color: inherit; text-decoration: none; }
nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--equals); }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.3rem, 5vw, 3.8rem); line-height: 1.12; margin: 0 0 0.4rem; }
h2 { font-family: var(--serif); font-weight: 400; font-size: 1.8rem; }
.lede { max-width: 40rem; font-size: 1.12rem; }
.device { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 1rem; align-items: stretch; margin: 1.2rem 0 2rem; }
.case { background: var(--case); color: #f6f1ea; border-radius: 28px; padding: 1rem; box-shadow: 0 22px 40px rgba(42, 36, 30, 0.18); }
.screen { background: var(--display); color: var(--display-ink); border-radius: 16px; min-height: 6.2rem; padding: 0.8rem 0.9rem; text-align: right; position: relative; }
.expression { min-height: 1.2rem; font-family: var(--mono); font-size: 0.82rem; opacity: 0.75; overflow-wrap: anywhere; }
.digits { font-family: var(--mono); font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.digits.shrunk { font-size: 1.35rem; }
.memory { position: absolute; left: 0.8rem; top: 0.7rem; font-family: var(--mono); font-size: 0.75rem; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; margin-top: 0.8rem; }
#scientific[hidden] { display: none; }
.keys button, .tape-head button, .text-button {
  font-family: var(--sans);
  border: 0;
  border-radius: 12px;
  background: var(--key);
  color: var(--ink);
  min-height: 3rem;
  font-size: 1.15rem;
  cursor: pointer;
}
.keys button.op { background: var(--key-op); }
.keys button.equals { background: var(--equals); color: white; }
.keys button:focus-visible, a:focus-visible, input:focus, textarea:focus, select:focus, .text-button:focus-visible { outline: 2px solid #f3c7bc; outline-offset: 2px; }
.sci-toggle { width: 100%; margin-top: 0.7rem; background: transparent; color: #f6f1ea; border: 1px solid rgba(246, 241, 234, 0.35); border-radius: 12px; min-height: 2.6rem; cursor: pointer; font: inherit; }
.tape { background: var(--tape); border: 1px solid var(--line); border-radius: 18px; min-height: 100%; padding: 0.8rem; display: flex; flex-direction: column; }
.tape-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.tape-head h2 { font-size: 1.1rem; margin: 0; }
.tape-head button { min-height: 2.2rem; padding: 0 0.7rem; font-size: 0.92rem; }
#tape { list-style: none; margin: 0.6rem 0 0; padding: 0; max-height: 28rem; overflow: auto; font-family: var(--mono); font-size: 0.86rem; flex: 1; }
#tape li { border-top: 1px dashed #e2d3be; padding: 0.4rem 0; text-align: right; overflow-wrap: anywhere; }
#tape li.empty { text-align: left; color: var(--muted); border: 0; font-family: var(--sans); }
.examples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
.examples article { background: rgba(255, 255, 255, 0.45); border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem; }
.examples h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.examples code { font-family: var(--mono); }
.faq details { border-top: 1px solid var(--line); padding: 0.7rem 0; }
.faq summary { cursor: pointer; font-weight: 650; }
.publisher-note { background: #fff6df; border: 1px solid #ead7a4; padding: 0.8rem 1rem; border-radius: 12px; }
label { display: block; margin: 0.75rem 0; }
label span { display: block; margin-bottom: 0.25rem; }
input, select, textarea { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem; background: white; }
textarea { min-height: 9rem; }
button.linkish { background: var(--ink); color: white; border: 0; border-radius: 999px; padding: 0.7rem 1rem; font: inherit; cursor: pointer; }
.site-footer { border-top: 1px solid var(--line); margin-top: 1.5rem; padding: 1.2rem 0 2rem; color: var(--muted); }
.footer-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-links { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
@media (max-width: 800px) {
  .device, .examples, .masthead { display: block; }
  nav { margin-top: 0.7rem; }
  .examples article { margin-top: 0.6rem; }
}
.ad-slot:not(:has(ins, iframe, .adsbygoogle)) { display: none; }
.ad-slot:has(ins, iframe, .adsbygoogle) {
  margin: 1.75rem auto;
  min-height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.ad-slot ins { display: block; width: 100%; }
