/* smartflyto/study - 역사 지도 탐험 스타일시트 (v5) */
:root {
  --bg-primary: #090d16;
  --bg-surface: rgba(15, 23, 42, 0.88);
  --bg-surface-elevated: rgba(30, 41, 59, 0.94);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.24);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --color-goguryeo: #ef4444;
  --color-baekje: #eab308;
  --color-silla: #3b82f6;
  --color-gaya: #10b981;
  --color-accent: #38bdf8;
  --font-family: -apple-system, BlinkMacSystemFont, "Pretendard Variable", Pretendard, Roboto, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, [contenteditable="true"], .selectable, .selectable-text {
  -webkit-user-select: text;
  user-select: text;
}

/* 지도 영역 */
#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  background-color: #0b0f19;
}

/* 상단 플로팅 헤더 */
.top-nav {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  max-width: 600px;
  margin: 0 auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.top-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.brand-text h1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.brand-text p {
  font-size: 10px;
  color: var(--text-muted);
}

.mode-toggle-group {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mode-btn.active {
  background: #38bdf8;
  color: #041226;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

/* 타임라인 시대 선택기 */
.timeline-bar {
  pointer-events: auto;
  display: flex;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 4px;
  gap: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.period-btn {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 4px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s ease;
}

.period-btn .century {
  font-size: 13px;
  font-weight: 800;
  color: #e2e8f0;
}

.period-btn .desc {
  font-size: 10px;
  opacity: 0.85;
}

.period-btn.active {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.period-btn.active[data-period="c4"] .century { color: #facc15; }
.period-btn.active[data-period="c5"] .century { color: #f87171; }
.period-btn.active[data-period="c6"] .century { color: #60a5fa; }

/* 지도 위 범례 (Legend) */
.map-legend {
  position: absolute;
  top: 124px;
  left: 10px;
  z-index: 900;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
}

.legend-color {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}
.legend-color.goguryeo { background-color: var(--color-goguryeo); }
.legend-color.baekje { background-color: var(--color-baekje); }
.legend-color.silla { background-color: var(--color-silla); }
.legend-color.gaya { background-color: var(--color-gaya); }
.legend-line {
  width: 14px;
  height: 3px;
  background: linear-gradient(90deg, #facc15, #ef4444, #3b82f6);
  border-radius: 2px;
}

/* 하단 바텀시트 컨테이너 */
.bottom-panel-container {
  position: absolute;
  bottom: 12px;
  left: 10px;
  right: 10px;
  max-width: 600px;
  margin: 0 auto;
  z-index: 1000;
  pointer-events: none;
}

.info-card {
  pointer-events: auto;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 13px 15px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  max-height: 38vh;
  overflow-y: auto;
}

.info-card.hidden {
  display: none;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.badge-nation {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.badge-category {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.collapse-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-body {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #cbd5e1;
}

.card-body.collapsed {
  display: none;
}

.route-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.route-chip {
  font-size: 11px;
  font-weight: 700;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.9);
  border-left: 3px solid #38bdf8;
  padding: 3px 8px;
  border-radius: 4px;
}

.exam-tip-box {
  margin-top: 10px;
  padding: 9px 11px;
  background: rgba(56, 189, 248, 0.09);
  border-left: 3px solid #38bdf8;
  border-radius: 0 8px 8px 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #bae6fd;
}

.exam-tip-box strong {
  color: #38bdf8;
  display: block;
  margin-bottom: 3px;
  font-weight: 700;
}

/* 퀴즈 전용 플로팅 패널 */
.quiz-panel {
  pointer-events: auto;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
}

.quiz-panel.hidden {
  display: none;
}

.quiz-badge {
  background: #0284c7;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  display: inline-block;
  margin-bottom: 6px;
}

.quiz-question {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
  margin-bottom: 6px;
}

.quiz-hint {
  font-size: 11.5px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.quiz-feedback {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  display: none;
}

.quiz-feedback.correct {
  display: block;
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.quiz-feedback.wrong {
  display: block;
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.quiz-next-btn {
  margin-top: 8px;
  width: 100%;
  padding: 9px;
  background: #38bdf8;
  color: #041226;
  border: none;
  border-radius: 10px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

/* 커스텀 역사 거점 마커 */
.marker-pin-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.marker-pin {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #0f172a;
  border: 2.5px solid #facc15;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.2s ease;
}

.marker-pin-wrap:hover .marker-pin {
  transform: scale(1.2);
  border-color: #38bdf8;
}

.marker-label {
  margin-top: 3px;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  gap: 4px;
}

.marker-year-tag {
  color: #facc15;
  font-weight: 800;
  font-size: 10px;
}

.marker-name-text {
  color: #ffffff;
}

/* ── MAP ATTRIBUTION COLLAPSIBLE MINI PILL (스마트플라이토 메인 표준 일체화) ── */
.map-attribution-pill {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 1005;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 4px;
}

.attr-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: rgba(203, 213, 225, 0.85);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.attr-toggle-btn:hover {
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  border-color: rgba(56, 189, 248, 0.45);
}

.attr-icon {
  font-size: 11px;
  color: #38bdf8;
}

.attr-detail-box {
  max-width: 320px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #cbd5e1;
  font-size: 10.5px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  text-align: right;
}

.attr-detail-box a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}

.attr-detail-box a:hover {
  text-decoration: underline;
}

/* MapLibre 기본 중복 attribution 숨김 (우측 하단 미니 알약으로 일원화) */
.maplibregl-ctrl-attrib,
.leaflet-control-attribution {
  display: none !important;
}
