:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #1f2d3d;
  --muted: #5d6b78;
  --line: #dbe4ee;
  --accent: #2b7fc1;
  --danger: #d9594c;
  --good: #3f9e4d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f8fbff 0%, #f4f7fb 100%);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  min-height: 100vh;
  padding: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(23, 42, 61, 0.08);
}

.toolbar {
  position: relative;
  overflow: hidden;
  padding: 20px 22px 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
  border: 1px solid #d8e3ef;
}

.toolbar::before {
  content: "";
  position: absolute;
  right: -48px;
  top: -56px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 127, 193, 0.08) 0%, rgba(43, 127, 193, 0) 72%);
}

.toolbar::after {
  content: "";
  position: absolute;
  left: -90px;
  bottom: -100px;
  width: 220px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 127, 193, 0.06) 0%, rgba(43, 127, 193, 0) 76%);
}

h1, .exp-head h2 {
  font-size: 22px;
  margin: 2px 0 8px;
}

.toolbar h1 {
  position: relative;
  z-index: 1;
  margin: 2px 0 10px;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: 1px;
  font-weight: 800;
  color: #184b72;
  text-shadow: 0 2px 10px rgba(24, 75, 114, 0.12);
  text-align: center;
}

.toolbar h1::after {
  content: "";
  display: block;
  width: 120px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(43, 127, 193, 0) 0%, rgba(43, 127, 193, 0.85) 50%, rgba(43, 127, 193, 0) 100%);
}

.subtitle {
  position: relative;
  z-index: 1;
  margin: 0 auto 8px;
  color: #556676;
  font-size: 15px;
  line-height: 1.65;
  max-width: 980px;
  padding: 10px 14px;
  border: 1px solid #dbe7f2;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  text-align: center;
}

.compare-config {
  position: relative;
  z-index: 1;
  border: 1px solid #dbe7f2;
  background: #f9fcff;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 10px 0 8px;
}

.compare-config h3 {
  margin: 0 0 8px;
  color: #2f536e;
  font-size: 14px;
  text-align: center;
}

.compare-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
}

.compare-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #42586c;
  padding: 6px 10px;
  background: #f2f8ff;
  border: 1px solid #d9e7f4;
  border-radius: 999px;
}

.compare-options input {
  accent-color: #2e8fd1;
}

.compare-options.locked {
  opacity: 0.72;
}

.experiment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.exp {
  padding: 14px;
  background: #ffffff;
  border: 1px solid #dde7f1;
}

.exp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.exp-head h2 {
  font-size: 19px;
  margin: 0;
}

.exp-head p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.control-group {
  margin: 10px 0;
}

.control-group.locked {
  opacity: 0.5;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 6px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.buttons {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: #f8fbff;
  cursor: pointer;
  font-size: 14px;
  color: #295067;
  font-weight: 700;
  transition: all 0.2s ease;
}

button:hover {
  background: #eef6ff;
  transform: translateY(-1px);
}

#startBtn {
  background: linear-gradient(135deg, #2e9a65, #2a8558);
  color: #fff;
  border-color: #2b915f;
}

#startBtn:hover {
  background: linear-gradient(135deg, #28865a, #23764f);
}

#startBtn:disabled {
  background: #b8c2cc;
  border-color: #aab4be;
  color: #f6f8fa;
  cursor: not-allowed;
}

#conclusionBtn {
  background: linear-gradient(135deg, #f29a19, #df8511);
  color: #fff;
  border-color: #d88410;
}

#conclusionBtn:hover {
  background: linear-gradient(135deg, #e18914, #cd780e);
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.metrics article {
  border: 1px solid #dce7f2;
  border-radius: 10px;
  padding: 10px;
  background: #f9fcff;
}

.metrics h3 {
  font-size: 13px;
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 500;
}

.metrics p {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

canvas {
  width: 100%;
  height: 400px;
  border-radius: 12px;
  background: linear-gradient(180deg, #d6ecff 0%, #e9f5ff 45%, #f0efe5 46%, #d4b28a 100%);
  border: 1px solid #d7e4f1;
}

.legend {
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}

.legend .rain { background: #33a7ff; }
.legend .soil { background: #8d5b3d; }
.legend .cup { background: #79bfd8; }
.legend .plant { background: #43a047; }

.conclusion {
  padding: 16px 18px;
  background: linear-gradient(180deg, #fffef8 0%, #fff9ea 100%);
}

.conclusion h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: #7a5a1f;
}

.conclusion p {
  margin: 0;
  line-height: 1.7;
  color: #3c4d5d;
  white-space: pre-line;
}

.knowledge {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.knowledge > h2 {
  margin: 0 0 12px;
  font-size: 24px;
  color: #214d70;
  text-align: center;
}

.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.knowledge-card {
  border: 1px solid #dbe6f2;
  border-radius: 12px;
  padding: 12px;
  background: #fbfdff;
}

.knowledge-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #2d5b7f;
}

.knowledge-figure {
  border: 1px solid #d9e5f1;
  background: #f8fbff;
  border-radius: 10px;
  padding: 6px;
  margin-bottom: 10px;
}

.knowledge-figure svg {
  width: 100%;
  height: auto;
  display: block;
}

.fig-title {
  font-size: 11px;
  fill: #3a5f7b;
  font-weight: 700;
}

.fig-sub {
  font-size: 10px;
  fill: #5a7389;
}

.fig-text {
  font-size: 11px;
  fill: #32536e;
  font-weight: 600;
}

.fig-dot-text {
  font-size: 9px;
  fill: #7b3f35;
  font-weight: 700;
}

.knowledge-card ul {
  margin: 0;
  padding-left: 18px;
  color: #495a68;
  line-height: 1.65;
  font-size: 14px;
}

@media (max-width: 1080px) {
  .toolbar h1 {
    font-size: 30px;
  }

  .subtitle {
    font-size: 14px;
  }

  .experiment-grid {
    grid-template-columns: 1fr;
  }

  canvas {
    height: 360px;
  }

  .knowledge-grid {
    grid-template-columns: 1fr;
  }
}

/* —— 版权（与「热力环流」控制面板一致）—— */
.copyright-entry-footer {
  margin-top: 4px;
  padding: 16px 18px 28px;
  border-top: 1px solid rgba(45, 67, 127, 0.15);
}

.copyright-text-btn {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: #9fb4e8;
  background: transparent;
  border: 1px solid rgba(45, 67, 127, 0.55);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.copyright-text-btn:hover {
  background: rgba(16, 34, 74, 0.45);
  border-color: #35509a;
  color: #d4e6ff;
}

.copyright-modal {
  max-width: 440px;
}

.copyright-modal .modal-title {
  text-align: center;
}

.copyright-modal .modal-actions {
  justify-content: center;
}

.copyright-qr-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 14px 16px;
  margin-bottom: 14px;
}

.copyright-qr-item {
  margin: 0;
  flex: 1 1 150px;
  max-width: 200px;
  min-width: 0;
  text-align: center;
}

.copyright-qr-caption {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: #9fb4e8;
}

.copyright-qr-image {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(45, 67, 127, 0.5);
}

.copyright-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #c8d6ff;
  text-align: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-dialog {
  width: 100%;
  max-width: 380px;
  padding: 18px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #0a1428 0%, #050a14 100%);
  border: 1px solid #2d437f;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  color: #e0e9ff;
}

.modal-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  color: #b8d4ff;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 8px 18px;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #35509a;
  background: #10214b;
  color: #eff3ff;
  font-family: inherit;
}

.modal-btn:hover {
  background: #18306c;
}

.modal-btn-primary {
  border-color: #4a6caf;
  background: #1a3a7a;
}
