* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #e0e5ec 0%, #d5dae3 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.header {
  background: #e0e5ec;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.header-content {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left,
.header-right {
  flex: 1;
}
.header-left {
  display: flex;
  justify-content: flex-start;
}
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}
.header-right {
  display: flex;
  justify-content: flex-end;
}
.back-btn {
  background: #e0e5ec;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 6px 6px 12px #bec3c9, -6px -6px 12px #ffffff;
  transition: all 0.1s ease;
}
.back-btn:active {
  box-shadow: inset 6px 6px 12px #bec3c9, inset -6px -6px 12px #ffffff;
}
.back-btn svg {
  width: 24px;
  height: 24px;
  fill: #4a5568;
}
.header-logo {
  width: 45px;
  height: 45px;
  background: #e0e5ec;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 6px 6px 12px #bec3c9, -6px -6px 12px #ffffff;
  font-size: 24px;
}
.header-logo svg {
  width: 28px;
  height: 28px;
  fill: #667eea;
}
.header-title {
  font-size: 20px;
  font-weight: bold;
  color: #4a5568;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}
.header-title span {
  display: block;
}
.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.container {
  width: 100%;
  max-width: 420px;
}
.calculator-wrap {
  background: #e0e5ec;
  border-radius: 40px;
  padding: 30px;
  box-shadow: 20px 20px 60px #bec3c9, -20px -20px 60px #ffffff;
}
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.mode-tab {
  background: #e0e5ec;
  border: none;
  border-radius: 12px;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #718096;
  cursor: pointer;
  box-shadow: 6px 6px 12px #bec3c9, -6px -6px 12px #ffffff;
  transition: all 0.1s ease;
}
.mode-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.2);
}
.input-section {
  background: #ffffff;
  border-radius: 25px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: inset 8px 8px 16px #d1d9e6, inset -8px -8px 16px #ffffff;
}
.section-label {
  font-size: 14px;
  font-weight: 600;
  color: #718096;
  margin-bottom: 12px;
}
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}
.matrix-input {
  background: #e0e5ec;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #2d3748;
  box-shadow: inset 4px 4px 8px #d1d9e6, inset -4px -4px 8px #ffffff;
  outline: none;
  width: 100%;
  text-align: center;
}
.result-section {
  background: #ffffff;
  border-radius: 25px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: inset 8px 8px 16px #d1d9e6, inset -8px -8px 16px #ffffff;
}
.result-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 20px;
  background: #e0e5ec;
  border-radius: 15px;
  box-shadow: inset 4px 4px 8px #d1d9e6, inset -4px -4px 8px #ffffff;
}
.result-cell {
  padding: 12px;
  background: #ffffff;
  border-radius: 8px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  color: #2d3748;
}
.result-display {
  font-size: 36px;
  font-weight: bold;
  color: #2d3748;
  text-align: center;
  padding: 25px;
  background: #e0e5ec;
  border-radius: 20px;
  box-shadow: inset 4px 4px 8px #d1d9e6, inset -4px -4px 8px #ffffff;
}
.buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.btn {
  background: #e0e5ec;
  border: none;
  border-radius: 18px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  color: #2d3748;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 8px 8px 16px #bec3c9, -8px -8px 16px #ffffff;
}
.btn:active {
  box-shadow: inset 8px 8px 16px #bec3c9, inset -8px -8px 16px #ffffff;
}
.btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  grid-column: span 2;
}
.btn.primary:active {
  box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.2);
}
@media (max-width: 480px) {
  .calculator-wrap {
    padding: 20px;
  }
  .matrix-input {
    font-size: 14px;
    padding: 10px;
  }
}
