:root { color-scheme: light dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #0f172a;
  color: #e2e8f0;
}
.wrap { padding: 24px; width: min(420px, 100%); }
.calc {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.screen {
  background: #020617;
  border-radius: 12px;
  padding: 14px 14px 10px;
  margin-bottom: 14px;
  min-height: 112px;
  overflow: hidden;
}
.history { min-height: 20px; font-size: 13px; color: #94a3b8; text-align: right; word-break: break-all; }
.expression { min-height: 22px; font-size: 15px; color: #94a3b8; text-align: right; word-break: break-all; }
.display { font-size: 44px; font-weight: 700; text-align: right; word-break: break-all; line-height: 1.1; }
.display.error { color: #f87171; font-size: 30px; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.btn {
  border: 1px solid #334155;
  background: #334155;
  color: #f1f5f9;
  border-radius: 10px;
  padding: 14px 0;
  font-size: 18px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn.num { background: #475569; }
.btn.op { background: #0ea5e9; border-color: #0ea5e9; color: #082f49; font-weight: 700; }
.btn.equals { background: #22c55e; border-color: #22c55e; color: #052e16; font-weight: 800; }
.btn.danger { background: #ef4444; border-color: #ef4444; color: #450a0a; font-weight: 700; }
.hint { font-size: 12px; color: #94a3b8; margin: 12px 2px 0; }
