:root {
  --bg: #f5efe8;
  --bg-2: #e2c39b;
  --panel: rgba(255, 251, 246, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --border: rgba(48, 34, 19, 0.12);
  --text: #1f1710;
  --muted: #68594a;
  --accent: #cf6236;
  --accent-strong: #9d3f1c;
  --key: rgba(255, 255, 255, 0.75);
  --key-strong: #1f1710;
  --shadow: 0 24px 70px rgba(95, 57, 11, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(226, 195, 155, 0.95), transparent 28rem),
    linear-gradient(135deg, #faf4ec 0%, var(--bg) 52%, #edd8bb 100%);
}

.app-shell {
  max-width: 1140px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px 20px 52px;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 24px;
  align-items: center;
}

.hero-panel,
.calculator-panel,
.display-card,
.history-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-panel {
  padding: 36px;
}

.eyebrow,
.lede,
.tips,
.history-label,
.history-value,
.text-button,
.history-item-expression {
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: "Syne", sans-serif;
}

h1 {
  font-size: clamp(3rem, 8vw, 5.8rem);
  line-height: 0.92;
  max-width: 6ch;
}

.lede {
  line-height: 1.65;
  max-width: 38ch;
}

.tips {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.tips span {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(48, 34, 19, 0.08);
}

.calculator-panel {
  padding: 22px;
}

.display-card {
  padding: 22px;
  margin-bottom: 18px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.88), rgba(255, 247, 238, 0.75)),
    var(--panel-strong);
}

.history-label,
.history-value {
  margin: 0;
  text-align: right;
}

.history-value {
  min-height: 1.5rem;
  margin-top: 4px;
  margin-bottom: 10px;
}

.display {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: right;
  font: 700 clamp(2.7rem, 6vw, 4.8rem) / 1 "Syne", sans-serif;
}

.display:focus {
  outline: none;
}

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

.key,
.text-button {
  appearance: none;
  border: 1px solid var(--border);
  font: inherit;
  cursor: pointer;
}

.key {
  min-height: 72px;
  border-radius: 22px;
  background: var(--key);
  color: var(--key-strong);
  font-size: 1.2rem;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.key:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.key:active,
.key.is-pressed {
  transform: translateY(1px) scale(0.985);
}

.key.operator {
  background: rgba(207, 98, 54, 0.14);
  color: var(--accent-strong);
}

.key.utility {
  background: rgba(31, 23, 16, 0.08);
}

.key.equals {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: white;
}

.history-card {
  margin-top: 18px;
  padding: 20px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.text-button {
  background: transparent;
  padding: 8px 0;
  border: 0;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
}

.history-list:empty::before {
  content: "No calculations yet.";
  color: var(--muted);
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(48, 34, 19, 0.08);
}

.history-item-result {
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  h1 {
    max-width: none;
  }
}

@media (max-width: 540px) {
  .app-shell {
    padding-inline: 14px;
  }

  .hero-panel,
  .calculator-panel,
  .display-card,
  .history-card {
    border-radius: 24px;
  }

  .key {
    min-height: 64px;
    border-radius: 18px;
  }
}
