/* CSS Variables for a clean, modern dark theme */
:root {
  --bg-color: #0f172a;
  --calc-bg: #1e293b;
  --display-text: #f8fafc;
  --display-prev-text: #94a3b8;
  --btn-bg: #334155;
  --btn-hover: #475569;
  --btn-text: #e2e8f0;
  --btn-operator-bg: #f59e0b;
  --btn-operator-hover: #fbbf24;
  --btn-operator-text: #fff;
  --btn-clear-bg: #ef4444;
  --btn-clear-hover: #f87171;
  --shadow-color: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.app-body {
  background-color: var(--bg-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.calculator-container {
  width: 100%;
  max-width: 360px;
}

.calculator-ui {
  background-color: var(--calc-bg);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px var(--shadow-color), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.calculator-display {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  word-wrap: break-word;
  word-break: break-all;
  box-shadow: inset 0 4px 6px rgba(0,0,0,0.3);
}

.display-previous {
  color: var(--display-prev-text);
  font-size: 1.1rem;
  min-height: 1.5rem;
}

.display-current {
  color: var(--display-text);
  font-size: 2.5rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.calculator-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.btn {
  cursor: pointer;
  border: none;
  outline: none;
  background-color: var(--btn-bg);
  color: var(--btn-text);
  font-size: 1.25rem;
  border-radius: 12px;
  padding: 1.2rem 1rem;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  user-select: none;
}

.btn:hover {
  background-color: var(--btn-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-operator {
  background-color: var(--btn-operator-bg);
  color: var(--btn-operator-text);
  font-weight: bold;
}

.btn-operator:hover {
  background-color: var(--btn-operator-hover);
}

.btn-clear, .btn-delete {
  background-color: var(--btn-clear-bg);
  color: white;
  font-weight: bold;
}

.btn-clear:hover, .btn-delete:hover {
  background-color: var(--btn-clear-hover);
}

.span-two {
  grid-column: span 2;
}

/* Responsiveness for very small screens */
@media (max-width: 350px) {
  .calculator-ui { padding: 1rem; }
  .btn { padding: 1rem 0.5rem; font-size: 1.1rem; }
  .display-current { font-size: 2rem; }
}
