:root {
  --bg: #ffffff; /* white background */
  --panel: #f8fafc; /* light panel */
  --frame: #cbd5e1; /* light gray frame */
  --accent: #06b6d4; /* teal */
  --muted: #475569;
  --btn: #e2e8f0;
  --btn-hover: #cbd5e1;
  --danger: #ef4444;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}

.frame {
  background: var(--frame);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1px solid #e2e8f0;
}

.calculator {
  width: 340px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  padding: 18px;
}

.screen {
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 12px 14px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.expr {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.result {
  font-size: 28px;
  font-weight: 600;
  width: 100%;
  text-align: right;
  letter-spacing: 0.6px;
}

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

button {
  background: var(--btn);
  border: 0;
  padding: 16px 12px;
  border-radius: 10px;
  font-size: 18px;
  color: inherit;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s ease, background 0.12s;
}

button:active { transform: translateY(2px); }
button:hover { background: var(--btn-hover); }

.op {
  background: linear-gradient(180deg, #e0f2fe, #bae6fd);
  color: #0369a1;
}

.wide { grid-column: span 2; }

.danger {
  background: linear-gradient(180deg, #fee2e2, #fecaca);
  color: var(--danger);
}

.small { font-size: 14px; padding: 10px; }

.help {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 380px) {
  .calculator { width: 100%; }
}
