body {
  font-family: 'Inter', sans-serif;
  display: flex;
  height: 100vh;
  justify-content: center;
  align-items: center;
  margin: 0;
  position: relative;
  background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
  background-size: 200% 200%;
  animation: gradientBG 30s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  overflow: hidden;
}

.math-symbols {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.symbol-row {
  position: absolute;
  white-space: nowrap;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.1);
  font-family: 'Times New Roman', serif;
  padding: 20px 0;
  width: 200%;
  left: -50%;
  animation-delay: 0s;
}

.row1 {
  top: 5%;
  animation: moveLeft 50s linear infinite;
  transform: translateX(100%);
}

.row2 {
  top: 20%;
  animation: moveRightImmediate 50s linear infinite;
  transform: translateX(0%);
}

.row3 {
  top: 35%;
  animation: moveLeft 75s linear infinite;
  transform: translateX(100%);
}

.row4 {
  top: 50%;
  animation: moveRight 50s linear infinite;
  transform: translateX(-100%);
}

.row5 {
  top: 65%;
  animation: moveLeft 75s linear infinite;
  transform: translateX(100%);
}

.row6 {
  top: 80%;
  animation: moveRight 50s linear infinite;
  transform: translateX(-100%);
}

.row7 {
  top: 95%;
  animation: moveLeftImmediate 75s linear infinite;
  transform: translateX(0%);
}

@keyframes moveLeft {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes moveRight {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes moveLeftImmediate {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-100%);
  }
}

@keyframes moveRightImmediate {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 25px 25px, rgba(255, 255, 255, 0.1) 2%, transparent 0%),
    radial-gradient(circle at 75px 75px, rgba(255, 255, 255, 0.1) 2%, transparent 0%);
  background-size: 100px 100px;
  pointer-events: none;
  z-index: 2;
}

.menu-container {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
}

.menu-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.1s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
}

.menu-icon i {
  font-size: 1.5em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.1s ease-out;
}

.menu-icon:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.menu-icon:hover i {
  color: #1a2a6c;
  text-shadow: none;
}

.dropdown-menu {
  position: absolute;
  top: 50px;
  left: 0;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(26, 42, 108, 0.25), 0 1.5px 8px rgba(251, 187, 45, 0.08);
  backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  display: none;
  min-width: 280px;
  padding: 8px;
  z-index: 1000;
}

.dropdown-menu.show {
  display: block;
  animation: fadeIn 0.1s ease-out;
}

.menu-item {
  padding: 12px 16px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.2em;
  border-radius: 8px;
  transition: all 0.1s ease-out;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.12);
  margin: 4px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
}

.menu-item:hover {
  background: linear-gradient(135deg, rgba(253, 187, 45, 0.9) 0%, rgba(253, 187, 45, 1) 100%);
  color: #1a2a6c;
  transform: translateY(-1px);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  text-shadow: none;
}

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

.calculator {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
  border: 1px solid rgba(255, 255, 255, 0.18);
  width: 90%;
  max-width: 400px;
  margin: 20px auto;
  position: relative;
  z-index: 10;
}

#display {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  text-align: right;
  font-size: 2em;
  color: white;
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  word-wrap: break-word;
  word-break: break-all;
}

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

button {
  padding: 15px;
  font-size: 1.2em;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.25);
  color: #1a2a6c;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

button:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

button.operator {
  font-size: 1.8em;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(178, 31, 31, 0.9) 0%, rgba(178, 31, 31, 1) 100%);
  color: #fff;
}

button.operator:hover {
  background: linear-gradient(135deg, rgba(26, 42, 108, 0.85) 0%, rgba(26, 42, 108, 0.95) 100%);
  color: #fdbb2d;
}

