/* Custom Font */
@font-face {
  font-family: 'Whoami';
  src: url('Whoami-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Custom CSS Variable Design System */
:root {
  --bg-color: #0d0d10;
  --text-main: #f5f5f7;
  --text-muted: #9e9e9e;
  --accent-gold: #C9B8E7;
  --accent-gold-rgb: 201, 184, 231;
  --accent-gold-hover: #B3A0D4;
  --panel-bg: rgba(13, 13, 16, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow-color: rgba(0, 0, 0, 0.6);
  --card-bg: rgba(255, 255, 255, 0.03);
  --font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  --transition-speed: 0.4s;
  --ease-curve: cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-width: 380px;
}

body.light-theme {
  --bg-color: #f0ede9; /* 부드럽고 은은한 웜그레이 */
  --text-main: #3d322e; /* 차분하고 선명한 팥죽색/딥 로즈 브라운 */
  --text-muted: #786862; /* 은은한 팥죽색 기운이 도는 샌드 브라운 */
  --accent-gold: #C9B8E7; /* 기존 맑은 연보라색 */
  --accent-gold-rgb: 201, 184, 231;
  --accent-gold-hover: #bdaae0;
  
  /* 기존 연보라색(#C9B8E7)에 은은한 투명도(0.25)를 적용한 단색 배경 */
  --panel-bg: rgba(201, 184, 231, 0.25);
  --border-color: rgba(201, 184, 231, 0.45); /* 은은한 연보라빛 테두리 */
  --shadow-color: rgba(61, 50, 46, 0.05); /* 부드럽고 가벼운 그림자 */
  --card-bg: rgba(255, 255, 255, 0.55); /* 서랍 카드 배경용 반투명 펄 화이트 */
}

/* Reset and Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Main Container */
#app {
  display: flex;
  position: relative;
  width: 100%;
  height: 100%;
}

/* Glassmorphism Panel Utility */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px var(--shadow-color);
  border-radius: 16px;
  z-index: 1000;
  transition: all var(--transition-speed) var(--ease-curve);
}

/* 1. Leaflet Interactive Map Container */
#map-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#map {
  width: 100%;
  height: 100%;
  background-color: #0d0d10; /* Match dark theme */
}

/* Logo Toggle Button */
#sidebar-toggle {
  position: absolute;
  top: 56px;
  left: 56px;
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  cursor: pointer;
  z-index: 1100;
  padding: 0;
  box-shadow: none;
  transition: all 0.3s var(--ease-curve);
}

#sidebar-toggle svg, #sidebar-toggle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  color: var(--accent-gold);
  display: block;
}

body.light-theme #sidebar-toggle svg {
  color: #A48FCA; /* 통일된 연보라색 */
}

#sidebar-toggle:hover {
  transform: scale(1.08);
}

/* ATLAS Center Title */
#atlas-title-container {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
  pointer-events: auto;
  text-align: center;
  overflow: visible;
}

#atlas-title-container span {
  display: inline-block;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.4s, filter 0.4s;
  color: var(--accent-gold);
  filter: drop-shadow(0 2px 2px rgba(255, 255, 255, 0.15)) drop-shadow(0 6px 12px rgba(var(--accent-gold-rgb), 0.35)) drop-shadow(0 12px 24px rgba(0, 0, 0, 0.4));
  padding: 15px 0; /* 크롭 방지용 상하 패딩 */
  overflow: visible;
}

.atlas-main-title {
  font-family: 'Whoami', 'Outfit', sans-serif;
  font-size: 72px;
  line-height: 1.25; /* 넉넉한 높이 확보로 크롭 방지 */
  pointer-events: none;
  white-space: nowrap;
  overflow: visible;
}

.atlas-main-title span {
  margin: 0 3px; /* 자간을 총 10px 좁히기 위해 기존 좌우 8px에서 3px로 축소 */
}
.leaflet-container {
  background: #0d0e12 !important;
}

/* Custom Marker Styling */
.custom-map-marker {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-pulse {
  width: 16px;
  height: 16px;
  background-color: var(--accent-gold);
  border: 2px solid var(--text-main);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-gold);
  position: relative;
  transition: all 0.3s ease;
}

