@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
  /* 1. 기본 라이트 테마 변수 */
  --bg-app: #F1F5F9;
  --bg-workspace: #E2E8F0;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-solid: #FFFFFF;
  --border: rgba(226, 232, 240, 0.8);
  --border-solid: #E2E8F0;
  --text-main: #0F172A;
  --text-sub: #64748B;
  --accent: #8B5CF6;        /* 네온 바이올렛 */
  --accent-hover: #7C3AED;
  --accent-light: rgba(139, 92, 246, 0.1);
  --success: #10B981;
  --warning: #F59E0B;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 32px rgba(139, 92, 246, 0.06);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. 다크 테마 클래스 (시스템 혹은 토글로 강제 설정 가능) */
body.dark-theme {
  --bg-app: #080C14;
  --bg-workspace: #111827;
  --surface: rgba(17, 24, 39, 0.6);
  --surface-solid: #111827;
  --border: rgba(37, 99, 235, 0.1);
  --border-solid: #1F2937;
  --text-main: #F3F4F6;
  --text-sub: #9CA3AF;
  --accent: #A78BFA;
  --accent-hover: #C4B5FD;
  --accent-light: rgba(167, 139, 250, 0.15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(17, 24, 39, 0.55);
  --glass-border: rgba(255, 255, 255, 0.05);
}

/* 시스템 다크모드 선호 자동 연동 */
@media (prefers-color-scheme: dark) {
  body:not(.light-theme-forced) {
    --bg-app: #080C14;
    --bg-workspace: #111827;
    --surface: rgba(17, 24, 39, 0.6);
    --surface-solid: #111827;
    --border: rgba(37, 99, 235, 0.1);
    --border-solid: #1F2937;
    --text-main: #F3F4F6;
    --text-sub: #9CA3AF;
    --accent: #A78BFA;
    --accent-hover: #C4B5FD;
    --accent-light: rgba(167, 139, 250, 0.15);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(17, 24, 39, 0.55);
    --glass-border: rgba(255, 255, 255, 0.05);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  user-select: none;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-solid);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-sub);
}

/* 상단 PWA 모던 헤더 */
header {
  height: 64px;
  background-color: var(--surface-solid);
  border-bottom: 1px solid var(--border-solid);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--text-main);
}

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

/* 모던 테마 토글 및 PWA 설치 버튼 */
.icon-btn {
  background: none;
  border: 1px solid var(--border-solid);
  color: var(--text-main);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

.icon-btn:hover {
  background-color: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}

.pwa-install-btn {
  background-color: var(--accent);
  color: #FFF;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: none; /* 설치 가능할 때만 보임 */
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.pwa-install-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

/* 뷰 컨테이너 */
.view-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

.view.active {
  display: flex;
  opacity: 1;
}

/* ==========================================================================
   PWA Dashboard (Home View)
   ========================================================================== */
#homeView {
  flex-direction: column;
  padding: 32px;
  overflow-y: auto;
}

.dashboard-layout {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* 모던 드롭존 (Glassmorphism 적용) */
.dropzone-container {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.dropzone-container:hover, .dropzone-container.dragover {
  background: var(--accent-light);
  transform: translateY(-2px);
}

.dropzone-icon {
  font-size: 48px;
  filter: drop-shadow(0 4px 10px rgba(139, 92, 246, 0.2));
}

.dropzone-text h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dropzone-text p {
  font-size: 13px;
  color: var(--text-sub);
}

/* 라이브러리 섹션 */
.library-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group {
  display: flex;
  background-color: var(--border-solid);
  padding: 3px;
  border-radius: 20px;
}

.filter-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  padding: 6px 16px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  color: var(--text-main);
}

.filter-btn.active {
  background-color: var(--surface-solid);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* 카드 그리드 및 모던 카드 디자인 */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
}

.project-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.card-thumbnail {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background-color: var(--bg-workspace);
  overflow: hidden;
}

.card-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
  transition: var(--transition);
}

.project-card:hover .card-thumbnail img {
  transform: scale(1.04);
}

.card-status {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-solid);
  box-shadow: var(--shadow-sm);
}

.card-status.completed {
  background-color: var(--success);
  color: #FFF;
  border: none;
}

