/* ============================================================
   silver.css — 站 5「白银的环球旅行」站内样式
   背景：base.css 定暗金展览令牌；本文件做地图、控制面板与仪表布局。
   设计意图：地图是主角（图形画布），控制面板贴右侧；
             仪表用横条 + 数值，银荒压力超阈值转朱砂警示；
             白银粒子为金色小点沿航路流动（silver.js 驱动）。
   约束：SVG 内地理形状为手绘示意（教学用，非精确地图）。
   ============================================================ */

.head-actions { display: flex; gap: var(--sp); align-items: center; }
.back-link { text-decoration: none; }

.lesson-head { padding: calc(var(--sp) * 5) 0 calc(var(--sp) * 3); }
.kicker { font-size: var(--fs-sm); letter-spacing: .14em; margin-bottom: var(--sp); }
.lesson-head h1 { font-size: var(--fs-xl); margin-bottom: calc(var(--sp) * 2); }
.intro { max-width: 660px; color: var(--ink-soft); }
.hint { display: flex; align-items: center; gap: .5em; font-size: var(--fs-sm); color: var(--gold); }

/* ---------- 模拟器布局 ---------- */
.sim {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: calc(var(--sp) * 3);
  align-items: start;
}
.map-wrap {
  margin: 0;
  background: var(--paper-2);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  padding: calc(var(--sp) * 1.5);
}
#tradeMap { display: block; width: 100%; height: auto; }

/* 地图元素 */
#tradeMap .land {
  fill: var(--paper-3);
  stroke: var(--gold-soft);
  stroke-width: 1.5;
}
#tradeMap .continent {
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: .3em;
  fill: var(--gold-soft);
  opacity: .8;
}
#tradeMap .sea path {
  fill: none;
  stroke: var(--gold-soft);
  stroke-opacity: .25;
  stroke-width: 1.4;
}
#tradeMap .ocean-name {
  font-family: var(--font-serif);
  font-size: 30px;
  letter-spacing: .5em;
  fill: var(--gold);
  opacity: .16;
}
#tradeMap .ocean-name-sub {
  font-family: var(--font-serif);
  font-size: 12px;
  letter-spacing: .5em;
  fill: var(--gold);
  opacity: .2;
}
#tradeMap .islands ellipse { fill: var(--paper-3); stroke: var(--gold-soft); stroke-width: 1.2; }
#tradeMap .compass circle { fill: none; stroke: var(--gold-soft); stroke-opacity: .5; }
#tradeMap .compass path { fill: var(--gold-soft); opacity: .7; }
#tradeMap .compass text { fill: var(--gold-soft); font-size: 11px; font-family: var(--font-mono); }

/* 城市节点 */
#tradeMap .city circle {
  fill: var(--gold);
  stroke: var(--paper-2);
  stroke-width: 2;
}
#tradeMap .city text {
  font-family: var(--font-sans);
  font-size: 12.5px;
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--paper-2);
  stroke-width: 3px;
}
#tradeMap .city-star circle {
  fill: var(--zhu);
  animation: star-glow 2.2s ease-in-out infinite;
}
@keyframes star-glow {
  0%, 100% { stroke: var(--paper-2); }
  50% { stroke: var(--zhu); }
}
#tradeMap .city-star text { fill: var(--zhu-deep); }

/* 航路：开 = 金线，关 = 暗残影 */
#tradeMap .route {
  fill: none;
  stroke: var(--gold-soft);
  stroke-width: 2.2;
  stroke-opacity: .22;
  stroke-dasharray: 2 7;
  stroke-linecap: round;
  transition: stroke-opacity .25s ease, stroke-width .25s ease;
}
#tradeMap .route.on {
  stroke: var(--gold);
  stroke-opacity: .85;
  stroke-dasharray: none;
}
#tradeMap .route-main.on { stroke-width: 3.2; }

/* 白银粒子 */
#tradeMap .coin {
  fill: var(--zhu);
  stroke: rgba(41, 32, 25, .5);
  stroke-width: .8;
}
#tradeMap .route-off .coin { display: none; }

