* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f0f5ff;
  color: #333;
  font-size: 15px;
  line-height: 1.6;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 14px 60px;
}

/* ===== 顶部 ===== */
.header {
  background: linear-gradient(135deg, #2c3e50, #4a6491);
  color: #fff;
  padding: 28px 22px;
  text-align: center;
  border-radius: 16px;
  margin-bottom: 18px;
}

.title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.description {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 18px;
}

.mode-switch {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.mode-btn {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 9px 28px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.mode-btn.active {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

/* ===== 主布局 ===== */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: #fff;
  padding: 20px 18px;
  border-radius: 14px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08);
}

.section-title {
  color: #2c3e50;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid #4a6491;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 20px;
}

.label {
  display: block;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 15px;
}

.checkbox-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 130px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1.5px solid #ddd;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  color: #333;
  font-family: inherit;
  text-align: left;
}

.checkbox-item .radio-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #bbb;
  background: #fff;
  flex: 0 0 auto;
  transition: all 0.2s;
}

.checkbox-item.selected {
  background: #e8f4ff;
  border-color: #4a6491;
  box-shadow: 0 0 0 3px rgba(74, 100, 145, 0.18);
  font-weight: 600;
}

.checkbox-item.selected .radio-dot {
  border-color: #4a6491;
  background: #4a6491;
  box-shadow: inset 0 0 0 3px #e8f4ff;
}

.coordinate-input,
.geometry-params {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.input-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 13.5px;
  color: #2c3e50;
  font-weight: 500;
}