.card-info {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-date {
  font-size: 11px;
  color: var(--text-sub);
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  opacity: 0;
  transition: var(--transition);
}

.project-card:hover .card-actions {
  opacity: 1;
}

.action-icon-btn {
  background: var(--surface-solid);
  border: 1px solid var(--border-solid);
  color: var(--text-sub);
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 11px;
}

.action-icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.action-icon-btn.delete-btn:hover {
  background-color: #FEE2E2;
  border-color: #FCA5A5;
  color: #EF4444;
}

/* ==========================================================================
   PWA Coloring Studio (Coloring View)
   ========================================================================== */
#coloringView {
  flex-direction: row;
  height: 100%;
}

/* 좌측 콤팩트 독 사이드바 */
.sidebar {
  width: 72px;
  background-color: var(--surface-solid);
  border-right: 1px solid var(--border-solid);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 16px;
}

.sidebar-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border-solid);
  background-color: var(--bg-app);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-btn:hover {
  transform: scale(1.08);
  border-color: var(--accent);
  color: var(--accent);
}

/* 중앙 캔버스 워크스페이스 */
.canvas-workspace {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-workspace);
  display: flex;
  flex-direction: column;
}

/* 플로팅 컨트롤 아일랜드 상단 바 */
.top-toolbar {
  height: 56px;
  margin: 16px 20px 0 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow-md);
  z-index: 5;
}

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

.toolbar-btn {
  background-color: var(--surface-solid);
  border: 1px solid var(--border-solid);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.toolbar-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.toolbar-btn.accent {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #FFF;
}

.toolbar-btn.accent:hover {
  background-color: var(--accent-hover);
}

.project-title-input {
  border: 1px solid transparent;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 6px;
  width: 180px;
  transition: var(--transition);
}

.project-title-input:hover, .project-title-input:focus {
  background-color: var(--surface-solid);
  border-color: var(--border-solid);
  outline: none;
}

/* 캔버스 포트 */
.canvas-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
}

.canvas-viewport:active {
  cursor: grabbing;
}

.canvas-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  background-color: #FFFFFF;
}

.canvas-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

/* 레이어 블렌딩 */
#lineCanvas {
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 3;
}
#colorCanvas {
  z-index: 2;
}
#bgCanvas {
  z-index: 1;
}

/* 하단 슬림 상태바 */
.statusbar {
  height: 28px;
  background-color: var(--surface-solid);
  border-top: 1px solid var(--border-solid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 11px;
  color: var(--text-sub);
}

/* 우측 설정 컨트롤 패널 (Glassmorphism 디자인) */
.control-panel {
  width: 290px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 26px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin-bottom: 4px;
}

/* 플랫 모던 도구 레이아웃 */
.tool-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tool-btn {
  background-color: var(--surface-solid);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
}

.tool-btn span {
  font-size: 20px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

.tool-btn:hover {
  border-color: var(--accent);
  background-color: var(--accent-light);
}

.tool-btn.active {
  border-color: var(--accent);
  background-color: var(--accent);
  color: #FFF;
  box-shadow: var(--shadow-md);
}

/* 슬라이더 커스텀 */
.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.setting-label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text-main);
}

.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  background: var(--border-solid);
  border-radius: 3px;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--accent-hover);
}

/* 스위치 */
.switch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-solid);
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-sub);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-light);
}

input:checked + .slider:before {
  transform: translateX(18px);
  background-color: var(--accent);
}

/* 컬러 칩 */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.palette-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-chip {
  width: 100%;
  padding-top: 100%;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.color-chip:hover {
  transform: scale(1.15);
}

.color-chip.active {
  border: 2px solid var(--surface-solid);
  outline: 2px solid var(--accent);
  transform: scale(1.15);
  box-shadow: var(--shadow-md);
}

.palette-category {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 8px;
  font-weight: 700;
}

.color-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-solid);
  border: 1px dashed var(--text-sub);
  position: relative;
}

.color-add-btn::after {
  content: '+';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  color: var(--text-sub);
}

.color-add-btn:hover {
  border-color: var(--accent);
}

/* 토스트 알림 (Glassmorphism 적용) */
.toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #FFF;
  padding: 10px 24px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast i {
  color: var(--success);
}

/* 오버레이 */
.timelapse-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(8, 12, 20, 0.7);
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: #FFF;
  backdrop-filter: blur(6px);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

