:root {
  color-scheme: light;
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f4f7fb;
  color: #172033;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
  background: #f4f7fb;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100% - 32px, 440px);
  margin: 0 auto;
  padding: 56px 0 32px;
}

.intro {
  margin-bottom: 28px;
}

.brand {
  margin: 0 0 10px;
  color: #0b766f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

h1 {
  margin: 0;
  color: #172033;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.subtitle {
  margin: 10px 0 0;
  color: #60708c;
  font-size: 15px;
  line-height: 1.6;
}

.calculator {
  overflow: hidden;
  border: 1px solid #d9e1ed;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(26, 49, 88, 0.1);
}

.screen {
  min-height: 142px;
  padding: 24px;
  border-bottom: 1px solid #e6ebf2;
  background: #fbfcfe;
  text-align: right;
}

.expression {
  min-height: 24px;
  margin: 0;
  overflow-wrap: anywhere;
  color: #74819a;
  font-size: 16px;
  line-height: 24px;
}

.result {
  display: block;
  margin-top: 14px;
  overflow-wrap: anywhere;
  color: #172033;
  font-size: clamp(32px, 9vw, 44px);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: #e6ebf2;
}

.key {
  min-height: 68px;
  padding: 0;
  border: 0;
  background: #ffffff;
  color: #1e2a42;
  cursor: pointer;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  transition: background-color 140ms ease, color 140ms ease;
}

.key:hover {
  background: #f2f6fb;
}

.key:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid #0b766f;
  outline-offset: -3px;
}

.key:active {
  background: #e7eff7;
}

.key-utility {
  color: #b44747;
  font-size: 15px;
}

.key-operator {
  color: #0b766f;
  background: #f1f8f7;
}

.key-operator:hover {
  background: #e3f2f0;
}

.key-equals {
  grid-row: span 2;
  background: #0b766f;
  color: #ffffff;
}

.key-equals:hover,
.key-equals:active {
  background: #075d57;
}

.key-zero {
  grid-column: span 2;
}

.site-footer {
  padding: 20px 16px 28px;
  color: #75819a;
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: #0b766f;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .app-shell {
    padding-top: 32px;
  }

  .screen {
    min-height: 126px;
    padding: 20px;
  }

  .key {
    min-height: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .key {
    transition: none;
  }
}