.marker-pulse::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: -2px;
  left: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  animation: pulse-ring 1.8s infinite cubic-bezier(0.215, 0.610, 0.355, 1);
  box-shadow: 0 0 10px var(--accent-gold);
}

.marker-pulse.active-marker {
  background-color: #fff;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 20px 4px var(--accent-gold);
  transform: scale(1.3);
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  80%, 100% { transform: scale(3.5); opacity: 0; }
}

/* Glow Path Style */
.glow-path {
  filter: drop-shadow(0 0 8px rgba(var(--accent-gold-rgb), 0.6));
  stroke-dasharray: 6, 6;
  animation: dash-move 30s linear infinite;
}

@keyframes dash-move {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Leaflet Zoom control styling */
.leaflet-top.leaflet-right {
  top: 24px !important;
  right: 24px !important;
}

.leaflet-right .leaflet-control {
  margin-right: 0 !important;
  margin-top: 0 !important;
}

.leaflet-bar {
  width: 30px !important;
  height: 57px !important; /* 5px 세로 길이 의도적 증가 */
  border: 1px solid rgba(201, 184, 231, 0.5) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
  background: var(--panel-bg) !important;
  border-radius: 15px !important; /* 토글 스위치와 동일한 r값 */
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.leaflet-bar a {
  width: 28px !important;
  height: 27.5px !important; /* 25px -> 27.5px 로 높임 */
  background: transparent !important;
  color: var(--text-main) !important;
  border-bottom: none !important;
  transition: background 0.3s;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  line-height: 1 !important;
}

.leaflet-bar a:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

.leaflet-control-zoom-out {
  padding-bottom: 3px !important; /* 마이너스 기호가 폰트 베이스라인으로 인해 처져 보이는 현상을 위로 보정 */
}

/* Hide leaflet attribution to keep UI super clean (Optional, legal to do with OSM if cited in code footer) */
.leaflet-control-attribution {
  background: rgba(0,0,0,0.5) !important;
  color: var(--text-muted) !important;
  font-size: 9px !important;
}

/* 2. Left Sidebar Styling */
#sidebar {
  position: absolute;
  top: 24px;
  left: 24px;
  bottom: 24px;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 32px;
  overflow-y: auto;
  transform: translateX(0);
  opacity: 1;
  transition: transform var(--transition-speed) var(--ease-curve),
              opacity var(--transition-speed) var(--ease-curve);
}

#sidebar.sidebar-hidden {
  transform: translateX(calc(-1 * var(--sidebar-width) - 48px));
  opacity: 0;
  pointer-events: none;
}

/* Timeline position adjusts when sidebar is hidden */
#timeline-container {
  transition: left var(--transition-speed) var(--ease-curve);
}

#timeline-container.sidebar-collapsed {
  left: 24px;
}

/* Scrollbar styling for sidebar */
#sidebar::-webkit-scrollbar {
  width: 4px;
}
#sidebar::-webkit-scrollbar-track {
  background: transparent;
}
#sidebar::-webkit-scrollbar-thumb {
  background: var(--accent-gold);
  border-radius: 4px;
}

.sidebar-drag-handle {
  display: none;
}

.sidebar-header {
  margin-top: 88px;
  margin-bottom: 40px;
}

.logo {
  display: flex;
  align-items: center;
}

.logo-image {
  height: 40px;
  width: auto;
  display: block;
  color: #ffffff; /* 다크모드 기본: 백색 로고 */
  transition: color var(--transition-speed) var(--ease-curve);
}

.easter-egg-dot {
  cursor: pointer;
  pointer-events: auto !important;
}

body.light-theme .logo-image {
  color: var(--text-main); /* 라이트모드: 시인성을 위해 어두운 텍스트 컬러 */
}

.brand-subtitle {
  font-size: 11px;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 16px;
  font-weight: 600;
}

body.light-theme .brand-subtitle {
  color: #A48FCA; /* 통일된 연보라색 */
}