/* 커스텀 모달 스타일 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
}

.modal-card {
  background: var(--surface-solid);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

body.dark-theme .modal-card {
  background-color: #0E1420;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-message {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.5;
}

.modal-input {
  width: 100%;
  background-color: var(--bg-app);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 14px;
  transition: var(--transition);
}

.modal-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-light);
}

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

.modal-btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.modal-btn.cancel {
  background-color: var(--border-solid);
  color: var(--text-sub);
}

.modal-btn.cancel:hover {
  background-color: rgba(0,0,0,0.05);
  color: var(--text-main);
}

body.dark-theme .modal-btn.cancel:hover {
  background-color: rgba(255,255,255,0.08);
}

.modal-btn.confirm {
  background-color: var(--accent);
  color: #FFF;
}

.modal-btn.confirm:hover {
  background-color: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

/* SVG 아이콘 정렬 보정 */
.toolbar-btn svg, 
.sidebar-btn svg, 
.logo svg, 
.pwa-install-btn svg, 
.icon-btn svg, 
.tool-btn svg,
.action-icon-btn svg {
  flex-shrink: 0;
  vertical-align: middle;
}

/* 도구 동적 설명 박스 */
.tool-desc-box {
  background-color: var(--accent-light);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 14px;
  font-size: 11.5px;
  line-height: 1.5;
  transition: var(--transition);
}

.tool-desc-box h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--accent);
}

.tool-desc-box p {
  color: var(--text-sub);
}

body.dark-theme .tool-desc-box {
  background-color: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.15);
}

/* 온보딩 사용 가이드 모달 스타일 */
.guide-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(9, 13, 22, 0.7);
  backdrop-filter: blur(10px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.guide-overlay.active {
  opacity: 1;
}

.guide-card {
  background: var(--surface-solid);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  min-height: 420px;
  position: relative;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px;
  transform: translateY(30px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.dark-theme .guide-card {
  background-color: #0E1420;
}

.guide-overlay.active .guide-card {
  transform: translateY(0);
}

.guide-close-btn {
  position: absolute;
  top: 20px; right: 24px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-sub);
  transition: var(--transition);
}

.guide-close-btn:hover {
  color: var(--text-main);
  transform: scale(1.1);
}

.guide-slides {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  position: relative;
}

.guide-slide {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  animation: fadeIn 0.25s ease-in-out forwards;
  width: 100%;
}

.guide-slide.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.guide-hero-icon {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.18);
}

.guide-slide h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  word-break: keep-all;
}

.guide-slide h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-slide p {
  font-size: 13.5px;
  color: var(--text-sub);
  line-height: 1.6;
  word-break: keep-all;
}

/* 가이드 도구 및 단축키 리스트 */
.guide-tool-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-app);
  overflow: hidden;
}

.guide-tool-list li {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-main);
  display: grid;
  grid-template-columns: 128px 1fr;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}

.guide-tool-list li:last-child {
  border-bottom: none;
}

.guide-tool-badge {
  background-color: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  padding: 12px 10px;
  font-size: 11.5px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  border-right: 1px solid var(--border);
}

.guide-tool-list li > span:last-child {
  padding: 12px 14px;
  word-break: keep-all;
  overflow-wrap: break-word;
  align-self: center;
}

.guide-tool-badge svg {
  flex-shrink: 0;
}

.guide-shortcut-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.guide-shortcut-table th {
  color: var(--text-sub);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  width: 130px;
}

.guide-shortcut-table td {
  color: var(--text-main);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.guide-shortcut-table code {
  background-color: var(--border-solid);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* 하단 조작계 */
.guide-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  border-top: 1px solid var(--border-solid);
  padding-top: 18px;
}

.guide-dots {
  display: flex;
  gap: 8px;
}

.guide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--border-solid);
  cursor: pointer;
  transition: var(--transition);
}

.guide-dot.active {
  background-color: var(--accent);
  width: 18px;
  border-radius: 4px;
}

