/* =========================================================================
   大航海群像志 · ui.css
   ========================================================================= */

#app {
  display: grid;
  grid-template-rows: 54px 1fr;
  height: 100vh;
  background: var(--bg-0);
}

/* ============================================================ 顶栏 */
#topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: linear-gradient(180deg, #0f2532, #0a1a24);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
  z-index: 100;
  position: relative;
}

.brand {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--gold-2);
  text-shadow: 0 0 22px rgba(214, 178, 92, .35);
  white-space: nowrap;
  padding-right: 6px;
  border-right: 1px solid var(--line);
  margin-right: 2px;
  height: 26px;
  display: flex;
  align-items: center;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.stat .k {
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .1em;
}
.stat b, .stat span:last-child {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}
#s-gold { color: var(--gold-2); }

.spacer { flex: 1; }

.speed {
  display: flex;
  gap: 2px;
  background: rgba(0, 0, 0, .3);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
}
.speed button {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 5px;
  color: var(--ink-3);
  transition: all .16s;
}
.speed button:hover { color: var(--ink); }
.speed button.on {
  background: var(--gold-dim);
  color: var(--gold-2);
  box-shadow: inset 0 0 0 1px rgba(214, 178, 92, .3);
}

/* ============================================================ 按钮 */
.btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-3);
  background: rgba(255, 255, 255, .03);
  color: var(--ink);
  font-size: 13px;
  transition: all .16s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: rgba(214, 178, 92, .1);
  border-color: rgba(214, 178, 92, .4);
  color: var(--gold-2);
}
.btn.primary {
  background: linear-gradient(180deg, #d9b662, #b8933f);
  color: #1a1206;
  border-color: #e6c877;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(214, 178, 92, .25);
}
.btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #e8c977, #c9a34a);
  color: #120c03;
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}
.btn.ghost:hover { color: var(--gold-2); background: rgba(214, 178, 92, .08); }
.btn.danger { border-color: rgba(176, 69, 58, .5); color: var(--red-2); }
.btn.danger:hover { background: rgba(176, 69, 58, .14); }

.mini {
  padding: 3px 9px;
  font-size: 11.5px;
  border-radius: 5px;
  border: 1px solid var(--line-3);
  background: rgba(255, 255, 255, .03);
  color: var(--ink-2);
  transition: all .14s;
}
.mini:hover:not(:disabled) { color: var(--ink); border-color: var(--line-3); background: rgba(255, 255, 255, .07); }
.mini.buy:hover:not(:disabled) { color: #8fd6a8; border-color: rgba(79, 158, 106, .5); background: rgba(79, 158, 106, .12); }
.mini.sell:hover:not(:disabled) { color: var(--gold-2); border-color: rgba(214, 178, 92, .5); background: var(--gold-dim); }

/* ============================================================ 主区 */
#stage {
  display: grid;
  grid-template-columns: 1fr 306px;
  overflow: hidden;
  min-height: 0;
}

#mapwrap {
  position: relative;
  overflow: hidden;
  background: var(--bg-0);
}

#map {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
#mapwrap::after { content: ''; position: absolute; inset: 0; pointer-events: none; border: 1px solid rgba(209,193,151,.13); box-shadow: inset 0 0 80px rgba(2,10,14,.28); }
.map-plaque { position: absolute; z-index: 12; left: 18px; top: 16px; display: grid; gap: 3px; padding: 9px 12px 10px; min-width: 164px; background: rgba(9,24,31,.66); border-left: 2px solid rgba(214,178,92,.62); color: #d9d0b7; pointer-events: none; }
.map-plaque span { color: #d8b961; font: 10px var(--font-display); letter-spacing: .16em; }
.map-plaque b { font: 500 12px var(--font-display); letter-spacing: .08em; }
.map-plaque b i { color: var(--gold-2); font-style: normal; font-variant-numeric: tabular-nums; }
.map-plaque small { color: rgba(203,203,186,.58); font-size: 9px; }
.map-legend { position: absolute; z-index: 12; right: 108px; bottom: 20px; display: flex; flex-wrap: wrap; gap: 13px; max-width: calc(100% - 150px); padding: 7px 10px; color: rgba(224,219,200,.7); background: rgba(8,20,27,.62); border: 1px solid rgba(214,178,92,.12); font-size: 9px; pointer-events: none; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.legend-port { background: var(--gold-2); box-shadow: 0 0 7px rgba(240,215,140,.5); }
.legend-ship { background: #f4ede0; border: 1px solid #d2a94f; }
.legend-fog { background: #26343a; border: 1px solid #53646a; }
#map.dragging { cursor: grabbing; }

#hint {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-size: 11px;
  color: rgba(233, 226, 208, .35);
  letter-spacing: .04em;
  pointer-events: none;
  background: rgba(7, 20, 28, .55);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .05);
}

#map-ctl {
  position: absolute;
  right: 14px;
  top: 14px;
  display: flex;
  gap: 4px;
  z-index: 20;
}
#map-ctl button {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: rgba(10, 26, 36, .82);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1;
  backdrop-filter: blur(6px);
  transition: all .15s;
}
#map-ctl button:hover {
  color: var(--gold-2);
  border-color: rgba(214, 178, 92, .4);
  background: rgba(214, 178, 92, .12);
}

