/* Reset & Center */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #a18cd1, #fbc2eb);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Container */
.container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 20px;
}

/* Calculator Box */
.calculator {
  background: #fff;
  padding: 20px;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.2);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
}

#display {
  width: 100%;
  height: 60px;
  font-size: 1.6rem;
  text-align: right;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 10px;
  border: 2px solid #ccc;
  outline: none;
}

/* Buttons */
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

button {
  padding: 15px;
  font-size: 1.2rem;
  border: none;
  border-radius: 12px;
  background: #f4f4f4;
  cursor: pointer;
  transition: 0.2s;
}

button:hover {
  background: #ddd;
}

/* History */
.history-box {
  margin-top: 20px;
  background: #fafafa;
  border-radius: 12px;
  padding: 10px;
  max-height: 150px;
  overflow-y: auto;
}

.history-box h2 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

#history {
  list-style: none;
  font-size: 0.9rem;
}

#history li {
  padding: 5px 0;
  border-bottom: 1px solid #eee;
}

/* Dark Mode */
.dark {
  background: #1e1e1e;
  color: #fff;
}

.dark .calculator {
  background: #2d2d2d;
}

.dark #display {
  background: #3a3a3a;
  border: 2px solid #555;
  color: #fff;
}

.dark button {
  background: #444;
  color: #fff;
}

.dark button:hover {
  background: #666;
}

.dark .history-box {
  background: #3a3a3a;
}