button.equal {
  font-size: 1.8em;
  font-weight: 700;
  background: linear-gradient(135deg, #b21f1f 0%, #fdbb2d 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

button.equal:hover {
  background: linear-gradient(135deg, #fdbb2d 0%, #b21f1f 100%);
  color: #fff;
}

button.clear {
  font-size: 1.6em;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(253, 187, 45, 0.9) 0%, rgba(253, 187, 45, 1) 100%);
  color: #1a2a6c;
}

button.clear:hover {
  background: linear-gradient(135deg, rgba(178, 31, 31, 0.85) 0%, rgba(178, 31, 31, 0.95) 100%);
  color: #fff;
}

button.memory {
  font-size: 1.4em;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(253, 187, 45, 0.9) 0%, rgba(253, 187, 45, 1) 100%);
  color: #1a2a6c;
}

button.memory:hover {
  background: linear-gradient(135deg, rgba(26, 42, 108, 0.75) 0%, rgba(26, 42, 108, 0.85) 100%);
  color: #fdbb2d;
}

/* Unique colors for numbers with enhanced styling */
.btn-1, 
.btn-2, 
.btn-3, 
.btn-4, 
.btn-5, 
.btn-6, 
.btn-7, 
.btn-8, 
.btn-9,
.btn-0 {
  background: rgba(255, 255, 255, 0.25);
  color: #1a2a6c;
  text-shadow: none;
}

button.btn-1:hover, 
button.btn-2:hover, 
button.btn-3:hover, 
button.btn-4:hover, 
button.btn-5:hover, 
button.btn-6:hover, 
button.btn-7:hover, 
button.btn-8:hover, 
button.btn-9:hover,
button.btn-0:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

button.decimal {
  font-size: 2.2em;
  font-weight: 700;
  padding-bottom: 8px;
  background: linear-gradient(135deg, #fdbb2d 0%, #fdcb3d 100%);
  color: #b21f1f;
}

button.decimal:hover {
  background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
  color: #1a2a6c;
}

/* Scientific calculator specific button styles */
.scientific-calculator .mode-btn {
  font-size: 1.1em;
  background: linear-gradient(135deg, rgba(26, 42, 108, 0.9) 0%, rgba(26, 42, 108, 1) 100%);
  color: #fdbb2d;
}

.scientific-calculator .mode-btn:hover {
  background: linear-gradient(135deg, rgba(253, 187, 45, 0.9) 0%, rgba(253, 187, 45, 1) 100%);
  color: #1a2a6c;
}

.scientific-calculator .scientific,
.scientific-calculator .chemistry,
.scientific-calculator .physics {
  font-size: 1.1em;
  background: rgba(26, 42, 108, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

.scientific-calculator .scientific:hover,
.scientific-calculator .chemistry:hover,
.scientific-calculator .physics:hover {
  background: linear-gradient(135deg, rgba(253, 187, 45, 0.9) 0%, rgba(253, 187, 45, 1) 100%);
  color: #1a2a6c;
}

/* Responsive styles */
@media (max-width: 480px) {
  .calculator {
    width: 95%;
    padding: 15px;
  }

  #display {
    padding: 12px;
    font-size: 1.5em;
    min-height: 38px;
  }

  .buttons {
    gap: 8px;
    padding: 8px;
  }

  button {
    padding: 12px;
    font-size: 1.1em;
    min-height: 45px;
  }
}

@media (max-width: 360px) {
  .calculator {
    width: 98%;
    padding: 10px;
  }

  #display {
    padding: 8px;
    font-size: 1.3em;
    min-height: 30px;
  }

  .buttons {
    gap: 6px;
    padding: 6px;
  }

  button {
    padding: 10px;
    font-size: 1em;
    min-height: 40px;
  }
}

/* Scientific calculator specific styles */
.scientific-calculator {
  width: 90%;
  max-width: 600px;
}

.scientific-calculator .buttons {
  grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 600px) {
  .scientific-calculator {
    width: 95%;
  }

  .scientific-calculator .buttons {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 480px) {
  .scientific-calculator {
    width: 98%;
  }

  .scientific-calculator .buttons {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Ensure buttons stay centered and don't touch edges */
.calculator .buttons,
.scientific-calculator .buttons {
  margin: 0 auto;
  max-width: 100%;
  box-sizing: border-box;
}

/* Ensure proper spacing for memory buttons */
.memory {
  font-size: 0.9em;
}

/* Ensure proper spacing for operator buttons */
.operator {
  font-size: 1.3em;
}

/* Ensure proper spacing for equal button */
.equal {
  font-size: 1.3em;
  background: rgba(253, 187, 45, 0.2);
}

/* Ensure proper spacing for clear button */
.clear {
  font-size: 1.1em;
  background: rgba(178, 31, 31, 0.2);
}

/* Mode-specific button visibility */
.math-mode .scientific {
  display: flex !important;
}

.chemistry-mode .chemistry {
  display: block;
}

.physics-mode .physics {
  display: block;
}

/* Adjust calculator grid for scientific functions */
.calculator .buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 20px;
}

/* Scientific Calculator Styles */
.scientific-calculator {
  width: 800px;
  padding: 32px 28px 28px 28px;
}

.scientific-calculator .buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 20px;
}

.scientific-calculator .mode-selection {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.scientific-calculator .mode-selection .mode-btn {
  flex: 1;
  max-width: 150px;
}

.scientific-calculator .subtab-space {
  grid-column: 1 / -1;
  height: 48px;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.scientific-calculator .chemistry-subtabs,
.scientific-calculator .physics-subtabs,
.scientific-calculator .math-subtabs {
  display: none;
  gap: 12px;
  justify-content: center;
  width: 100%;
}

.scientific-calculator .chemistry-subtab,
.scientific-calculator .physics-subtab,
.scientific-calculator .math-subtab {
  background: linear-gradient(135deg, rgba(26, 42, 108, 0.65) 0%, rgba(26, 42, 108, 0.75) 100%);
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1em;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.1s ease-out;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.scientific-calculator .chemistry-subtab:hover,
.scientific-calculator .physics-subtab:hover,
.scientific-calculator .math-subtab:hover {
  background: linear-gradient(135deg, rgba(253, 187, 45, 0.9) 0%, rgba(253, 187, 45, 1) 100%);
  color: #1a2a6c;
  transform: translateY(-1px);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* Show subtabs when in respective mode */
.scientific-calculator.chemistry-mode .chemistry-subtabs,
.scientific-calculator.physics-mode .physics-subtabs,
.scientific-calculator.math-mode .math-subtabs {
  display: flex;
}

.scientific-calculator button {
  height: 48px;
  font-size: 1.2em;
  padding: 0;
  margin: 0;
  width: 100%;
}

.scientific-calculator .mode-btn {
  font-size: 1.1em;
  background: linear-gradient(135deg, rgba(26, 42, 108, 0.9) 0%, rgba(26, 42, 108, 1) 100%);
  color: #fdbb2d;
}

.scientific-calculator .mode-btn:hover {
  background: linear-gradient(135deg, rgba(253, 187, 45, 0.9) 0%, rgba(253, 187, 45, 1) 100%);
  color: #1a2a6c;
}

.scientific-calculator .scientific,
.scientific-calculator .chemistry,
.scientific-calculator .physics {
  font-size: 1.1em;
  background: rgba(26, 42, 108, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

.scientific-calculator .scientific:hover,
.scientific-calculator .chemistry:hover,
.scientific-calculator .physics:hover {
  background: linear-gradient(135deg, rgba(253, 187, 45, 0.9) 0%, rgba(253, 187, 45, 1) 100%);
  color: #1a2a6c;
}

/* Responsive adjustments */
@media (max-width: 850px) {
  .scientific-calculator {
    width: 95%;
    max-width: 800px;
  }
  
  .scientific-calculator .buttons {
    gap: 8px;
  }
  
  .scientific-calculator button {
    height: 42px;
    font-size: 1.1em;
  }
}

.scientific-calculator button.scientific {
  font-size: 1.1em;
  padding: 8px 16px;
}

/* Mode-specific button visibility */
.math-mode .scientific {
  display: flex !important;
}

.chemistry-mode .chemistry {
  display: block;
}

.physics-mode .physics {
  display: block;
}

/* Ensure all buttons in the grid are properly sized */
.scientific-calculator .buttons > button {
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Adjust the last row of buttons */
.scientific-calculator .buttons > button:nth-last-child(-n+5) {
  grid-column: span 1;
}

.website-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 15px 0;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.1em;
  backdrop-filter: blur(16px);
  border-top: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 -8px 32px rgba(26, 42, 108, 0.25), 0 -1.5px 8px rgba(251, 187, 45, 0.08);
  z-index: 1000;
}

.website-footer p {
  margin: 0;
  padding: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
}
