/* =============================================
   common.css - 공통 스타일
   Adventure Studio
   ============================================= */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700;800&family=Black+Han+Sans&display=swap');

/* ---- CSS Variables ---- */
:root {
  /* Brand Colors */
  --color-primary: #6C63FF;
  --color-primary-dark: #4B44CC;
  --color-primary-light: #A09CFF;
  --color-primary-bg: #F0EFFE;

  /* Semantic */
  --color-success: #22C55E;
  --color-success-light: #DCFCE7;
  --color-success-dark: #16A34A;
  --color-danger: #EF4444;
  --color-danger-light: #FEE2E2;
  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;
  --color-info: #3B82F6;
  --color-info-light: #DBEAFE;

  /* Neutral */
  --color-neutral-950: #0A0A1A;
  --color-neutral-900: #1A1A2E;
  --color-neutral-800: #252540;
  --color-neutral-700: #363655;
  --color-neutral-600: #4A4A6A;
  --color-neutral-500: #6B6B8A;
  --color-neutral-400: #9B9BB4;
  --color-neutral-300: #BBBBD0;
  --color-neutral-200: #E0E0EE;
  --color-neutral-100: #F0F0FA;
  --color-neutral-50: #F8F8FD;
  --color-white: #FFFFFF;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6C63FF 0%, #A09CFF 100%);
  --gradient-hero: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
  --gradient-success: linear-gradient(135deg, #22C55E 0%, #4ADE80 100%);
  --gradient-danger: linear-gradient(135deg, #EF4444 0%, #F87171 100%);
  --gradient-card: linear-gradient(135deg, #FFFFFF 0%, #F8F8FD 100%);

  /* Typography */
  --font-base: 'Noto Sans KR', sans-serif;
  --font-display: 'Black Han Sans', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.15), 0 8px 16px rgba(0,0,0,0.08);
  --shadow-primary: 0 4px 20px rgba(108,99,255,0.35);
  --shadow-success: 0 4px 20px rgba(34,197,94,0.35);
  --shadow-danger: 0 4px 20px rgba(239,68,68,0.35);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-base);
  font-size: var(--font-size-md);
  color: var(--color-neutral-900);
  background: var(--color-neutral-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  transition: all var(--transition-base);
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 25px rgba(108,99,255,0.45); }

.btn-secondary {
  background: var(--color-white);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-secondary:hover { background: var(--color-primary-bg); }

.btn-ghost {
  background: transparent;
  color: var(--color-neutral-600);
  border: 1px solid var(--color-neutral-200);
}
.btn-ghost:hover { background: var(--color-neutral-100); color: var(--color-neutral-900); }

.btn-danger {
  background: var(--gradient-danger);
  color: var(--color-white);
  box-shadow: var(--shadow-danger);
}
.btn-danger:hover { filter: brightness(1.08); }

.btn-success {
  background: var(--gradient-success);
  color: var(--color-white);
  box-shadow: var(--shadow-success);
}

.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--font-size-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--font-size-lg); border-radius: var(--radius-lg); }
.btn-xl { padding: var(--space-5) var(--space-10); font-size: var(--font-size-xl); border-radius: var(--radius-xl); }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}
.btn-icon-sm { width: 28px; height: 28px; }
.btn-icon-lg { width: 44px; height: 44px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

/* ---- Form Elements ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-neutral-700);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-label .required {
  color: var(--color-danger);
  font-weight: 700;
}

.form-input,
.form-textarea,
.form-select {
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  color: var(--color-neutral-900);
  background: var(--color-white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  width: 100%;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.12);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--color-neutral-400);
}

.form-counter {
  font-size: var(--font-size-xs);
  color: var(--color-neutral-400);
  text-align: right;
}

/* ---- Cards ---- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-neutral-200);
  overflow: hidden;
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-neutral-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-neutral-100);
  background: var(--color-neutral-50);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.badge-primary { background: var(--color-primary-bg); color: var(--color-primary-dark); }
.badge-success { background: var(--color-success-light); color: var(--color-success-dark); }
.badge-danger { background: var(--color-danger-light); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge-neutral { background: var(--color-neutral-100); color: var(--color-neutral-600); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,26,0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.96);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-neutral-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.modal-body { padding: var(--space-6); }

.modal-footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--color-neutral-100);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ---- Toast ---- */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-neutral-900);
  color: var(--color-white);
  font-size: var(--font-size-sm);
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  pointer-events: all;
  transform: translateX(120%);
  transition: transform var(--transition-base);
  min-width: 260px;
  max-width: 380px;
}

