* {
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  text-align: center;
  padding: 1rem;
  background-color: #f4f4f4;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

.calculator {
  width: 100%;
  max-width: 350px;
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

h1 {
  font-size: 1.8rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

.display {
  background: #eee;
  padding: 1rem;
  font-size: 2rem;
  text-align: right;
  border-radius: 5px;
  margin-bottom: 1rem; /* Увеличено разстояние */
  height: 70px; /* Уголемен правоъгълник */
  overflow: hidden;
  color: #333;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  /* Плавна промяна на размера на шрифта */
  transition: font-size 0.2s;
}

.display.placeholder {
  font-size: 1.2rem !important;
  font-weight: normal !important;
  color: #888 !important;
  justify-content: center !important;
}

/* НОВ СТИЛ: Когато показваме резултата, шрифтът ще е по-малък */
.display.result-mode {
    font-size: 1.5rem;
    justify-content: center;
}

/* Премахнахме стила за .result оттук */

.keypad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 1rem;
}

.key {
  padding: 1rem;
  font-size: 1.5rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  background-color: #fafafa;
  cursor: pointer;
  touch-action: manipulation;
}

.key:active {
  background-color: #ccc;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Правим бутоните равни */
  gap: 8px;
}

.action-btn {
  padding: 0.8rem;
  font-size: 1.2rem;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  touch-action: manipulation;
}

.action-btn.clear {
  background-color: #f44336;
}

.action-btn.convert {
  background-color: #007bff;
}

.action-btn:active {
  opacity: 0.8;
}