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

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

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

/* ------------------------------ 选关页 ------------------------------ */

.g-slitherlink .sl-continue {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  text-align: left;
  min-height: 52px;
}
.g-slitherlink .sl-continue:active { transform: scale(0.98); }
.g-slitherlink .sl-continue-k {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  padding: 2px 7px;
  flex: none;
}
.g-slitherlink .sl-continue-n { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-slitherlink .sl-continue-t { font-size: 11px; color: var(--dim); flex: none; font-variant-numeric: tabular-nums; }
.g-slitherlink .sl-continue-a { font-size: 19px; line-height: 1; color: var(--faint); flex: none; }

.g-slitherlink .sl-sec { display: flex; flex-direction: column; gap: 7px; }
.g-slitherlink .sl-sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px; }
.g-slitherlink .sl-sec-t { font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--dim); }
.g-slitherlink .sl-sec-c { font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.g-slitherlink .sl-lv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.g-slitherlink .sl-lv {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 84px;
  padding: 9px 5px 8px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  transition: transform 0.1s ease, border-color 0.16s ease;
  touch-action: manipulation;
}
.g-slitherlink .sl-lv:active { transform: scale(0.96); }
.g-slitherlink .sl-lv.done {
  border-color: rgba(62, 207, 142, 0.34);
  background: linear-gradient(180deg, rgba(62, 207, 142, 0.13), rgba(62, 207, 142, 0.035));
}
.g-slitherlink .sl-lv-no { font-size: 13px; font-weight: 800; color: var(--accent); }
.g-slitherlink .sl-lv.done .sl-lv-no { color: var(--ok); }
.g-slitherlink .sl-lv-name { font-size: 11.5px; font-weight: 600; color: var(--text); }
.g-slitherlink .sl-lv-meta { font-size: 9.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.g-slitherlink .sl-lv-check { position: absolute; top: 5px; right: 7px; font-size: 11px; font-weight: 800; color: var(--ok); }
.g-slitherlink .sl-foot-hint { text-align: center; padding: 2px 4px 0; }

/* ------------------------------ 对局页 ------------------------------ */

.g-slitherlink .sl-board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
}
.g-slitherlink .sl-board {
  position: relative;
  flex: none;
  margin: auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.022);
  box-shadow: inset 0 0 0 1px var(--line), 0 24px 50px -30px rgba(0, 0, 0, 0.9);
  touch-action: none;
  transition: box-shadow 0.3s ease;
}
.g-slitherlink .sl-svg { display: block; width: 100%; height: 100%; overflow: visible; }

.g-slitherlink .sl-clue rect {
  fill: rgba(255, 255, 255, 0.045);
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
  transition: fill 0.12s ease, stroke 0.12s ease;
}
.g-slitherlink .sl-clue text {
  fill: #c8d4e8;
  font-weight: 700;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.g-slitherlink .sl-clue.sat rect { fill: rgba(62, 207, 142, 0.09); stroke: rgba(62, 207, 142, 0.35); }
.g-slitherlink .sl-clue.sat text { fill: #c9f0df; }
.g-slitherlink .sl-clue.over rect { fill: rgba(255, 92, 108, 0.24); stroke: #ff5c6c; }
.g-slitherlink .sl-clue.over text { fill: #ffb3bb; }
.g-slitherlink .sl-clue.under rect { fill: rgba(255, 176, 32, 0.13); stroke: rgba(255, 176, 32, 0.6); }
.g-slitherlink .sl-clue.under text { fill: #ffd28a; }

.g-slitherlink .sl-edge,
.g-slitherlink .sl-edge-glow {
  stroke: transparent;
  stroke-linecap: round;
}
.g-slitherlink .sl-edge-glow.on { stroke: var(--accent); opacity: 0.26; }
.g-slitherlink .sl-edge.on { stroke: var(--accent); }
.g-slitherlink .sl-edge.on.hint { stroke: #ffd166; }
.g-slitherlink .sl-edge-glow.on.hint { stroke: #ffd166; opacity: 0.38; }

.g-slitherlink .sl-dot {
  fill: rgba(154, 164, 184, 0.6);
  transition: fill 0.12s ease;
}
.g-slitherlink .sl-dot.endpt { fill: #ffb020; }
.g-slitherlink .sl-dot.branch { fill: #ff5c6c; }
.g-slitherlink .sl-dot.endpt.bad { fill: #ffb020; stroke: #fff3d6; stroke-width: 1.4; }
.g-slitherlink .sl-dot.branch.bad { fill: #ff5c6c; stroke: #ffd7dc; stroke-width: 1.4; }
.g-slitherlink .sl-clue.under rect { stroke-width: 1.6; }

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

/* 完成后的展示 */
.g-slitherlink.won-view .stats,
.g-slitherlink.won-view .sl-ctrl { display: none; }
.g-slitherlink.won-view .sl-board-wrap {
  justify-content: flex-start;
  padding-top: 4px;
}
.g-slitherlink.won-view .sl-board {
  margin: 0 auto;
  transform: scale(0.9);
  transform-origin: top center;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 42px color-mix(in srgb, var(--accent) 26%, transparent),
    0 24px 50px -30px rgba(0, 0, 0, 0.9);
}

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

.overlay.sl-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.sl-result-overlay .dialog { padding: 15px 16px; border-radius: 18px; }
.overlay.sl-result-overlay .dialog-actions { margin-top: 13px; }

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

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