/* ===== Cartoon Calculator Styles ===== */

/* --- Background decorations --- */
.bg-decor {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.float-emoji {
  position: absolute; font-size: 2rem; opacity: 0.18;
  animation: floatAround 14s ease-in-out infinite;
}
.f1 { top: 8%;  left: 5%;  animation-delay: 0s;   font-size: 2.4rem; }
.f2 { top: 12%; right: 8%;  animation-delay: -3s;  font-size: 1.8rem; }
.f3 { top: 55%; left: 3%;  animation-delay: -6s;  font-size: 2rem; }
.f4 { top: 70%; right: 5%;  animation-delay: -9s;  font-size: 2.2rem; }
.f5 { top: 40%; left: 88%; animation-delay: -5s;  font-size: 1.6rem; }
.f6 { top: 80%; left: 12%; animation-delay: -11s; font-size: 1.9rem; }

@keyframes floatAround {
  0%, 100% { transform: translateY(0)    rotate(0deg)  scale(1); }
  25%      { transform: translateY(-18px) rotate(6deg)  scale(1.08); }
  50%      { transform: translateY(6px)   rotate(-4deg) scale(0.94); }
  75%      { transform: translateY(-10px) rotate(3deg)  scale(1.04); }
}

/* --- Calculator body --- */
.calc-body {
  position: relative; z-index: 1;
  width: 100%; max-width: 360px; margin: 0 auto;
  background: linear-gradient(145deg, #fff9f2 0%, #fef3e4 40%, #fde8d0 100%);
  border: 3px solid #f0c78e;
  border-radius: 28px;
  box-shadow:
    0 10px 40px rgba(180, 120, 60, 0.18),
    0 4px 12px rgba(180, 120, 60, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.7);
  padding: 24px 20px 20px;
}

/* --- Display area --- */
.display-area {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}

.emoji-face {
  flex: 0 0 auto;
  font-size: 3rem;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.10));
  user-select: none;
}
.emoji-face.bounce {
  animation: emojiBounce 0.45s cubic-bezier(.34,1.56,.64,1);
}
@keyframes emojiBounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35); }
  60%  { transform: scale(0.85); }
  100% { transform: scale(1); }
}

.display-screen {
  flex: 1 1 auto;
  background: #fffef9;
  border: 2.5px dashed #e8d5b7;
  border-radius: 18px;
  padding: 10px 16px;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: #5c3d2e;
  text-align: right;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0.02em;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.04);
  min-height: 58px;
  display: flex; align-items: center; justify-content: flex-end;
}

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

/* --- Base calc button --- */
.calc-btn {
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  padding: 0;
  min-height: 58px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  transition: transform 0.12s cubic-bezier(.34,1.56,.64,1),
              box-shadow 0.12s ease,
              filter 0.12s ease;
  /* 3D puffy look */
  box-shadow:
    0 5px 0 var(--btn-shadow),
    0 6px 12px rgba(0,0,0,0.08);
  /* top highlight */
  border-top: 2px solid rgba(255,255,255,0.55);
}
.calc-btn:active {
  transform: translateY(3px) scale(0.96);
  box-shadow:
    0 2px 0 var(--btn-shadow),
    0 3px 6px rgba(0,0,0,0.06);
}
.calc-btn:hover {
  filter: brightness(1.06);
}

/* --- Digit buttons (warm peach) --- */
.btn-digit {
  --btn-shadow: #e8b88a;
  background: linear-gradient(180deg, #fff0e0 0%, #ffe0b2 60%, #f5cba0 100%);
  color: #6b4226;
}

/* --- Operator buttons --- */
.btn-op {
  color: #fff;
}
.btn-op[data-value="÷"] {
  --btn-shadow: #4fa8d4;
  background: linear-gradient(180deg, #a3dffb 0%, #81d4fa 50%, #5bb8e0 100%);
}
.btn-op[data-value="×"] {
  --btn-shadow: #c96a85;
  background: linear-gradient(180deg, #f7b0c4 0%, #f48fb1 50%, #d47090 100%);
}
.btn-op[data-value="−"] {
  --btn-shadow: #6da876;
  background: linear-gradient(180deg, #bce0bf 0%, #a5d6a7 50%, #7db880 100%);
}
.btn-op[data-value="+"] {
  --btn-shadow: #c9a840;
  background: linear-gradient(180deg, #fff0b0 0%, #ffe082 50%, #e0c050 100%);
  color: #5c3d00;
}

/* --- Clear button --- */
.btn-clear {
  --btn-shadow: #c95a52;
  background: linear-gradient(180deg, #ffb0aa 0%, #ff8a80 50%, #e06058 100%);
  color: #fff;
}

/* --- Delete button --- */
.btn-del {
  --btn-shadow: #c97a5e;
  background: linear-gradient(180deg, #ffc8b4 0%, #ffab91 50%, #e08060 100%);
  color: #fff;
}

/* --- Percent button --- */
.btn-pct {
  --btn-shadow: #7e6aaa;
  background: linear-gradient(180deg, #cfc0eb 0%, #b39ddb 50%, #8c70b8 100%);
  color: #fff;
}

/* --- Equals button --- */
.btn-eq {
  --btn-shadow: #c98030;
  background: linear-gradient(180deg, #ffe0b0 0%, #ffcc80 50%, #f0a040 100%);
  color: #5c3000;
  font-size: 1.5rem;
}

/* --- Zero spans 2 columns --- */
.btn-zero {
  grid-column: span 2;
}

/* --- Responsive --- */
@media (max-width: 400px) {
  .calc-body {
    max-width: 100%;
    padding: 18px 14px 16px;
    border-radius: 22px;
  }
  .btn-grid {
    gap: 7px;
  }
  .calc-btn {
    font-size: 1.1rem;
    min-height: 50px;
    border-radius: 14px;
  }
  .display-screen {
    font-size: 1.5rem;
    padding: 8px 12px;
    min-height: 48px;
  }
  .emoji-face {
    font-size: 2.4rem;
  }
}
