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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0a1628;
  color: #fff;
  overflow: hidden;
}

/* ── 지도 ── */
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── 상태바 ── */
#status-bar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  z-index: 1000;
  white-space: nowrap;
}
#status-bar strong { font-weight: 700; color: #2563eb; }
.status-sep { color: #cbd5e1; font-size: 11px; }

#status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #888;
  transition: background 0.3s;
}
#status-dot.connected { background: #22c55e; animation: pulse-dot 2s infinite; }
#status-dot.error { background: #ef4444; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── 워터마크 ── */
#watermark {
  position: fixed;
  bottom: 16px;
  left: 16px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(30, 41, 59, 0.45);
  letter-spacing: 0.4px;
  z-index: 1000;
  pointer-events: none;
  user-select: none;
}

/* ── 저작권 ── */
#copyright {
  position: fixed;
  top: 12px;
  left: 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 33px;
  font-weight: 600;
  color: #475569;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  z-index: 1000;
  letter-spacing: 0.3px;
}

/* 클릭 유도 힌트 */
#click-hint {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(37, 99, 235, 0.93);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px 8px 12px;
  border-radius: 20px;
  box-shadow: 0 3px 14px rgba(37,99,235,0.35);
  z-index: 1000;
  white-space: nowrap;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#click-hint.fade-out {
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
  pointer-events: none;
}
.hint-hand { font-size: 16px; animation: hint-wave 1.2s ease-in-out infinite; }
@keyframes hint-wave {
  0%, 100% { transform: rotate(0deg); }
  25%       { transform: rotate(-20deg); }
  75%       { transform: rotate(20deg); }
}
.hint-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 20px; height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  margin-left: 2px;
  flex-shrink: 0;
}

/* ── 범례 ── */
#legend {
  position: fixed;
  bottom: 20px;
  right: 14px;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 11px;
  padding: 9px 11px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  z-index: 1000;
  min-width: 128px;
}

.legend-section { display: flex; flex-direction: column; gap: 5px; }

.legend-divider {
  height: 1px;
  background: rgba(0,0,0,0.08);
  margin: 6px 0;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #334155;
  font-weight: 500;
}

.legend-emoji { font-size: 14px; line-height: 1; width: 17px; text-align: center; }

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  margin-left: 4px;
}

.legend-text { line-height: 1; }

/* ── 선박 마커 ── */
.leaflet-ship-icon {
  background: none !important;
  border: none !important;
  overflow: visible !important;
}

.ship-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s;
  user-select: none;
  -webkit-user-select: none;
}
.ship-pin:hover { transform: scale(1.3); }

.ship-pin-emoji {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
  display: block;
}

/* 상태 점 */
.ship-pin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 2px;
  border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  display: block;
  flex-shrink: 0;
}

/* 선택 상태 */
.ship-pin.selected {
  transform: scale(1.25);
  animation: selected-bounce 0.4s ease forwards;
}
.ship-pin.selected .ship-pin-emoji {
  filter: drop-shadow(0 0 7px #3b82f6) drop-shadow(0 2px 4px rgba(0,0,0,0.45));
}
.ship-pin.selected .ship-pin-dot {
  box-shadow: 0 0 6px 2px rgba(59,130,246,0.6), 0 1px 3px rgba(0,0,0,0.35);
}

@keyframes selected-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.45); }
  100% { transform: scale(1.25); }
}

/* ── Leaflet 툴팁 커스텀 ── */
.ship-tooltip {
  background: rgba(15, 23, 42, 0.88);
  border: none;
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.ship-tooltip::before { display: none; }

/* Leaflet attribution */
.leaflet-control-attribution {
  background: rgba(255,255,255,0.8) !important;
  color: #64748b !important;
  font-size: 10px !important;
}

/* ── 하단 카드 ── */
#info-card {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 22, 40, 0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px 20px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
  z-index: 1000;
  transform: translateY(110%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 600px;
  margin: 0 auto;
}
#info-card.visible { transform: translateY(0); }

.card-handle {
  width: 36px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 12px auto 0;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
}
.ship-emoji { font-size: 36px; }
.card-title-wrap { flex: 1; }
.card-title-wrap h2 { font-size: 18px; font-weight: 700; }
#card-flag { font-size: 20px; }
.close-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin: 0 20px;
  border-radius: 12px;
  overflow: hidden;
}
.card-item {
  background: rgba(255,255,255,0.03);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-item .label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
.card-item .value { font-size: 15px; font-weight: 600; color: #e2e8f0; }

.detail-btn {
  display: block;
  width: calc(100% - 40px);
  margin: 16px 20px;
  padding: 14px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.detail-btn:active { opacity: 0.8; }

/* ── 상세 팝업 오버레이 ── */
#detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#detail-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── 상세 팝업 ── */
#detail-page {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: calc(100% - 32px);
  max-width: 480px;
  max-height: 82vh;
  background: #0f1f38;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  z-index: 1200;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
#detail-page.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.detail-header {
  position: sticky;
  top: 0;
  background: rgba(15, 31, 56, 0.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 16px 20px 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
}
.detail-header h1 { font-size: 18px; font-weight: 700; flex: 1; }
.back-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.detail-body { padding: 0 20px 28px; }

.detail-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 24px;
}
.detail-ship-icon { font-size: 64px; }
.detail-ship-meta { display: flex; flex-direction: column; gap: 8px; }
.detail-ship-meta span:first-child { font-size: 16px; color: #94a3b8; }
.detail-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.detail-section { margin-bottom: 24px; }
.detail-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: #60a5fa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 14px;
}
.detail-row span:first-child { color: #64748b; }
.detail-row span:last-child { font-weight: 500; color: #e2e8f0; }