.brand-intro {
  margin-bottom: 40px;
}

.intro-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 16px;
}

.intro-title .highlight {
  color: var(--accent-gold);
  position: relative;
}

.intro-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  font-weight: 300;
}

body.light-theme .intro-description {
  color: #495057; /* 선명한 다크그레이 */
  font-weight: 400; /* 웜그레이 배경에서의 가독성 조율 */
}

/* Stats Section */
.stats-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 35px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 0 20px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 56px;
  font-weight: 800;
  color: var(--accent-gold);
  font-family: 'Outfit', sans-serif;
  line-height: 1.1;
}

body.light-theme .stat-num {
  color: #A48FCA; /* 통일된 연보라색 */
}

body.light-theme .marker-pulse {
  border-color: #A48FCA; /* 마커 테두리도 동일하게 통일 */
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Project List Section */
.project-list-section {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-gold);
  margin-bottom: 16px;
  font-weight: 600;
}

body.light-theme .section-title {
  color: #A48FCA; /* 통일된 연보라색 */
}

.project-list-wrapper {
  overflow-y: auto;
  overflow-x: hidden; /* 가로 스크롤 방지 */
  flex-grow: 1;
  padding-right: 6px; /* translateX(4px) 호버 이동 시 테두리 잘림을 방지하기 위한 안전 여백 확보 */
}

.sidebar-project-item {
  padding: 12px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid transparent;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s var(--ease-curve);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.sidebar-project-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(var(--accent-gold-rgb), 0.2);
}

.sidebar-project-item.active-item {
  background: rgba(var(--accent-gold-rgb), 0.1);
  border: 1px solid var(--accent-gold);
}

.sb-proj-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sb-proj-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.sb-proj-year-cat {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.sb-proj-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(var(--accent-gold-rgb), 0.15);
  color: var(--accent-gold);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.sidebar-footer {
  margin-top: 30px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.contact-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.4;
}

.contact-info a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s var(--ease-curve);
}

.contact-info a:hover {
  color: var(--accent-gold);
}

.copyright {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.2);
}

body.light-theme .copyright {
  color: rgba(44, 39, 36, 0.35);
}

/* 3. Bottom Timeline Container */
#timeline-container {
  position: absolute;
  bottom: 24px;
  left: 428px; /* Offset sidebar */
  right: 24px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.timeline-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.timeline-nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-gold);
}

.timeline-years {
  display: flex;
  justify-content: space-around;
  flex-grow: 1;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

/* Horizontal connecting timeline line in background */
.timeline-years::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15) 20%, rgba(255,255,255,0.15) 80%, transparent);
  z-index: 1;
  pointer-events: none;
}

.year-btn {
  background: #0d0f14;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  z-index: 2;
  transition: all 0.3s var(--ease-curve);
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.year-btn:hover {
  color: var(--text-main);
  border-color: rgba(var(--accent-gold-rgb), 0.5);
  transform: translateY(-2px);
}

.year-btn.active {
  background: var(--accent-gold);
  color: #0d0d10;
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(var(--accent-gold-rgb), 0.5);
}

body.light-theme .year-btn {
  background: rgba(255, 255, 255, 0.7);
  color: #A48FCA; /* 통일된 연보라색 */
  box-shadow: 0 4px 10px rgba(61, 50, 46, 0.06);
}

body.light-theme .year-btn:hover {
  color: var(--text-main);
  background: #ffffff;
}

body.light-theme .year-btn.active {
  background: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(var(--accent-gold-rgb), 0.45);
}

/* Custom Leaflet Popup and capsule-shaped project card */
.custom-leaflet-popup .leaflet-popup-content-wrapper {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible !important;
}

.custom-leaflet-popup .leaflet-popup-content {
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  overflow: visible !important;
}

.custom-leaflet-popup .leaflet-popup-tip-container {
  display: none !important;
}

.custom-leaflet-popup .leaflet-popup-close-button {
  display: none !important;
}

/* Arch-dome shaped capsule project card */
.custom-project-card {
  width: 240px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 32px var(--shadow-color);
  border-radius: 120px 120px 24px 24px;
  padding: 12px;
  text-align: center;
  color: var(--text-main);
  font-family: var(--font-family);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.card-image-wrapper {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  margin: 8px auto 16px auto;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  background-color: #161a22;
  position: relative;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-curve);
}

.custom-project-card:hover .card-image-wrapper img {
  transform: scale(1.05);
}

.card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #101217 0%, #1e222a 100%);
  color: var(--accent-gold);
}

