body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: #1a1a1a;
  color: white;
  font-size: 17px;
}
.container {
  max-width: 1400px;
  margin: auto;
}
header {
  background-color: #000;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-size: 22px;
  font-weight: bold;
}
.logo .blue { color: #00aaff; }
.logo .green { color: #00cc66; }

.search-bar {
  display: flex;
}
.search-bar input {
  padding: 6px;
  font-size: 16px;
  border-radius: 4px 0 0 4px;
  border: none;
}
.search-bar button {
  padding: 6px 10px;
  font-size: 16px;
  background-color: #00aaff;
  border: none;
  color: white;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

main {
  background-color: #111;
  padding: 20px;
}
.calculator-wrapper {
  display: flex;
  justify-content: center;
  gap: 30px;
}
.calculator {
  background-color: #000;
  border-radius: 16px;
  padding: 14px;
  width: 100%;
  max-width: 920px;
  position: relative;
}
.ad-space {
  width: 220px;
  flex-shrink: 0;
}

.display {
  background-color: #222;
  border-radius: 8px;
  padding: 6px;
  margin-bottom: 6px;
}
#mathInputDisplay {
  font-size: 24px;
  text-align: right;
  min-height: 32px;
  padding: 3px;
  background-color: transparent;
}
#resultDisplay {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  font-size: 20px;
  min-height: 28px;
  padding: 2px;
  color: #00ff99;
}
#resultFormatted {
  text-align: right;
}

.mq-root-block,
.mq-editable-field {
  background: transparent !important;
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  color: white;
  font-size: 24px;
  padding: 2px;
  caret-color: white;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
  position: relative;
}

.calc-buttons {
  grid-column: 1 / span 9;
  grid-row: 1 / span 7;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 5px;
}

.calc-buttons button {
  font-size: 15px;
  padding: 7px;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calc-buttons button.number {
  background-color: #444;
}
.calc-buttons button:hover {
  background-color: #555;
}

/* ✅ Fixed-height Scrollable History */
.history {
  grid-column: 7 / span 3;
  grid-row: 4 / span 4;
  background-color: #1c1c1c;
  padding: 6px;
  border-radius: 10px;
  color: white;
  height: 200px;
  overflow-y: auto;
}
.history ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.history li {
  margin-bottom: 6px;
  font-size: 15px;
}
.history .mq-root-block {
  font-size: 15px;
  color: white;
}

/* DEG/RAD toggle in top-right button grid */
.deg-rad-toggle-wrapper {
  grid-column: 8 / span 2;
  grid-row: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 2px;
}

.deg-rad-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.switch {
  position: relative;
  width: 70px;
  height: 26px;
  background-color: #222;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 13px;
  color: white;
}

.switch span {
  flex: 1;
  text-align: center;
  z-index: 2;
}

#toggleKnob {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background-color: #00aaff;
  border-radius: 16px;
  transition: left 0.3s ease;
  z-index: 1;
  left: 0;
}
/* ✅ Custom Scrollbar for History Box */
.history::-webkit-scrollbar {
  width: 10px;
}

.history::-webkit-scrollbar-track {
  background: #2a2a2a;
  border-radius: 10px;
}

.history::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 10px;
  border: 2px solid #2a2a2a;
}

.history::-webkit-scrollbar-thumb:hover {
  background: #777;
}
