.mdas-calculator {
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  font-family: 'Segoe UI', sans-serif;
  color: #333333;
}

.mdas-calculator.dark-mode {
  background: #1e1e1e;
  color: #eeeeee;
}

.mdas-calculator h2 {
  text-align: center;
  color: #F43676;
  margin-bottom: 15px;
}

.theme-toggle {
  text-align: center;
  margin-bottom: 15px;
}

.theme-toggle button {
  background-color: #F43676;
  color: #ffffff;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 14px;
}

.theme-toggle button:hover {
  background-color: #c22c5e;
}

.expression-group {
  margin-bottom: 15px;
}

.expression-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
}

.expression-input-wrapper {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #cccccc;
  padding: 6px;
  overflow-x: auto;
  white-space: nowrap;
}

.expression-input-wrapper input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 18px;
  background: transparent;
  color: inherit;
}

.mdas-calculator.dark-mode .expression-input-wrapper {
  border-color: #555555;
}

.mdas-error-message {
  margin-top: 6px;
  font-size: 13px;
  color: #d9534f;
  min-height: 16px;
}

/* Keypad layout */
.mdas-keypad {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.mdas-keypad button {
  flex: 1 0 22%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background-color: #F43676;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.05s;
}

.mdas-keypad button:hover {
  background-color: #c22c5e;
}

.mdas-keypad button:active {
  transform: scale(0.97);
}

.mdas-keypad .wide-btn {
  flex: 1 0 46%;
}

.mdas-keypad .primary-btn {
  background-color: #F43676;
  font-weight: bold;
}

.mdas-keypad .secondary-btn {
  background-color: #555555;
}

.mdas-calculator.dark-mode .mdas-keypad .secondary-btn {
  background-color: #444444;
}

.mdas-calculator.dark-mode .mdas-keypad button {
  background-color: #F43676;
}

/* Result area */
.mdas-result {
  margin-top: 20px;
  padding: 12px;
  border-radius: 10px;
  background: #fdf3f7;
  border: 1px solid #F43676;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mdas-calculator.dark-mode .mdas-result {
  background: #2a1f24;
  border-color: #F43676;
}

.mdas-result-label {
  font-weight: bold;
  color: #F43676;
}

.mdas-result-value {
  font-size: 20px;
  font-weight: bold;
  overflow-x: auto;
  white-space: nowrap;
}

/* Buttons / Inputs font color sync */
.mdas-calculator.dark-mode input {
  color: #eeeeee;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .mdas-calculator {
    padding: 16px;
    margin: 10px;
  }

  .mdas-keypad button {
    flex: 1 0 22%;
    padding: 10px;
    font-size: 15px;
  }

  .mdas-keypad .wide-btn {
    flex: 1 0 48%;
  }

  .mdas-result-value {
    font-size: 18px;
  }
}