body.light-theme .card-image-placeholder {
  background: linear-gradient(135deg, #e0dcd8 0%, #edeae6 100%);
}

.card-image-placeholder .placeholder-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(var(--accent-gold-rgb), 0.4));
}

.card-category {
  font-size: 10px;
  color: var(--accent-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.card-title {
  margin-bottom: 6px;
  line-height: 1.3;
  color: var(--text-main);
  word-break: keep-all;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.card-title .title-ko {
  font-size: 16px;
  font-weight: 700;
}

.card-title .title-en {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-details {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.card-action-btn {
  width: 100%;
  padding: 10px 0;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  border: none;
  background: var(--accent-gold);
  color: #0d0d10;
  box-shadow: 0 4px 12px rgba(var(--accent-gold-rgb), 0.3);
  transition: all 0.3s var(--ease-curve);
}

.card-action-btn:hover {
  background: var(--accent-gold-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(var(--accent-gold-rgb), 0.4);
}

body.light-theme .card-action-btn {
  color: #ffffff;
}

/* 5. Intro Animation Overlay */
#intro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #090a0f;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s;
  pointer-events: none;
}

#intro-overlay.overlay-hidden {
  opacity: 0;
  visibility: hidden;
}

.overlay-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.loader-circle-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 39px; /* 심볼과 ATLAS 글귀 사이의 간격을 15px 늘림 (24px -> 39px) */
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-symbol-spin {
  width: 80px;
  height: 80px;
  color: var(--accent-gold);
  transform: rotate(180deg); /* 초기 상태를 느낌표 ! 모양으로 180도 뒤집어 설정 */
  animation: symbol-rotate-once 3.2s cubic-bezier(0.25, 1, 0.5, 1) forwards; /* !에서 시작해 1.5바퀴(540도)를 돌며 i로 정차 */
  display: block;
  transform-origin: center;
}

@keyframes symbol-rotate-once {
  from { transform: rotate(180deg); } /* 느낌표 ! 에서 출발 */
  to { transform: rotate(720deg); } /* 소문자 i 모양으로 정차 */
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-logo-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Whoami', 'Outfit', sans-serif;
  color: var(--accent-gold);
  text-shadow: 0 0 15px rgba(var(--accent-gold-rgb), 0.6);
  animation: intro-logo-scale 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: none;
  text-align: center;
  line-height: 1.15;
  margin-bottom: 4px; /* ATLAS와 상태 메시지의 간격을 좁히기 위해 줄임 */
}

.loader-brand-name {
  font-size: 56px;
}

.loader-atlas-name {
  font-size: 112px; /* 2배 더 크게 (기존 56px에서 112px로) */
  margin-top: 0;
  letter-spacing: 10px; /* 자간 10px 더해줌 */
  text-indent: 10px; /* 자간으로 인한 미세한 좌측 쏠림 정렬 보정 */
}

@keyframes intro-logo-scale {
  0% {
    opacity: 0;
    transform: scale(0.65) translateY(12px);
    filter: blur(5px);
  }
  25% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.loader-progress {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--accent-gold);
  margin-top: 4px; /* ATLAS와 상태 메시지의 간격을 좁힘 */
  text-transform: uppercase;
  
  /* 타이포 타이핑 효과 */
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  border-right: 2px solid var(--accent-gold);
  width: 0;
  animation: 
    typing-effect 1.8s steps(16) 0.6s forwards, /* 16글자(자간 공백 포함) 타이핑 애니메이션 (0.6초 딜레이 후 재생) */
    caret-blink 0.75s step-end infinite;
}

@keyframes typing-effect {
  from { width: 0; }
  to { width: 13.6em; } /* 3개 온점에 맞춘 한글 텍스트 너비 최적화 */
}

@keyframes caret-blink {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-gold); }
}

/* Responsive Styles */
@media (max-width: 1024px) {
  #sidebar {
    width: 320px;
    padding: 24px;
  }
  
  #timeline-container {
    left: 368px;
  }
}