/* ---------- 控制面板 ---------- */
.panel {
  background: var(--paper-2);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  padding: calc(var(--sp) * 2.5);
}
.panel-title {
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
  letter-spacing: .12em;
  color: var(--gold);
  margin: calc(var(--sp) * 2.5) 0 calc(var(--sp) * 1.5);
}
.panel-title:first-child { margin-top: 0; }

.switch-row {
  display: flex;
  align-items: center;
  gap: calc(var(--sp) * 1.4);
  padding: calc(var(--sp) * 1.1) 0;
  cursor: pointer;
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 42px;
  height: 23px;
  border-radius: 999px;
  background: var(--paper-3);
  border: 1.5px solid var(--line);
  position: relative;
  flex: none;
  transition: background-color .2s ease, border-color .2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--gold-soft);
  transition: transform .2s ease, background-color .2s ease;
}
.switch-row input:checked + .switch {
  background: var(--gold-mist);
  border-color: var(--gold);
}
.switch-row input:checked + .switch::after {
  transform: translateX(19px);
  background: var(--gold);
}
.switch-row input:focus-visible + .switch { box-shadow: 0 0 0 3px var(--gold-mist); }
.switch-label { font-size: var(--fs-sm); }

.slider-row { display: flex; align-items: center; gap: calc(var(--sp) * 1.5); }
.slider-row input[type="range"] {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold) var(--fill, 70%), var(--paper-3) var(--fill, 70%));
  outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--paper-2);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .45);
  cursor: pointer;
}
.slider-row input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--paper-2);
  cursor: pointer;
}
#prodVal { min-width: 3.2em; text-align: right; font-size: var(--fs-md); }

.era-nav { display: flex; flex-wrap: wrap; gap: calc(var(--sp) * 1); }
.era-btn {
  font: inherit;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--gold);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: .32em .9em;
  cursor: pointer;
}
.era-btn:hover { background: var(--gold-mist); }
.era-btn.active { background: var(--gold); border-color: var(--gold); color: #fff8ea; }
.era-btn.danger.active { background: var(--zhu); border-color: var(--zhu); color: #fff8ea; }

/* ---------- 明朝仪表 ---------- */
.gauges {
  margin-top: calc(var(--sp) * 4);
  background: var(--paper-2);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  padding: calc(var(--sp) * 3);
}
.gauges-title { font-size: var(--fs-lg); margin-bottom: calc(var(--sp) * 2.5); }

.gauge { margin-bottom: calc(var(--sp) * 2.4); }
.gauge:last-child { margin-bottom: 0; }
.g-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: calc(var(--sp) * 0.8);
}
.g-label { font-size: var(--fs-sm); font-weight: 600; }
.g-val { font-size: var(--fs-md); color: var(--gold); }
.g-bar {
  height: 12px;
  border-radius: 6px;
  background: var(--paper-3);
  border: 1px solid var(--line-dim);
  overflow: hidden;
}
.g-fill {
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width .5s ease, background-color .5s ease;
}
.gauge.alert .g-fill { background: var(--zhu); }
.gauge.alert .g-val { color: var(--zhu); }
.g-note { font-size: 12.5px; color: var(--ink-soft); margin: calc(var(--sp) * 0.8) 0 0; }

/* ---------- 年代叙事卡 ---------- */
.era-card {
  margin-top: calc(var(--sp) * 3);
  background: var(--gold-mist);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: calc(var(--sp) * 2.5) calc(var(--sp) * 3);
}
.era-card h3 {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  color: var(--zhu);
  margin-bottom: calc(var(--sp) * 1.2);
}
.era-card p { margin: 0; max-width: 680px; }

/* ---------- 结尾 ---------- */
.ending { text-align: center; padding-bottom: calc(var(--sp) * 6); }
.ending-line {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: 1.65;
  max-width: 700px;
  margin: 0 auto calc(var(--sp) * 2);
}
.model-note { font-size: var(--fs-sm); color: var(--ink-soft); margin-bottom: calc(var(--sp) * 3); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .sim { grid-template-columns: 1fr; }
  #tradeMap .city text { font-size: 11px; }
  #tradeMap .ocean-name { font-size: 22px; }
}

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  #tradeMap .city-star circle { animation: none; }
  .g-fill { transition: none; }
}
