* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  background: #fff;
}

body {
  margin: 0;
  color: #252933;
  font-family: "Microsoft JhengHei", "PingFang HK", system-ui, sans-serif;
}

.workspace {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-content: center;
  justify-items: center;
  padding: 12px;
}

.calculator {
  position: relative;
  width: min(calc(100vw - 24px), 410px, calc((100vh - 24px) * (var(--frame-ratio))));
  width: min(calc(100vw - 24px), 410px, calc((100svh - 24px) * (var(--frame-ratio))));
  min-width: min(242px, calc(100vw - 24px));
  aspect-ratio: var(--frame-ratio);
  overflow: hidden;
  isolation: isolate;
}

.faceplate {
  position: absolute;
  inset: var(--photo-top) auto auto var(--photo-left);
  width: var(--photo-width);
  max-width: none;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.lcd {
  position: absolute;
  display: block;
  border-radius: 1.5% 1.2% 2.5% 3.1% / 4% 4% 7% 8%;
  pointer-events: none;
}

.key {
  position: absolute;
  display: block;
  appearance: none;
  border: 0;
  border-radius: 29% 28% 38% 38% / 27% 29% 58% 58%;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.key.pressed {
  background: rgb(14 18 27 / 20%);
  box-shadow: inset 0 1px 3px rgb(12 16 25 / 35%);
}

.key:focus-visible {
  outline: 2px solid #123b8d;
  outline-offset: 1px;
}

.key:is([data-key="SHIFT"], [data-key="ALPHA"]) {
  border-radius: 48% 62% 22% 63% / 51% 37% 28% 59%;
}

.key:is([data-key="MODE"], [data-key="ON"]) {
  border-radius: 62% 48% 63% 22% / 37% 51% 59% 28%;
}

.replay {
  position: absolute;
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
}

.replay .key {
  inset: 0;
  border-radius: 0;
  pointer-events: auto;
}

.replay .key:focus-visible {
  outline: none;
  background: rgb(25 66 143 / 35%);
}

.replay [data-key="UP"] { clip-path: polygon(0 0, 100% 0, 50% 50%); }
.replay [data-key="RIGHT"] { clip-path: polygon(100% 0, 100% 100%, 50% 50%); }
.replay [data-key="DOWN"] { clip-path: polygon(100% 100%, 0 100%, 50% 50%); }
.replay [data-key="LEFT"] { clip-path: polygon(0 100%, 0 0, 50% 50%); }

.assistive-display {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.storage-status {
  margin: 12px 0 0;
  max-width: 30ch;
  font-size: 0.875rem;
  text-align: center;
}
