html {
  box-sizing: border-box;
}
*, *::before, *::after {
  box-sizing: inherit;
}

body {
  font-family: Arial, sans-serif;
  background: #f7fafc;
  color: #111827;
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
}

.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #dbeafe;
  color: #1e3a8a;
  padding: 18px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.site-header h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

main,
.page-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 auto 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
  max-width: 960px;
}

.site-nav a {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
}

.site-nav a:hover,
.site-nav a:focus {
  text-decoration: underline;
}

h1 {
  color: #111827;
  margin-top: 0;
}

.tool-page {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 24px;
  margin: 24px auto 40px;
  max-width: 760px;
}

.tool-page h1 {
  margin-top: 0;
  margin-bottom: 24px;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.calculator {
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  width: 260px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.calculator.wide {
  width: 320px;
}

#display,
.display {
  width: 100%;
  height: 50px;
  font-size: 20px;
  margin-bottom: 10px;
  padding: 10px;
  text-align: right;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}

.display {
  height: 60px;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.buttons.scientific {
  grid-template-columns: repeat(5, 1fr);
}

button,
.actions button {
  padding: 12px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  background: #e5e7eb;
  cursor: pointer;
  transition: background 0.2s ease;
}

button:hover,
.actions button:hover {
  background: #d1d5db;
}

.equal,
.button--primary {
  background: #2563eb;
  color: #ffffff;
}

.equal:hover,
.button--primary:hover {
  background: #1d4ed8;
}

.clear,
.button--danger {
  background: #ef4444;
  color: #ffffff;
}

.contact-form {
  max-width: 600px;
  margin: 24px auto;
  background: #ffffff;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  border-radius: 12px;
}

.contact-form h1 {
  font-size: 28px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
  box-sizing: border-box;
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.actions button {
  padding: 12px 20px;
}

.actions button.submit {
  background: #2563eb;
  color: white;
}

.actions button.cancel {
  background: #e5e7eb;
  color: #111827;
}

.error {
  color: #b91c1c;
  font-size: 14px;
  margin-top: 6px;
}

@media (max-width: 640px) {
  .calculator,
  .calculator.wide,
  .contact-form {
    width: 100%;
  }

  .buttons.scientific {
    grid-template-columns: repeat(4, 1fr);
  }
}
