html, body, main, header, footer, #app {
  padding: 0px;
  margin: 0px;
}

body {
  background-color: #f0f2f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header#header {
  width: 100%;
  text-align: center;
  padding-top: 16px;
  padding-bottom: 8px;
}

#page-title {
  font-size: 1.6rem;
  color: #333;
  margin: 12px 0 4px;
  font-weight: 600;
}

main#main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  width: 100%;
}

div#app {
  width: 100%;
  max-width: 380px;
}

#calculator-card {
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

#display {
  background: #1c1c1e;
  color: #fff;
  padding: 20px 24px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  border-bottom: none;
}

#expression {
  font-size: 1rem;
  color: #8e8e93;
  min-height: 22px;
  word-break: break-all;
  text-align: right;
  width: 100%;
}

#result {
  font-size: 2.8rem;
  font-weight: 300;
  line-height: 1.2;
  word-break: break-all;
  text-align: right;
  width: 100%;
}

#keypad {
  padding: 12px;
  background: #f8f9fa;
}

.calc-btn {
  height: 56px;
  font-size: 1.25rem;
  font-weight: 500;
  border-radius: 12px;
  border: none;
  transition: filter 0.1s;
}

.calc-btn:active {
  filter: brightness(0.85);
}

.calc-btn.number {
  background-color: #fff;
  color: #1c1c1e;
  border: 1px solid #e5e5ea;
}

.calc-btn.number:hover {
  background-color: #e9e9eb;
}

.calc-btn.operator {
  background-color: #ff9f0a;
  color: #fff;
}

.calc-btn.operator:hover {
  background-color: #e0890a;
}

.btn-secondary.calc-btn {
  background-color: #d1d1d6;
  color: #1c1c1e;
}

.btn-secondary.calc-btn:hover {
  background-color: #c4c4ca;
}

#btn-equals {
  background-color: #007aff;
  color: #fff;
  font-weight: 600;
}

#btn-equals:hover {
  background-color: #0066d6;
}

footer#footer {
  width: 100%;
  text-align: center;
  padding: 16px;
  padding-bottom: 24px;
}

#copyright {
  color: #8e8e93;
  font-size: 0.85rem;
  margin-top: 12px;
  margin-bottom: 0;
}

.ad-slot {
  display: flex;
  justify-content: center;
  margin: 0 auto;
  overflow: hidden;
}

@media (max-width: 480px) {
  #result {
    font-size: 2.2rem;
  }
  .calc-btn {
    height: 48px;
    font-size: 1.1rem;
    border-radius: 8px;
  }
  div#app {
    max-width: 100%;
  }
}
