:root {
  --bg: #121214;
  --primary: rgba(32, 33, 36, 0.85);
  --primary-blur: rgba(32, 33, 36, 0.4);
  --text: #e0e0e0;
  --accent: #ff6f61;
  --accent-light: #ff9278;
  --btn-bg: rgba(40, 41, 45, 0.75);
  --btn-hover-bg: rgba(255, 111, 97, 0.15);
  --shadow-light: rgba(255, 255, 255, 0.1);
  --shadow-dark: rgba(0, 0, 0, 0.7);
  --glass-blur: 15px;
  --font-main: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-main);
}

body {
  background: linear-gradient(135deg, #0f0f13, #1a1a1f);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  user-select: none;
}

.calculator {
  width: 360px;
  padding: 2rem 2.5rem;
  border-radius: 2rem;
  background: var(--primary);
  backdrop-filter: blur(var(--glass-blur));
  box-shadow:
    8px 8px 20px var(--shadow-dark),
    -8px -8px 20px var(--shadow-light);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: transform 0.3s ease;
}

.display {
  background: rgba(255 255 255 / 0.1);
  border-radius: 1rem;
  padding: 1.5rem 2rem;
  font-size: 3rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  letter-spacing: 0.05em;
  box-shadow:
    inset 0 0 15px rgba(255 255 255 / 0.2),
    inset 0 -4px 12px rgba(0 0 0 / 0.4);
  user-select: text;
  min-height: 70px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.display::-webkit-scrollbar {
  display: none;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.btn {
  background: var(--btn-bg);
  color: var(--text);
  border-radius: 1rem;
  border: none;
  padding: 1.3rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    4px 4px 10px var(--shadow-dark),
    -4px -4px 10px var(--shadow-light);
  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.15s ease;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150%;
  height: 150%;
  background: var(--accent);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  border-radius: 50%;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 0;
}

.btn:hover::before {
  opacity: 0.15;
  transform: translate(-50%, -50%) scale(1.1);
}

.btn:hover {
  background: var(--btn-hover-bg);
  box-shadow:
    0 6px 12px var(--accent-light),
    0 4px 6px var(--shadow-dark);
  color: var(--accent);
  transform: translateY(-4px) scale(1.05);
  z-index: 1;
}

.btn:active {
  transform: translateY(1px) scale(0.95);
  box-shadow:
    inset 0 4px 8px var(--shadow-dark);
}

.btn:focus {
  outline: none;
  box-shadow:
    0 0 0 3px var(--accent-light),
    0 0 10px var(--accent);
}

.equal {
  grid-row: span 2;
  background: var(--accent);
  color: #121214;
  font-weight: 700;
  box-shadow:
    0 6px 14px var(--accent-light),
    inset 0 -4px 10px #c1503e;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
}

.equal::before {
  background: #ff856e;
}

.equal:hover {
  background: var(--accent-light);
  box-shadow:
    0 10px 20px var(--accent),
    inset 0 -6px 12px #d96e56;
  color: #121214;
  transform: translateY(-5px) scale(1.08);
  z-index: 1;
}

.equal:active {
  transform: translateY(2px) scale(0.95);
  box-shadow:
    inset 0 4px 8px #a0422b;
}

.zero {
  grid-column: span 2;
}

