﻿/* ===================== base ===================== */
:root {
  --bg:           #e8ecf5;
  --card:         #ffffff;
  --accent:       #d7263d;
  --accent-soft:  #f15a6c;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  background: #0b1020; /* 全局深色背景 */
  color: #e5e7eb;
  margin: 0;
}

/* ===================== layout ===================== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100vh;
  padding: 6px;
  gap: 5px;
}

.github-link {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 28, 58, 0.82);
  border: 1px solid rgba(155, 192, 255, 0.42);
  color: #ffffff;
  z-index: 20;
  text-decoration: none;
  backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent;
}

.github-link svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.github-link:hover {
  background: rgba(20, 40, 84, 0.92);
  border-color: rgba(155, 192, 255, 0.72);
}

.github-link:focus-visible {
  outline: 2px solid #9bc0ff;
  outline-offset: 2px;
}

/* ===================== board wrapper ===================== */
.board-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: transparent; /* 统一背景，不区分地图区域 */
  box-shadow: none;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 4px 10px rgba(28, 47, 84, 0.08));
}


/* ===================== SVG map elements (background unified) ===================== */
.dock-bg { fill: none; }
.dock-frame-outline {
  fill: none;
  stroke: rgba(150, 180, 225, 0.35);
  stroke-width: 1;
  stroke-dasharray: 5 5;
  pointer-events: none;
  transition: opacity 600ms ease;
}

.dock-frame-outline.dock-frame--hidden {
  opacity: 0;
}

.sea-dash-line {
  fill: none;
  stroke: rgba(86, 110, 146, 0.95);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-dasharray: 5 7;
  pointer-events: none;
}
.target-slot {
  fill: rgba(175, 190, 218, 0.28);
  stroke: rgba(160, 178, 212, 0.55);
  stroke-width: 0.8;
}

.target-slot.snap-ready {
  stroke: rgba(154, 226, 255, 0.96);
  stroke-width: 1.8;
  filter: drop-shadow(0 0 3px rgba(110, 210, 255, 0.95)) drop-shadow(0 0 8px rgba(80, 184, 255, 0.8));
}

.geo-label-layer {
  pointer-events: none;
}

.geo-context-label {
  fill: rgba(188, 203, 236, 0.18);
  font-size: 10px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  letter-spacing: 0.5px;
  user-select: none;
}

.geo-context-label--country {
  fill: rgba(186, 201, 232, 0.2);
}

.geo-context-label--sea,
.geo-context-label--bay {
  fill: rgba(164, 196, 244, 0.16);
}

#labelLayer {
  pointer-events: auto;
}

/* ===================== pieces ===================== */
.piece {
  cursor: grab;
  will-change: transform;
  touch-action: none;
}

.piece-shadow {
  opacity: 0.75;
}
.piece.dragging .piece-shadow {
  opacity: 0.86;
}

.piece-side {
  opacity: 0.9;
}

.piece-top {
  filter: saturate(1.05);
}

/* Only animate the return-to-dock bounce */
.piece.returning {
  transition: transform 340ms cubic-bezier(0.18, 0.85, 0.22, 1);
}

.piece.dragging {
  cursor: grabbing;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.24));
}

.piece.locked {
  cursor: default;
}

.piece-label {
  fill: rgba(15, 25, 55, 0.82);
  font-size: 10px;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

.piece-label--inner {
  fill: rgba(17, 28, 56, 0.9);
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 1.1;
}

.piece-callout-line {
  stroke: rgba(48, 74, 122, 0.78);
  stroke-width: 1;
  pointer-events: none;
}

.piece-callout-bg {
  display: none;
  pointer-events: none;
}

.piece-label--callout {
  fill: rgba(22, 40, 78, 0.95);
  font-size: 10px;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 1;
}

.piece-label {
  pointer-events: auto;
  cursor: grab;
}

.piece-label:active {
  cursor: grabbing;
}

/* ===================== responsive ===================== */
@media (max-width: 520px) {
  .app { padding: 4px; gap: 3px; }
  .github-link {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
  }
  .github-link svg {
    width: 20px;
    height: 20px;
  }
  .geo-context-label {
    font-size: 8px;
    letter-spacing: 0.2px;
  }
}