/* ---------------------------------------------------------- 地图元素 */
.landmass { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); }
.coast-ink { opacity: .72; }
.river-line { fill: none; stroke: rgba(75,127,130,.58); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.river-label { fill: rgba(67,105,103,.78); font-family: var(--font-display); font-size: 10px; letter-spacing: 2px; paint-order: stroke; stroke: rgba(218,203,163,.7); stroke-width: 3px; }
.depth-contour { fill: none; stroke: rgba(136,193,184,.12); stroke-width: 1.15; }
.reef-mark { fill: none; stroke: rgba(206,183,123,.56); stroke-width: 1.5; stroke-linecap: round; }
.reef-label { fill: rgba(221,195,136,.62); font-family: var(--font-display); font-size: 9px; letter-spacing: 2px; }
.current-line { fill: none; stroke: rgba(212,190,127,.30); stroke-width: 1.25; stroke-dasharray: 3 8; }
.current-arrow { fill: none; stroke: rgba(212,190,127,.45); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.sea-label { fill: rgba(197,204,183,.34); font-family: var(--font-display); font-size: 18px; letter-spacing: 8px; }

.port { cursor: pointer; }
.port-dot {
  fill: var(--nc);
  stroke: rgba(245, 238, 220, .88);
  stroke-width: 1.6;
  transition: r .18s, stroke-width .18s;
}
.port-core { fill: rgba(250, 245, 230, .92); }
.port-halo { fill: rgba(240, 215, 140, 0); transition: fill .2s; }
.port.is-here .port-halo {
  fill: rgba(240, 215, 140, .16);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
.port-label {
  fill: #e8e0cc;
  font-family: var(--font-display);
  font-weight: 500;
  paint-order: stroke;
  stroke: rgba(7, 20, 28, .88);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
  transition: fill .16s;
}
.port.is-here .port-label { fill: var(--gold-2); font-weight: 700; }
.port.is-hover .port-label { fill: #fff; }
.port.is-hover .port-dot { r: 6.6; stroke-width: 2.2; }
.port-nation {
  fill: var(--nc);
  font-family: var(--font-ui);
  paint-order: stroke;
  stroke: rgba(7, 20, 28, .8);
  stroke-width: 2.6px;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: .85;
}

.player-ship { pointer-events: none; }
.route-ghost { animation: dashmove 1.4s linear infinite; }
@keyframes dashmove { to { stroke-dashoffset: -22; } }

/* ---------------------------------------------------------- 港口卡片 */
.port-card {
  position: absolute;
  width: 272px;
  background: linear-gradient(180deg, rgba(19, 42, 56, .97), rgba(11, 27, 37, .98));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(8px);
  z-index: 30;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  animation: cardIn .18s ease-out;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
}
.pc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.pc-flag {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
  flex: 0 0 auto;
}
.pc-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-2);
}
.pc-class { display: flex; align-items: center; gap: 6px; margin: -3px 0 9px 17px; color: #d2bb7b; font: 10px var(--font-display); letter-spacing: .08em; }
.pc-class span { color: var(--gold-2); }
.pc-class i { margin-left: auto; color: var(--ink-3); font: 9px var(--font-ui); font-style: normal; }
.pc-low-supply { color: #e3a18d !important; }
.pc-low-supply b { color: #be7969 !important; }
.pc-nat { font-size: 11px; color: var(--ink-3); }
.pc-x {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}
.pc-x:hover { color: var(--ink); }
.pc-note {
  margin: 0 0 10px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-2);
  border-left: 2px solid rgba(214, 178, 92, .3);
  padding-left: 8px;
}
.pc-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.pc-rows div { font-size: 11.5px; color: var(--ink-2); }
.pc-rows b {
  display: inline-block;
  width: 38px;
  color: var(--ink-3);
  font-weight: 500;
  font-size: 10.5px;
}
.pc-sail { width: 100%; }

/* ---------------------------------------------------------- 航行 HUD */
.voyage-hud {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 40px));
  background: rgba(10, 26, 36, .9);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-1);
  z-index: 20;
}
.vh-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  margin-bottom: 7px;
}
.vh-to { color: var(--gold-2); font-weight: 600; font-family: var(--font-display); font-size: 13.5px; }
.vh-day { color: var(--ink-2); }
.vh-left { color: var(--ink-3); font-size: 11px; }
.vh-bar {
  height: 4px;
  background: rgba(0, 0, 0, .4);
  border-radius: 2px;
  overflow: hidden;
}
.vh-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  border-radius: 2px;
  transition: width .5s linear;
}

/* ============================================================ 侧栏 */
#sidebar {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line-2);
  border-left: 1px solid var(--line);
  overflow: hidden;
  min-height: 0;
}

.panel {
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 7px;
  font-size: 10.5px;
  letter-spacing: .14em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-2);
  flex: 0 0 auto;
}
.panel-head b { color: var(--ink-2); font-weight: 500; letter-spacing: .1em; }
.panel-body {
  padding: 10px 12px;
  overflow-y: auto;
  min-height: 0;
}

#p-fleet { flex: 0 0 auto; max-height: 268px; }
#p-fleet .panel-body { display: flex; flex-direction: column; gap: 8px; }
#p-cargo { flex: 0 0 auto; max-height: 176px; }
#p-cargo .panel-body { padding: 6px 8px; }
#p-log { flex: 1 1 auto; min-height: 100px; }
#p-log .panel-body { padding: 6px 12px 12px; }

/* 船只卡 */
.ship-card {
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 9px 10px;
}
.ship-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 7px;
}
.ship-name {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold-2);
}
.ship-type { font-size: 10px; color: var(--ink-3); margin-left: auto; }
.bar-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}
.bar-label { font-size: 10px; color: var(--ink-3); width: 24px; flex: 0 0 auto; }
.bar {
  flex: 1;
  height: 5px;
  background: rgba(0, 0, 0, .38);
  border-radius: 3px;
  overflow: hidden;
}
.bar i { display: block; height: 100%; border-radius: 3px; transition: width .3s; }
.bar-num { font-size: 10px; color: var(--ink-3); width: 44px; text-align: right; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.ship-meta { font-size: 10px; color: var(--ink-3); margin-top: 5px; letter-spacing: .02em; }

/* 货物 */
.cargo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 5px;
  font-size: 12px;
}
.cargo-row:hover { background: rgba(255, 255, 255, .04); }
.cargo-icon { width: 10px; display: flex; align-items: center; justify-content: center; }
.cargo-name { color: var(--ink); flex: 1; }
.cargo-qty { color: var(--gold-2); font-variant-numeric: tabular-nums; }
.cargo-val { font-size: 10.5px; color: var(--ink-3); width: 62px; text-align: right; }

.empty {
  padding: 16px 8px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* 日志 */
.log-item {
  font-size: 11.5px;
  line-height: 1.62;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .05);
  color: var(--ink-2);
}
.log-item:last-child { border-bottom: none; }
.log-date {
  font-size: 9.5px;
  color: var(--ink-3);
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.log-good { color: #8fd6a8; }
.log-bad { color: var(--red-2); }
.log-info { color: var(--ink-2); }

/* ============================================================ 模态 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(4, 11, 16, .74);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.modal.hidden { display: none !important; }
.hidden { display: none !important; }

.port-shell {
  width: min(840px, 100%);
  max-height: min(88vh, 800px);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
}

.port-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px 14px;
  background: linear-gradient(180deg, rgba(214, 178, 92, .07), transparent);
  border-bottom: 1px solid var(--line);
}
.port-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--gold-2);
}
.port-head .sub {
  font-size: 11.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.port-head .sub .sep { color: var(--ink-3); opacity: .5; }
.port-close {
  margin-left: auto;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
  padding: 2px 6px;
  border-radius: 6px;
}
.port-close:hover { color: var(--ink); background: rgba(255, 255, 255, .07); }

#port-tabs {
  display: flex;
  gap: 2px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-2);
  background: rgba(0, 0, 0, .14);
}
#port-tabs button {
  padding: 10px 16px 9px;
  font-size: 12.5px;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: all .16s;
  letter-spacing: .04em;
}
#port-tabs button:hover { color: var(--ink-2); }
#port-tabs button.on {
  color: var(--gold-2);
  border-bottom-color: var(--gold);
}

#port-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px 22px;
  min-height: 0;
}

/* 市场 */
.market-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.unit-pick {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-3);
}
.unit-pick span { margin-right: 4px; }
.unit {
  padding: 3px 10px;
  font-size: 11.5px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  transition: all .14s;
}
.unit:hover { color: var(--ink); }
.unit.on {
  background: var(--gold-dim);
  color: var(--gold-2);
  border-color: rgba(214, 178, 92, .35);
}
.quick-supply { display: flex; gap: 6px; }

.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.market-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--ink-3);
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}
.market-table th.num { text-align: right; }
.market-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
}
.market-table tbody tr:hover td { background: rgba(214, 178, 92, .045); }
.g-name { display: flex; align-items: center; gap: 7px; }
.g-dot {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  display: inline-block;
  flex: 0 0 auto;
  opacity: .9;
}
.market-table th:nth-child(4), .market-table td:nth-child(4) { width: 92px; }
.market-table th:nth-child(5), .market-table td:nth-child(5) { width: 48px; }