.toast.show { transform: translateX(0); }
.toast.success { background: var(--color-success-dark); }
.toast.error { background: var(--color-danger); }
.toast.warning { background: var(--color-warning); color: var(--color-neutral-900); }

/* ---- Loader ---- */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(108,99,255,0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--color-neutral-200);
  gap: 0;
}

.tab-btn {
  padding: var(--space-3) var(--space-5);
  background: none;
  border: none;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-neutral-500);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
}

.tab-btn:hover { color: var(--color-primary); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--color-neutral-300);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  position: relative;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

input:checked + .toggle-track {
  background: var(--color-primary);
}

input:checked + .toggle-track::after {
  transform: translateX(20px);
}

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--color-neutral-400);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-neutral-500);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--font-size-sm);
  max-width: 300px;
  margin-bottom: var(--space-6);
}

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--color-neutral-200);
  margin: var(--space-6) 0;
}

/* ---- Utility ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-muted { color: var(--color-neutral-400); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success-dark); }
.text-danger { color: var(--color-danger); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.animate-fadeIn { animation: fadeIn 0.3s ease forwards; }
.animate-slideIn { animation: slideInLeft 0.3s ease forwards; }
.animate-pulse { animation: pulse 1.5s ease infinite; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-neutral-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-neutral-400); }

/* ---- Image Upload Area ---- */
.upload-area {
  border: 2px dashed var(--color-neutral-300);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--color-neutral-50);
  position: relative;
}

.upload-area:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.upload-area.has-image {
  padding: 0;
  border: none;
}

.upload-area img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon { font-size: 2rem; margin-bottom: var(--space-2); opacity: 0.4; }
.upload-text { font-size: var(--font-size-sm); color: var(--color-neutral-500); }

/* ---- Section Header ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-neutral-800);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .btn-xl { padding: var(--space-4) var(--space-6); font-size: var(--font-size-lg); }
  #toast-container { right: var(--space-4); bottom: var(--space-4); left: var(--space-4); }
  .toast { min-width: unset; max-width: 100%; }
}

/* ============================================================
   추가 공통 스타일
   ============================================================ */

