/* ===== Design Tokens ===== */
:root {
  --clr-bg: #0f0e17;
  --clr-surface: rgba(255, 255, 255, 0.04);
  --clr-surface-hover: rgba(255, 255, 255, 0.08);
  --clr-border: rgba(255, 255, 255, 0.08);
  --clr-text: #fffffe;
  --clr-text-muted: rgba(255, 255, 255, 0.5);
  --clr-accent: #7f5af0;
  --clr-accent-glow: rgba(127, 90, 240, 0.35);
  --clr-accent-2: #2cb67d;
  --clr-error: #ff6b6b;
  --clr-error-bg: rgba(255, 107, 107, 0.1);
  --font: 'Outfit', system-ui, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ===== Animated Background Shapes ===== */
.background-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

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

.shape-1 {
  width: 400px;
  height: 400px;
  background: var(--clr-accent);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.shape-2 {
  width: 350px;
  height: 350px;
  background: var(--clr-accent-2);
  bottom: -80px;
  left: -80px;
  animation-delay: -7s;
}

.shape-3 {
  width: 250px;
  height: 250px;
  background: #e45858;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.1); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 30px) scale(1.05); }
}

/* ===== Container ===== */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 24px;
}

/* ===== Card ===== */
.card {
  background: var(--clr-surface);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: var(--shadow);
  animation: cardIn 0.6s ease-out;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== Card Header ===== */
.card-header {
  text-align: center;
  margin-bottom: 36px;
}

.icon-wrapper {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--clr-accent), var(--clr-accent-2));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: iconPulse 3s ease-in-out infinite;
}

.cake-icon {
  width: 28px;
  height: 28px;
  color: white;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--clr-accent-glow); }
  50% { box-shadow: 0 0 20px 6px var(--clr-accent-glow); }
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--clr-text-muted);
  font-weight: 300;
}

/* ===== Input Group ===== */
.input-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 14px;
  margin-bottom: 28px;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--clr-text-muted);
  transition: color var(--transition);
}

.input-field.error label {
  color: var(--clr-error);
}

.input-field input {
  width: 100%;
  padding: 14px 16px;
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-field input::placeholder {
  color: rgba(255, 255, 255, 0.2);
  font-weight: 400;
}

.input-field input:hover {
  background: var(--clr-surface-hover);
}

.input-field input:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px var(--clr-accent-glow);
}

.input-field.error input {
  border-color: var(--clr-error);
  box-shadow: 0 0 0 3px var(--clr-error-bg);
}

.error-message {
  font-size: 0.72rem;
  color: var(--clr-error);
  min-height: 1rem;
  font-weight: 400;
}

/* Hide number spinner */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* ===== Divider Row ===== */
.divider-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.divider-line {
  flex: 1;
  border: none;
  height: 1px;
  background: var(--clr-border);
}

#calculate-btn {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-accent), #6341d0);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px var(--clr-accent-glow);
}

#calculate-btn svg {
  width: 26px;
  height: 26px;
}

#calculate-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px var(--clr-accent-glow);
}

#calculate-btn:active {
  transform: scale(0.95);
}

/* ===== Results ===== */
.results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.result-number {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--clr-accent), var(--clr-accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity var(--transition);
}

.result-number.animate {
  animation: countPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes countPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.result-label {
  font-size: 1.6rem;
  font-weight: 300;
  color: var(--clr-text-muted);
}

/* ===== Fun Fact ===== */
.fun-fact {
  margin-top: 24px;
  padding: 16px 20px;
  background: rgba(127, 90, 240, 0.08);
  border: 1px solid rgba(127, 90, 240, 0.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fadeUp 0.4s ease-out;
}

.fun-fact.hidden {
  display: none;
}

.fun-fact-icon {
  font-size: 1.1rem;
  line-height: 1.5;
}

.fun-fact p {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  line-height: 1.5;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  margin-top: 24px;
}

.footer p {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.25);
  font-weight: 300;
}

/* ===== Responsive ===== */
@media (max-width: 520px) {
  .container {
    padding: 16px;
  }

  .card {
    padding: 28px 22px;
  }

  .result-number {
    font-size: 2.5rem;
  }

  .result-label {
    font-size: 1.3rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  .input-group {
    gap: 10px;
  }

  .input-field input {
    padding: 12px 12px;
    font-size: 1rem;
  }
}
