/* Reset some default margins/paddings */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: Arial, sans-serif;
  background-color: #121212;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Full screen calculator container */
.calculator {
  margin-top: 15px;    
  background-color: #222;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  width: 100vw;
  max-width: 480px;
  height: 100vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
}

/* Screen input */
#screen {
  width: 100%;
  height: 4.5rem;
  font-size: 2.5rem;
  text-align: right;
  margin-bottom: 1rem;
  padding: 0 1rem;
  border: none;
  border-radius: 8px;
  background-color: #333;
  color: #fff;
  user-select: none;
}

/* History container */
.history {
  flex: 0 0 20%;
  overflow-y: auto;
  margin-bottom: 1rem;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  background-color: #1a1a1a;
}

.history h4 {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  font-size: 1.1rem;
}

#history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  max-height: 100%;
}

#history-list li {
  padding: 0.3rem 0;
  border-bottom: 1px solid #333;
}

/* Numpad grid */
.numpad {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

/* Buttons */
.numpad button {
  font-size: 1.3rem;
  padding: 0.2rem 0;
  border: none;
  border-radius: 8px;
  background-color: #444;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
}

.numpad button:hover {
  background-color: #555;
}

.numpad button:active {
  background-color: #655;
}

/* Responsive font sizes and layout tweaks */
@media (max-width: 480px) {
  .calculator {
    width: 95vw;
    height: 95vh;
    padding: 1rem;
  }

  #screen {
    font-size: 2rem;
    height: 4rem;
  }

  .numpad button {
    font-size: 1.2rem;
    padding: 0.4rem 0;
  }

  .history {
    font-size: 0.8rem;
  }
}