.best { line-height: 1.25; }
.best .dim { color: var(--ink-3); }
.best-p { color: #8fd6a8; font-weight: 600; display: block; }
.best-g { font-size: 9.5px; color: rgba(143, 214, 168, .7); }
.best-port { font-size: 9.5px; color: var(--ink-3); display: block; }
.price { text-align: right; color: var(--gold-2); font-weight: 600; }
.have { text-align: right; color: var(--ink-2); }
.ops { text-align: right; white-space: nowrap; }
.ops .mini { margin-left: 4px; }

.stock-cell { white-space: nowrap; }
.stock-bar {
  width: 62px;
  height: 5px;
  background: rgba(0, 0, 0, .38);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.stock-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: 3px;
}
.stock-num {
  font-size: 10px;
  color: var(--ink-3);
  margin-left: 7px;
  font-variant-numeric: tabular-nums;
}

.tag {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: .06em;
  margin-left: 5px;
  vertical-align: middle;
}
.tag-prod { background: rgba(79, 158, 106, .18); color: #7fc99a; }
.tag-dem { background: rgba(176, 69, 58, .18); color: #d97b6d; }

.dead-goods {
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-3);
  padding: 8px 10px;
  background: rgba(255, 255, 255, .02);
  border-radius: 6px;
  border-left: 2px solid rgba(176, 69, 58, .35);
}

.port-foot {
  display: flex;
  gap: 22px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.port-foot b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 酒馆 */
.rumor {
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line-2);
  border-left: 3px solid rgba(214, 178, 92, .45);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.rumor-label {
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--gold);
  margin-bottom: 7px;
}
.rumor p {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
}
.tavern-acts { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tavern-info { font-size: 11.5px; color: var(--ink-3); }

/* 船坞 */
.yard-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-2);
}
.yard-hint { font-size: 11px; color: var(--ink-3); }
.yard h4, .quests h4 {
  margin: 18px 0 10px;
  font-size: 10.5px;
  letter-spacing: .14em;
  color: var(--ink-3);
  font-weight: 500;
}
.yard h4:first-of-type { margin-top: 0; }
.yard-list { display: flex; flex-direction: column; gap: 8px; }

.yard-ship {
  background: rgba(255, 255, 255, .022);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 11px 13px;
}
.ys-head { display: flex; align-items: baseline; gap: 10px; }
.ys-head b {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}
.ys-price {
  margin-left: auto;
  font-size: 13px;
  color: var(--gold-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ys-price.poor { color: var(--red-2); }
.ys-desc { font-size: 11.5px; color: var(--ink-3); margin: 4px 0 7px; line-height: 1.6; }
.ys-stats {
  display: flex;
  gap: 14px;
  font-size: 10.5px;
  color: var(--ink-3);
  margin-bottom: 9px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.yard-mine {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .022);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  font-size: 12.5px;
}
.ym-meta { font-size: 10.5px; color: var(--ink-3); margin-left: auto; }

/* 委托 */
.quest-card {
  background: rgba(255, 255, 255, .022);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 9px;
}
.quest-card.active { border-left: 3px solid var(--gold); }
.q-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 5px;
}
.q-head b { font-family: var(--font-display); font-size: 13.5px; font-weight: 600; }
.q-reward { margin-left: auto; color: var(--gold-2); font-size: 12.5px; font-weight: 600; }
.q-active { margin-left: auto; color: var(--green); font-size: 11px; }
.q-desc { font-size: 12px; color: var(--ink-2); line-height: 1.65; margin-bottom: 8px; }
.q-prog { font-size: 11px; color: var(--ink-3); margin-bottom: 6px; }
.quest-hint { font-size: 11px; color: var(--ink-3); margin-top: 14px; }

/* ============================================================ 战斗 */
#battle {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: #061019;
  overflow: hidden;
}
#battle.is-open { display: block; }

#battle-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.bship .rock {
  animation: rock 3.6s ease-in-out infinite;
  transform-origin: center bottom;
}
.bship .rock-2 { animation-duration: 4.3s; animation-delay: -.7s; }
@keyframes rock {
  0%, 100% { transform: rotate(-1.1deg) translateY(0); }
  50% { transform: rotate(1.1deg) translateY(-3px); }
}

.bship.hurt .ship-body::after { content: ''; }
.bship.critical { filter: brightness(.86); }

.battle-hud {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
}
.battle-hud.top {
  top: 0;
  padding: 18px 24px;
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, rgba(4, 12, 18, .8), transparent);
}
.battle-hud.bottom {
  bottom: 0;
  padding: 16px 24px 20px;
  background: linear-gradient(0deg, rgba(4, 12, 18, .92), transparent);
  pointer-events: auto;
}

#battle-enemy {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 24, 32, .78);
  border: 1px solid rgba(176, 69, 58, .3);
  border-radius: 30px;
  padding: 7px 18px;
  backdrop-filter: blur(8px);
  font-size: 13px;
}
#battle-enemy b { font-family: var(--font-display); color: #e8c4bc; font-size: 14.5px; }
.be-flag { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.be-stats { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

#battle-log {
  max-width: 720px;
  margin: 0 auto 12px;
  max-height: 92px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(233, 226, 208, .62);
  text-align: center;
}
#battle-log .bl-last { color: var(--gold-2); }

#battle-actions {
  display: flex;
  gap: 9px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 760px;
  margin: 0 auto;
}
#battle-actions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 92px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid rgba(214, 178, 92, .25);
  background: rgba(16, 36, 48, .82);
  color: var(--ink);
  font-size: 12.5px;
  transition: all .16s;
  backdrop-filter: blur(6px);
}
#battle-actions button .k {
  font-size: 9.5px;
  color: var(--ink-3);
  letter-spacing: .1em;
}
#battle-actions button:hover:not(:disabled) {
  background: rgba(214, 178, 92, .16);
  border-color: rgba(214, 178, 92, .6);
  color: var(--gold-2);
  transform: translateY(-2px);
}
#battle-actions button[data-cmd="fire"] {
  border-color: rgba(176, 69, 58, .45);
  background: rgba(60, 24, 20, .7);
}
#battle-actions button[data-cmd="fire"]:hover:not(:disabled) {
  background: rgba(176, 69, 58, .28);
  border-color: var(--red-2);
  color: #f0c8c0;
}
#battle-actions button[data-cmd="flee"] { opacity: .8; }
#battle-actions button.unavailable { opacity: .35; }

#battle-result {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 9, 14, .72);
  backdrop-filter: blur(4px);
}
#battle-result.is-open { display: flex; }

