:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --color-accent: #6366f1;
  --color-accent-hover: #4f46e5;
  --color-operator: #ec4899;
  --color-operator-hover: #db2777;
  --color-function: #3b82f6;
  --color-function-hover: #2563eb;
  --color-number: rgba(255, 255, 255, 0.05);
  --color-number-hover: rgba(255, 255, 255, 0.1);
  --transition-speed: 0.2s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg-gradient);
  overflow: hidden;
  position: relative;
}

/* Background Animated Orbs */
.background-decorations {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 0;
  overflow: hidden;
}

.circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: float-around 20s infinite ease-in-out;
}

.circle-1 {
  width: 300px;
  height: 300px;
  background: #4f46e5;
  top: 15%;
  left: 20%;
  animation-delay: 0s;
}

.circle-2 {
  width: 400px;
  height: 400px;
  background: #db2777;
  bottom: 10%;
  right: 15%;
  animation-delay: -5s;
}

@keyframes float-around {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-40px) scale(1.1);
  }
}

/* Calculator Glass Frame */
.calculator-container {
  position: relative;
  z-index: 10;
  width: 360px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--glass-shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header decor */
.calculator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.brand {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  font-weight: 600;
  opacity: 0.8;
}

.status-dots {
  display: flex;
  gap: 6px;
}

.status-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

/* Screen Display */
.display-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  min-height: 120px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 18px;
  word-wrap: break-word;
  word-break: break-all;
  overflow: hidden;
}

.previous-operand {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 300;
  min-height: 1.6rem;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.current-operand {
  color: var(--text-primary);
  font-size: 2.8rem;
  font-weight: 400;
  margin-top: 4px;
  transition: font-size 0.1s ease;
  white-space: nowrap;
}

/* Grid Keys Layout */
.keys-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Base Key Styles */
.key {
  border: none;
  outline: none;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text-primary);
  height: 64px;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  transition: background-color var(--transition-speed), transform 0.08s, box-shadow var(--transition-speed);
}

.key:active {
  transform: scale(0.94);
}

/* Number Button Styles */
.key.number {
  background: var(--color-number);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

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

/* Operators (/, *, -, +, etc.) */
.key.operator {
  background: var(--color-operator);
  font-weight: 600;
  color: #fff;
}

.key.operator:hover {
  background: var(--color-operator-hover);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
}

/* Functions (AC, +/-, %) */
.key.function {
  background: var(--color-function);
  font-weight: 500;
  color: #fff;
}

.key.function:hover {
  background: var(--color-function-hover);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

/* Decimal Key */
.key.decimal {
  background: var(--color-number);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

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

/* Equals Key */
.key.equals {
  background: var(--color-accent);
  font-weight: 600;
  color: #fff;
}

.key.equals:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.5);
}

/* Special Double Width Button for Zero */
.double-width {
  grid-column: span 2;
}

/* Responsive adjustment */
@media (max-width: 400px) {
  .calculator-container {
    width: 90%;
    margin: 10px;
    padding: 16px;
  }
  
  .key {
    height: 58px;
    font-size: 1.25rem;
  }
  
  .current-operand {
    font-size: 2.2rem;
  }
}
