* {
  box-sizing: border-box;
}

:root {
  --ink: #083241;
  --teal: #087b77;
  --teal-dark: #055e5c;
  --blue: #0b4f78;
  --sky: #d9f1fb;
  --orange: #f49a2f;
  --warm: #fff2df;
  --cool: #e2f3ff;
  --line: rgba(8, 50, 65, 0.15);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.94), rgba(217, 241, 251, 0.84)),
    radial-gradient(circle at 90% 10%, rgba(244, 154, 47, 0.18), transparent 28%),
    linear-gradient(145deg, #eef8fb 0%, #ffffff 54%, #e0f3f5 100%);
}

.app {
  width: min(1180px, calc(100vw - 40px));
  margin: 24px auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  position: relative;
  box-shadow: 0 10px 28px rgba(8, 50, 65, 0.18);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 20px;
  width: 22px;
  height: 4px;
  border-radius: 999px;
  background: var(--orange);
  box-shadow: 0 -9px 0 rgba(255, 255, 255, 0.9), 0 9px 0 rgba(255, 255, 255, 0.85);
}

.home-link {
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 700;
  padding: 8px 14px;
  border: 1px solid rgba(8, 123, 119, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.kicker::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 4px;
  border-radius: 999px;
  background: var(--orange);
}

h1 {
  margin: 8px 0 8px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.summary {
  margin: 0;
  max-width: 760px;
  color: rgba(8, 50, 65, 0.76);
  font-size: 17px;
  line-height: 1.7;
}

.status-pill {
  min-width: 170px;
  text-align: center;
  color: white;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 12px 28px rgba(8, 50, 65, 0.16);
}

.panel {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 18px;
}

.stage,
.controls,
.card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 18px 42px rgba(8, 50, 65, 0.08);
  backdrop-filter: blur(8px);
}

.stage {
  min-height: 420px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.controls {
  border-radius: 12px;
  padding: 18px;
}

.controls h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.control-group {
  margin: 14px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.control-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}

button,
select,
input[type="range"] {
  width: 100%;
}

button,
.option {
  border: 0;
  border-radius: 10px;
  background: var(--teal);
  color: white;
  padding: 11px 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  margin: 6px 0;
}

button.secondary {
  color: var(--ink);
  background: #e9f6f8;
  border: 1px solid rgba(8, 123, 119, 0.22);
}

button.active,
.option.active {
  background: var(--orange);
}

select {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  background: white;
}

label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 800;
}

.hint {
  color: rgba(8, 50, 65, 0.68);
  line-height: 1.55;
  font-size: 14px;
}

.feedback {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #fff7e8;
  color: #9a5515;
  font-weight: 700;
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.card {
  border-radius: 12px;
  padding: 18px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.card p {
  margin: 0;
  line-height: 1.6;
  color: rgba(8, 50, 65, 0.74);
}

svg {
  width: 100%;
  height: 100%;
  display: block;
}

.caption {
  position: absolute;
  left: 18px;
  bottom: 16px;
  right: 18px;
  color: rgba(8, 50, 65, 0.72);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(8, 50, 65, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
}

.stage.thermal-stage {
  min-height: 430px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(235, 248, 251, 0.82)),
    radial-gradient(circle at 22% 18%, rgba(244, 154, 47, 0.16), transparent 24%),
    radial-gradient(circle at 80% 28%, rgba(11, 117, 168, 0.15), transparent 24%);
}

body[data-page="thermal"] .panel {
  align-items: stretch;
}

body[data-page="thermal"] .controls {
  padding: 16px;
}

body[data-page="thermal"] .control-group {
  margin: 10px 0;
  padding-top: 10px;
}

body[data-page="thermal"] button {
  padding: 9px 12px;
  margin: 4px 0;
}

body[data-page="thermal"] .feedback {
  margin-top: 10px;
  padding: 10px;
  font-size: 15px;
}

.thermal-readout {
  position: absolute;
  left: 18px;
  top: 16px;
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 10px;
  z-index: 2;
}

.thermal-chip {
  border: 1px solid rgba(8, 123, 119, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 10px;
  box-shadow: 0 8px 18px rgba(8, 50, 65, 0.07);
}

.stage.thermal-stage .thermal-svg {
  position: absolute;
  inset: 0 0 58px;
  width: 100%;
  height: calc(100% - 58px);
  object-fit: contain;
}

.stage.thermal-stage .simple-thermal-svg {
  inset: 8px 10px 58px;
}

.stage.thermal-stage .caption {
  bottom: 10px;
  padding: 8px 12px;
  font-size: 14px;
}

body[data-page="thermal"] .caption,
body[data-page="animation"] .caption {
  display: none;
}

.token-row,
.zone-grid {
  display: grid;
  gap: 8px;
}

.token-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.zone-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lab-token.hot {
  background: #f49a2f;
}

.lab-token.cold {
  background: #0b75a8;
}

.drop-zone {
  cursor: pointer;
}

.drop-zone rect {
  transition: opacity .18s ease, stroke-width .18s ease;
}

.drop-zone:hover rect {
  opacity: .68;
  stroke-width: 4;
}

.thermal-svg .glass {
  filter: drop-shadow(0 18px 24px rgba(8, 50, 65, 0.1));
}

.thermal-svg .flow-hot,
.thermal-svg .flow-cool,
.thermal-svg .smoke-main,
.thermal-svg .particle-flow {
  stroke-dasharray: 14 12;
  animation: flowDash 1.5s linear infinite;
}

.thermal-svg.paused .flow-hot,
.thermal-svg.paused .flow-cool,
.thermal-svg.paused .smoke-main,
.thermal-svg.paused .particle-flow {
  animation-play-state: paused;
}

.thermal-svg .smoke-wisp {
  animation: smokeFloat 2.8s ease-in-out infinite;
  transform-origin: center;
}

.thermal-svg.paused .smoke-wisp {
  animation-play-state: paused;
}

.thermal-svg .particle {
  animation: particlePulse 2.2s ease-in-out infinite;
}

.thermal-log {
  display: grid;
  gap: 6px;
}

.thermal-log .log-item {
  border: 1px solid rgba(8, 123, 119, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  padding: 7px 9px;
  color: rgba(8, 50, 65, 0.82);
  font-size: 13px;
  line-height: 1.38;
}

.thermal-log .log-item strong {
  color: var(--teal-dark);
}

.stage.isobar-stage {
  min-height: 430px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(235, 248, 251, 0.86)),
    radial-gradient(circle at 82% 18%, rgba(11, 79, 120, 0.12), transparent 26%),
    radial-gradient(circle at 20% 80%, rgba(244, 154, 47, 0.13), transparent 24%);
}

body[data-page="isobar"] .panel {
  align-items: start;
}

body[data-page="isobar"] .controls {
  padding: 16px;
}

body[data-page="isobar"] .control-group {
  margin: 10px 0;
  padding-top: 10px;
}

body[data-page="isobar"] button,
body[data-page="isobar"] select {
  margin: 4px 0;
}

body[data-page="isobar"] .feedback {
  font-size: 15px;
}

@keyframes flowDash {
  to {
    stroke-dashoffset: -52;
  }
}

@keyframes smokeFloat {
  0%, 100% {
    opacity: 0.46;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 0.84;
    transform: translateY(-7px) scale(1.03);
  }
}

@keyframes particlePulse {
  0%, 100% {
    opacity: 0.38;
  }
  50% {
    opacity: 0.95;
  }
}

.page-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-list a {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.tag {
  display: inline-block;
  margin-bottom: 8px;
  color: white;
  background: var(--teal);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .hero,
  .panel {
    grid-template-columns: 1fr;
  }

  .grid,
  .page-list {
    grid-template-columns: 1fr;
  }
}