/* 폼 기본 */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 0.9rem; font-weight: 600;
  color: var(--text-primary);
}
.form-label.required::after { content: ' *'; color: #EF4444; }
.form-hint { font-size: 0.78rem; color: var(--text-secondary); }
.form-sub-label { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 6px; }

.form-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.9rem;
  background: var(--surface); color: var(--text-primary);
  outline: none; transition: border-color 0.2s;
  box-sizing: border-box;
}
.form-input:focus { border-color: var(--primary, #6C63FF); }
.form-input-readonly { background: var(--bg-secondary); color: var(--text-secondary); cursor: not-allowed; }

.form-select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.9rem;
  background: var(--surface); color: var(--text-primary);
  outline: none; cursor: pointer;
}

.form-textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.9rem;
  background: var(--surface); color: var(--text-primary);
  outline: none; transition: border-color 0.2s;
  resize: vertical; box-sizing: border-box;
  font-family: inherit;
}
.form-textarea:focus { border-color: var(--primary, #6C63FF); }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px;
  border-radius: 8px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  border: 1.5px solid transparent; text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary, #6C63FF);
  color: #fff; border-color: transparent;
}
.btn-primary:hover { background: #5753e0; }

.btn-outline {
  /* background: transparent; */
  background: #f5f0e7;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--primary, #6C63FF); color: var(--primary, #6C63FF); }

.btn-danger {
  background: #EF4444; color: #fff; border-color: transparent;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  background: none; border: none;
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: var(--text-secondary);
  transition: background 0.2s;
}
.btn-icon:hover { background: var(--bg-secondary); }

/* 모달 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
  max-width: 480px; width: 90%;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1rem; font-weight: 700; margin: 0; }

.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-secondary); border: none;
  cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all 0.2s;
}
.modal-close:hover { background: var(--border); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

/* 토스트 */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9000; display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 12px 16px;
  background: #1a1a2e; color: #fff;
  border-radius: 10px; font-size: 0.88rem;
  border-left: 3px solid #6C63FF;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
.toast-success { border-left-color: #22C55E; }
.toast-error { border-left-color: #EF4444; }
.toast-warning { border-left-color: #F59E0B; }
.toast-info { border-left-color: #3B82F6; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* CSS 변수 (라이트 테마 기본) */
:root {
  --primary: #6C63FF;
  --surface: #fff;
  --bg-secondary: #f8f9fa;
  --border: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
}

/* 스튜디오는 다크 사이드바 + 밝은 메인 */
.studio-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-secondary);
}

.sidebar {
  width: 240px; flex-shrink: 0;
  background: #1A1A2E; color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 200;
  transition: width 0.2s;
}

.sidebar-header { padding: 16px; }
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #fff;
}
.logo-icon { font-size: 1.4rem; }
.logo-text { font-family: 'Black Han Sans', sans-serif; font-size: 1rem; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-section-label {
  padding: 8px 16px 4px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3); text-transform: uppercase;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: rgba(255,255,255,0.6);
  text-decoration: none; font-size: 0.9rem;
  transition: all 0.15s; cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
  background: rgba(108,99,255,0.15);
  color: #a78bfa; border-left-color: #6C63FF;
}
.nav-icon { font-size: 1.1rem; flex-shrink: 0; }

.sidebar-footer { padding: 12px 0; border-top: 1px solid rgba(255,255,255,0.06); }

.studio-topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 60px;
  background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

.sidebar-toggle { display: none; }

.studio-content { flex: 1; overflow-y: auto; }

.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; font-weight: 700;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .studio-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .content-edit-layout { flex-direction: column; }
  .content-edit-sidebar { display: none; }
  .image-set-grid { grid-template-columns: 1fr; }
}



/* ============================================================
   플레이어 테마 시스템 - CSS 변수 기반
   applyPlayerTheme()이 body에 data-theme 속성을 설정하면
   아래 변수들이 자동으로 적용됩니다.
   ============================================================ */

/* 다크 테마 (기본) */
[data-theme="dark"] {
  --pt-bg:              linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  --pt-overlay:         rgba(0, 0, 0, 0.45);
  --pt-text-primary:    #ffffff;
  --pt-text-secondary:  rgba(255, 255, 255, 0.65);
  --pt-text-hint:       rgba(255, 255, 255, 0.35);
  --pt-card-bg:         rgba(255, 255, 255, 0.06);
  --pt-card-border:     rgba(255, 255, 255, 0.1);
  --pt-input-bg:        rgba(255, 255, 255, 0.08);
  --pt-input-border:    rgba(255, 255, 255, 0.15);
  --pt-input-color:     #ffffff;
  --pt-topbar-bg:       rgba(255, 255, 255, 0.05);
  --pt-topbar-btn-bg:   rgba(255, 255, 255, 0.1);
  --pt-topbar-btn-color:#ffffff;
  --pt-choice-bg:       rgba(255, 255, 255, 0.07);
  --pt-choice-color:    #ffffff;
  --pt-badge-bg:        rgba(108, 99, 255, 0.25);
  --pt-badge-color:     #c4c0ff;
  --pt-photo-bg:        rgba(255, 255, 255, 0.05);
  --pt-photo-border:    rgba(255, 255, 255, 0.1);
  --pt-photo-color:     rgba(255, 255, 255, 0.5);
  --pt-numpad-bg:       rgba(255, 255, 255, 0.08);
  --pt-numpad-color:    #ffffff;
}

/* 라이트 테마 */
[data-theme="light"] {
  --pt-bg:              linear-gradient(135deg, #f0f4ff, #e8eeff);
  --pt-overlay:         rgba(255, 255, 255, 0.2);
  --pt-text-primary:    #1a1a2e;
  --pt-text-secondary:  rgba(0, 0, 0, 0.6);
  --pt-text-hint:       rgba(0, 0, 0, 0.35);
  --pt-card-bg:         rgba(255, 255, 255, 0.88);
  --pt-card-border:     rgba(0, 0, 0, 0.08);
  --pt-input-bg:        rgba(0, 0, 0, 0.04);
  --pt-input-border:    rgba(0, 0, 0, 0.15);
  --pt-input-color:     #1a1a2e;
  --pt-topbar-bg:       rgba(255, 255, 255, 0.75);
  --pt-topbar-btn-bg:   rgba(0, 0, 0, 0.07);
  --pt-topbar-btn-color:#1a1a2e;
  --pt-choice-bg:       rgba(255, 255, 255, 0.9);
  --pt-choice-color:    #1a1a2e;
  --pt-badge-bg:        rgba(108, 99, 255, 0.1);
  --pt-badge-color:     #4B44CC;
  --pt-photo-bg:        rgba(0, 0, 0, 0.03);
  --pt-photo-border:    rgba(0, 0, 0, 0.1);
  --pt-photo-color:     rgba(0, 0, 0, 0.45);
  --pt-numpad-bg:       rgba(255, 255, 255, 0.8);
  --pt-numpad-color:    #1a1a2e;
}

/* ── 테마 변수 적용 ─────────────────────────────────────── */

/* 배경 */
[data-theme] .player-bg      { background: var(--pt-bg) !important; }
[data-theme] .player-bg-overlay { background: var(--pt-overlay) !important; }

/* 주요 텍스트 */
[data-theme] .intro-title,
[data-theme] .mission-list-title,
[data-theme] .mission-intro-title,
[data-theme] .quest-title,
[data-theme] .player-game-title,
[data-theme] .result-title,
[data-theme] .result-subtitle,
[data-theme] .result-player-name,
[data-theme] .nickname-title,
[data-theme] .code-entry-title,
[data-theme] .resume-title,
[data-theme] .duplicate-title { color: var(--pt-text-primary) !important; }

/* 보조 텍스트 */
[data-theme] .intro-story,
[data-theme] .intro-meta-item,
[data-theme] .mission-card-desc,
[data-theme] .mission-intro-body,
[data-theme] .quest-body,
[data-theme] .quest-step-indicator,
[data-theme] .player-name-badge,
[data-theme] .progress-text,
[data-theme] .nickname-desc,
[data-theme] .code-entry-desc,
[data-theme] .resume-desc,
[data-theme] .duplicate-desc,
[data-theme] .stat-label { color: var(--pt-text-secondary) !important; }

/* stat-value */
[data-theme] .stat-value { color: var(--pt-text-primary) !important; }

/* 카드 */
[data-theme] .mission-card,
[data-theme] .quest-content-card,
[data-theme] .mission-intro-card {
  background: var(--pt-card-bg) !important;
  border-color: var(--pt-card-border) !important;
}
[data-theme] .mission-card-title { color: var(--pt-text-primary) !important; }

/* 입력 필드 */
[data-theme] .quest-input,
[data-theme] .code-input {
  background: var(--pt-input-bg) !important;
  color: var(--pt-input-color) !important;
  border-color: var(--pt-input-border) !important;
}

/* 선택지 버튼 */
[data-theme] .choice-btn {
  background: var(--pt-choice-bg) !important;
  color: var(--pt-choice-color) !important;
}

/* 상단바 */
[data-theme] .player-topbar { background: var(--pt-topbar-bg) !important; }
[data-theme] .player-back-btn,
[data-theme] .player-topbar-icon {
  background: var(--pt-topbar-btn-bg) !important;
  color: var(--pt-topbar-btn-color) !important;
}

/* 배지 */
[data-theme] .intro-badge {
  background: var(--pt-badge-bg) !important;
  color: var(--pt-badge-color) !important;
}

/* 사진 촬영 영역 */
[data-theme] .photo-placeholder { color: var(--pt-photo-color) !important; }
[data-theme] .action-photo {
  background: var(--pt-photo-bg) !important;
  border-color: var(--pt-photo-border) !important;
}

/* 숫자패드 */
[data-theme] .numpad-btn {
  background: var(--pt-numpad-bg) !important;
  color: var(--pt-numpad-color) !important;
}

/* 인벤토리 패널 */
[data-theme] .inventory-panel {
  /* background: var(--pt-card-bg) !important;
  border-color: var(--pt-card-border) !important; */
}
[data-theme] .inventory-header h3 { color: var(--pt-text-primary) !important; }

@keyframes itemDetailIn {
    from { transform:scale(0.85); opacity:0; }
    to   { transform:scale(1);    opacity:1; }
}