@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }
  
  #sidebar-toggle {
    display: none !important;
  }

  #sidebar.sidebar-hidden {
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  #sidebar::before {
    content: "" !important;
    display: block !important;
    height: 20px !important; /* 상단 얼라인과 첫 번째 프로젝트 카드 사이의 여백 20px 고정 가드 */
    width: 100% !important;
    flex-shrink: 0 !important;
  }

  #sidebar {
    position: absolute !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 26vh !important; /* 프로젝트 카드가 2개 노출되는 기준에 맞춘 콤팩트한 26% 높이 고정 */
    margin-top: 0 !important;
    z-index: 1000;
    border-radius: 24px 24px 0 0 !important; /* 하단 밀착을 위해 아래쪽 r값 제거 */
    border: 1px solid var(--border-color);
    border-bottom: none !important; /* 바닥 밀착을 위해 하단 테두리 제거 */
    padding: 0 14px 76px 20px !important; /* 상단은 가상요소(20px)로 대체, 좌측 20px, 우측 14px(스크롤바 보정), 하단 76px(타임라인과의 안전 간격) */
    display: block !important;
    overflow-y: auto !important;
    transition: height 0.4s var(--ease-curve);
  }

  #sidebar.expanded {
    height: 26vh !important; /* 26% 높이로 고정 */
  }


  #sidebar::-webkit-scrollbar {
    width: 6px !important;
    background: transparent !important;
  }

  #sidebar::-webkit-scrollbar-track {
    background: transparent !important;
    margin-top: 16px !important; /* 스크롤바가 상단 라운드 영역 바깥으로 튀어나오지 않도록 보정 */
    margin-bottom: 16px !important;
  }

  #sidebar::-webkit-scrollbar-thumb {
    background: var(--accent-gold) !important; /* 선명한 연보라색 고정 */
    border-radius: 3px !important;
  }
  
  #map-container {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
  }

  .sidebar-header {
    margin-top: 4px !important; /* 10px -> 4px 로 축소 */
    margin-bottom: 8px !important; /* 12px -> 8px 로 축소 */
  }

  .logo-image {
    width: clamp(150px, 24vh, 180px) !important; /* 기존 대비 2배 확대 */
  }

  .brand-subtitle {
    display: none !important;
  }

  .brand-intro {
    display: none !important;
  }

  .stats-container {
    margin-bottom: 4px !important; /* 8px -> 4px 로 축소 */
    padding: 0 0 2px 0 !important;
    gap: 8px !important;
  }

  .stat-num {
    font-size: clamp(36px, 6.4vh, 46px) !important; /* 기존 대비 2배 확대 */
  }

  .stat-label {
    font-size: clamp(7px, 1vh, 8.5px) !important; /* 라벨 폰트 크기 추가 축소 */
    letter-spacing: -0.1px !important;
    white-space: nowrap !important;
  }

  .project-list-section {
    display: block !important;
    flex-grow: 0 !important;
    min-height: auto !important;
  }

  .project-list-wrapper {
    display: block !important;
    overflow-y: visible !important;
    flex-grow: 0 !important;
    padding-right: 0 !important; /* 데스크톱에서 설정한 우측 6px 안전 마진 제거로 모바일 좌우 정렬 보정 */
  }

  .sidebar-project-item {
    padding: 8px 10px !important; /* 2개 카드 뷰 밀착을 위해 상하 패딩 8px로 축소 */
    margin-bottom: 6px !important; /* 카드 간 마진 6px로 축소 */
  }
  
  #timeline-container {
    position: fixed;
    bottom: 0;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 72px;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
    z-index: 1001;
    padding: 0 16px;
  }

  #prev-year-btn,
  #next-year-btn {
    display: none;
  }

  .timeline-years {
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 0;
  }

  .timeline-years::before {
    display: none !important;
  }

  .year-btn {
    padding: 8px 0;
    font-size: 11px;
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;
    text-align: center;
  }

  .loader-atlas-name {
    font-size: 48px !important;
    letter-spacing: 6px !important;
    text-indent: 6px !important;
  }

  .leaflet-control-attribution {
    display: none !important;
  }

  /* 캡슐배너 (Leaflet Popup Card) 모바일 스케일 다운 */
  .custom-project-card {
    width: 200px !important;
    border-radius: 100px 100px 20px 20px !important;
    padding: 10px !important;
  }
  .card-image-wrapper {
    width: 140px !important;
    height: 140px !important;
    margin: 4px auto 10px auto !important;
  }
  .card-details {
    margin-bottom: 12px !important;
  }
  .card-title .title-ko {
    font-size: 14px !important;
  }
  .card-title .title-en {
    font-size: 10px !important;
  }
  .card-action-btn {
    padding: 8px 0 !important;
    font-size: 11px !important;
  }
  
  /* Drawer styles removed */
  
  /* 세로 높이가 극단적으로 짧은 기기(예: iPhone SE)를 위한 추가 초슬림 반응형 오버라이드 */
  @media (max-height: 680px) {
    #sidebar::before {
      height: 12px !important; /* 상단 스크롤 가드 축소 */
    }
    .sidebar-header {
      margin-top: 2px !important;
      margin-bottom: 6px !important;
    }
    .logo-image {
      width: 140px !important; /* 기존 대비 2배 확대 */
    }
    .stats-container {
      margin-bottom: 2px !important;
      padding: 0 0 2px 0 !important;
      gap: 6px !important;
    }
    .stat-num {
      font-size: 32px !important; /* 기존 대비 2배 확대 */
    }
    .stat-label {
      font-size: 8px !important; /* 통계 라벨 축소 */
    }
  }
}

