:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: #12151a;
  color: #f4f1ea;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 15%, #2a4b4b 0, transparent 34%),
    radial-gradient(circle at 90% 85%, #45333b 0, transparent 32%),
    #12151a;
}

.calculadora {
  width: min(100% - 32px, 420px);
  margin: 0 auto;
  padding: 48px 0 32px;
}

.cabecalho {
  padding: 0 8px 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #f0b36d;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(2.1rem, 9vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.05em;
}

.painel {
  padding: 18px;
  border: 1px solid #ffffff1c;
  border-radius: 28px;
  background: #1b2027dd;
  box-shadow: 0 24px 60px #00000050;
  backdrop-filter: blur(12px);
}

#visor {
  display: block;
  width: 100%;
  min-height: 92px;
  padding: 14px 16px;
  overflow: hidden;
  border-radius: 18px;
  background: #0d1014;
  color: #f6f0e5;
  font-family: "Courier New", monospace;
  font-size: clamp(2.25rem, 11vw, 3.6rem);
  line-height: 1.2;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teclas {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.tecla {
  min-width: 0;
  min-height: 54px;
  border: 1px solid #ffffff12;
  border-radius: 16px;
  background: #2a3039;
  color: #f4f1ea;
  cursor: pointer;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.tecla:hover {
  border-color: #f0b36d80;
  background: #353e48;
}

.tecla:active {
  transform: scale(0.95);
}

.tecla:focus-visible {
  outline: 3px solid #f0b36d;
  outline-offset: 3px;
}

.tecla-funcao {
  background: #354047;
  color: #a9d6c9;
}

.tecla-operador,
.tecla-igual {
  background: #c8794d;
  color: #1b1514;
}

.tecla[data-tecla="0"] {
  grid-column: span 2;
}

.tecla-igual {
  background: #f0b36d;
  grid-column: 1 / -1;
}

@media (max-width: 375px) {
  .calculadora {
    width: min(100% - 20px, 420px);
    padding-top: 24px;
  }

  .painel {
    padding: 12px;
    border-radius: 22px;
  }

  .teclas {
    gap: 7px;
  }

  .tecla {
    min-height: 48px;
    border-radius: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tecla {
    transition: none;
  }
}
