:root {
  --bg: #0f1115;
  --panel: #171a21;
  --key: #232733;
  --key-hover: #2c3140;
  --fn: #2f3545;
  --op: #f59e0b;
  --op-text: #1a1204;
  --text: #f3f4f6;
  --muted: #8b93a7;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #1c2030 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 20px;
}

.title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.calculator {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border-radius: 28px;
  padding: 20px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.display {
  padding: 16px 8px 20px;
  text-align: right;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.history {
  color: var(--muted);
  font-size: 1rem;
  min-height: 1.4em;
  overflow-wrap: anywhere;
}

.output {
  display: block;
  font-size: 2.6rem;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.output.is-long {
  font-size: 1.8rem;
}

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

.key {
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--radius);
  background: var(--key);
  color: var(--text);
  font: inherit;
  font-size: 1.35rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.key:hover {
  background: var(--key-hover);
}

.key:active,
.key.is-pressed {
  transform: scale(0.95);
}

.key:focus-visible {
  outline: 2px solid var(--op);
  outline-offset: 2px;
}

.key--fn {
  background: var(--fn);
  color: #cbd2e1;
}

.key--op,
.key--equals {
  background: var(--op);
  color: var(--op-text);
  font-weight: 600;
}

.key--op:hover,
.key--equals:hover {
  background: #fbbf24;
}

.key--op.is-active {
  background: var(--text);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