/* 6. Theme Toggle Widget */
#theme-toggle {
  position: absolute;
  top: 88px;
  right: 24px;
  width: 30px;
  height: 52px;
  border-radius: 15px;
  border: 1px solid rgba(201, 184, 231, 0.5); /* 다크모드 기본 테두리 */
  background: rgba(13, 13, 16, 0.95);
  cursor: pointer;
  z-index: 1100;
  padding: 2px;
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: background 0.3s var(--ease-curve);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

#theme-toggle:hover {
  transform: scale(1.02);
}

.toggle-slider {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  transform: translateY(0);
}

/* Light Theme Switch Toggle State */
body.light-theme #theme-toggle {
  background: var(--accent-gold);
  border: none;
}

body.light-theme .toggle-slider {
  transform: translateY(22px);
}

/* Light theme adjustments for specific elements */
body.light-theme .leaflet-container {
  background: #edeae6 !important;
}

body.light-theme .leaflet-bar {
  background: rgba(255, 255, 255, 0.45) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none !important;
  border-radius: 15px !important;
  overflow: hidden !important;
  box-shadow: 0 4px 12px var(--shadow-color) !important;
}

body.light-theme .leaflet-bar a {
  color: #2c2724 !important;
  border-bottom: none !important;
}

body.light-theme .year-btn {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #807670;
}

body.light-theme .year-btn:hover {
  color: #2c2724;
  border-color: var(--accent-gold);
}

body.light-theme .year-btn.active {
  background: var(--accent-gold);
  color: #ffffff;
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(var(--accent-gold-rgb), 0.4);
}

/* Light theme defaults for ATLAS title spans */
body.light-theme #atlas-title-container span {
  color: #4a4542; /* 다크 그레이 */
  filter: drop-shadow(0 2px 2px rgba(255, 255, 255, 0.4)) drop-shadow(0 6px 12px rgba(212, 191, 232, 0.6)) drop-shadow(0 12px 24px rgba(44, 39, 36, 0.15)); /* 그림자 컬러: 연보라색 (#D4BFE8) 메인 */
}