.input-field {
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  background: #f9f9f9;
  width: 100%;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.input-field:focus {
  border-color: #4a6491;
  background: #fff;
}

.input-field::placeholder {
  color: #aaa;
}

.remark-input {
  font-size: 15px;
}

.hidden {
  display: none !important;
}

/* ===== 按钮 ===== */
.btn-primary,
.btn-clear {
  display: block;
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 13px;
  font-size: 17px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.2s;
  margin-top: 14px;
}

.btn-primary {
  background: #4a6491;
  color: #fff;
}

.btn-primary:hover {
  background: #3a5278;
}

.btn-primary:active {
  background: #334a6c;
}

.btn-clear {
  background: #e74c3c;
  color: #fff;
}

.btn-clear:hover {
  background: #c0392b;
}

.btn-clear:active {
  background: #b0392b;
}

/* ===== 结果 ===== */
.result-item {
  margin-bottom: 16px;
  padding: 14px;
  background: #f9f9f9;
  border-radius: 8px;
}

.result-title {
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 6px;
  font-size: 14px;
}

.result-value {
  color: #333;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

/* ===== 可视化 ===== */
.visualization {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.visualization-item {
  background: #fff;
  padding: 14px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.visualization-title {
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 12px;
  text-align: center;
  font-size: 14px;
}

.visualization-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  background: #fdfdfd;
}

/* ===== 调整建议 ===== */
.adjustment {
  background: #e8f4ff;
  padding: 16px;
  border-radius: 8px;
  margin-top: 16px;
}

.adjustment .section-title {
  border-bottom-color: #b9d4f5;
}

.adjustment-details {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.adjustment-item {
  padding: 12px;
  background: #d4e7ff;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.adjustment-label {
  font-weight: 600;
  font-size: 13.5px;
  color: #2c3e50;
}

.adjustment-value {
  font-weight: 700;
  color: #2c3e50;
  font-size: 13.5px;
  text-align: right;
  word-break: break-all;
}

/* ===== 历史记录 ===== */
.history-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1.5px solid #ddd;
}

.history-list {
  margin-bottom: 12px;
}

.history-item {
  padding: 12px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border-radius: 8px;
}

.history-title-input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  margin-bottom: 8px;
}

.history-title-input:focus {
  border-color: #4a6491;
}

.history-item-details {
  font-size: 12.5px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 10px;
}

.history-time {
  font-family: Consolas, Monaco, monospace;
  color: #666;
}

.history-item-actions {
  display: flex;
  gap: 10px;
}

.btn-load,
.btn-delete-item {
  border: none;
  padding: 8px;
  border-radius: 5px;
  font-size: 13px;
  flex: 1;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.btn-load {
  background: #3498db;
}

.btn-load:hover {
  background: #2c80b9;
}

.btn-delete-item {
  background: #e74c3c;
}

.btn-delete-item:hover {
  background: #c0392b;
}

.no-history {
  text-align: center;
  color: #999;
  padding: 24px 0;
  font-size: 13.5px;
}

/* ===== 关于 ===== */
.about {
  margin-top: 18px;
}

.about summary {
  cursor: pointer;
  color: #2c3e50;
  font-size: 16px;
  font-weight: 700;
  outline: none;
  user-select: none;
}

.about summary:hover {
  color: #4a6491;
}

.about-content {
  margin-top: 14px;
}

.about-block {
  margin-bottom: 24px;
}

.about-block-title {
  color: #2c3e50;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.about-text {
  color: #333;
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 10px;
}

.feature-list {
  margin-left: 20px;
}

.feature-list li {
  color: #333;
  font-size: 13.5px;
  line-height: 1.9;
}

.formula-box {
  background: #f0f7ff;
  border-left: 5px solid #4a6491;
  padding: 14px;
  border-radius: 0 8px 8px 0;
}

.formula-title {
  font-weight: 700;
  color: #2c3e50;
  margin: 10px 0 4px;
  font-size: 13.5px;
  display: block;
}

.formula-title:first-child {
  margin-top: 0;
}

.formula {
  font-family: Consolas, "Courier New", monospace;
  background: #fff;
  padding: 10px;
  border-radius: 6px;
  margin: 8px 0;
  border: 1.5px solid #ddd;
  font-size: 13px;
  color: #333;
}

.formula-desc {
  color: #666;
  font-size: 13px;
  margin-top: 8px;
}

.info-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 8px;
}

.info-label {
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
  min-width: 90px;
  flex: 0 0 auto;
}

.info-value {
  color: #333;
  font-size: 14px;
  flex: 1;
}

.contact {
  color: #4a6491;
  text-decoration: underline;
  cursor: pointer;
}

.disclaimer-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #eee;
}

.disclaimer-text {
  color: #999;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

/* ===== 页脚备案 ===== */
.footer {
  margin-top: 18px;
  padding: 18px 0 6px;
  text-align: center;
}

.beian-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.beian-sep {
  color: #bbb;
  font-size: 12px;
}

.icp-text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  vertical-align: middle;
}

.icp-text:hover {
  color: #4a6491;
}

.beian-ico {
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
  width: auto;
  height: 18px;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 82%;
  max-width: 340px;
  padding: 22px 18px 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 10px;
}

.modal-content {
  font-size: 14px;
  color: #555;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 16px;
  word-break: break-all;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.modal-btn-ok {
  background: #4a6491;
  color: #fff;
}

.modal-btn-ok:hover {
  background: #3a5278;
}

.modal-btn-cancel {
  background: #eef1f5;
  color: #333;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  background: rgba(44, 62, 80, 0.92);
  color: #fff;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  max-width: 75%;
  text-align: center;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* ===== 响应式（宽屏） ===== */
@media (min-width: 860px) {
  .container {
    padding: 22px 24px 80px;
  }

  .main-content {
    flex-direction: row;
    align-items: flex-start;
  }

  .input-section,
  .result-section {
    flex: 1;
    min-width: 0;
  }

  .coordinate-input,
  .geometry-params {
    grid-template-columns: 1fr 1fr;
  }

  .visualization {
    flex-direction: row;
  }

  .visualization-item {
    flex: 1;
    min-width: 0;
  }

  .adjustment-details {
    grid-template-columns: 1fr 1fr;
  }
}
