/* ============================================================================
   数桥 Hashi · 游戏专属样式
   选择器统一以 .g-hashi 前缀限定，避免影响其他游戏
   ========================================================================== */

.g-hashi {
  gap: 10px;
  padding: 12px 10px calc(14px + var(--safe-b));
}

.g-hashi .stats .stat-v { font-size: 16px; }

.g-hashi .hs-ctrl { gap: 8px; align-items: stretch; }
.g-hashi .hs-ctrl .seg { flex: 1; min-width: 0; }
.g-hashi .hs-check-btn { flex: none; min-width: 74px; }

.g-hashi .hs-board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
}

/* ------------------------------ 棋盘 ------------------------------ */

.g-hashi .hs-board {
  --cell: 40px;
  position: relative;
  flex: none;
  margin: auto;
  border-radius: 16px;
  background-color: rgba(255, 255, 255, 0.028);
  background-image:
    linear-gradient(to right, rgba(190, 210, 255, 0.075) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(190, 210, 255, 0.075) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  box-shadow: inset 0 0 0 1px var(--line-2),
    0 24px 50px -30px rgba(0, 0, 0, 0.92);
  touch-action: none;
  transition: box-shadow 0.3s ease;
  overflow: visible;
}
.g-hashi .hs-board.won {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent),
    0 0 42px color-mix(in srgb, var(--accent) 28%, transparent),
    0 24px 50px -30px rgba(0, 0, 0, 0.92);
}

.g-hashi .hs-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.g-hashi .hs-islands {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ------------------------------ 岛 ------------------------------ */

.g-hashi .hs-island {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 38% 28%, #33456b, #141b2b 74%);
  border: 1px solid rgba(150, 180, 245, 0.55);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #e9efff;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.g-hashi .hs-island .hs-num { display: block; line-height: 1; }

.g-hashi .hs-island.sel {
  background: radial-gradient(circle at 38% 28%, #4a6cae, #1d2a46 74%);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 20px color-mix(in srgb, var(--accent) 45%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.g-hashi .hs-island.target {
  transform: scale(1.1);
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 0 18px rgba(255, 255, 255, 0.3);
}
.g-hashi .hs-island.bad {
  background: radial-gradient(circle at 38% 28%, #7d2534, #3a1018 74%);
  border-color: #ff5c6c;
  color: #ffdbe0;
  box-shadow: 0 0 0 2px rgba(255, 92, 108, 0.45), 0 0 16px rgba(255, 92, 108, 0.4);
}

/* ------------------------------ 桥 ------------------------------ */

.g-hashi .hs-bridge {
  stroke: var(--accent);
  stroke-linecap: round;
  opacity: 0.95;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 45%, transparent));
  transition: stroke 0.12s ease, opacity 0.12s ease;
}
.g-hashi .hs-bridge.hot {
  stroke: #d3e0ff;
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(190, 212, 255, 0.8));
}
.g-hashi .hs-preview {
  stroke: rgba(255, 255, 255, 0.72);
  stroke-linecap: round;
  stroke-dasharray: 6 5;
  opacity: 0.9;
}
.g-hashi .hs-preview.bad { stroke: #ff5c6c; }

/* 完成后收起统计与尺寸切换，把空间让给棋盘 */
.g-hashi.won-view .stats,
.g-hashi.won-view .hs-ctrl { display: none; }
.g-hashi.won-view .hs-board-wrap {
  justify-content: flex-start;
  padding-top: 4px;
}
.g-hashi.won-view .hs-board {
  margin: 0 auto;
  transform: scale(0.92);
  transform-origin: top center;
  transition: transform 0.3s ease;
}

/* ------------------------------ 结算弹窗 ------------------------------ */

.overlay.hs-result-overlay {
  align-items: flex-end;
  padding: 14px 16px calc(18px + var(--safe-b));
  background: rgba(4, 6, 11, 0.36);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.overlay.hs-result-overlay .dialog { padding: 15px 16px; border-radius: 18px; }
.overlay.hs-result-overlay .dialog-actions { margin-top: 13px; }

.hs-res-k {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0 11px;
}
.hs-res-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
}
.hs-res-grid b {
  display: block;
  font-size: 15.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  color: var(--text);
}
.hs-res-grid .hint { display: block; font-size: 10px; }
.hs-res-tip {
  margin-top: 11px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--warn);
}

/* 小屏压缩 */
@media (max-width: 374px) {
  .g-hashi { padding-left: 8px; padding-right: 8px; gap: 8px; }
  .g-hashi .g-head-right .btn { padding: 6px 8px; }
  .g-hashi .hs-check-btn { min-width: 66px; }
}
