:root {
  color-scheme: light;
  --body-top: #f7f7f8;
  --body-bottom: #b7bcc4;
  --ink: #1d2126;
  --lcd: #c9d7b8;
  --lcd-ink: #1c2822;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 244, 220, 0.18), transparent 42%),
    linear-gradient(180deg, #4a433c 0%, #241f1b 100%);
}

.device {
  width: min(360px, 100%);
  padding: 22px 18px 18px;
  border-radius: 40px;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), transparent 18%),
    linear-gradient(160deg, var(--body-top) 0%, #d5d8de 28%, var(--body-bottom) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -10px 18px rgba(70, 78, 90, 0.28),
    0 1px 0 #8d939c,
    0 22px 36px rgba(0, 0, 0, 0.45);
}

.device-top {
  display: grid;
  grid-template-columns: 16px 1fr 16px;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.screw {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff 0 1px, transparent 2px),
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(0, 0, 0, 0.35) 5px 6px),
    radial-gradient(circle at 35% 30%, #f4f4f4, #9aa1aa 42%, #5d646c 78%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.8),
    0 1px 1px rgba(0, 0, 0, 0.35);
}

.solar {
  height: 22px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(
      90deg,
      #1b2430 0 6px,
      #314056 6px 8px,
      #243246 8px 14px
    );
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.25),
    inset 0 -2px 3px rgba(0, 0, 0, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 2px 4px 10px;
  color: #3e4650;
  letter-spacing: 0.22em;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.brand span {
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
  color: #6a5350;
}

.screen {
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #2c3036 0%, #555b63 100%);
  box-shadow:
    inset 0 3px 6px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.65);
}

.lcd {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  height: 78px;
  overflow: hidden;
  border-radius: 8px;
  padding: 10px 12px 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 36%),
    linear-gradient(180deg, #d5e2c4 0%, var(--lcd) 100%);
  color: var(--lcd-ink);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-align: right;
  box-shadow:
    inset 0 0 0 2px rgba(40, 60, 40, 0.12),
    inset 0 10px 16px rgba(70, 90, 60, 0.12);
  scrollbar-width: none;
}

.lcd::-webkit-scrollbar {
  display: none;
}

.lcd::before {
  content: "8888888888";
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: rgba(28, 40, 34, 0.08);
  pointer-events: none;
}

.lcd.is-error {
  color: #8d1e1e;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.04));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -2px 6px rgba(0, 0, 0, 0.06);
}

.key {
  appearance: none;
  height: 62px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  font: inherit;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(180deg, #ffffff 0%, #ececec 46%, #d0d0d0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -3px 4px rgba(0, 0, 0, 0.06),
    0 4px 0 #8e949c,
    0 7px 8px rgba(0, 0, 0, 0.22);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  touch-action: manipulation;
  user-select: none;
}

.key:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.16),
    0 1px 0 #8e949c,
    0 2px 3px rgba(0, 0, 0, 0.18);
}

.key:focus-visible {
  outline: 3px solid #2d6cdf;
  outline-offset: 2px;
}

.key-fn {
  background: linear-gradient(180deg, #f3f5f8 0%, #d5dae2 48%, #b7bfcb 100%);
  color: #2c3440;
  font-size: 18px;
}

.key-ac {
  background: linear-gradient(180deg, #ff8d7d 0%, #e45446 48%, #c4372d 100%);
  color: #fff8f6;
  text-shadow: 0 1px 0 rgba(90, 15, 10, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -3px 4px rgba(0, 0, 0, 0.08),
    0 4px 0 #8d261f,
    0 7px 8px rgba(0, 0, 0, 0.22);
}

.key-ac:active {
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    0 1px 0 #8d261f;
}

.key-op,
.key-eq {
  background: linear-gradient(180deg, #ffd27a 0%, #f0a12d 46%, #d98416 100%);
  color: #3a2508;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -3px 4px rgba(120, 60, 0, 0.12),
    0 4px 0 #a86410,
    0 7px 8px rgba(0, 0, 0, 0.22);
}

.key-op:active,
.key-eq:active {
  box-shadow:
    inset 0 2px 4px rgba(90, 40, 0, 0.2),
    0 1px 0 #a86410;
}

.key-eq {
  background: linear-gradient(180deg, #ffb067 0%, #f07a22 48%, #d85a12 100%);
}

@media (max-width: 380px) {
  .lcd {
    font-size: 32px;
    height: 68px;
  }

  .key {
    height: 54px;
    font-size: 22px;
    border-radius: 14px;
  }

  .keypad {
    gap: 8px;
    padding: 10px;
  }
}
