:root {
  --ink: #20201e;
  --muted: #77746c;
  --paper: #f4f1ea;
  --card: #fbfaf7;
  --line: #dfdcd4;
  --accent: #3478d4;
  --accent-dark: #2864b5;
  --key: #eeece6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(52, 120, 212, .08), transparent 25rem),
    var(--paper);
  font-family: "Manrope", sans-serif;
}

main {
  width: min(1120px, calc(100% - 40px));
  min-height: 100vh;
  margin: auto;
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: clamp(60px, 10vw, 150px);
  align-items: center;
  padding: 64px 0;
}

.intro { max-width: 510px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.eyebrow span {
  width: 28px;
  height: 2px;
  background: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(70px, 8.5vw, 116px);
  line-height: .85;
  letter-spacing: -.075em;
  font-weight: 600;
}

h1 em {
  color: var(--accent);
  font-family: Georgia, serif;
  font-weight: 400;
}

.intro > p {
  max-width: 430px;
  margin: 35px 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.hint {
  display: flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  color: var(--muted);
  font-size: 12px;
}

.hint strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hint-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.45);
  font-size: 18px;
}

.calculator-shell { width: 100%; }

.calculator {
  overflow: hidden;
  border: 1px solid rgba(32,32,30,.08);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 30px 70px rgba(57, 48, 38, .12), 0 3px 10px rgba(57, 48, 38, .06);
}

.screen {
  height: 180px;
  padding: 34px 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  background: #272724;
  color: white;
}

.expression {
  min-height: 22px;
  margin-bottom: 10px;
  color: #99978f;
  font: 400 14px "DM Mono", monospace;
}

output {
  max-width: 100%;
  overflow: hidden;
  font: 400 52px/1 "DM Mono", monospace;
  letter-spacing: -.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 20px;
}

.key {
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: var(--key);
  cursor: pointer;
  font: 500 20px "DM Mono", monospace;
  transition: transform .12s ease, background .18s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent;
}

.key:hover { background: #e5e2da; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.key:active, .key.pressed { transform: scale(.94); }
.key:focus-visible { outline: 3px solid rgba(52,120,212,.35); outline-offset: 2px; }
.utility { color: #65625d; background: #e5e1d8; font-size: 16px; }
.operator { color: var(--accent); background: #f5e5de; font-size: 24px; }
.operator:hover { background: #f0d8ce; }
.equals { color: white; background: var(--accent); font-size: 25px; }
.equals:hover { background: var(--accent-dark); }
.wide { grid-column: span 1; }
.zero { grid-column: span 2; text-align: left; padding-left: 27px; }

.footer-note {
  margin: 20px 0 0;
  color: #99958d;
  text-align: center;
  font-size: 11px;
  letter-spacing: .03em;
}

@media (max-width: 850px) {
  main {
    grid-template-columns: 1fr;
    gap: 50px;
    width: min(500px, calc(100% - 32px));
    padding: 55px 0;
  }
  .intro { text-align: center; }
  .eyebrow, .hint { margin-left: auto; margin-right: auto; }
  .intro > p { margin-left: auto; margin-right: auto; }
}

@media (max-width: 420px) {
  main { width: calc(100% - 20px); padding: 38px 0; gap: 38px; }
  h1 { font-size: 65px; }
  .intro > p { margin: 25px 10px; font-size: 15px; }
  .screen { height: 145px; padding: 25px 22px 20px; }
  output { font-size: 42px; }
  .keypad { gap: 8px; padding: 12px; }
  .key { min-height: 59px; border-radius: 14px; }
  .calculator { border-radius: 22px; }
}

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