.guide-nav-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.guide-dont-show {
  font-size: 11.5px;
  color: var(--text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-btn {
  background-color: var(--accent);
  color: #FFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 24px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.guide-btn:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

/* AI 추천 프롬프트 스타일 */
.prompt-suggestion-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: -8px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.prompt-card {
  background: var(--surface-solid);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: var(--transition);
}

.prompt-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.prompt-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-icon {
  font-size: 20px;
}

.prompt-card-header h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.prompt-text {
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.6;
  background-color: var(--bg-app);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  flex-grow: 1;
  word-break: keep-all;
  user-select: text; /* 텍스트 직접 복사 허용 */
}

.prompt-copy-btn {
  background-color: var(--surface-solid);
  border: 1px solid var(--border-solid);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.prompt-copy-btn:hover {
  background-color: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.prompt-tips-box {
  background-color: var(--accent-light);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.dark-theme .prompt-tips-box {
  background-color: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.1);
}

.prompt-tips-box h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
}

.prompt-tips-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-tips-box li {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-sub);
  position: relative;
  padding-left: 14px;
}

.prompt-tips-box li::before {
  content: "•";
  color: var(--accent);
  position: absolute;
  left: 0;
  font-size: 14px;
}

/* 와이드 모달 카드 (AI 프롬프트 가이드용) */
.guide-card.wide-card {
  max-width: 900px;
  width: 92%;
  height: 90vh;
  max-height: 720px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

@media (max-width: 768px) {
  .guide-card.wide-card {
    height: 95vh;
    padding: 20px;
  }
}

/* 브랜드 푸터 스타일 */
.app-footer {
  margin-top: 56px;
  padding: 24px 16px 36px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.03em;
  border-top: 1px solid var(--border-solid);
  width: 100%;
  box-sizing: border-box;
}

.app-footer .brand {
  opacity: 0.85;
}

body.dark-theme .app-footer {
  color: #64748b;
}

@media (max-width: 640px) {
  .app-footer {
    margin-top: 36px;
    padding: 20px 12px 28px;
    font-size: 11px;
  }
}

/* 페이지네이션 스타일 */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 36px;
  margin-bottom: 12px;
}

.pagination-btn {
  background: var(--surface-solid);
  border: 1px solid var(--border-solid);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  user-select: none;
}

.pagination-btn:hover:not(:disabled) {
  background-color: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.pagination-btn.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #FFF;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn svg {
  vertical-align: middle;
}

@media (max-width: 640px) {
  .pagination-container {
    gap: 6px;
    margin-top: 24px;
  }
  .pagination-btn {
    padding: 6px 10px;
    font-size: 11.5px;
  }
}

/* 모바일 패널 닫기 버튼 기본 상태 */
.panel-close-btn {
  display: none;
}

/* 데스크톱 모드에서 도구함 버튼 숨김 */
#btnTogglePanel {
  display: none;
}

/* 모바일 전용 반응형 레이아웃 오버라이드 */
@media (max-width: 768px) {
  /* 그리기 화면의 사이드바 숨김 */
  .sidebar {
    display: none !important;
  }

  /* 도구함 버튼 노출 */
  #btnTogglePanel {
    display: inline-flex;
  }

  /* 상단 툴바 최적화 */
  .top-toolbar {
    margin: 8px 8px 0 8px;
    height: 48px;
    padding: 0 8px;
    gap: 4px;
  }

  /* 툴바 텍스트 숨기고 아이콘만 노출 */
  .toolbar-btn {
    font-size: 0 !important;
    padding: 8px 10px !important;
    gap: 0;
  }

  .toolbar-btn svg {
    width: 14px;
    height: 14px;
    margin: 0;
  }

  /* 소형 모바일에서는 제목 입력 숨겨 공간 확보 */
  @media (max-width: 500px) {
    .project-title-input {
      display: none !important;
    }
  }

  /* 우측 설정창을 모바일용 슬라이딩 드로어로 개조 */
  .control-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 290px;
    height: 100vh;
    z-index: 120;
    background-color: var(--surface-solid);
    border-left: 1px solid var(--border-solid);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 20px;
  }

  .control-panel.open {
    transform: translateX(0);
  }

  /* 모바일용 닫기 단추 활성화 */
  .panel-close-btn {
    display: block;
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    color: var(--text-sub);
    cursor: pointer;
    margin-bottom: -10px;
    margin-right: -4px;
  }

  .panel-close-btn:hover {
    color: var(--text-main);
  }
}

/* ==========================================================================
   공식 서비스 고도화 추가 UI (백업 컨트롤 & 스마트 색상 추천 바)
   ========================================================================== */
.library-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.backup-btn {
  background: var(--surface-solid);
  border: 1px solid var(--border-solid);
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.backup-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-light);
}

/* 스마트 색상 조화 추천 박스 */
.smart-recommend-box {
  background-color: var(--accent-light);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.dark-theme .smart-recommend-box {
  background-color: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.18);
}

.smart-recommend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.smart-recommend-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
}

.smart-analyze-btn {
  background-color: var(--surface-solid);
  border: 1px solid var(--border-solid);
  color: var(--text-main);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.smart-analyze-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 640px) {
  .library-toolbar {
    width: 100%;
    justify-content: space-between;
  }
}