.br-card {
  text-align: center;
  padding: 34px 46px;
  background: linear-gradient(180deg, rgba(19, 42, 56, .98), rgba(9, 22, 31, .99));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  animation: modalIn .3s cubic-bezier(.2, .8, .3, 1);
}
.br-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 34px;
  letter-spacing: .3em;
  text-indent: .3em;
  font-weight: 700;
}
.br-card.win h2 { color: var(--gold-2); text-shadow: 0 0 34px rgba(214, 178, 92, .5); }
.br-card.lose h2 { color: var(--red-2); }
.br-card.flee h2 { color: var(--ink-2); }
.br-card p { margin: 0 0 22px; color: var(--ink-2); font-size: 13px; }

/* ============================================================ 提示 */
.toast {
  position: fixed;
  left: 50%;
  top: 66px;
  transform: translate(-50%, -14px);
  padding: 9px 20px;
  background: rgba(12, 30, 41, .96);
  border: 1px solid var(--line);
  border-radius: 24px;
  font-size: 12.5px;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity .26s, transform .26s;
  z-index: 400;
  box-shadow: var(--shadow-1);
  max-width: 80vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(79, 158, 106, .45); color: #a8e0bd; }
.toast.err { border-color: rgba(176, 69, 58, .45); color: #e8b0a8; }

#tooltip {
  position: fixed;
  z-index: 300;
  width: 210px;
  padding: 10px 12px;
  background: rgba(11, 27, 37, .97);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-2);
  pointer-events: none;
  font-size: 11.5px;
  backdrop-filter: blur(8px);
}
.tt-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--gold-2);
  margin-bottom: 3px;
}
.tt-sub { font-size: 10.5px; color: var(--ink-3); margin-bottom: 7px; }
.tt-row { color: var(--ink-2); line-height: 1.7; font-size: 11px; }
.tt-row.dim { color: var(--ink-3); margin-top: 5px; }

/* 菜单 */
.menu-card {
  width: min(460px, 100%);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-2);
  animation: modalIn .2s;
}
.menu-card h3 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--gold-2);
  letter-spacing: .1em;
  font-weight: 700;
}
.menu-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.menu-actions .btn { text-align: center; }
.menu-stats {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.9;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}
.menu-stats b { color: var(--gold-2); font-family: var(--font-display); font-size: 13px; }
.menu-tip {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.7;
}

