:root {
  color-scheme: light;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  color: #263933;
  background: #f3f2ed;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: grid; place-items: center; }
main { width: min(100%, 452px); padding: 28px 16px 40px; }
h1 { margin: 0 0 16px 3px; font-size: 34px; letter-spacing: -.07em; }
h1 span { color: #dc693a; }
.instrument {
  padding: clamp(16px, 5vw, 26px);
  border-radius: 25px; background: #dedfd6;
  border: 1px solid #b7bbaf; box-shadow: inset 0 2px 0 #f5f5f1, 0 4px 0 #b3b6aa, 0 15px 28px #22352b16;
}
button, input { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid #176f81; outline-offset: 3px; }
.switch { display: flex; gap: 3px; background: #ced0c5; border-radius: 9px; padding: 4px; width: fit-content; margin-bottom: 17px; }
.switch button { background: transparent; border: 0; border-radius: 6px; padding: 8px 18px; font-weight: 650; font-size: 14px; }
.switch button[aria-pressed="true"] { background: #35443d; color: #fff; }
.screen { padding: 15px 20px; border-radius: 13px; background: #203b35; color: #edffd7; box-shadow: inset 0 3px 6px #122b26; }
.caption { display: flex; align-items: center; gap: 7px; color: #c0d4bc; font-size: 12px; }
.led { width: 6px; height: 6px; border-radius: 50%; background: #badf92; }
#trail { min-height: 23px; margin-top: 6px; text-align: right; color: #b8cdb8; font: 15px/1.5 monospace; overflow-wrap: anywhere; }
output { display: block; text-align: right; font: 500 clamp(36px, 10vw, 52px)/1.2 ui-monospace, monospace; letter-spacing: -.05em; overflow-wrap: anywhere; min-height: 1.2em; }
output.compact { font-size: 23px; line-height: 1.65; }
.controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 12px 0; }
.controls p { margin: 0; font-size: 13px; line-height: 1.5; color: #42554b; }
#clear { background: transparent; border: 1px solid #aeb3a6; border-radius: 6px; font-size: 12px; padding: 8px 10px; white-space: nowrap; }
#keypad { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; }
#keypad button, .submit { border: 1px solid #b9bdb1; border-radius: 10px; background: #faf9f3; box-shadow: 0 2px 0 #a7ac9e; min-height: 56px; font: 500 25px ui-monospace, monospace; }
#keypad .op { background: #c6d2c5; }
#keypad .equals, .submit { background: #fd9966; color: #372a20; border-color: #ce835b; }
button:active { transform: translateY(1px); }
#formula { display: grid; gap: 12px; }
#formula label { font-size: 14px; font-weight: bold; }
#expression { width: 100%; padding: 15px; border-radius: 9px; background: #faf9f3; border: 1px solid #a1a797; font: 20px ui-monospace, monospace; }
.submit { font-family: inherit; font-size: 17px; font-weight: 650; }
[hidden], #keypad[hidden], #formula[hidden] { display: none; }
