/* ============================================================
   冒險地圖 — Worksheet Studio 風格 (Mario-style)
   採用 SVG 蜿蜒路徑 + 5 個關卡節點 + 吉祥物站在當前關卡
   ============================================================ */
#screen-map {
  background:
    radial-gradient(ellipse at 50% 100%, #cfe9d7 0%, transparent 60%),
    radial-gradient(ellipse at 50% 0%, #d6ecff 0%, transparent 50%),
    linear-gradient(180deg, #fff8e7 0%, #fffaf0 100%);
  font-family: 'Nunito', 'Noto Sans TC', sans-serif;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
}

#screen-map::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(26, 46, 74, 0.04) 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, rgba(26, 46, 74, 0.04) 1px, transparent 1.5px);
  background-size: 50px 50px, 70px 70px;
  pointer-events: none;
}

.ws-map {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.ws-map-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 3px solid #1a2e4a;
  box-shadow: 0 4px 0 rgba(26, 46, 74, 0.08);
  z-index: 5;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ws-map-back {
  border: 2.5px solid #1a2e4a;
  background: #fff;
  color: #1a2e4a;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1a2e4a;
  transition: transform 0.1s, box-shadow 0.1s;
  white-space: nowrap;
}
.ws-map-back:hover { background: #ffd166; }
.ws-map-back:active { transform: translate(2px, 2px); box-shadow: 0 0 0 #1a2e4a; }

.ws-map-title-block {
  flex: 1;
  min-width: 0;
}
.ws-map-title {
  font-family: 'Nunito', 'Noto Sans TC', sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  color: #1a2e4a;
  letter-spacing: 1.5px;
  background: none;
  -webkit-text-fill-color: #1a2e4a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-map-sub {
  font-size: 0.7rem;
  font-weight: 700;
  color: #1a2e4a;
  opacity: 0.55;
  letter-spacing: 0.8px;
  margin: 0;
}

.ws-map-progress {
  font-weight: 900;
  font-size: 0.9rem;
  color: #1a2e4a;
  background: #ffd166;
  border: 2.5px solid #1a2e4a;
  border-radius: 8px;
  padding: 5px 12px;
  box-shadow: 2px 2px 0 #1a2e4a;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 模式切換 tabs */
.ws-map-mode-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 18px 0;
  flex-shrink: 0;
}

.ws-map-mode-tab {
  flex: 1;
  padding: 8px 12px;
  border: 2.5px solid #1a2e4a;
  border-radius: 10px 10px 0 0;
  background: #fff;
  color: #1a2e4a;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1a2e4a;
  transition: all 0.15s;
}
.ws-map-mode-tab:hover { background: #fff8e0; }
.ws-map-mode-tab.active {
  background: #1a2e4a;
  color: #ffd166;
  transform: translateY(2px);
  box-shadow: 0 0 0 #1a2e4a;
}

.ws-map-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
  margin: 12px;
  border: 3px dashed rgba(26, 46, 74, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
  min-height: 360px;
}

.ws-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ws-map-path {
  animation: ws-path-drift 30s linear infinite;
}
@keyframes ws-path-drift {
  to { stroke-dashoffset: -40; }
}

.ws-map-nodes {
  position: absolute;
  inset: 0;
}

.ws-map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3.5px solid #1a2e4a;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-family: 'Nunito', 'Noto Sans TC', sans-serif;
  box-shadow: 3px 3px 0 #1a2e4a;
  transition: transform 0.15s ease, box-shadow 0.15s;
  padding: 0;
}

.ws-map-node:hover:not(.locked) {
  transform: translate(-50%, -52%) scale(1.08);
  box-shadow: 4px 4px 0 #1a2e4a;
}
.ws-map-node:active:not(.locked) {
  transform: translate(-48%, -48%) scale(1);
  box-shadow: 1px 1px 0 #1a2e4a;
}

.ws-map-node-num {
  font-size: 1.4rem;
  font-weight: 900;
  color: #1a2e4a;
  line-height: 1;
}

.ws-map-node-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.ws-map-node-label {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 2px solid #1a2e4a;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #1a2e4a;
  white-space: nowrap;
  box-shadow: 1px 1px 0 #1a2e4a;
}

.ws-map-node.accent-coral { background: #fff0ee; }
.ws-map-node.accent-yellow { background: #fff8e0; }
.ws-map-node.accent-mint { background: #e6faf3; }

.ws-map-node.cleared {
  background: #ffd166;
  border-color: #1a2e4a;
}

.ws-map-node.boss {
  border-color: #ff6b5b;
  border-width: 4px;
}
.ws-map-node.boss.cleared {
  background: linear-gradient(135deg, #ff6b5b, #ff9100);
}
.ws-map-node.boss.cleared .ws-map-node-icon { filter: drop-shadow(0 1px 0 #1a2e4a); }

/* 星星徽章 */
.ws-map-node-stars {
  position: absolute;
  top: -10px;
  right: -14px;
  display: flex;
  gap: 1px;
  background: #1a2e4a;
  padding: 2px 5px;
  border-radius: 10px;
  border: 2px solid #fff;
  box-shadow: 1px 1px 0 #1a2e4a;
  font-size: 0.62rem;
  font-weight: 900;
  color: #ffd166;
  letter-spacing: 0;
}

.ws-map-node-stamp {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  background: #ccc;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 1px 1px 0 #1a2e4a;
}

.ws-map-node.locked {
  background: #ececec;
  cursor: not-allowed;
  filter: grayscale(0.7) opacity(0.7);
}
.ws-map-node.locked .ws-map-node-num { color: #888; }

.ws-map-node.current:not(.cleared):not(.locked) {
  background: #fff8e0;
  border-color: #1a2e4a;
  z-index: 3;
}
.ws-map-node-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid #ff6b5b;
  animation: ws-node-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ws-node-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.25); opacity: 0; }
}

/* 站在當前關卡上的吉祥物 */
.ws-map-hero {
  position: absolute;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -110%);
  background-image: url("../assets/mascots/02_rabbit.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 3px 0 rgba(26, 46, 74, 0.25));
  animation: ws-hero-bob 1.6s ease-in-out infinite;
}
@keyframes ws-hero-bob {
  0%, 100% { transform: translate(-50%, -110%); }
  50% { transform: translate(-50%, -118%); }
}

/* 無盡模式按鈕 */
.ws-map-endless {
  padding: 10px 18px 18px;
  flex-shrink: 0;
}

.ws-map-endless-btn {
  width: 100%;
  padding: 12px;
  border: 2.5px solid #1a2e4a;
  border-radius: 10px;
  background: #fff;
  color: #1a2e4a;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 3px 3px 0 #1a2e4a;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ws-map-endless-btn:not(.locked):hover {
  background: #ff9100;
  color: #fff;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #1a2e4a;
}
.ws-map-endless-btn:not(.locked):active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #1a2e4a;
}
.ws-map-endless-btn.locked {
  background: #ececec;
  color: #888;
  cursor: not-allowed;
  filter: grayscale(0.6);
}
.ws-map-endless-btn:not(.locked) {
  background: #ff6b5b;
  color: #fff;
}
