/* ==========================================================
   호치리치 - 슈퍼마리오 메이커 풍 맵 에디터 스타일
   ========================================================== */

/* hidden 속성이 최우선으로 적용되도록 보장 (인라인/CSS 충돌 방지) */
#editorOverlay[hidden],
#editorSettingsModal[hidden],
#editorLoadModal[hidden],
#editorPlayReturnBar[hidden],
#editorPlayReturnBtn[hidden],
#courseWorldModal[hidden],
#workerConfigModal[hidden] {
  display: none !important;
}

#editorOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 40;
  box-sizing: border-box;
  font-family: 'Jua', 'Apple SD Gothic Neo', sans-serif;
}

#editorOverlay * {
  pointer-events: auto;
  user-select: none;
}

/* 상단 에디터 바 */
.editorTopBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  color: #fff;
}

.editorBrandRow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editorLogo {
  font-size: 1.3rem;
  font-weight: bold;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.editorCourseNameInput {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 5px 10px;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  width: 140px;
  transition: all 0.2s;
}

.editorCourseNameInput:focus {
  background: rgba(255, 255, 255, 0.25);
  border-color: #38bdf8;
  outline: none;
  width: 180px;
}

.editorTopCenter {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editorQuickRuleGroup {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 10px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.editorQuickRuleItem {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.editorQuickRuleLabel {
  font-weight: bold;
  color: #f1f5f9;
  font-size: 0.85rem;
  white-space: nowrap;
}

.editorQuickSelect,
.editorQuickNumber {
  background: rgba(15, 23, 42, 0.8);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.editorQuickSelect:focus,
.editorQuickNumber:focus {
  border-color: #38bdf8;
  background: rgba(15, 23, 42, 0.95);
}

.editorQuickNumber {
  width: 48px;
  text-align: center;
}

.editorQuickUnit {
  color: #94a3b8;
  font-size: 0.8rem;
}

.editorToolGroup {
  display: flex;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  gap: 2px;
}

.editorToolBtn {
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 6px 12px;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.editorToolBtn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.editorToolBtn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.editorTopRight {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editorBtn {
  background: rgba(51, 65, 85, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.editorBtn:hover {
  background: rgba(71, 85, 105, 0.95);
  transform: translateY(-1px);
}

.editorBtn.playBtn {
  background: linear-gradient(135deg, #10b981, #059669);
  font-weight: bold;
  font-size: 1.0rem;
  padding: 6px 18px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.editorBtn.playBtn:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

.editorBtn.dangerBtn:hover {
  background: #dc2626;
  border-color: #ef4444;
}

/* 좌측 높이/레이어 조절 바 */
.editorSideBar {
  position: absolute;
  left: 16px;
  top: 70px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(10px);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  color: #fff;
}

.editorLayerTitle {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
}

.editorLayerValue {
  font-size: 1.3rem;
  font-weight: bold;
  color: #38bdf8;
  text-align: center;
}

.editorLayerBtn {
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 8px;
  padding: 6px;
  font-size: 1.0rem;
  cursor: pointer;
  transition: background 0.15s;
}

.editorLayerBtn:hover {
  background: rgba(71, 85, 105, 1);
}

.editorViewAngleBtn {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 0.75rem;
  cursor: pointer;
  margin-top: 6px;
}

.editorViewAngleBtn:hover {
  background: #3b82f6;
  color: #fff;
}

.editorYModeBtn {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 0.74rem;
  cursor: pointer;
  margin-top: 6px;
  font-family: inherit;
  font-weight: bold;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.editorYModeBtn:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
}

.editorYModeBtn.surface {
  background: linear-gradient(135deg, #10b981, #047857);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.editorYModeBadge {
  font-size: 0.68rem;
  color: #cbd5e1;
  text-align: center;
  line-height: 1.2;
}

/* 하단 팔레트 (슈마메 아이템 선택기) */
.editorBottomPalette {
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border-top: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.paletteTabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.paletteTabBtn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.95rem;
  font-family: inherit;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.paletteTabBtn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.paletteTabBtn.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  font-weight: bold;
}

.paletteGrid {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.paletteItem {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #fff;
}

.paletteItem:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: #38bdf8;
  transform: translateY(-2px);
}

.paletteItem.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
  transform: scale(1.06);
}

.paletteIcon {
  font-size: 1.6rem;
  line-height: 1.2;
}

.paletteThumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  transition: transform 0.15s ease;
  pointer-events: none;
}

.paletteItem:hover .paletteThumb {
  transform: scale(1.12);
}

.paletteName {
  font-size: 0.68rem;
  color: #cbd5e1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58px;
}

/* 우측 하단 에디터 가이드 & 마우스 팁 */
.editorHintBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #94a3b8;
  padding: 0 4px;
}

/* 맵 속성 설정 모달 */
.editorModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #0f172a;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  padding: 24px;
  width: 90%;
  max-width: 440px;
  color: #fff;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: 'Jua', sans-serif;
}

.editorModalTitle {
  font-size: 1.3rem;
  color: #38bdf8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 8px;
  margin: 0;
}

.editorModalField {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.editorModalField label {
  font-size: 0.85rem;
  color: #cbd5e1;
}

.editorModalField select,
.editorModalField input {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
}

.editorModalBtns {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* 저장된 맵 목록 모달 */
.courseSlotList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.courseSlotItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  transition: all 0.15s;
}

.courseSlotItem:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: #38bdf8;
}

.courseSlotMeta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.courseSlotTitle {
  font-size: 1.0rem;
  font-weight: bold;
}

.courseSlotDate {
  font-size: 0.75rem;
  color: #94a3b8;
}

.courseSlotActions {
  display: flex;
  gap: 6px;
}

/* ==========================================================
   세계의 코스 (Course World) 모달 스타일
   ========================================================== */
.courseWorldModal {
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 18px 22px;
}

.cwHeader {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.cwTitleRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cwTitle {
  margin: 0;
  font-size: 1.35rem;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cwStatusBadge {
  font-size: 0.75rem;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 3px 8px;
  border-radius: 9999px;
  font-weight: 600;
}

.cwSub {
  margin: 4px 0 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.cwToolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.cwSearchBox {
  display: flex;
  gap: 8px;
}

.cwSearchBox input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.cwSearchBox input:focus {
  border-color: #38bdf8;
}

.cwFilterRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cwSortTabs {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cwSortBtn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.cwSortBtn:hover {
  color: #fff;
}

.cwSortBtn.active {
  background: #3b82f6;
  color: #fff;
  font-weight: bold;
}

.cwSelects {
  display: flex;
  gap: 6px;
}

.cwCourseList {
  flex: 1;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
  margin-bottom: 12px;
}

.cwCourseCard {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s;
}

.cwCourseCard:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cwCardMeta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cwCardTitleRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cwCardTitle {
  font-size: 1.05rem;
  font-weight: bold;
  color: #f8fafc;
}

.cwCardCode {
  font-size: 0.75rem;
  background: #1e293b;
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: bold;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.cwCardDetails {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: #94a3b8;
}

.cwCardStats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-top: 2px;
}

.cwCardActions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cwEmptyNotice {
  text-align: center;
  color: #94a3b8;
  padding: 30px;
  font-size: 0.95rem;
}

.cwFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 10px;
}

/* 플레이 테스트 복귀 플로팅 바 & 버튼 */
#editorPlayReturnBar {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

#editorPlayReturnBar[hidden] {
  display: none !important;
}

#editorPlayReturnBtn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 2px solid #ffffff;
  color: #ffffff;
  font-family: 'Jua', 'Apple SD Gothic Neo', sans-serif;
  font-size: 1.15rem;
  font-weight: bold;
  padding: 10px 22px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s, background 0.15s;
  animation: pulseReturnBtn 2s infinite;
}

#editorPlayReturnBtn:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: scale(1.06);
}

.editorPlayStatusBadge {
  background: linear-gradient(135deg, #10b981, #059669);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: 'Jua', sans-serif;
  font-weight: bold;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.editorPlayHintBadge {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: 'Jua', sans-serif;
}

@keyframes pulseReturnBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); box-shadow: 0 6px 25px rgba(245, 158, 11, 0.7); }
}