/* ---------------------------------------------------------- 船长选择与剧情 */
.hero-modal { z-index: 500; overflow-y: auto; align-items: flex-start; padding: clamp(18px, 5vh, 58px) 20px; background: radial-gradient(ellipse at 48% 20%, rgba(42,76,83,.55), rgba(4,13,18,.96) 67%); }
.hero-shell { width: min(960px, 100%); margin: auto; padding: clamp(8px, 3vw, 30px); position: relative; }
.hero-shell::before { content: ''; position: absolute; inset: 0; border: 1px solid rgba(214,178,92,.23); pointer-events: none; clip-path: polygon(0 0, 35% 0, 38% 7px, 62% 7px, 65% 0, 100% 0, 100% 100%, 0 100%); }
.hero-kicker,.story-kicker,.route-kicker { color: var(--gold); font-size: 11px; letter-spacing: .28em; text-transform: uppercase; }
.hero-shell h1 { margin: 14px 0 12px; color: #f1e4c4; font: 500 clamp(34px, 5.4vw, 56px)/1.2 var(--font-display); letter-spacing: .08em; }
.hero-lede { max-width: 610px; margin: 0; color: #b9b5a5; font-size: 14px; line-height: 1.9; }
.hero-roster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0 14px; }
.hero-choice { min-height: 76px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; border: 1px solid rgba(211,197,160,.19); background: linear-gradient(130deg, rgba(232,220,184,.07), rgba(14,30,37,.42)); transition: border-color .18s, background .18s, transform .18s; }
.hero-choice:hover { border-color: rgba(214,178,92,.52); transform: translateY(-2px); }
.hero-choice.selected { border-color: var(--gold); background: linear-gradient(130deg, rgba(214,178,92,.2), rgba(15,32,39,.56)); box-shadow: inset 3px 0 var(--gold); }
.hero-mark { width: 39px; height: 39px; display: grid; place-items: center; color: var(--gold-2); border: 1px solid rgba(214,178,92,.45); border-radius: 50%; font: 19px var(--font-display); background: radial-gradient(circle, rgba(214,178,92,.16), transparent); }
.hero-choice-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.hero-choice-copy b { font: 600 16px var(--font-display); color: #eee1c5; }
.hero-choice-copy small { color: #a7a392; font-size: 11px; }
.hero-index { margin-left: auto; color: rgba(228,207,155,.42); font: 12px Georgia,serif; }
.hero-detail { padding: 22px 24px 20px; color: var(--ink); background: rgba(9,22,29,.68); border-top: 1px solid rgba(214,178,92,.36); border-bottom: 1px solid rgba(214,178,92,.18); }
.hero-detail-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.hero-nation { color: var(--hero-color); font-size: 10px; letter-spacing: .18em; }
.hero-detail h2 { margin: 5px 0 0; font: 600 24px var(--font-display); color: #f2e5c7; }
.hero-start-stats { display: flex; gap: 24px; color: var(--gold-2); text-align: right; font-variant-numeric: tabular-nums; }
.hero-start-stats span { display: flex; flex-direction: column; font-size: 15px; }
.hero-start-stats small { color: #858b85; font-size: 10px; }
.hero-detail p { max-width: 780px; margin: 16px 0; color: #c3c0b1; line-height: 1.85; white-space: pre-line; }
.hero-perk { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12px; }
.hero-perk b { color: #d9bd70; }
.hero-perk span { color: #a7a392; }
.hero-actions { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.hero-actions .btn.primary { min-width: 220px; padding: 11px 18px; }
.hero-foot { margin-top: 22px; color: rgba(204,196,166,.43); font-size: 10px; letter-spacing: .24em; text-align: center; }
.story-card { width: min(640px, 100%); padding: clamp(23px, 5vw, 42px); background: linear-gradient(140deg, #142d37, #0b1921 75%); border: 1px solid rgba(214,178,92,.38); box-shadow: 0 28px 90px rgba(0,0,0,.6); }
.story-card h2 { margin: 12px 0 20px; color: var(--gold-2); font: 600 26px var(--font-display); }
#story-text { color: #d5d0c1; font-size: 14px; line-height: 2; white-space: pre-line; }
.story-bottom { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 24px; padding-top: 17px; border-top: 1px solid var(--line); }
.story-bottom span { color: #c7ad67; font-size: 12px; }

/* ---------------------------------------------------------- 金三角航线簿 */
.route-planner { width: min(780px, 100%); max-height: min(88vh, 820px); display: flex; flex-direction: column; overflow: hidden; color: var(--ink); background: #0d2029; border: 1px solid rgba(214,178,92,.36); box-shadow: var(--shadow-2); }
.route-head { display: flex; justify-content: space-between; gap: 20px; padding: 22px 26px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(110deg, rgba(214,178,92,.09), transparent 55%); }
.route-head h2 { margin: 6px 0; color: var(--gold-2); font: 600 25px var(--font-display); }
.route-head p { max-width: 590px; margin: 0; color: var(--ink-2); font-size: 12px; line-height: 1.7; }
.route-list { min-height: 0; padding: 16px 22px; overflow-y: auto; }
.route-option { padding: 15px 16px; margin-bottom: 12px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.025); }
.route-option-title { display: flex; gap: 15px; align-items: baseline; color: #8e958b; font-size: 11px; }
.route-option-title b { color: #eee3ca; font: 600 15px var(--font-display); letter-spacing: .06em; }
.route-legs { display: grid; gap: 6px; margin: 13px 0; }
.route-legs div { display: grid; grid-template-columns: 1fr 20px 1fr auto; align-items: center; gap: 8px; color: #b2b3a8; font-size: 11px; }
.route-legs i { color: var(--gold); font-style: normal; text-align: center; }
.route-legs em { color: #92c7a4; font-size: 10px; font-style: normal; text-align: right; }
.route-option footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); color: #9b9d91; font-size: 11px; }
.route-option footer b { color: var(--gold-2); font-variant-numeric: tabular-nums; }
.route-option footer .btn { margin-left: auto; }
.route-empty { padding: 50px 30px; text-align: center; border: 1px dashed rgba(214,178,92,.22); }
.route-empty span { color: var(--gold-2); font: 19px var(--font-display); }
.route-empty p { max-width: 460px; margin: 10px auto 16px; color: var(--ink-2); font-size: 12px; line-height: 1.8; }
.route-empty b { color: #85938e; font-size: 11px; }
.route-running { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px 14px; padding: 13px 24px; background: rgba(79,158,106,.1); border-bottom: 1px solid rgba(79,158,106,.24); }
.route-running b { color: #9bdbad; font-size: 12px; }
.route-running span { color: #d7d1bc; font: 13px var(--font-display); }
.route-running small { grid-column: 2; color: #869a8d; font-size: 10px; }
.route-running button { grid-column: 3; grid-row: 1 / span 2; }
.route-retired { display: flex; flex-wrap: wrap; gap: 7px 14px; padding: 11px 24px; color: #a3a399; background: rgba(255,255,255,.035); border-bottom: 1px solid rgba(255,255,255,.08); font-size: 11px; }
.route-retired b { color: #dbb981; }
.route-retired.abolished b { color: #d8947c; }
.route-footnote { padding: 12px 24px; color: #7f8b88; border-top: 1px solid rgba(255,255,255,.07); font-size: 10.5px; line-height: 1.6; }
.intel-age { margin-left: 38px; color: #8ca49e !important; font-size: 10px !important; }

/* ============================================================ 响应式 */
@media (max-width: 1280px) {
  .stat.hide-sm { display: none; }
}
@media (max-width: 980px) {
  #stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  #sidebar {
    flex-direction: row;
    max-height: 30vh;
    border-left: none;
    border-top: 1px solid var(--line);
    overflow-x: auto;
  }
  #sidebar .panel { flex: 1 1 0; min-width: 220px; max-height: none; }
  #p-log { min-width: 240px; }
  .brand { font-size: 16px; letter-spacing: .1em; }
  #port-body { padding: 14px; }
  .port-head { padding: 14px 16px 12px; }
  .port-head h2 { font-size: 20px; }
}
@media (max-width: 620px) {
  .stat .k { display: none; }
  .speed { display: none; }
  #battle-actions button { min-width: 74px; padding: 8px 10px; font-size: 11.5px; }
  .hero-roster { grid-template-columns: 1fr; gap: 6px; margin-top: 18px; }
  .hero-choice { min-height: 60px; }
  .hero-detail { padding: 17px; }
  .hero-detail-top { flex-direction: column; }
  .hero-start-stats { text-align: left; }
  .hero-start-stats span { flex-direction: row; align-items: baseline; gap: 5px; }
  .hero-shell h1 { font-size: 37px; }
  .route-head { padding: 17px; }
  .route-list { padding: 12px; }
  .route-option { padding: 12px; }
  .route-legs div { grid-template-columns: 1fr 15px 1fr auto; gap: 4px; font-size: 10px; }
  .route-running { grid-template-columns: 1fr auto; }
  .route-running span,.route-running small { grid-column: 1; }
  .route-running button { grid-column: 2; grid-row: 1 / span 2; }
  .map-plaque { left: 9px; top: 9px; min-width: 135px; padding: 7px 8px; }
  .map-legend { left: 8px; right: 66px; bottom: 8px; gap: 8px; font-size: 8px; }
}

/* ============================================================ 航海图册 UI 重构 */
:root { --ink: #eee8d8; --ink-2: #c2b9a3; --ink-3: #9a9d91; --gold: #cfaa59; --gold-2: #efd58c; }
html, body { font-size: 16px; }
#app { grid-template-rows: 68px 1fr; }
#topbar { gap: 20px; padding: 0 22px; background: #101e24; border-bottom: 1px solid #8c7446; box-shadow: none; }
.brand { font-size: 22px; letter-spacing: .12em; text-shadow: none; }
.stat { gap: 8px; }
.stat .k { font-size: 12px; color: #a9a590; }
.stat b, .stat span:last-child { font-size: 15px; }
.speed button { font-size: 14px; padding: 6px 10px; }
.btn { font-size: 15px; padding: 9px 16px; border-radius: 3px; }
.btn.primary { background: #c9a452; border-color: #e1c478; box-shadow: none; }
#stage { grid-template-columns: minmax(0, 1fr) 350px; }
#sidebar { background: #14242a; border-left: 1px solid #796b4b; }
.panel { border-radius: 0; }
.panel-head { min-height: 48px; padding: 12px 16px; }
.panel-head b { font-size: 14px; letter-spacing: .14em; }
.panel-body { padding: 13px 16px; }
.ship-name, .cargo-name { font-size: 15px; }
.ship-meta, .cargo-val { font-size: 13px; }
.log-item { font-size: 13.5px; line-height: 1.7; }
.log-date { font-size: 11px; }
.map-plaque { left: 22px; top: 20px; min-width: 220px; padding: 12px 16px 13px; background: rgba(12,29,35,.9); border-left-width: 3px; }
.map-plaque span { font-size: 12px; }
.map-plaque b { font-size: 16px; }
.map-plaque small { font-size: 12px; }
.map-legend { right: 112px; bottom: 22px; gap: 18px; padding: 10px 14px; font-size: 13px; }
#hint { bottom: 17px; font-size: 13px; padding: 7px 12px; border-radius: 2px; }
#map-ctl button { width: 42px; height: 42px; border-radius: 2px; font-size: 22px; backdrop-filter: none; }
.port-label { font-weight: 650; stroke-width: 4px; }
.sea-label { font-size: 23px; letter-spacing: 9px; }
.landmass { filter: none; }

/* 港口变成一张可经营的港湾总览：场景与功能导航在左，操作区在右。 */
#port-modal { padding: 3vh 3vw; background: rgba(5,13,17,.82); backdrop-filter: blur(2px); }
.port-shell {
  width: min(1480px, 100%); height: min(900px, 94vh); max-height: 94vh;
  display: grid; grid-template-columns: 340px minmax(0,1fr); grid-template-rows: 340px minmax(0,1fr);
  background: #eee7d3; color: #292f2b; border: 1px solid #a39066; border-radius: 2px; box-shadow: 0 22px 70px rgba(0,0,0,.55);
}
.port-head { grid-column: 1; grid-row: 1; position: relative; display: flex; flex-direction: column; gap: 12px; padding: 0 22px 20px; background: #e5dcc3; border-bottom: 1px solid #aa9a74; }
.port-scene { height: 205px; margin: 0 -22px; overflow: hidden; border-bottom: 1px solid #8c7b59; background: #c2d1c5; }
.port-scene img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 55%; }
.port-head h2 { color: #252e2c; font-size: 34px; line-height: 1.16; letter-spacing: .04em; }
.port-head .sub { font-size: 14px; line-height: 1.55; color: #555b50; align-items: flex-start; }
.port-head .sub .pc-flag { width: 11px; height: 11px; margin-top: 4px; }
.port-head .sub .sep { color: #918362; }
.port-close { position: absolute; z-index: 2; top: 12px; right: 12px; margin: 0; color: #fff; font-size: 30px; width: 42px; height: 42px; border-radius: 0; background: rgba(28,39,36,.72); }
.port-close:hover { background: #273b36; color: #fff; }
#port-tabs { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 0; padding: 14px 0; background: #e5dcc3; border: 0; }
#port-tabs button { display: grid; grid-template-columns: 44px 1fr 18px; align-items: center; gap: 10px; min-height: 76px; padding: 9px 20px; color: #51574e; border: 0; border-left: 4px solid transparent; border-bottom: 1px solid rgba(92,82,58,.2); text-align: left; letter-spacing: 0; }
#port-tabs button:hover { color: #242e2a; background: #dcd1b6; }
#port-tabs button.on { color: #273c37; border-left-color: #a67e31; background: #d8ceb2; }
.tab-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #928465; border-radius: 50%; font-family: Georgia,serif; font-size: 23px; }
#port-tabs button b { display: block; font-size: 17px; font-weight: 700; }
#port-tabs button small { display: block; margin-top: 2px; color: #777665; font-size: 13px; }
#port-tabs button i { color: #847a61; font-size: 24px; font-style: normal; }
#port-body { grid-column: 2; grid-row: 1 / span 2; min-width: 0; overflow: auto; padding: 34px clamp(22px,3.5vw,56px) 34px; background: #f4efdf; color: #29312d; }
.market-head { padding-bottom: 18px; margin-bottom: 14px; border-bottom: 1px solid #c8bda2; }
.unit-pick { gap: 7px; color: #5c625a; font-size: 14px; }
.unit { padding: 7px 13px; font-size: 14px; border-color: #bdb294; border-radius: 2px; color: #414941; }
.unit.on { background: #dcd1b3; color: #293a33; border-color: #9d8751; }
.mini { padding: 7px 11px; font-size: 14px; border-radius: 2px; border-color: #a9a087; color: #414940; }
.quick-supply { gap: 8px; }
.market-table { color: #29312d; font-size: 15px; }
.market-table th { padding: 12px 10px; color: #63685d; font-size: 12px; border-color: #bdb294; }
.market-table td { padding: 13px 10px; border-color: #d8cfba; }
.market-table tbody tr:hover td { background: #e9e1ca; }
.market-table .mini { padding: 7px 14px; }
.g-name { font-size: 16px; }
.g-dot { width: 5px; height: 18px; }
.stock-num, .best-port, .dead-goods, .port-foot { font-size: 13px; }
.port-foot { padding-top: 18px; border-top: 1px solid #bdb294; color: #5c6258; }
.port-foot b { color: #29312d; font-size: 16px; }
.tag { font-size: 11px; }
.tavern, .yard, .quests { font-size: 16px; }
.rumor { padding: 24px; background: #e4dcc6; border-left-color: #9d7940; }
.rumor-label, .yard h4, .quests h4 { font-size: 15px; }
.rumor p { font-size: 21px; }
.yard-ship, .quest-card { padding: 18px; background: #e9e2cf; border-color: #c2b698; }
.ys-head b, .q-head b { font-size: 18px; }
.ys-desc, .q-desc, .ys-stats, .ym-meta, .quest-hint { font-size: 14px; }
.yard-list { gap: 10px; }

@media (max-width: 980px) {
  #stage { grid-template-columns: minmax(0,1fr); grid-template-rows: 1fr auto; }
  .port-shell { grid-template-columns: 280px minmax(0,1fr); grid-template-rows: 280px minmax(0,1fr); }
  .port-scene { height: 160px; }
  #port-body { padding: 24px; }
}
@media (max-width: 680px) {
  #topbar { gap: 8px; padding: 0 9px; }
  .brand { font-size: 16px; }
  .stat { display: none; }
  #s-date, #s-gold { display: flex; }
  .port-shell { height: 96vh; max-height: 96vh; display: flex; flex-direction: column; overflow-y: auto; }
  .port-head { flex: 0 0 auto; padding-bottom: 12px; }
  .port-scene { height: 145px; }
  .port-head h2 { font-size: 27px; }
  #port-tabs { flex-direction: row; overflow-x: auto; padding: 0; flex: 0 0 auto; }
  #port-tabs button { display: flex; min-width: 118px; min-height: 62px; gap: 8px; padding: 7px; border-left: 0; border-bottom: 3px solid transparent; }
  #port-tabs button.on { border-bottom-color: #a67e31; }
  .tab-mark { width: 32px; height: 32px; font-size: 18px; flex: 0 0 auto; }
  #port-tabs button b { font-size: 14px; }
  #port-tabs button small, #port-tabs button i { display: none; }
  #port-body { overflow: visible; padding: 16px 12px 24px; }
  .market-table { min-width: 620px; }
  #port-body:has(.market-table) { overflow-x: auto; }
  .map-plaque { min-width: 180px; }
  .map-legend { left: 8px; max-width: calc(100% - 80px); font-size: 11px; }
}
.weather-mark { pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.weather-label { fill: #f0e5c6; stroke: #27383a; stroke-width: 3px; paint-order: stroke; font: 700 12px var(--font-ui); letter-spacing: 2px; }
.chart-tick { stroke: rgba(222,203,154,.5); stroke-width: 1; }
.port.is-invested .port-dot { fill: #efd58c; stroke: #fff2c7; stroke-dasharray: 2 1; }
.port.is-allied .port-dot { fill: #9ec8b7; stroke: #e6ead5; stroke-dasharray: 1 1; }
.port.is-scouted .port-dot { stroke-width: 2.4; }
.legend-ally { background: #9ec8b7; border: 1px dashed #e6ead5; }
.legend-share { background: #efd58c; border: 1px dashed #fff2c7; }
.guild-panel { max-width: 850px; margin: 12px auto; padding: clamp(20px,4vw,48px); border: 1px solid #b9ad90; background: #eee6d1; }
.guild-kicker { color: #8a7446; font: 13px var(--font-display); letter-spacing: .2em; }
.guild-panel h3 { margin: 12px 0; color: #293630; font: 700 30px var(--font-display); }
.guild-panel p { max-width: 620px; color: #62675b; font-size: 16px; line-height: 1.8; }
.guild-share { position: relative; display: flex; align-items: baseline; gap: 14px; margin: 28px 0; padding-bottom: 14px; border-bottom: 5px solid #d5cbb3; }
.guild-share b { color: #4b614e; font: 700 42px var(--font-display); }
.guild-share span { color: #6b6d5e; font-size: 15px; }
.guild-share i { position: absolute; left: 0; bottom: -5px; height: 5px; background: #8a7245; }
.guild-offers { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 22px; }
.guild-offer { min-height: 94px; padding: 14px; text-align: left; color: #343c34; border: 1px solid #b4a889; background: #e3dac2; }
.guild-offer:hover:not(:disabled) { border-color: #897340; background: #d8cba9; }
.guild-offer b, .guild-offer small { display: block; }
.guild-offer b { font-size: 16px; }
.guild-offer small { margin-top: 7px; color: #6c6d60; font-size: 13px; }
.guild-note { margin-top: 24px; padding-top: 14px; color: #727365; border-top: 1px solid #c8bea3; font-size: 14px; }
.tavern .rumor { background: #e4dcc6; border: 1px solid #c2b698; border-left: 4px solid #9d7940; border-radius: 2px; }
.tavern .rumor-label { color: #846936; }
.tavern .rumor p { color: #303b35; }
.tavern-acts .btn { color: #303a34; background: #e7dec8; border-color: #b6a988; border-radius: 2px; }
.tavern-acts .btn:hover:not(:disabled) { color: #25352d; background: #d9cdaa; border-color: #8e7949; }
.tavern-info { color: #666a5d; }

/* ============================================================ 领航图室：更清楚的纸、海与朱砂色层级 */
html, body { font-size: 17px; color: var(--ink); }
#app { grid-template-rows: 72px minmax(0,1fr); background: var(--bg-1); }
#topbar {
  gap: 18px; padding: 0 24px; color: #f0eadb; background: #263f46;
  border-bottom: 3px solid #a85b45; box-shadow: none;
}
.brand { color: #f0eadb; font-size: 23px; letter-spacing: .07em; text-shadow: none; border-color: rgba(240,234,219,.24); }
.stat .k { color: #b7c1b8; font-size: 13px; letter-spacing: .04em; }
.stat b, .stat span:last-child { color: #f0eadb; font-size: 16px; }
#s-gold { color: #e4a178; }
.speed { padding: 2px; border: 1px solid rgba(240,234,219,.25); border-radius: 2px; background: #1e3339; }
.speed button { min-height: 36px; padding: 5px 11px; border-radius: 1px; color: #c2c9c0; font-size: 14px; }
.speed button.on { color: #fff0db; background: #a85b45; box-shadow: none; }
.btn { min-height: 40px; border-radius: 2px; border-color: rgba(240,234,219,.28); color: #f0eadb; font-size: 16px; }
.btn.ghost { color: #e1e1d3; }
.btn.ghost:hover { color: #fff; background: rgba(255,255,255,.09); }
.btn.primary { color: #fff8eb; background: #a45140; border-color: #a45140; }
.btn.primary:hover:not(:disabled) { color: #fff8eb; background: #8f4437; }

#stage { grid-template-columns: minmax(0,1fr) 372px; background: var(--bg-1); }
#mapwrap { background: #203b43; }
#mapwrap::after { border: 0; box-shadow: inset 0 0 54px rgba(8,26,31,.22); }
#sidebar { color: var(--ink); background: #e9e2d1; border-left: 1px solid #b8ad96; }
.panel { color: var(--ink); background: transparent; border-bottom: 1px solid #c9bea7; }
.panel-head { min-height: 54px; padding: 14px 18px; color: #334b4c; background: #e1d9c6; border-bottom: 1px solid #c7bba1; }
.panel-head b { font-size: 17px; letter-spacing: .08em; }
.panel-body { padding: 15px 18px; }
.ship-card { background: #f0eadb; border: 1px solid #c6baa0; border-radius: 2px; }
.ship-name { color: #344f4f; }
.ship-type { color: #68766d; font-size: 14px; }
.bar { background: #c7c1b1; border-radius: 0; }
.bar-label, .bar-num { color: #5f6c65; }
.cargo-row { font-size: 15px; }
.cargo-row:hover { background: #e2dac7; }
.cargo-qty { color: #a45140; }
.empty { color: #64726a; font-size: 15px; }
.log-good { color: #416c52; }
.log-bad { color: #9e473b; }
.log-item { border-color: #c9bea7; }
.ship-name, .cargo-name { color: #293d40; font-size: 17px; }
.ship-meta, .cargo-val { color: #5e6a62; font-size: 15px; }
.log-item { color: #3f514f; font-size: 15px; line-height: 1.7; }
.log-date { color: #8a7a61; font-size: 13px; }
.bar-track { background: #cfc7b4; }
.bar-label, .bar-num { color: #66736a; font-size: 13px; }
.ship-row, .cargo-row, .log-item { border-color: #c9bea7; }

.map-plaque { left: 24px; top: 22px; min-width: 250px; padding: 14px 17px; color: #f1ead7; background: rgba(25,48,55,.94); border-left: 4px solid #a85b45; }
.map-plaque span { color: #e3a17b; font-size: 14px; letter-spacing: .09em; }
.map-plaque b { font-size: 18px; }
.map-plaque b i { color: #f1d6b9; }
.map-plaque small { color: #d1d5c9; font-size: 14px; }
.map-legend { right: 112px; bottom: 24px; gap: 16px; padding: 11px 15px; color: #e6e3d5; background: rgba(26,49,55,.9); border: 1px solid rgba(224,214,190,.3); font-size: 14px; }
.map-legend i { width: 10px; height: 10px; }
.legend-port { background: #d17a5d; box-shadow: none; }
#hint { left: 20px; bottom: 20px; color: #e3e5d8; background: rgba(26,49,55,.9); border: 1px solid rgba(224,214,190,.24); border-radius: 2px; font-size: 14px; }
#map-ctl { gap: 3px; }
#map-ctl button { width: 44px; height: 44px; color: #efe8d7; background: #29454b; border: 1px solid rgba(230,223,204,.32); border-radius: 2px; font-size: 24px; }
#map-ctl button:hover { color: #fff; background: #a45140; border-color: #a45140; }
.port-label { font-weight: 650; stroke: rgba(22,44,50,.95); stroke-width: 4px; }
.port-nation { stroke: rgba(22,44,50,.92); stroke-width: 3px; }
.sea-label { fill: rgba(209,225,216,.28); font-size: 25px; letter-spacing: 10px; }

/* 港口账房：有图的档案侧栏 + 清晰的操作区，取消漂浮玻璃感 */
#port-modal { padding: 2.5vh 2.4vw; background: rgba(20,39,43,.82); backdrop-filter: none; }
.port-shell {
  width: min(1500px,100%); height: min(900px,95vh); max-height: 95vh;
  grid-template-columns: 330px minmax(0,1fr); grid-template-rows: 310px minmax(0,1fr);
  background: #f0e9d8; color: #293d40; border: 1px solid #9d9279; border-radius: 2px;
  box-shadow: 0 12px 36px rgba(12,29,32,.3);
}
.port-head, #port-tabs { color: #f1ead8; background: #29454b; }
.port-head { padding: 0 22px 18px; border-bottom: 1px solid #647774; }
.port-scene { height: 188px; margin: 0 -22px; border-bottom: 2px solid #a85b45; background: #506a68; }
.port-head h2 { margin: 3px 0 0; color: #f2ead8; font-size: 36px; }
.port-head .sub { color: #d6d8c9; font-size: 16px; }
.port-close { color: #f4ecda; background: rgba(29,52,57,.9); border: 1px solid rgba(240,234,219,.34); }
.port-close:hover { background: #a45140; }
#port-tabs { padding: 8px 0; }
#port-tabs button { min-height: 72px; padding: 8px 20px; color: #d2d8cd; border-bottom: 1px solid rgba(229,228,209,.14); }
#port-tabs button:hover { color: #fff4df; background: #34565a; }
#port-tabs button.on { color: #fff3dc; border-left-color: #bd6b51; background: #35565a; }
.tab-mark { border-color: #718985; border-radius: 2px; color: #e1c6a5; }
#port-tabs button b { font-size: 18px; }
#port-tabs button small { color: #bac8bd; font-size: 14px; }
#port-body { padding: 38px clamp(24px,3.5vw,58px); color: #293d40; background: #f0e9d8; }
.market-head { border-color: #c5b99e; }
.market-table { color: #293d40; font-size: 16px; }
.market-table th { color: #56645e; font-size: 14px; }
.market-table td { border-color: #d4cbb5; }
.market-table tbody tr:hover td { background: #e7deca; }
.unit-pick, .unit, .mini { font-size: 15px; }
.unit.on, .mini.buy { color: #385d4a; background: #dce5d8; }
.port-foot, .stock-num, .best-port, .dead-goods { font-size: 15px; }
.tag { font-size: 13px; }
.rumor { border-radius: 2px; }
.rumor-label, .yard h4, .quests h4 { font-size: 16px; }
.tavern .rumor p { font-size: 22px; line-height: 1.7; }
.tavern-info { font-size: 15px; }
.ys-desc, .q-desc, .ys-stats, .ym-meta, .quest-hint { font-size: 15px; }
.guild-panel { color: #293d40; background: #e8e0cd; border-color: #beb298; }
.guild-panel p, .guild-note { color: #53635f; font-size: 17px; }
.guild-offer { color: #293d40; background: #ddd4c1; border-color: #b8ad94; }
.guild-offer b { font-size: 17px; }
.guild-offer small { color: #5f6c63; font-size: 15px; }

#tooltip {
  width: 280px; padding: 14px 16px; color: #f0ead8; background: #223d44;
  border: 1px solid #8d9a86; border-left: 4px solid #bd6b51; border-radius: 2px;
  box-shadow: 0 4px 14px rgba(14,30,33,.32); font-size: 15px; backdrop-filter: none;
}
.tt-head { color: #f0c4a3; font-size: 18px; }
.tt-sub { color: #c1cbc0; font-size: 14px; }
.tt-row { color: #edf0e4; font-size: 15px; line-height: 1.65; }
.tt-row.dim { color: #c1cbc0; }
.port-card { color: #f0ead8; background: #223d44; border-color: #71837e; border-radius: 2px; box-shadow: 0 5px 16px rgba(14,30,33,.35); backdrop-filter: none; }

@media (max-width: 1100px) {
  #stage { grid-template-columns: minmax(0,1fr) 330px; }
  #topbar { gap: 10px; padding: 0 14px; }
  .brand { font-size: 20px; }
  .stat .k { font-size: 12px; }
  .stat b, .stat span:last-child { font-size: 14px; }
  .topbar .btn { padding-inline: 10px; }
}
@media (max-width: 980px) {
  #stage { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(52vh,1fr) minmax(180px,30vh); }
  #sidebar { display: grid; grid-template-columns: 1fr 1fr 1.25fr; overflow: auto; border-left: 0; border-top: 1px solid #b8ad96; }
  .panel { min-width: 0; border-right: 1px solid #c9bea7; border-bottom: 0; }
  .port-shell { grid-template-columns: 290px minmax(0,1fr); grid-template-rows: 280px minmax(0,1fr); }
  .port-scene { height: 160px; }
}
@media (max-width: 680px) {
  #app { grid-template-rows: 58px minmax(0,1fr); }
  #topbar { gap: 6px; padding: 0 8px; }
  .brand { margin-right: auto; padding: 0; border: 0; font-size: 18px; }
  .stat { display: none; }
  #topbar .btn { min-height: 36px; padding: 5px 8px; font-size: 14px; }
  .speed button { min-height: 32px; padding: 4px 7px; font-size: 13px; }
  #stage { grid-template-rows: minmax(48vh,1fr) minmax(170px,31vh); }
  #sidebar { grid-template-columns: 1fr 1fr; }
  #p-log { grid-column: 1 / -1; }
  .panel-head { min-height: 40px; padding: 8px 10px; }
  .panel-head b { font-size: 14px; }
  .panel-body { padding: 8px 10px; }
  .map-plaque { left: 10px; top: 10px; min-width: 208px; padding: 9px 12px; }
  .map-plaque span { font-size: 12px; }
  .map-plaque b { font-size: 15px; }
  .map-plaque small { font-size: 12px; }
  .map-legend { left: 8px; right: 56px; bottom: 8px; gap: 8px 12px; max-width: calc(100% - 64px); padding: 8px 10px; font-size: 12px; }
  #hint { display: none; }
  #map-ctl { right: 8px; top: 8px; flex-direction: column; }
  #map-ctl button { width: 38px; height: 38px; }
  #port-modal { padding: 0; }
  .port-shell { width: 100%; height: 100%; max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
  .port-head { flex: 0 0 auto; min-height: 220px; padding-bottom: 12px; }
  .port-scene { height: 145px; }
  .port-head h2 { font-size: 30px; }
  #port-tabs { flex: 0 0 auto; flex-direction: row; overflow-x: auto; padding: 0; }
  #port-tabs button { display: flex; min-width: 124px; min-height: 62px; gap: 8px; padding: 7px 10px; border-left: 0; border-bottom: 3px solid transparent; }
  #port-tabs button.on { border-bottom-color: #bd6b51; }
  #port-tabs button b { font-size: 15px; }
  #port-tabs button small, #port-tabs button i { display: none; }
  .tab-mark { width: 32px; height: 32px; font-size: 18px; }
  #port-body { min-height: 0; overflow: auto; padding: 18px 14px 28px; }
  .market-table { min-width: 620px; }
  #port-body:has(.market-table) { overflow: auto; }
  #tooltip { width: min(280px, calc(100vw - 24px)); }
}
