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

#app {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 16px;
}

#app-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: #212121;
  margin-bottom: 24px;
}

/* 精度选择 */
#precision-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

#precision-control label {
  font-size: 15px;
  color: #555;
}

#precision-select {
  padding: 6px 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

#precision-select:focus {
  border-color: #2196F3;
}

/* 换算网格 */
#converter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.unit-card {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.unit-card.active {
  border-color: #2196F3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

.unit-label {
  display: block;
  font-size: 14px;
  color: #757575;
  margin-bottom: 8px;
  font-weight: 500;
}

.unit-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 22px;
  text-align: center;
  border: none;
  border-bottom: 2px solid #e0e0e0;
  padding: 8px 4px;
  outline: none;
  background: transparent;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}

.unit-input::-webkit-outer-spin-button,
.unit-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.unit-input:focus {
  border-bottom-color: #2196F3;
}

/* 操作按钮 */
#action-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

#reset-btn {
  padding: 10px 36px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

#reset-btn:hover {
  background: #e0e0e0;
  border-color: #bbb;
}

#reset-btn:active {
  background: #d0d0d0;
}

/* 响应式设计 */
@media (max-width: 767px) {
  #converter-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  #app-title {
    font-size: 24px;
  }

  .unit-input {
    font-size: 20px;
  }
}

@media (max-width: 479px) {
  #converter-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #app-title {
    font-size: 20px;
  }

  .unit-card {
    padding: 12px 10px;
  }

  .unit-input {
    font-size: 18px;
  }
}
