:root {
  --bg: #0f1115;
  --card: #171a21;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e9eef7;
  --muted: rgba(233, 238, 247, 0.65);
  --btn: #222635;
  --btnHover: #2a3044;
  --op: #2a2f43;
  --opHover: #343b56;
  --danger: #3a2a2a;
  --dangerHover: #4a3131;
  --accent: #f59e0b;
  --accentHover: #ffb23d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Prompt", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 20% 15%, rgba(245, 158, 11, 0.12), transparent 55%),
    radial-gradient(900px 450px at 85% 25%, rgba(99, 102, 241, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.calculator-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 80px;
}

.calculator {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 55%),
    var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.display-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 10px;
  background: rgba(255, 255, 255, 0.02);
}

.display {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: clamp(34px, 6vw, 44px);
  font-weight: 600;
  text-align: right;
  letter-spacing: 0.3px;
  padding: 6px 2px 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.last-calculation {
  margin-top: 8px;
  text-align: right;
  min-height: 18px;
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buttons {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

button {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  height: 60px;
  background: var(--btn);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

button:hover {
  background: var(--btnHover);
  border-color: rgba(255, 255, 255, 0.14);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 2px solid rgba(245, 158, 11, 0.65);
  outline-offset: 2px;
}

.operator {
  background: var(--op);
}

.operator:hover {
  background: var(--opHover);
}

.function {
  background: var(--danger);
}

.function:hover {
  background: var(--dangerHover);
}

.equals {
  background: var(--accent);
  color: #111;
  border-color: rgba(255, 255, 255, 0.12);
}

.equals:hover {
  background: var(--accentHover);
}

.main-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: rgba(15, 17, 21, 0.7);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.footer-content {
  width: min(920px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-content p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.social {
  display: flex;
  align-items: center;
  gap: 10px;
}

.social a {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--text);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  transition: background-color 0.15s ease, transform 0.08s ease, border-color 0.15s ease;
  text-decoration: none;
}

.social a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.social a:active {
  transform: translateY(1px);
}

@media (max-width: 420px) {
  button {
    height: 56px;
    font-size: 17px;
    border-radius: 12px;
  }

  .calculator {
    padding: 16px;
    border-radius: 16px;
  }

  .display-section {
    border-radius: 12px;
  }
}
