* {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
      background-color: #FFFFFF;
      color: #1a1a1a;
      min-height: 100vh;
    }

    /* ============================================ */
    /* Header - Flutter 스타일 */
    /* ============================================ */
    .app-header {
      background: #FFFFFF;
      padding: 10px 16px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #F3F4F6;
    }

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

    .header-icon {
      width: 36px;
      height: 36px;
      background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .header-icon i {
      color: #FFFFFF;
      font-size: 18px;
    }

    .header-title {
      font-size: 16px;
      font-weight: 600;
      color: #1F2937;
    }

    .btn-primary {
      background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
      color: white;
      border: none;
      padding: 10px 16px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      font-family: 'Noto Sans KR', sans-serif;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .btn-primary:hover {
      opacity: 0.95;
    }

    .btn-secondary {
      background: white;
      color: #6B7280;
      border: 1px solid #E5E7EB;
      padding: 10px 16px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      font-family: 'Noto Sans KR', sans-serif;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s;
    }

	    .btn-secondary:hover {
	      background: #F3F4F6;
	      border-color: #D1D5DB;
	    }

	    .btn-secondary.active {
	      background: #EEF2FF;
	      border-color: #C7D2FE;
	      color: #3730A3;
	    }

    /* ============================================ */
    /* Tabs - Flutter 스타일 (전체 너비 균등 배분) */
    /* ============================================ */
    .tabs-container {
      background: #FFFFFF;
      border-bottom: 1px solid #E5E7EB;
    }

    .tabs {
      display: flex;
      width: 100%;
    }

    .tab {
      flex: 1;
      padding: 12px 0;
      font-size: 13px;
      font-weight: 500;
      color: #6B7280;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      border-bottom: 2px solid transparent;
      transition: all 0.2s;
      margin-bottom: -1px;
      text-decoration: none;
    }

    .tab:hover {
      color: #6366F1;
    }

    .tab.active {
      color: #6366F1;
      border-bottom-color: #6366F1;
    }

    .tab i {
      font-size: 14px;
    }

    .tab-count {
      color: #6366F1;
      font-weight: 600;
      margin-left: 2px;
    }

    /* ============================================ */
    /* Main Content */
    /* ============================================ */
    .main-content {
      padding: 16px;
      background: #FAFAFA;
    }

    .main-content.no-padding {
      padding: 0;
      background: #FFFFFF;
    }

    .tab-content {
      display: none;
    }

    .tab-content.active {
      display: block;
    }

    /* ============================================ */
    /* Story Card - Flutter 스타일 */
    /* ============================================ */
    .story-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 16px 20px;
      margin-bottom: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .story-card:hover {
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .story-header {
      display: flex;
      align-items: flex-start;
      gap: 14px;
      margin-bottom: 14px;
    }

    .story-icon {
      width: 44px;
      height: 44px;
      background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .story-icon i {
      font-size: 20px;
      color: #FFFFFF;
    }

    .story-info {
      flex: 1;
    }

    .story-title {
      font-size: 15px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 4px;
    }

    .story-desc {
      font-size: 13px;
      color: #9CA3AF;
      line-height: 1.4;
    }

    .story-badge {
      font-size: 12px;
      font-weight: 600;
      flex-shrink: 0;
      padding: 4px 10px;
      border-radius: 6px;
    }

    .story-badge.published {
      background: #D1FAE5;
      color: #059669;
    }

    .story-badge.draft {
      background: #FEF3C7;
      color: #D97706;
    }

    .story-meta {
      display: flex;
      align-items: center;
      padding: 10px 14px;
      background: #F3F4F6;
      border-radius: 8px;
    }

    .meta-item {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      color: #6B7280;
    }

    .meta-item i {
      font-size: 14px;
      color: #9CA3AF;
    }

    .meta-divider {
      width: 1px;
      height: 14px;
      background: #D1D5DB;
      margin: 0 14px;
    }

    .story-arrow {
      margin-left: auto;
      color: #D1D5DB;
      font-size: 16px;
    }

    /* ============================================ */
    /* Quest Card - Flutter 스타일 */
    /* ============================================ */
    .quest-card {
      background: #FFFFFF;
      border: 1px solid #F9FAFB;
      border-radius: 16px;
      padding: 20px 24px;
      margin-bottom: 12px;
      display: flex;
      align-items: flex-start;
      gap: 16px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .quest-card:hover {
      background: #FAFAFA;
    }

    .quest-card.epic {
      border: 2px solid #818CF8;
    }

    .quest-icon {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      flex-shrink: 0;
    }

    .quest-icon.orange { background: #FEF3C7; color: #F59E0B; }
    .quest-icon.blue { background: #EEF2FF; color: #6366F1; }
    .quest-icon.green { background: #D1FAE5; color: #10B981; }

    .quest-info {
      flex: 1;
      min-width: 0;
    }

    .quest-title-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
    }

    .epic-badge {
      background: #10B981;
      color: white;
      font-size: 10px;
      font-weight: 700;
      padding: 3px 8px;
      border-radius: 4px;
      letter-spacing: 0.5px;
    }

    .quest-title {
      font-size: 15px;
      font-weight: 600;
      color: #1F2937;
    }

    .quest-desc {
      font-size: 13px;
      color: #6B7280;
      margin-bottom: 10px;
      line-height: 1.4;
    }

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

    .quest-story-tag {
      background: #F3F4F6;
      color: #9CA3AF;
      font-size: 12px;
      padding: 4px 10px;
      border-radius: 6px;
    }

    .quest-stars {
      display: flex;
      gap: 2px;
    }

    .quest-stars i {
      font-size: 14px;
      color: #FBBF24;
    }

    .quest-stars i.empty {
      color: #E5E7EB;
    }

    .quest-exp {
      margin-left: auto;
      font-size: 14px;
      font-weight: 700;
      color: #10B981;
      white-space: nowrap;
    }

    .quest-arrow {
      color: #D1D5DB;
      font-size: 20px;
      flex-shrink: 0;
      align-self: center;
    }

    /* ============================================ */
    /* Quest Grid Card - 퀘스트 목록 전용 카드 */
    /* ============================================ */
    .quest-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 14px;
    }

    .quest-grid-card {
      background: #FFFFFF;
      border: 1px solid #E8EAF0;
      border-radius: 16px;
      padding: 18px 20px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      cursor: pointer;
      transition: all 0.2s;
      position: relative;
      overflow: hidden;
    }

    .quest-grid-card:hover {
      box-shadow: 0 6px 20px rgba(0,0,0,0.08);
      transform: translateY(-2px);
    }

    .quest-grid-card.status-submitted {
      border-left: 4px solid #6366F1;
    }

    .quest-grid-card.status-proposed {
      border-left: 4px solid #F59E0B;
    }

    .quest-grid-card.status-in_progress {
      border-left: 4px solid #10B981;
    }

    .quest-grid-card.status-verified {
      border-left: 4px solid #22C55E;
    }

    .quest-grid-card.status-selected {
      border-left: 4px solid #3B82F6;
    }

    .quest-grid-card.is-coop {
      border: 2px solid #EC4899;
    }

    .quest-grid-top {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .quest-grid-icon {
      width: 48px;
      height: 48px;
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      overflow: hidden;
      background: #F3F4F6;
    }

    .quest-grid-icon img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .quest-grid-icon.cat-study { background: url('/uploads/assets/quest-icons/quest_icon_study.png') center/cover no-repeat, #DBEAFE; }
    .quest-grid-icon.cat-health { background: url('/uploads/assets/quest-icons/quest_icon_health.png') center/cover no-repeat, #D1FAE5; }
    .quest-grid-icon.cat-chore { background: url('/uploads/assets/quest-icons/quest_icon_chore.png') center/cover no-repeat, #FEF3C7; }
    .quest-grid-icon.cat-social { background: url('/uploads/assets/quest-icons/quest_icon_social.png') center/cover no-repeat, #EDE9FE; }
    .quest-grid-icon.cat-creative { background: url('/uploads/assets/quest-icons/quest_icon_creative.png') center/cover no-repeat, #FCE7F3; }
    .quest-grid-icon.cat-daily { background: url('/uploads/assets/quest-icons/quest_icon_daily.png') center/cover no-repeat, #F0F9FF; }
    .quest-grid-icon.cat-epic { background: url('/uploads/assets/quest-icons/quest_icon_epic.png') center/cover no-repeat, #EEF2FF; }
    .quest-grid-icon.cat-coop { background: url('/uploads/assets/quest-icons/quest_icon_coop.png') center/cover no-repeat, #FCE7F3; }

    .quest-grid-title-area {
      flex: 1;
      min-width: 0;
    }

    .quest-grid-title {
      font-size: 15px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 3px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .quest-grid-category {
      font-size: 12px;
      color: #9CA3AF;
    }

    .quest-grid-status-badge {
      font-size: 10px;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 6px;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .quest-grid-desc {
      font-size: 13px;
      color: #6B7280;
      line-height: 1.5;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .quest-grid-meta {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .quest-grid-difficulty {
      display: flex;
      align-items: center;
      gap: 3px;
    }

    .quest-grid-difficulty i {
      font-size: 12px;
      color: #FBBF24;
    }

    .quest-grid-difficulty i.empty {
      color: #E5E7EB;
    }

    .quest-grid-difficulty-label {
      font-size: 11px;
      font-weight: 600;
      padding: 2px 8px;
      border-radius: 4px;
      margin-left: 4px;
    }

    .quest-grid-rewards {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: auto;
    }

    .quest-grid-reward {
      font-size: 12px;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 3px;
    }

    .quest-grid-reward.exp { color: #10B981; }
    .quest-grid-reward.grit { color: #F59E0B; }
    .quest-grid-reward.dream { color: #8B5CF6; }

    .quest-grid-actions {
      position: absolute;
      top: 12px;
      right: 12px;
      display: flex;
      gap: 4px;
      opacity: 0;
      transition: opacity 0.2s;
    }

    .quest-grid-card:hover .quest-grid-actions {
      opacity: 1;
    }

    .quest-grid-actions .btn-icon {
      width: 30px;
      height: 30px;
      border-radius: 8px;
      background: rgba(255,255,255,0.9);
      border: 1px solid #E5E7EB;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 13px;
      color: #6B7280;
      transition: all 0.15s;
    }

    .quest-grid-actions .btn-icon:hover {
      background: #F3F4F6;
    }

    .quest-grid-actions .btn-icon.delete:hover {
      color: #EF4444;
      border-color: #FCA5A5;
      background: #FEF2F2;
    }

    .quest-grid-coop-badge {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      font-size: 10px;
      font-weight: 600;
      background: #FCE7F3;
      color: #EC4899;
      padding: 2px 8px;
      border-radius: 4px;
    }

    /* ============================================ */
    /* App Preview Tab - Flutter 스타일 */
    /* ============================================ */
    #previewTab {
      margin: 0;
    }

    .mobile-preview-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 16px;
      padding-bottom: 12px;
    }

    .mobile-preview-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 16px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    }

    .mobile-preview-index {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #6B7280;
    }

    .mobile-preview-card img {
      width: 100%;
      border-radius: 12px;
      border: 1px solid #E5E7EB;
      background: #F8FAFC;
      object-fit: contain;
    }

    .mobile-preview-caption {
      font-size: 12px;
      font-weight: 600;
      color: #111827;
    }

    .mobile-preview-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.72);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      padding: 24px;
    }

    .mobile-preview-overlay.show {
      display: flex;
    }

    .mobile-preview-dialog {
      position: relative;
      width: min(1100px, 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 16px;
    }

    .mobile-preview-stage {
      background: #0F172A;
      border-radius: 18px;
      padding: 16px 16px 12px;
      max-width: 900px;
      width: min(80vw, 900px);
      box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    #mobilePreviewLarge {
      width: 100%;
      max-height: 78vh;
      object-fit: contain;
      border-radius: 14px;
      background: #111827;
    }

    .mobile-preview-meta {
      display: flex;
      justify-content: space-between;
      font-size: 12px;
      color: #E5E7EB;
    }

    .mobile-preview-nav,
    .mobile-preview-close {
      border: none;
      background: rgba(15, 23, 42, 0.85);
      color: #F9FAFB;
      width: 44px;
      height: 44px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
    }

    .mobile-preview-close {
      position: absolute;
      top: -8px;
      right: -8px;
    }

    .mobile-preview-nav.prev {
      margin-left: -10px;
    }

    .mobile-preview-nav.next {
      margin-right: -10px;
    }

    @media (max-width: 640px) {
      .mobile-preview-dialog {
        gap: 6px;
      }

      .mobile-preview-stage {
        width: 100%;
        padding: 12px;
      }

      .mobile-preview-nav {
        width: 38px;
        height: 38px;
      }
    }

    .preview-layout {
      display: flex;
      gap: 0;
      min-height: calc(100vh - 100px);
    }

    .preview-sidebar {
      width: 270px;
      flex-shrink: 0;
      padding: 16px 16px 16px 16px;
      border-right: 1px solid #E5E7EB;
      background: #FFFFFF;
    }

    .preview-sidebar-title {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 20px;
    }

    .preview-section {
      margin-bottom: 20px;
    }

    .preview-section-title {
      font-size: 12px;
      font-weight: 600;
      color: #6366F1;
      margin-bottom: 12px;
    }

    .preview-item {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 12px 14px;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .preview-item:hover {
      border-color: #C7D2FE;
    }

    .preview-item.selected {
      border-color: #6366F1;
      background: #F5F3FF;
    }

    .preview-item-icon {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
    }

    .preview-item-info {
      flex: 1;
    }

    .preview-item-title {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
    }

    .preview-item-subtitle {
      font-size: 12px;
      color: #9CA3AF;
    }

    .preview-main {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: center;
      padding: 20px;
      background: #F9FAFB;
      position: relative;
    }

    .preview-controls {
      display: flex;
      gap: 12px;
      margin-bottom: 20px;
    }

    .preview-control-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 10px 16px;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      background: #FFFFFF;
      font-size: 13px;
      font-weight: 500;
      color: #374151;
      cursor: pointer;
      transition: all 0.2s;
    }

    .preview-control-btn:hover {
      border-color: #6366F1;
      color: #6366F1;
    }

    .preview-control-btn.active {
      background: #6366F1;
      border-color: #6366F1;
      color: white;
    }

    /* 데스크톱에서는 짧은 텍스트 */
    .fullscreen-text {
      display: none;
    }

    #fullscreenBtn::after {
      content: '전체화면';
    }

    .phone-mockup {
      width: 375px;
      height: 750px;
      background: #1F2937;
      border-radius: 44px;
      padding: 10px;
      box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
      transition: all 0.3s ease;
    }

    .phone-screen {
      width: 100%;
      height: 100%;
      background: #111827;
      border-radius: 30px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      position: relative;
    }

    .phone-notch {
      position: absolute;
      top: 10px;
      width: 80px;
      height: 24px;
      background: #1F2937;
      border-radius: 12px;
    }

    .phone-content {
      text-align: center;
      color: #6B7280;
    }

    .phone-content i {
      font-size: 48px;
      margin-bottom: 16px;
      opacity: 0.5;
    }

    .phone-content p {
      font-size: 14px;
      line-height: 1.5;
    }

    .phone-home-indicator {
      position: absolute;
      bottom: 8px;
      width: 100px;
      height: 4px;
      background: #374151;
      border-radius: 2px;
    }

    /* 전체화면 모드 */
    .fullscreen-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%;
      height: 100%;
      height: 100vh;
      height: 100dvh;
      background: #000;
      z-index: 3000;
      display: none;
      overflow: hidden;
    }

    .fullscreen-overlay.show {
      display: flex;
      flex-direction: column;
    }

    .fullscreen-close {
      position: fixed;
      top: 16px;
      right: 16px;
      background: rgba(0, 0, 0, 0.6);
      border: 2px solid rgba(255, 255, 255, 0.3);
      color: white;
      font-size: 20px;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
      z-index: 3001;
      backdrop-filter: blur(10px);
    }

    .fullscreen-close:hover {
      background: rgba(255, 255, 255, 0.2);
      border-color: rgba(255, 255, 255, 0.5);
    }

    .fullscreen-phone {
      width: 100%;
      height: 100%;
      flex: 1;
      min-height: 0;
      background: transparent;
      border-radius: 0;
      padding: 0;
      position: relative;
      display: flex;
      flex-direction: column;
    }

    .fullscreen-phone .phone-screen {
      width: 100%;
      height: 100%;
      flex: 1;
      min-height: 0;
      background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
      border-radius: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .fullscreen-phone .phone-notch {
      display: none;
    }

    .fullscreen-phone .phone-home-indicator {
      display: none;
    }

    .fullscreen-phone .app-preview {
      border-radius: 0;
      height: 100%;
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .fullscreen-phone .app-preview-header {
      padding: 60px 20px 16px;
      padding-top: max(60px, env(safe-area-inset-top, 60px));
      flex-shrink: 0;
    }

    .fullscreen-phone .app-preview-title {
      font-size: 20px;
    }

    .fullscreen-phone .coin-badge {
      font-size: 14px;
      padding: 8px 14px;
    }

    .fullscreen-phone .app-preview-body {
      padding: 16px 20px;
      flex: 1;
      overflow-y: auto;
      min-height: 0;
    }

    .fullscreen-phone .preview-quest-card {
      padding: 20px;
      border-radius: 20px;
      margin-bottom: 16px;
    }

    .fullscreen-phone .preview-quest-icon {
      width: 56px;
      height: 56px;
      font-size: 26px;
    }

    .fullscreen-phone .preview-quest-title {
      font-size: 18px;
    }

    .fullscreen-phone .preview-quest-category {
      font-size: 14px;
    }

    .fullscreen-phone .preview-npc-dialogue {
      padding: 16px;
      margin: 16px 0;
    }

    .fullscreen-phone .preview-npc-avatar {
      width: 48px;
      height: 48px;
      font-size: 24px;
    }

    .fullscreen-phone .preview-npc-name {
      font-size: 14px;
    }

    .fullscreen-phone .preview-npc-message {
      font-size: 15px;
      line-height: 1.5;
    }

    .fullscreen-phone .preview-complete-btn {
      padding: 18px;
      font-size: 16px;
    }

    .fullscreen-phone .app-preview-nav {
      padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
      flex-shrink: 0;
      background: rgba(17, 24, 39, 0.95);
      border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .fullscreen-phone .app-nav-item {
      font-size: 11px;
    }

    .fullscreen-phone .app-nav-item i {
      font-size: 22px;
    }

    .fullscreen-hint {
      display: none;
    }

    /* ============================================ */
    /* 앱 미리보기 상세 UI */
    /* ============================================ */

    /* 폰 화면 내부 앱 UI */
    .app-preview {
      width: 100%;
      height: 100%;
      background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
      border-radius: 30px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .app-preview-header {
      padding: 40px 16px 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .app-preview-title {
      color: #FFFFFF;
      font-size: 14px;
      font-weight: 600;
    }

    .app-preview-coins {
      display: flex;
      gap: 8px;
    }

    .coin-badge {
      display: flex;
      align-items: center;
      gap: 4px;
      background: rgba(255,255,255,0.1);
      padding: 4px 8px;
      border-radius: 12px;
      font-size: 11px;
      color: #FFFFFF;
    }

    .coin-badge i {
      font-size: 12px;
    }

    .coin-badge.grit { color: #FFD700; }
    .coin-badge.dream { color: #EC4899; }
    .coin-badge.exp { color: #4ECDC4; }

    .app-preview-body {
      flex: 1;
      padding: 0 12px 12px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    /* 퀘스트 카드 미리보기 */
    .preview-quest-card {
      background: rgba(255,255,255,0.95);
      border-radius: 14px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .preview-quest-header {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .preview-quest-icon {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
    }

    .preview-quest-icon.study { background: url('/uploads/assets/quest-icons/quest_icon_study.png') center/cover no-repeat; }
    .preview-quest-icon.health { background: url('/uploads/assets/quest-icons/quest_icon_health.png') center/cover no-repeat; }
    .preview-quest-icon.chore { background: url('/uploads/assets/quest-icons/quest_icon_chore.png') center/cover no-repeat; }
    .preview-quest-icon.social { background: url('/uploads/assets/quest-icons/quest_icon_social.png') center/cover no-repeat; }
    .preview-quest-icon.creative { background: url('/uploads/assets/quest-icons/quest_icon_creative.png') center/cover no-repeat; }
    .preview-quest-icon.daily { background: url('/uploads/assets/quest-icons/quest_icon_daily.png') center/cover no-repeat; }
    .preview-quest-icon.epic { background: url('/uploads/assets/quest-icons/quest_icon_epic.png') center/cover no-repeat; }
    .preview-quest-icon.coop { background: url('/uploads/assets/quest-icons/quest_icon_coop.png') center/cover no-repeat; }

    .preview-quest-info {
      flex: 1;
    }

    .preview-quest-title {
      font-size: 13px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 2px;
    }

    .preview-quest-category {
      font-size: 10px;
      color: #6B7280;
    }

    .preview-quest-badge {
      font-size: 9px;
      padding: 3px 6px;
      border-radius: 4px;
      font-weight: 600;
    }

    .preview-quest-badge.epic {
      background: linear-gradient(135deg, #8B5CF6, #6366F1);
      color: white;
    }

    .preview-quest-badge.coop {
      background: #D1FAE5;
      color: #059669;
    }

    .preview-quest-badge.daily {
      background: #DBEAFE;
      color: #3B82F6;
    }

    /* NPC 다이얼로그 박스 */
    .preview-npc-dialogue {
      background: #F3F4F6;
      border-radius: 10px;
      padding: 10px;
      display: flex;
      gap: 8px;
      align-items: flex-start;
    }

    .preview-npc-avatar {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      flex-shrink: 0;
      overflow: hidden;
    }

    .preview-npc-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .preview-npc-avatar.lumi { background: #FEF3C7; }
    .preview-npc-avatar.owl { background: #E0E7FF; }
    .preview-npc-avatar.bear { background: #FEE2E2; }
    .preview-npc-avatar.fairy { background: #D1FAE5; }
    .preview-npc-avatar.mom { background: #FCE7F3; }
    .preview-npc-avatar.dad { background: #DBEAFE; }

    .preview-npc-card-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 50%;
    }

    .preview-npc-text {
      flex: 1;
    }

    .preview-npc-name {
      font-size: 10px;
      font-weight: 600;
      color: #6B7280;
      margin-bottom: 2px;
    }

    .preview-npc-message {
      font-size: 11px;
      color: #1F2937;
      line-height: 1.4;
    }

    /* 보상 표시 */
    .preview-rewards {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .preview-reward {
      display: flex;
      align-items: center;
      gap: 3px;
      background: #F9FAFB;
      padding: 4px 8px;
      border-radius: 6px;
      font-size: 10px;
      color: #4B5563;
    }

    .preview-reward i {
      font-size: 11px;
    }

    .preview-reward.grit { color: #F59E0B; background: #FEF3C7; }
    .preview-reward.exp { color: #3B82F6; background: #DBEAFE; }
    .preview-reward.dream { color: #EC4899; background: #FCE7F3; }

    /* 퀘스트 완료 버튼 */
    .preview-complete-btn {
      background: linear-gradient(135deg, #10B981, #059669);
      color: white;
      border: none;
      border-radius: 8px;
      padding: 10px;
      font-size: 12px;
      font-weight: 600;
      text-align: center;
      cursor: pointer;
    }

    /* 랠리 시스템 UI */
    .preview-rally-card {
      background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
      border-radius: 14px;
      padding: 14px;
      border: 2px solid #F59E0B;
    }

    .preview-rally-title {
      font-size: 13px;
      font-weight: 700;
      color: #92400E;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .preview-rally-title i {
      font-size: 16px;
    }

    .preview-rally-message {
      font-size: 11px;
      color: #78350F;
      margin-bottom: 12px;
      line-height: 1.4;
    }

    .preview-rally-items {
      display: flex;
      gap: 8px;
    }

    .preview-rally-item {
      flex: 1;
      background: white;
      border-radius: 10px;
      padding: 10px;
      text-align: center;
      cursor: pointer;
      transition: transform 0.2s;
    }

    .preview-rally-item:hover {
      transform: scale(1.02);
    }

    .preview-rally-item-icon {
      width: 36px;
      height: 36px;
      margin: 0 auto 6px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
    }

    .preview-rally-item-icon.potion { background: #FCE7F3; }
    .preview-rally-item-icon.axe { background: #DBEAFE; }

    .preview-rally-item-name {
      font-size: 10px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 2px;
    }

    .preview-rally-item-desc {
      font-size: 9px;
      color: #6B7280;
    }

    /* NPC 갤러리 */
    .preview-npc-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }

    .preview-npc-card {
      background: rgba(255,255,255,0.95);
      border-radius: 12px;
      padding: 10px;
      text-align: center;
    }

    .preview-npc-card-avatar {
      width: 48px;
      height: 48px;
      margin: 0 auto 6px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
    }

    .preview-npc-card-name {
      font-size: 11px;
      font-weight: 600;
      color: #1F2937;
    }

    .preview-npc-card-role {
      font-size: 9px;
      color: #6B7280;
    }

    /* 협동 퀘스트 카드 */
    .preview-coop-card {
      background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
      border-radius: 14px;
      padding: 12px;
      border: 2px solid #10B981;
    }

    .preview-coop-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
    }

    .preview-coop-icon {
      width: 40px;
      height: 40px;
      background: #10B981;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 18px;
    }

    .preview-coop-title {
      font-size: 13px;
      font-weight: 600;
      color: #065F46;
    }

    .preview-coop-subtitle {
      font-size: 10px;
      color: #047857;
    }

    .preview-coop-participants {
      display: flex;
      gap: 6px;
      margin-bottom: 10px;
    }

    .preview-participant {
      display: flex;
      align-items: center;
      gap: 4px;
      background: white;
      padding: 4px 8px;
      border-radius: 12px;
      font-size: 10px;
      color: #065F46;
    }

    .preview-participant i {
      font-size: 12px;
    }

    /* 에픽 퀘스트 카드 */
    .preview-epic-card {
      background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
      border-radius: 14px;
      padding: 14px;
      color: white;
      position: relative;
      overflow: hidden;
    }

    .preview-epic-card::before {
      content: '';
      position: absolute;
      top: -50%;
      right: -50%;
      width: 100%;
      height: 100%;
      background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    }

    .preview-epic-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
      position: relative;
    }

    .preview-epic-icon {
      width: 44px;
      height: 44px;
      background: rgba(255,255,255,0.2);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
    }

    .preview-epic-title {
      font-size: 14px;
      font-weight: 700;
    }

    .preview-epic-subtitle {
      font-size: 10px;
      opacity: 0.9;
    }

    .preview-epic-progress {
      background: rgba(255,255,255,0.2);
      border-radius: 6px;
      height: 8px;
      margin-bottom: 8px;
      overflow: hidden;
    }

    .preview-epic-progress-bar {
      height: 100%;
      background: #FFE66D;
      border-radius: 6px;
      width: 65%;
    }

    .preview-epic-requirements {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
    }

    .preview-epic-req {
      background: rgba(255,255,255,0.2);
      padding: 3px 8px;
      border-radius: 4px;
      font-size: 9px;
    }

    /* 미리보기 하단 네비게이션 */
    .app-preview-nav {
      display: flex;
      justify-content: space-around;
      padding: 10px 16px 20px;
      background: rgba(0,0,0,0.3);
      flex-shrink: 0;
    }

    .app-nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      color: rgba(255,255,255,0.5);
      font-size: 9px;
    }

    .app-nav-item i {
      font-size: 18px;
    }

    .app-nav-item.active {
      color: #4ECDC4;
    }

    /* 사이드바 카테고리 확장 */
    .preview-section-title {
      font-size: 11px;
      font-weight: 600;
      color: #6B7280;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 8px;
      padding: 0 4px;
    }

    .preview-item.selected {
      background: #EEF2FF;
      border-color: #6366F1;
    }

    .preview-section + .preview-section {
      margin-top: 16px;
      padding-top: 16px;
      border-top: 1px solid #F3F4F6;
    }

    /* ============================================ */
    /* Story Editor Page - Flutter 스타일 */
    /* ============================================ */
    #storyDetailPage {
      display: none;
      min-height: 100vh;
      background: #FFFFFF;
    }

    #editorPage {
      display: none;
      min-height: 100vh;
      background: #FFFFFF;
    }

    body[data-page="story-detail"] #storyDetailPage {
      display: block;
    }

    body[data-page="story-detail"] {
      height: 100vh;
      overflow: hidden;
    }

    body[data-page="story-detail"] #storyDetailPage {
      height: 100vh;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    body[data-page="story-detail"] .story-detail-layout {
      flex: 1 1 auto;
      min-height: 0;
    }

    body[data-page="story-detail"] .story-detail-sidebar,
    body[data-page="story-detail"] .story-detail-main {
      height: 100%;
      min-height: 0;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }

    body[data-page="story-editor"] #editorPage {
      display: block;
    }

    .editor-layout {
      display: flex;
      min-height: calc(100vh - 60px);
    }

    .editor-sidebar {
      width: 280px;
      background: #FAFAFA;
      border-right: 1px solid #F3F4F6;
      padding: 20px;
      flex-shrink: 0;
    }

    .sidebar-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 24px;
    }

    .sidebar-title {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
    }

    .sidebar-title i {
      color: #6366F1;
      font-size: 16px;
    }

    .sidebar-add-btn {
      width: 26px;
      height: 26px;
      background: #10B981;
      color: white;
      border: none;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }

    .sidebar-add-btn:hover {
      background: #059669;
    }

    body[data-page="story-detail"] .map-assign-btn {
      width: auto;
      min-width: 84px;
      height: 30px;
      border-radius: 999px;
      padding: 0 10px;
      gap: 5px;
      font-size: 12px;
      font-weight: 700;
      line-height: 1;
    }

    body[data-page="story-detail"] .map-assign-btn i {
      font-size: 12px;
    }

    .sidebar-empty {
      text-align: center;
      padding: 60px 16px;
    }

    .sidebar-empty-icon {
      width: 100px;
      height: 100px;
      background: #E0E7FF;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 20px;
    }

    .sidebar-empty-icon i {
      font-size: 40px;
      color: #6366F1;
    }

    .sidebar-empty h3 {
      font-size: 15px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 10px;
    }

    .sidebar-empty p {
      font-size: 13px;
      color: #9CA3AF;
      margin-bottom: 24px;
      line-height: 1.6;
    }

    .sidebar-create-btn {
      background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
      color: white;
      border: none;
      padding: 12px 20px;
      border-radius: 10px;
      font-size: 14px;
      font-weight: 600;
      font-family: 'Noto Sans KR', sans-serif;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }

    .sidebar-create-btn:hover {
      opacity: 0.95;
    }

    .editor-main {
      flex: 1;
      padding: 24px;
      background: #FFFFFF;
      overflow-y: auto;
    }

    .editor-banner {
      background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
      border-radius: 12px;
      padding: 24px 28px;
      color: white;
      margin-bottom: 28px;
      display: flex;
      align-items: center;
      gap: 20px;
    }

    .banner-icon {
      width: 56px;
      height: 56px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 28px;
    }

    .banner-text h2 {
      font-size: 20px;
      font-weight: 700;
      margin-bottom: 4px;
    }

    .banner-text p {
      font-size: 14px;
      opacity: 0.9;
    }

    .preset-section-title {
      font-size: 16px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 16px;
    }

    /* Preset cards - 가로 배치 */
    .preset-grid {
      display: flex;
      gap: 16px;
      margin-bottom: 24px;
      overflow-x: auto;
      padding-bottom: 8px;
    }

    .preset-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 20px;
      min-width: 200px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .preset-card:hover {
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .preset-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 10px;
    }

    .preset-icon {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
    }

    .preset-icon.purple { background: #8B5CF6; color: white; }
    .preset-icon.green { background: #10B981; color: white; }
    .preset-icon.orange { background: #F59E0B; color: white; }
    .preset-icon.pink { background: #EC4899; color: white; }
    .preset-icon.cyan { background: #06B6D4; color: white; }

    .preset-title {
      font-size: 15px;
      font-weight: 600;
      color: #1F2937;
    }

    .preset-desc {
      font-size: 13px;
      color: #9CA3AF;
      margin-bottom: 14px;
      line-height: 1.5;
    }

    .preset-ai-btn {
      background: transparent;
      color: #6366F1;
      border: none;
      padding: 0;
      font-size: 13px;
      font-weight: 500;
      font-family: 'Noto Sans KR', sans-serif;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .preset-ai-btn:hover {
      color: #4F46E5;
    }

    .custom-story-btn {
      background: #FFFFFF;
      color: #6366F1;
      border: 1px solid #E5E7EB;
      padding: 12px 24px;
      border-radius: 10px;
      font-size: 14px;
      font-weight: 500;
      font-family: 'Noto Sans KR', sans-serif;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }

    .custom-story-btn:hover {
      border-color: #C7D2FE;
      background: #FAFAFF;
    }

    /* Back button */
    .header-back {
      background: none;
      border: none;
      font-size: 20px;
      color: #374151;
      cursor: pointer;
      padding: 8px;
      margin-right: 8px;
      display: none;
    }

    .header-back:hover {
      color: #6366F1;
    }

    /* ============================================ */
    /* Story Detail View - 스토리 상세 페이지 */
    /* ============================================ */
    .story-detail-layout {
      display: flex;
      min-height: calc(100vh - 60px);
    }

    .story-video-panel {
      background: #F8FAFC;
      border: 1px solid #E5E7EB;
      border-radius: 14px;
      padding: 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 24px;
      flex-wrap: wrap;
    }

    .story-video-title {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 4px;
    }

    .story-video-desc {
      font-size: 12px;
      color: #6B7280;
    }

    .story-detail-sidebar {
      width: 280px;
      background: #FAFAFA;
      border-right: 1px solid #E5E7EB;
      padding: 16px;
      flex-shrink: 0;
      overflow-y: auto;
    }

    .chapter-tree {
      margin-top: 8px;
    }

    #storyJourneyDnDHost {
      margin-top: 10px;
      margin-bottom: 12px;
    }

    .journey-dnd-board {
      border: 1px solid #E2E8F0;
      border-radius: 12px;
      background: #FFFFFF;
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .journey-dnd-title {
      font-size: 12px;
      font-weight: 700;
      color: #1F2937;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .journey-dnd-subtitle {
      font-size: 11px;
      color: #64748B;
      line-height: 1.4;
    }

    .journey-drop-zone-grid {
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-height: 260px;
      overflow: auto;
      padding-right: 2px;
    }

    .journey-drop-zone {
      border: 1px dashed #CBD5E1;
      border-radius: 10px;
      background: #F8FAFC;
      padding: 8px;
      transition: border-color 0.15s ease, background 0.15s ease;
    }

    .journey-drop-zone.is-over {
      border-color: #4F46E5;
      background: #EEF2FF;
    }

    .journey-drop-zone.is-disabled {
      opacity: 0.65;
      cursor: not-allowed;
    }

    .journey-drop-zone-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-bottom: 6px;
    }

    .journey-drop-zone-title {
      font-size: 12px;
      font-weight: 700;
      color: #0F172A;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .journey-drop-zone-meta {
      font-size: 10px;
      color: #64748B;
      flex-shrink: 0;
    }

    .journey-drop-chip-wrap {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .journey-drop-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      max-width: 100%;
      border: 1px solid #C7D2FE;
      border-radius: 999px;
      background: #EEF2FF;
      padding: 3px 6px 3px 8px;
      font-size: 11px;
      color: #3730A3;
    }

    .journey-drop-chip span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .journey-drop-chip-remove {
      width: 16px;
      height: 16px;
      border-radius: 999px;
      border: none;
      background: rgba(67, 56, 202, 0.18);
      color: #3730A3;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      padding: 0;
    }

    .journey-drop-chip-remove:hover {
      background: rgba(220, 38, 38, 0.16);
      color: #B91C1C;
    }

    .journey-drop-empty {
      font-size: 11px;
      color: #94A3B8;
      line-height: 1.4;
    }

    .journey-quest-pool-tools {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .journey-quest-pool-search {
      width: 100%;
      padding: 8px 10px;
      border-radius: 10px;
      border: 1px solid #D1D5DB;
      font-size: 12px;
      color: #0F172A;
    }

    .journey-quest-pool-meta {
      font-size: 11px;
      color: #64748B;
    }

    .journey-quest-pool-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-height: 300px;
      overflow: auto;
      padding-right: 2px;
    }

    .journey-quest-card {
      display: grid;
      grid-template-columns: 46px minmax(0, 1fr);
      gap: 8px;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      padding: 7px;
      background: #FFFFFF;
      cursor: grab;
      user-select: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .journey-quest-card:hover {
      border-color: #A5B4FC;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    }

    .journey-quest-card.dragging {
      opacity: 0.55;
      cursor: grabbing;
    }

    .journey-quest-thumb {
      width: 46px;
      height: 46px;
      border-radius: 8px;
      border: 1px solid #E2E8F0;
      background: #F8FAFC;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #64748B;
      font-size: 16px;
    }

    .journey-quest-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .journey-quest-thumb-fallback {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #64748B;
      font-size: 16px;
    }

    .journey-quest-copy {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .journey-quest-title {
      font-size: 12px;
      color: #111827;
      font-weight: 700;
      line-height: 1.3;
      word-break: break-word;
    }

    .journey-quest-sub {
      font-size: 11px;
      color: #6B7280;
      line-height: 1.3;
      word-break: break-word;
    }

    .journey-quest-tags {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
      margin-top: 1px;
    }

    .journey-quest-tag {
      display: inline-flex;
      align-items: center;
      font-size: 10px;
      color: #4338CA;
      background: #EEF2FF;
      border-radius: 999px;
      padding: 2px 6px;
    }

    .journey-quest-pool-empty {
      border: 1px dashed #CBD5E1;
      border-radius: 10px;
      background: #F8FAFC;
      padding: 14px 10px;
      text-align: center;
      font-size: 11px;
      color: #64748B;
      line-height: 1.4;
    }

    .chapter-item {
      margin-bottom: 8px;
    }

    .chapter-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 12px;
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .chapter-header:hover {
      border-color: #C7D2FE;
    }

    .chapter-header.active {
      border-color: #6366F1;
      background: #F5F3FF;
    }

    .chapter-icon {
      width: 28px;
      height: 28px;
      background: linear-gradient(135deg, #8B5CF6, #6366F1);
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 12px;
      font-weight: 700;
    }

    .chapter-info {
      flex: 1;
    }

    .chapter-title {
      font-size: 13px;
      font-weight: 600;
      color: #1F2937;
    }

    .chapter-meta {
      font-size: 11px;
      color: #9CA3AF;
    }

    .chapter-toggle {
      color: #9CA3AF;
      font-size: 12px;
      transition: transform 0.2s;
    }

    .chapter-toggle.open {
      transform: rotate(90deg);
    }

    .quest-list {
      margin-left: 20px;
      margin-top: 8px;
      display: none;
    }

    .quest-list.open {
      display: block;
    }

    .quest-tree-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-left: 2px solid #E5E7EB;
      margin-left: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .quest-tree-item:hover {
      background: #F9FAFB;
      border-left-color: #6366F1;
    }

    .quest-tree-icon {
      width: 24px;
      height: 24px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
    }

    .quest-tree-title {
      font-size: 12px;
      color: #4B5563;
    }

    .quest-tree-item.quest-add-item {
      opacity: 0.7;
      border-left-style: dashed;
    }

    .quest-tree-item.quest-add-item .quest-tree-icon {
      background: #F3F4F6;
      color: #9CA3AF;
    }

    .quest-tree-item.quest-add-item:hover {
      opacity: 1;
      border-left-color: #6366F1;
    }

    /* Story Detail Main Content */
    .story-detail-main {
      flex: 1;
      padding: 24px;
      overflow-y: auto;
      background: #F9FAFB;
    }

    .story-detail-header {
      display: flex;
      gap: 24px;
      margin-bottom: 24px;
    }

    .story-map-container {
      width: 400px;
      height: 250px;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
      position: relative;
      flex-shrink: 0;
    }

    .story-map-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .story-map-overlay {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 16px;
      background: linear-gradient(transparent, rgba(0,0,0,0.7));
      color: white;
    }

    .story-map-title {
      font-size: 18px;
      font-weight: 700;
      margin-bottom: 4px;
    }

    .story-map-subtitle {
      font-size: 13px;
      opacity: 0.9;
    }

    .story-info-panel {
      flex: 1;
      background: #FFFFFF;
      border-radius: 16px;
      padding: 24px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }

    .story-info-title {
      font-size: 24px;
      font-weight: 700;
      color: #1F2937;
      margin-bottom: 8px;
    }

    .story-info-desc {
      font-size: 14px;
      color: #6B7280;
      line-height: 1.6;
      margin-bottom: 16px;
    }

    .story-summary-block + .story-summary-block {
      margin-top: 10px;
    }

    .story-summary-label {
      font-size: 11px;
      font-weight: 700;
      color: #4F46E5;
      margin-bottom: 2px;
      letter-spacing: 0.01em;
    }

    .story-summary-text {
      font-size: 12px;
      color: #4B5563;
      line-height: 1.45;
    }

    .story-stats {
      display: flex;
      gap: 24px;
      margin-bottom: 20px;
    }

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

    .story-stat-icon {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
    }

    .story-stat-icon.purple { background: #EDE9FE; color: #7C3AED; }
    .story-stat-icon.blue { background: #DBEAFE; color: #2563EB; }
    .story-stat-icon.green { background: #D1FAE5; color: #059669; }

    .story-stat-info {
      display: flex;
      flex-direction: column;
    }

    .story-stat-value {
      font-size: 18px;
      font-weight: 700;
      color: #1F2937;
    }

    .story-stat-label {
      font-size: 12px;
      color: #9CA3AF;
    }

    .story-tags {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .story-tag {
      padding: 6px 12px;
      background: #F3F4F6;
      border-radius: 20px;
      font-size: 12px;
      color: #4B5563;
    }

    /* NPC Section */
    .section-title {
      font-size: 16px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .section-title i {
      color: #6366F1;
    }

    .section-title-with-actions {
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }

    .section-title-main {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }

    .section-title-action-btn {
      margin-left: auto;
      padding: 8px 12px;
      font-size: 12px;
      border-radius: 10px;
    }

    .npc-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 16px;
      margin-bottom: 32px;
    }

    .npc-card {
      background: #FFFFFF;
      border-radius: 12px;
      padding: 20px;
      text-align: center;
      box-shadow: 0 2px 8px rgba(0,0,0,0.04);
      transition: all 0.2s;
    }

    .npc-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

    .npc-avatar {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      margin: 0 auto 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 36px;
    }

    .npc-name {
      font-size: 15px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 4px;
    }

    .npc-role {
      font-size: 12px;
      color: #6366F1;
      margin-bottom: 8px;
    }

    .npc-dialogue {
      font-size: 12px;
      color: #6B7280;
      font-style: italic;
      line-height: 1.4;
    }

    /* Chapter Detail Cards */
    .chapter-detail-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 16px;
    }

    body[data-page="story-detail"] .chapter-detail-grid {
      grid-template-columns: minmax(0, 1fr);
    }

    .chapter-detail-card {
      background: #FFFFFF;
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0,0,0,0.04);
      position: relative;
      cursor: pointer;
    }

    .chapter-detail-banner {
      height: 78px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 34px;
    }

    .chapter-detail-content {
      padding: 16px;
    }

    .chapter-detail-title {
      font-size: 16px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 8px;
    }

    .chapter-detail-desc {
      font-size: 13px;
      color: #6B7280;
      margin-bottom: 12px;
      line-height: 1.4;
    }

    .chapter-detail-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .chapter-quest-count {
      font-size: 12px;
      color: #6366F1;
      font-weight: 500;
    }

    .chapter-exp {
      font-size: 12px;
      color: #10B981;
      font-weight: 600;
    }

    .chapter-edit-btn {
      position: absolute;
      top: 10px;
      right: 10px;
      width: 32px;
      height: 32px;
      border-radius: 999px;
      border: none;
      background: rgba(15, 23, 42, 0.6);
      color: #FFFFFF;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: background 0.2s ease, transform 0.2s ease;
    }

    .chapter-edit-btn:hover {
      background: rgba(15, 23, 42, 0.8);
      transform: translateY(-1px);
    }

    .story-empty-msg {
      grid-column: 1 / -1;
      text-align: center;
      padding: 28px 16px;
      color: #9CA3AF;
      background: #FFFFFF;
      border: 1px dashed #D1D5DB;
      border-radius: 12px;
      font-size: 13px;
    }

    .story-quest-tree-item {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      border-left: 2px solid #E5E7EB;
      margin-left: 12px;
      padding: 8px 12px;
      cursor: default;
    }

    .chapter-quick-add-btn {
      width: 24px;
      height: 24px;
      border: 1px solid #C7D2FE;
      background: #EEF2FF;
      color: #4F46E5;
      border-radius: 7px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      margin-right: 8px;
      flex-shrink: 0;
    }

    .chapter-quick-add-btn:hover {
      background: #E0E7FF;
    }

    .story-quest-tree-dot {
      width: 8px;
      height: 8px;
      border-radius: 999px;
      background: #6366F1;
      margin-top: 6px;
      flex-shrink: 0;
    }

    .story-quest-tree-copy {
      min-width: 0;
      flex: 1;
    }

    .story-quest-tree-title {
      font-size: 12px;
      color: #374151;
      font-weight: 600;
      line-height: 1.35;
    }

    .story-quest-tree-sub {
      font-size: 11px;
      color: #9CA3AF;
      margin-top: 2px;
      line-height: 1.3;
    }

    .story-quest-tree-remove {
      width: 22px;
      height: 22px;
      border-radius: 999px;
      border: 1px solid #E5E7EB;
      background: #FFFFFF;
      color: #9CA3AF;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      margin-top: 1px;
    }

    .story-quest-tree-remove:hover {
      color: #EF4444;
      border-color: #FCA5A5;
      background: #FEF2F2;
    }

    .story-quest-tree-empty {
      margin-left: 12px;
      border-left: 2px dashed #E5E7EB;
      padding: 8px 12px;
      font-size: 11px;
      color: #9CA3AF;
    }

    .chapter-map-quest-panel {
      margin-top: 14px;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      background: #F9FAFB;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .chapter-assignment-summary {
      margin-top: 12px;
      padding: 10px 12px;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      background: #F8FAFC;
    }

    .chapter-assignment-summary-title {
      font-size: 12px;
      font-weight: 700;
      color: #374151;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 8px;
    }

    .chapter-assignment-summary-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chapter-assignment-summary-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border-radius: 8px;
      background: #FFFFFF;
      padding: 7px 9px;
      border: 1px solid #E5E7EB;
    }

    .chapter-assignment-summary-place {
      font-size: 12px;
      font-weight: 600;
      color: #111827;
    }

    .chapter-assignment-summary-quest {
      font-size: 11px;
      color: #4F46E5;
      text-align: right;
    }

    .chapter-assignment-summary-empty {
      font-size: 11px;
      color: #9CA3AF;
    }

    .chapter-modal-journey {
      margin-top: 8px;
      padding-top: 10px;
      border-top: 1px dashed #D1D5DB;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .chapter-modal-placement-item {
      border-color: #D1D5DB;
    }

    .chapter-panel-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .chapter-panel-title {
      font-size: 13px;
      font-weight: 700;
      color: #1F2937;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .chapter-panel-links {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-panel-links a {
      font-size: 11px;
      color: #4F46E5;
      text-decoration: none;
      background: #EEF2FF;
      border-radius: 999px;
      padding: 4px 8px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    .chapter-panel-links a:hover {
      background: #E0E7FF;
    }

    .chapter-map-select-row {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chapter-map-select-row label {
      font-size: 12px;
      font-weight: 600;
      color: #374151;
    }

    .chapter-map-select-actions {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    .chapter-input {
      width: 100%;
      border: 1px solid #D1D5DB;
      border-radius: 8px;
      padding: 8px 10px;
      font-size: 12px;
      color: #1F2937;
      background: #FFFFFF;
    }

    .chapter-map-select {
      min-width: 260px;
      flex: 1;
    }

    .chapter-map-preview {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      min-height: 88px;
    }

    .chapter-map-preview img {
      width: 100%;
      height: 110px;
      object-fit: cover;
      display: block;
    }

    .chapter-map-preview-empty {
      min-height: 72px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      color: #9CA3AF;
      font-size: 12px;
      padding: 8px;
    }

    .chapter-map-preview-meta {
      font-size: 11px;
      color: #6B7280;
      padding: 7px 10px;
      border-top: 1px solid #F3F4F6;
      background: #F9FAFB;
    }

    .chapter-assignment-heading {
      font-size: 12px;
      font-weight: 600;
      color: #374151;
      margin-top: 2px;
    }

    .chapter-assignment-heading-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-assignment-heading-row .btn-secondary {
      padding: 6px 10px;
      font-size: 11px;
      border-radius: 999px;
      line-height: 1.2;
    }

    .chapter-storyline-box {
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      background: #FFFFFF;
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

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

    .chapter-storyline-head label {
      font-size: 12px;
      font-weight: 700;
      color: #1F2937;
    }

    .chapter-storyline-head .btn-secondary {
      padding: 6px 10px;
      font-size: 11px;
      border-radius: 999px;
    }

    .chapter-storyline-input {
      min-height: 76px;
      resize: vertical;
    }

    .chapter-placement-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .chapter-placement-item {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

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

    .chapter-placement-name {
      font-size: 12px;
      font-weight: 700;
      color: #1F2937;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }

    .chapter-placement-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
    }

    .chapter-placement-field {
      display: flex;
      flex-direction: column;
      gap: 5px;
    }

    .chapter-placement-field label {
      font-size: 11px;
      font-weight: 600;
      color: #4B5563;
    }

    .chapter-placement-field-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-placement-field-head .btn-secondary {
      padding: 5px 9px;
      font-size: 10px;
      border-radius: 999px;
      line-height: 1.2;
    }

    .chapter-placement-field textarea {
      min-height: 56px;
      resize: vertical;
    }

    .chapter-placement-field-episode textarea {
      min-height: 78px;
      line-height: 1.45;
    }

    .chapter-field-hint {
      font-size: 10px;
      color: #9CA3AF;
      line-height: 1.35;
    }

    .chapter-episode-image-tools {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 2px;
    }

    .chapter-episode-image-mode-section {
      margin-top: 8px;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      background: #F8FAFC;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chapter-episode-image-mode-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-episode-image-mode-title {
      font-size: 11px;
      font-weight: 700;
      color: #334155;
      line-height: 1.25;
    }

    .chapter-episode-image-mode-head .btn-secondary {
      padding: 5px 9px;
      font-size: 10px;
      border-radius: 999px;
      line-height: 1.2;
    }

    .chapter-episode-image-mode-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 6px;
      flex-wrap: wrap;
    }

    .chapter-episode-image-model-wrap {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 10px;
      font-weight: 700;
      color: #475569;
      background: #ffffff;
      border: 1px solid #dbe3ef;
      border-radius: 999px;
      padding: 4px 8px;
      line-height: 1.2;
    }

    .chapter-episode-image-model-wrap > span {
      white-space: nowrap;
    }

    .chapter-episode-image-model-select.chapter-input {
      min-width: 230px;
      font-size: 10px;
      line-height: 1.2;
      height: 28px;
      border-radius: 999px;
      padding: 4px 10px;
      border-color: #cbd5e1;
      background: #f8fafc;
    }

    .chapter-episode-dialogue-tools {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 2px;
      justify-content: space-between;
    }

    .chapter-episode-dialogue-tools .btn-secondary {
      padding: 5px 9px;
      font-size: 10px;
      border-radius: 999px;
      line-height: 1.2;
    }

    .chapter-episode-dialogue-group {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 2px;
    }

    .chapter-episode-dialogue-editor {
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      background: #F8FAFC;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chapter-episode-dialogue-title {
      font-size: 10px;
      font-weight: 700;
      color: #334155;
      line-height: 1.25;
    }

    .chapter-episode-dialogue-input {
      min-height: 62px;
      resize: vertical;
      line-height: 1.45;
    }

    .chapter-episode-image-tools .btn-secondary {
      padding: 5px 9px;
      font-size: 10px;
      border-radius: 999px;
      line-height: 1.2;
    }

    .chapter-episode-image-preview-row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      margin-top: 6px;
    }

    .chapter-episode-image-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-width: 0;
    }

    .chapter-episode-image-group-head {
      font-size: 10px;
      font-weight: 700;
      color: #334155;
      line-height: 1.2;
      padding: 0 2px;
    }

    .chapter-episode-image-group-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
    }

    .chapter-episode-image-card-wrap {
      position: relative;
      min-width: 0;
    }

    .chapter-episode-image-card {
      display: flex;
      flex-direction: column;
      gap: 6px;
      text-decoration: none;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      background: #FFFFFF;
      overflow: hidden;
      min-height: 104px;
    }

    .chapter-episode-image-card img {
      width: 100%;
      aspect-ratio: 9 / 16;
      object-fit: cover;
      background: #0F172A;
      max-height: 124px;
    }

    .chapter-episode-image-card span {
      display: block;
      font-size: 11px;
      font-weight: 600;
      color: #374151;
      padding: 0 8px 8px;
      text-align: center;
    }

    .chapter-episode-image-card.is-compact {
      min-height: 0;
    }

    .chapter-episode-image-card.is-compact span {
      font-size: 10px;
      padding: 0 4px 6px;
    }

    .chapter-episode-image-regenerate-btn {
      position: absolute;
      top: 6px;
      right: 6px;
      width: 22px;
      height: 22px;
      border: 1px solid rgba(255, 255, 255, 0.9);
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.86);
      color: #F8FAFC;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      line-height: 1;
      cursor: pointer;
      transition: transform .12s ease, background .12s ease;
      z-index: 2;
      padding: 0;
    }

    .chapter-episode-image-regenerate-btn:hover {
      background: rgba(37, 99, 235, 0.92);
      transform: translateY(-1px);
    }

    .chapter-episode-image-regenerate-btn:disabled {
      opacity: .55;
      cursor: not-allowed;
      transform: none;
    }

    .chapter-episode-image-empty {
      border: 1px dashed #D1D5DB;
      border-radius: 8px;
      padding: 10px 8px;
      min-height: 72px;
      font-size: 11px;
      color: #9CA3AF;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      background: #F8FAFC;
    }

    .chapter-story-resource-panel {
      margin-top: 6px;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      background: #F8FAFC;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chapter-story-resource-title {
      font-size: 11px;
      color: #374151;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }

    .chapter-story-resource-row {
      display: flex;
      align-items: stretch;
      gap: 8px;
      overflow-x: auto;
      padding-bottom: 2px;
    }

    .chapter-story-resource-chip {
      flex: 0 0 86px;
      width: 86px;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      background: #FFFFFF;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      gap: 3px;
      padding-bottom: 6px;
    }

    .chapter-story-resource-thumb {
      width: 100%;
      height: 62px;
      background: #F3F4F6;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      border-bottom: 1px solid #F3F4F6;
    }

    .chapter-story-resource-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      background: #FFFFFF;
    }

    .chapter-story-resource-empty {
      color: #9CA3AF;
      font-size: 14px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
    }

    .chapter-story-resource-label {
      font-size: 10px;
      color: #4B5563;
      font-weight: 700;
      line-height: 1.2;
      padding: 0 6px;
      text-align: center;
    }

    .chapter-story-resource-name {
      font-size: 10px;
      color: #6B7280;
      line-height: 1.2;
      padding: 0 6px;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .chapter-episode-image-status {
      min-height: 24px;
      margin-top: 6px;
    }

    .chapter-episode-image-progress {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .chapter-episode-image-progress-bar {
      width: 100%;
      height: 6px;
      border-radius: 999px;
      background: #E5E7EB;
      overflow: hidden;
    }

    .chapter-episode-image-progress-fill {
      width: 0%;
      height: 100%;
      border-radius: 999px;
      background: #0EA5E9;
      transition: width 0.35s ease;
    }

    .chapter-episode-image-progress-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 10px;
      line-height: 1.3;
      color: #374151;
    }

    .chapter-episode-image-progress-label {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .chapter-episode-image-progress-percent {
      font-weight: 700;
      color: #111827;
      flex-shrink: 0;
    }

    .chapter-episode-image-status.is-saving .chapter-episode-image-progress-fill {
      background: linear-gradient(90deg, #22D3EE, #2563EB);
    }

    .chapter-episode-image-status.is-success .chapter-episode-image-progress-fill {
      background: linear-gradient(90deg, #34D399, #10B981);
    }

    .chapter-episode-image-status.is-error .chapter-episode-image-progress-fill {
      background: linear-gradient(90deg, #FB7185, #EF4444);
    }

    .episode-image-viewer-modal {
      position: fixed;
      inset: 0;
      background: rgba(2, 6, 23, 0.72);
      backdrop-filter: blur(3px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 2600;
      padding: 16px;
    }

    .episode-image-viewer-modal.show {
      display: flex;
    }

    .episode-image-viewer-card {
      width: min(1100px, 96vw);
      max-height: 92vh;
      background: #0B1220;
      border: 1px solid rgba(148, 163, 184, 0.35);
      border-radius: 14px;
      box-shadow: 0 26px 46px rgba(2, 6, 23, 0.45);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .episode-image-viewer-head {
      height: 48px;
      padding: 0 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border-bottom: 1px solid rgba(148, 163, 184, 0.2);
      color: #E2E8F0;
    }

    .episode-image-viewer-title {
      font-size: 13px;
      font-weight: 700;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .episode-image-viewer-head-right {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex: 0 0 auto;
    }

    .episode-image-viewer-counter {
      font-size: 11px;
      font-weight: 700;
      color: #94A3B8;
      min-width: 52px;
      text-align: right;
    }

    .episode-image-viewer-close {
      width: 30px;
      height: 30px;
      border: 0;
      border-radius: 8px;
      cursor: pointer;
      background: rgba(148, 163, 184, 0.18);
      color: #F8FAFC;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .episode-image-viewer-close:hover {
      background: rgba(148, 163, 184, 0.28);
    }

    .episode-image-viewer-stage {
      min-height: 320px;
      max-height: calc(92vh - 48px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 10px;
      background: #020617;
      position: relative;
    }

    .episode-image-viewer-stage img {
      width: auto;
      max-width: 100%;
      max-height: calc(92vh - 68px);
      height: auto;
      object-fit: contain;
      border-radius: 10px;
      background: #0F172A;
    }

    .episode-image-viewer-nav {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      width: 36px;
      height: 36px;
      border: 0;
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.62);
      color: #F8FAFC;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: background 0.15s ease, opacity 0.15s ease;
      z-index: 1;
    }

    .episode-image-viewer-nav:hover {
      background: rgba(30, 41, 59, 0.86);
    }

    .episode-image-viewer-nav:disabled {
      opacity: 0.34;
      cursor: not-allowed;
    }

    .episode-image-viewer-nav-prev {
      left: 14px;
    }

    .episode-image-viewer-nav-next {
      right: 14px;
    }

    @media (max-width: 720px) {
      .chapter-episode-image-preview-row {
        grid-template-columns: 1fr;
      }

      .episode-image-viewer-card {
        width: 96vw;
      }
    }

    .chapter-video-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-video-link {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 11px;
      color: #4F46E5;
      text-decoration: none;
      padding: 5px 8px;
      border-radius: 999px;
      background: #EEF2FF;
    }

    .chapter-video-link:hover {
      background: #E0E7FF;
    }

    .chapter-video-empty {
      font-size: 11px;
      color: #9CA3AF;
    }

    .chapter-video-status {
      font-size: 10px;
      color: #9CA3AF;
      min-height: 14px;
      line-height: 1.3;
    }

    .chapter-video-status.is-saving {
      color: #0369A1;
    }

    .chapter-video-status.is-success {
      color: #059669;
    }

    .chapter-video-status.is-error {
      color: #DC2626;
    }

    .chapter-shop-section {
      margin-top: 8px;
      border: 1px solid #D1D5DB;
      border-radius: 10px;
      background: #FFFBF0;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .chapter-shop-head {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .chapter-shop-title {
      font-size: 11px;
      font-weight: 700;
      color: #92400E;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }

    .chapter-shop-grid {
      display: flex;
      gap: 16px;
      flex-wrap: wrap;
    }

    .chapter-shop-card {
      flex: 1;
      min-width: 200px;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      background: #FFFFFF;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chapter-shop-card-head {
      font-size: 11px;
      font-weight: 700;
      color: #1F2937;
    }

    .chapter-shop-preview img,
    .chapter-shop-preview video {
      max-width: 100%;
      height: auto;
      border-radius: 8px;
    }

    .chapter-shop-preview .chapter-episode-image-card img {
      max-height: 160px;
      object-fit: cover;
    }

    .chapter-shop-video-thumb {
      max-width: 180px;
    }
    .chapter-shop-video-thumb img {
      max-height: 160px;
      object-fit: cover;
    }
    .chapter-shop-video-play-overlay i {
      font-size: 36px;
    }

    .chapter-shop-empty {
      font-size: 10px;
      color: #9CA3AF;
      padding: 12px 0;
      text-align: center;
    }

    .chapter-shop-video-row {
      margin-top: 6px;
    }

    .chapter-shop-video-thumb {
      display: block;
      position: relative;
      border-radius: 10px;
      overflow: hidden;
      cursor: pointer;
      transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    .chapter-shop-video-thumb:hover {
      transform: scale(1.02);
      box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    }
    .chapter-shop-video-thumb img {
      width: 100%;
      height: auto;
      display: block;
      border-radius: 10px;
    }
    .chapter-shop-video-play-overlay {
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(0,0,0,0.25);
      border-radius: 10px;
      transition: background 0.15s ease;
    }
    .chapter-shop-video-thumb:hover .chapter-shop-video-play-overlay {
      background: rgba(0,0,0,0.35);
    }
    .chapter-shop-video-play-overlay i {
      font-size: 48px;
      color: #fff;
      filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
      transition: transform 0.15s ease;
    }
    .chapter-shop-video-thumb:hover .chapter-shop-video-play-overlay i {
      transform: scale(1.12);
    }

    .chapter-quest-video-section {
      margin-top: 8px;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      background: #F8FAFC;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .chapter-quest-video-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-quest-video-title {
      font-size: 11px;
      font-weight: 700;
      color: #1F2937;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }

    .chapter-quest-video-base-tools {
      border: 1px dashed #C7D2FE;
      border-radius: 9px;
      background: #F8FAFF;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chapter-quest-video-base-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-quest-video-base-title {
      font-size: 10px;
      font-weight: 700;
      color: #1E3A8A;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }

    .chapter-quest-video-base-meta {
      font-size: 10px;
      color: #475569;
      font-weight: 600;
    }

    .chapter-quest-video-base-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-quest-video-base-actions {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }

    .chapter-quest-video-base-actions-wrap {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 6px;
      min-width: 0;
    }

    .chapter-quest-video-base-actions-row {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .chapter-quest-video-base-gender-chip {
      font-size: 10px;
      font-weight: 700;
      color: #1E3A8A;
      background: #DBEAFE;
      border: 1px solid #BFDBFE;
      border-radius: 999px;
      padding: 2px 8px;
      line-height: 1.2;
    }

    .chapter-quest-video-base-preview-list {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      min-width: 0;
    }

    .chapter-quest-video-base-generate-btn.btn-secondary {
      padding: 5px 10px;
      font-size: 10px;
      border-radius: 999px;
      line-height: 1.2;
      white-space: nowrap;
    }

    .chapter-quest-video-base-delete-btn.btn-secondary {
      padding: 5px 10px;
      font-size: 10px;
      border-radius: 999px;
      line-height: 1.2;
      white-space: nowrap;
      border-color: #FECACA;
      color: #B91C1C;
      background: #FEF2F2;
    }

    .chapter-quest-video-base-delete-btn.btn-secondary:hover:not(:disabled) {
      border-color: #FCA5A5;
      background: #FEE2E2;
      color: #991B1B;
    }

    .chapter-quest-video-base-preview {
      min-width: 110px;
      max-width: 146px;
      flex: 0 1 auto;
    }

    .chapter-quest-video-base-empty {
      font-size: 11px;
      color: #94A3B8;
      padding: 6px 2px;
    }

    .chapter-quest-video-card-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .chapter-quest-video-card {
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      background: #FFFFFF;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .chapter-quest-video-card-head {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }

    .chapter-quest-video-icon {
      width: 34px;
      height: 34px;
      border-radius: 8px;
      border: 1px solid #E5E7EB;
      background: #F3F4F6;
      object-fit: cover;
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #6B7280;
      font-size: 13px;
    }

    .chapter-quest-video-icon-empty {
      background: #EEF2FF;
      border-color: #C7D2FE;
      color: #4F46E5;
    }

    .chapter-quest-video-card-copy {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .chapter-quest-video-card-title {
      font-size: 11px;
      font-weight: 700;
      color: #111827;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .chapter-quest-video-card-meta {
      font-size: 10px;
      color: #6B7280;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .chapter-quest-video-mode-list {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
    }

    .chapter-quest-video-mode {
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      background: #F8FAFC;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .chapter-quest-video-mode-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .chapter-quest-video-mode-title {
      font-size: 10px;
      font-weight: 700;
      color: #334155;
      line-height: 1.2;
    }

    .chapter-quest-video-auto-btn.btn-secondary {
      padding: 4px 9px;
      font-size: 10px;
      border-radius: 999px;
      line-height: 1.2;
    }

    .chapter-quest-video-delete-btn.btn-secondary {
      padding: 4px 9px;
      font-size: 10px;
      border-radius: 999px;
      line-height: 1.2;
      border-color: #FECACA;
      color: #B91C1C;
      background: #FEF2F2;
    }

    .chapter-quest-video-delete-btn.btn-secondary:hover:not(:disabled) {
      background: #FEE2E2;
      border-color: #FCA5A5;
    }

    .chapter-quest-video-prompt {
      min-height: 54px;
      line-height: 1.4;
      resize: vertical;
    }

    .chapter-quest-video-preview-open {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 4px 8px 4px 4px;
      border: 1px solid #C7D2FE;
      border-radius: 8px;
      background: #EEF2FF;
      color: #3730A3;
      text-decoration: none;
      cursor: pointer;
      min-height: 46px;
    }

    .chapter-quest-video-preview-open:hover {
      background: #E0E7FF;
      border-color: #A5B4FC;
    }

    .chapter-quest-video-preview-thumb {
      width: 34px;
      height: 42px;
      border-radius: 6px;
      overflow: hidden;
      background: #0F172A;
      border: 1px solid rgba(148, 163, 184, 0.35);
      flex: 0 0 auto;
    }

    .chapter-quest-video-preview-thumb video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      pointer-events: none;
    }

    .chapter-quest-video-preview-label {
      font-size: 11px;
      font-weight: 700;
      color: inherit;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      line-height: 1.2;
    }

    .chapter-quest-video-preview-empty {
      font-size: 11px;
      color: #9CA3AF;
      padding: 0 2px;
    }

    .chapter-quest-video-progress {
      margin-top: 2px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 6px 8px;
      border-radius: 8px;
      border: 1px solid #DBEAFE;
      background: #F8FAFC;
    }

    .chapter-quest-video-progress.is-hidden {
      display: none;
    }

    .chapter-quest-video-progress-bar {
      width: 100%;
      height: 6px;
      border-radius: 999px;
      background: #E2E8F0;
      overflow: hidden;
    }

    .chapter-quest-video-progress-fill {
      width: 0%;
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, #22D3EE, #2563EB);
      transition: width .3s ease;
    }

    .chapter-quest-video-progress-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      font-size: 10px;
      color: #475569;
      line-height: 1.3;
    }

    .chapter-quest-video-progress-label {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .chapter-quest-video-progress-percent {
      font-weight: 700;
      color: #0F172A;
      flex-shrink: 0;
    }

    .chapter-quest-video-progress.is-success .chapter-quest-video-progress-fill {
      background: linear-gradient(90deg, #34D399, #059669);
    }

    .chapter-quest-video-progress.is-error .chapter-quest-video-progress-fill {
      background: linear-gradient(90deg, #FB7185, #DC2626);
    }

    .chapter-quest-video-viewer-modal {
      position: fixed;
      inset: 0;
      z-index: 2700;
      background: rgba(2, 6, 23, 0.78);
      backdrop-filter: blur(3px);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }

    .chapter-quest-video-viewer-modal.show {
      display: flex;
    }

    .chapter-quest-video-viewer-card {
      width: min(540px, 96vw);
      background: #0B1220;
      border: 1px solid rgba(148, 163, 184, 0.35);
      border-radius: 14px;
      overflow: hidden;
      box-shadow: 0 24px 46px rgba(2, 6, 23, 0.52);
      display: flex;
      flex-direction: column;
    }

    .chapter-quest-video-viewer-head {
      height: 46px;
      padding: 0 10px 0 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    }

    .chapter-quest-video-viewer-title {
      font-size: 12px;
      font-weight: 700;
      color: #E2E8F0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .chapter-quest-video-viewer-close {
      width: 30px;
      height: 30px;
      border: 0;
      border-radius: 8px;
      background: rgba(148, 163, 184, 0.2);
      color: #F8FAFC;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }

    .chapter-quest-video-viewer-close:hover {
      background: rgba(148, 163, 184, 0.32);
    }

    .chapter-quest-video-viewer-stage {
      padding: 10px;
      background: #020617;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .chapter-quest-video-viewer-stage video {
      width: min(360px, 88vw);
      max-height: 80vh;
      aspect-ratio: 9 / 16;
      border-radius: 10px;
      background: #0F172A;
      border: 1px solid rgba(148, 163, 184, 0.3);
    }

    .chapter-quest-video-empty {
      border: 1px dashed #CBD5E1;
      border-radius: 8px;
      padding: 10px;
      font-size: 11px;
      color: #64748B;
      background: #FFFFFF;
      text-align: center;
    }

    .chapter-save-status {
      min-height: 14px;
      font-size: 11px;
      color: #9CA3AF;
    }

    .chapter-save-status.is-saving {
      color: #0369A1;
    }

    .chapter-save-status.is-success {
      color: #059669;
    }

    .chapter-save-status.is-error {
      color: #DC2626;
    }

    .chapter-assignment-empty {
      border: 1px dashed #D1D5DB;
      border-radius: 10px;
      padding: 14px 12px;
      color: #9CA3AF;
      font-size: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
      background: #FFFFFF;
    }

    .storyline-builder-panel {
      margin-top: 12px;
      border: 1px solid #E5E7EB;
      border-radius: 14px;
      background: #F8FAFC;
      padding: 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .storyline-builder-toolbar {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }

    .storyline-builder-copy {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 4px;
      flex: 1;
    }

    .storyline-builder-title {
      font-size: 14px;
      font-weight: 700;
      color: #111827;
      line-height: 1.35;
    }

    .storyline-builder-desc {
      font-size: 12px;
      color: #6B7280;
      line-height: 1.45;
    }

    .storyline-builder-actions {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      flex-shrink: 0;
    }

    .storyline-builder-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .storyline-builder-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .storyline-builder-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }

    .storyline-builder-head-copy {
      min-width: 0;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .storyline-builder-head-title {
      font-size: 13px;
      font-weight: 700;
      color: #1F2937;
      line-height: 1.35;
    }

    .storyline-builder-head-sub {
      font-size: 11px;
      color: #6B7280;
      line-height: 1.35;
      word-break: break-word;
    }

    .storyline-builder-meta {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .storyline-builder-meta span {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: #EEF2FF;
      color: #4338CA;
      border-radius: 999px;
      padding: 4px 8px;
      font-size: 11px;
      line-height: 1.2;
      max-width: 100%;
    }

    .storyline-builder-input {
      min-height: 94px;
      resize: vertical;
      line-height: 1.5;
      font-size: 12px;
    }

    .storyline-builder-placement-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .storyline-builder-placement-title {
      font-size: 12px;
      font-weight: 700;
      color: #1F2937;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .storyline-builder-placement-item {
      background: #F8FAFC;
      border-color: #D1D5DB;
    }

    .storyline-builder-placement-quest {
      font-size: 11px;
      color: #4F46E5;
      white-space: normal;
      text-align: right;
    }

    @media (max-width: 960px) {
      .chapter-map-select {
        min-width: 100%;
      }

      .storyline-builder-placement-quest {
        text-align: left;
      }

      .storyline-builder-actions {
        width: 100%;
      }

      .storyline-builder-actions .btn-secondary,
      .storyline-builder-actions .btn-primary {
        flex: 1;
        justify-content: center;
      }
    }

    /* Shop Section */
    .shop-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
      gap: 16px;
      margin-bottom: 32px;
    }

    .shop-card {
      background: #FFFFFF;
      border-radius: 12px;
      padding: 20px;
      display: flex;
      align-items: center;
      gap: 16px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }

    .shop-icon {
      width: 56px;
      height: 56px;
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
    }

    .shop-info {
      flex: 1;
    }

    .shop-name {
      font-size: 15px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 4px;
    }

    .shop-owner {
      font-size: 12px;
      color: #9CA3AF;
      margin-bottom: 8px;
    }

    .shop-items {
      display: flex;
      gap: 8px;
    }

    .shop-item-badge {
      padding: 4px 8px;
      background: #F3F4F6;
      border-radius: 4px;
      font-size: 11px;
      color: #4B5563;
    }

    /* ============================================ */
    /* Badge/Sticker Tab Styles */
    /* ============================================ */
    .badge-subtabs {
      display: flex;
      gap: 8px;
      margin-bottom: 24px;
      padding: 4px;
      background: #F3F4F6;
      border-radius: 12px;
    }

    .badge-subtab {
      flex: 1;
      padding: 12px 16px;
      text-align: center;
      font-size: 13px;
      font-weight: 500;
      color: #6B7280;
      cursor: pointer;
      border-radius: 8px;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    .badge-subtab:hover {
      color: #6366F1;
    }

    .badge-subtab.active {
      background: #FFFFFF;
      color: #6366F1;
      box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .badge-section {
      display: none;
    }

    .badge-section.active {
      display: block;
    }

    .section-header {
      margin-bottom: 24px;
    }

    .section-header h3 {
      font-size: 18px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .section-header h3 i {
      color: #6366F1;
    }

    .section-desc {
      font-size: 14px;
      color: #6B7280;
      margin-bottom: 16px;
    }

    /* History */
    .history-filters {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 16px;
    }

    .history-filter-btn {
      padding: 6px 12px;
      border: 1px solid #E5E7EB;
      background: white;
      color: #6B7280;
      border-radius: 8px;
      font-size: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .history-filter-btn.active {
      background: #6366F1;
      color: white;
      border-color: #6366F1;
    }

    .history-list {
      display: grid;
      gap: 12px;
    }

    .history-empty {
      text-align: center;
      padding: 32px 20px;
      border: 1px dashed #E5E7EB;
      border-radius: 12px;
      color: #9CA3AF;
      font-size: 13px;
    }

    .history-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 14px 16px;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
    }

    .history-card-left {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      min-width: 0;
    }

    .history-icon {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #FFFFFF;
      font-size: 18px;
      flex-shrink: 0;
    }

    .history-info {
      min-width: 0;
    }

    .history-title {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .history-desc {
      font-size: 12px;
      color: #6B7280;
      margin-top: 4px;
    }

    .history-meta {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 8px;
      font-size: 11px;
      color: #9CA3AF;
    }

    .history-tag {
      background: #EEF2FF;
      color: #4F46E5;
      padding: 2px 8px;
      border-radius: 999px;
      font-weight: 600;
      font-size: 10px;
    }

    .history-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
      align-items: flex-end;
    }

    .history-video-status {
      display: none;
      background: #EEF2FF;
      border-radius: 12px;
      padding: 12px 14px;
      color: #4338CA;
      font-size: 12px;
      margin-top: 12px;
    }

    .history-video-result {
      display: none;
      background: #F9FAFB;
      border-radius: 12px;
      border: 1px solid #E5E7EB;
      padding: 12px;
      margin-top: 12px;
    }

    .history-video-result video {
      width: 100%;
      border-radius: 10px;
      background: #111827;
    }

    .history-video-event-label {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 10px;
      border-radius: 999px;
      background: #EEF2FF;
      color: #4338CA;
      font-size: 12px;
      font-weight: 600;
    }

    @media (max-width: 640px) {
      .history-card {
        flex-direction: column;
        align-items: flex-start;
      }

      .history-actions {
        width: 100%;
        flex-direction: row;
        justify-content: flex-end;
      }

      .history-title {
        white-space: normal;
      }
    }

    /* Badge Grid */
    .badge-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 16px;
    }

    .badge-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 16px;
      padding: 20px;
      display: flex;
      gap: 16px;
      transition: all 0.2s;
    }

    .badge-card:hover {
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

    .badge-image {
      width: 64px;
      height: 64px;
      border-radius: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .badge-image i {
      font-size: 28px;
      color: white;
    }

    .badge-info {
      flex: 1;
      min-width: 0;
    }

    .badge-name {
      font-size: 15px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 4px;
    }

    .badge-desc {
      font-size: 13px;
      color: #6B7280;
      margin-bottom: 8px;
    }

    .badge-condition {
      font-size: 12px;
    }

    .condition-label {
      color: #9CA3AF;
    }

    .condition-value {
      color: #6366F1;
      font-weight: 500;
    }

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

    .btn-icon {
      width: 32px;
      height: 32px;
      border: none;
      background: #F3F4F6;
      border-radius: 8px;
      color: #6B7280;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
    }

    .btn-icon:hover {
      background: #E0E7FF;
      color: #6366F1;
    }

    .btn-icon.danger:hover {
      background: #FEE2E2;
      color: #EF4444;
    }

    /* Sticker Grid */
    .sticker-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
      gap: 16px;
    }

    .sticker-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 16px;
      padding: 20px;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s;
    }

    .sticker-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

    .sticker-image {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      margin: 0 auto 12px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .sticker-name {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 4px;
    }

    .sticker-message {
      font-size: 12px;
      color: #6B7280;
      font-style: italic;
    }

    /* Events Table */
    .events-table {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      overflow: hidden;
    }

    .event-row {
      display: grid;
      grid-template-columns: 150px 120px 1fr 100px 80px;
      padding: 14px 20px;
      align-items: center;
      border-bottom: 1px solid #F3F4F6;
    }

    .event-row:last-child {
      border-bottom: none;
    }

    .event-row.header {
      background: #F9FAFB;
      font-size: 12px;
      font-weight: 600;
      color: #6B7280;
      text-transform: uppercase;
    }

    .event-code code {
      background: #EEF2FF;
      color: #6366F1;
      padding: 4px 8px;
      border-radius: 6px;
      font-size: 12px;
    }

    .event-name {
      font-size: 14px;
      font-weight: 500;
      color: #1F2937;
    }

    .event-desc {
      font-size: 13px;
      color: #6B7280;
    }

    .event-tokens input {
      width: 70px;
      padding: 8px 12px;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      font-size: 14px;
      text-align: center;
    }

    .event-tokens input:focus {
      outline: none;
      border-color: #6366F1;
    }

    .event-active input[type="checkbox"] {
      width: 20px;
      height: 20px;
      accent-color: #6366F1;
      cursor: pointer;
    }

    /* ============================================ */
    /* Resource Tab Styles */
    /* ============================================ */
    .resource-subtabs {
      display: flex;
      gap: 8px;
      margin-bottom: 24px;
      padding: 4px;
      background: #F3F4F6;
      border-radius: 12px;
      flex-wrap: wrap;
    }

    .resource-subtab {
      flex: 1;
      min-width: 80px;
      padding: 12px 16px;
      text-align: center;
      font-size: 13px;
      font-weight: 500;
      color: #6B7280;
      cursor: pointer;
      border-radius: 8px;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    .resource-subtab:hover {
      color: #6366F1;
    }

    .resource-subtab.active {
      background: #FFFFFF;
      color: #6366F1;
      box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .resource-section {
      display: none;
    }

    .resource-section.active {
      display: block;
    }

    .resource-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 16px;
    }

    .resource-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 16px;
      display: flex;
      align-items: center;
      gap: 14px;
      transition: all 0.2s;
    }

    #backgroundsSection .resource-tags {
      display: none;
    }

    #mapsSection .resource-tags {
      display: none;
    }

    .resource-card:hover {
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

    .resource-image {
      width: 56px;
      height: 56px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      color: white;
      flex-shrink: 0;
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      overflow: hidden;
    }
    .resource-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 12px;
    }

    .resource-info {
      flex: 1;
      min-width: 0;
    }

    .resource-name {
      font-size: 15px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 4px;
    }

    .resource-desc {
      font-size: 13px;
      color: #6B7280;
      margin-bottom: 8px;
    }

    .resource-tags {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    #charactersSection .resource-tags,
    #npcsSection .resource-tags,
    #equipmentSection .resource-tags,
    #buildingsSection .resource-tags,
    #natureSection .resource-tags {
      display: none;
    }

    .resource-tag {
      font-size: 11px;
      padding: 3px 8px;
      background: #EEF2FF;
      color: #6366F1;
      border-radius: 4px;
    }

    .resource-tag.easy {
      background: #D1FAE5;
      color: #059669;
    }

    .resource-tag.medium {
      background: #FEF3C7;
      color: #D97706;
    }

    .resource-tag.hard {
      background: #FEE2E2;
      color: #DC2626;
    }

    .resource-actions {
      display: flex;
      gap: 6px;
    }

    /* Quest list layout polish */
    #questGrid .resource-card {
      align-items: center;
      padding: 16px;
      gap: 14px;
      border-radius: 12px;
      border-color: #E5E7EB;
      box-shadow: none;
      cursor: pointer;
      transition: box-shadow 0.2s ease;
    }

    #questGrid .resource-card:hover {
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

    #questGrid .resource-image {
      width: 56px;
      height: 56px;
      border-radius: 12px;
      background: #F9FAFB;
      box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
    }

    #questGrid .resource-image img {
      border-radius: 12px;
    }

    #questGrid .resource-info {
      gap: 6px;
    }

    #questGrid .resource-desc {
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    #questGrid .quest-video-actions,
    #questGrid .quest-rewards,
    #questGrid .resource-actions {
      display: none;
    }

    @media (max-width: 640px) {
      #questGrid .resource-card {
        padding: 16px;
      }

      #questGrid .resource-image {
        width: 52px;
        height: 52px;
      }
    }

    .quest-video-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
    }

    .quest-video-btn {
      padding: 6px 10px;
      font-size: 12px;
      border-radius: 6px;
      white-space: nowrap;
    }

    .quest-video-btn i {
      font-size: 12px;
    }

    .quest-video-section {
      margin-bottom: 24px;
      padding: 16px;
      border: 1px solid #E5E7EB;
      border-radius: 14px;
      background: #F9FAFB;
    }

    #questEditorModal .quest-editor-panel {
      width: min(96vw, 1120px);
      max-width: 1120px;
    }

    #questEditorModal .quest-editor-body {
      padding: 24px;
      max-height: min(82vh, 920px);
      overflow-y: auto;
    }

    #questEditorModal .quest-difficulty-grid {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 8px;
    }

    #questEditorModal .difficulty-btn {
      width: 100%;
      min-height: 42px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      line-height: 1.3;
      white-space: normal;
    }

    #questEditorModal .quest-reward-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 20px;
    }

    #questEditorModal .quest-video-section * {
      box-sizing: border-box;
    }

    .quest-video-header {
      margin-bottom: 12px;
    }

    .quest-video-title {
      font-size: 14px;
      font-weight: 700;
      color: #111827;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .quest-video-desc {
      font-size: 12px;
      color: #6B7280;
      margin-top: 6px;
      line-height: 1.5;
    }

    .quest-video-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: 12px;
    }

    .quest-video-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-width: 0;
    }

    .quest-video-card-title {
      font-size: 13px;
      font-weight: 600;
      color: #1F2937;
      display: flex;
      align-items: center;
      gap: 6px;
      line-height: 1.35;
    }

    .quest-video-prompt {
      width: 100%;
      padding: 10px;
      border: 1px solid #D1D5DB;
      border-radius: 10px;
      font-size: 12px;
      resize: vertical;
      margin: 0;
    }

    .quest-video-generate {
      width: 100%;
      padding: 10px;
      font-size: 12px;
      border-radius: 10px;
    }

    .quest-video-status {
      font-size: 11px;
      color: #6B7280;
      display: none;
    }

    .quest-video-status.is-error {
      color: #EF4444;
    }

    .quest-video-status.is-success {
      color: #10B981;
    }

    .quest-video-preview {
      width: 100%;
      border-radius: 10px;
      display: none;
      /* Quest videos are generated for mobile portrait (9:16). */
      aspect-ratio: 9 / 16;
      background: #0F172A;
      /* If the generated mp4 is truly 9:16, this will cover fully with no bars.
         If the mp4 contains letterboxing, this will crop it away in preview. */
      object-fit: cover;
      cursor: zoom-in;
    }

    .quest-video-hero {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 16px;
    }

    .quest-video-hero label {
      font-size: 12px;
      font-weight: 600;
      color: #374151;
    }

    .quest-video-hero-controls {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    #questVideoHeroSelect {
      flex: 1 1 220px;
      min-width: 220px;
      padding: 10px;
      border: 1px solid #D1D5DB;
      border-radius: 10px;
      font-size: 12px;
      background: #FFFFFF;
    }

    .quest-video-hero-preview {
      width: 44px;
      height: 44px;
      border-radius: 10px;
      border: 1px solid #E5E7EB;
      background: #FFFFFF;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      flex: 0 0 44px;
    }

    .quest-video-hero-preview img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
    }

    .quest-video-actions-row {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    .quest-video-actions-row .btn-secondary,
    .quest-video-actions-row .btn-primary {
      flex: 1 1 140px;
      justify-content: center;
      padding: 10px;
      font-size: 12px;
      border-radius: 10px;
      white-space: nowrap;
    }

    .quest-video-gender-actions {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    .quest-video-gender-actions .btn-primary {
      flex: 1 1 140px;
      justify-content: center;
      padding: 10px;
      font-size: 12px;
      border-radius: 10px;
      white-space: nowrap;
    }

    .quest-video-gender-previews {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      width: 100%;
    }

    .quest-video-gender-preview-col {
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-width: 0;
    }

    .quest-video-gender-preview-label {
      font-size: 11px;
      color: #6B7280;
      font-weight: 600;
    }

    .quest-video-assets {
      background: #F9FAFB;
      border: 1px dashed #E5E7EB;
      border-radius: 10px;
      padding: 10px;
    }

    .quest-video-assets-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 12px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 8px;
      flex-wrap: wrap;
    }

    .quest-video-boss {
      background: #F9FAFB;
      border: 1px dashed #E5E7EB;
      border-radius: 10px;
      padding: 10px;
    }

    .quest-video-boss-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 12px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 8px;
      flex-wrap: wrap;
    }

    .quest-video-boss-hint {
      font-size: 11px;
      font-weight: 500;
      color: #6B7280;
    }

    .quest-video-boss-controls {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    #questVideoBossSelect {
      flex: 1 1 200px;
      min-width: 200px;
      padding: 8px 10px;
      border: 1px solid #D1D5DB;
      border-radius: 8px;
      font-size: 12px;
      background: #FFFFFF;
    }

    .quest-video-boss-preview {
      width: 48px;
      height: 48px;
      border-radius: 10px;
      border: 1px solid #E5E7EB;
      background: #FFFFFF;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      flex: 0 0 48px;
    }

    .quest-video-boss-preview img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
    }

    .quest-video-rewards {
      background: #F9FAFB;
      border: 1px dashed #E5E7EB;
      border-radius: 10px;
      padding: 10px;
    }

    .quest-video-rewards-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 12px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 8px;
      flex-wrap: wrap;
    }

    .quest-video-rewards-controls {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: nowrap;
    }

    #questVideoRewardSelect {
      min-width: 0;
      flex: 1 1 auto;
      padding: 6px 8px;
      border: 1px solid #D1D5DB;
      border-radius: 8px;
      font-size: 11px;
      background: #FFFFFF;
    }

    .quest-video-reward-add {
      white-space: nowrap;
    }

    #questVideoRewardSelect[multiple] {
      min-height: 110px;
      padding: 8px;
      height: auto;
    }

    .quest-video-reward-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .quest-video-reward-empty {
      font-size: 11px;
      color: #9CA3AF;
    }

    .quest-video-reward-chip {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px 4px 4px;
      background: #FFFFFF;
      border-radius: 999px;
      border: 1px solid #E5E7EB;
      font-size: 11px;
      color: #374151;
    }

    .quest-video-reward-chip img {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      object-fit: cover;
      background: #F3F4F6;
    }

    .quest-video-reward-remove {
      border: none;
      background: transparent;
      color: #9CA3AF;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .quest-video-assets-controls {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }

    .quest-video-asset-select {
      min-width: 160px;
      flex: 1 1 160px;
      padding: 6px 8px;
      border: 1px solid #D1D5DB;
      border-radius: 8px;
      font-size: 11px;
      background: #FFFFFF;
    }

    .quest-video-asset-add {
      padding: 6px 10px;
      font-size: 11px;
      border-radius: 8px;
    }

    .quest-video-asset-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .quest-video-asset-empty {
      font-size: 11px;
      color: #9CA3AF;
    }

    .quest-video-asset-chip {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px 4px 4px;
      background: #FFFFFF;
      border-radius: 999px;
      border: 1px solid #E5E7EB;
      font-size: 11px;
      color: #374151;
    }

    .quest-video-asset-chip img {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      object-fit: cover;
      background: #F3F4F6;
    }

    .quest-video-asset-remove {
      border: none;
      background: transparent;
      color: #9CA3AF;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .quest-video-progress {
      display: none;
      align-items: center;
      gap: 8px;
      margin-top: 6px;
    }

    .quest-video-progress.is-visible {
      display: flex !important;
    }

    .quest-video-progress-bar {
      flex: 1;
      height: 8px;
      border-radius: 999px;
      background: #E5E7EB;
      overflow: hidden;
    }

    .quest-video-progress-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #8B5CF6, #6366F1);
      transition: width 0.4s ease;
    }

    .quest-video-progress-value {
      font-size: 11px;
      color: #6B7280;
      min-width: 32px;
      text-align: right;
    }

    .quest-video-progress-info {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      color: #6B7280;
    }

    .quest-video-progress-info [data-quest-video-base-progress-percent] {
      min-width: 32px;
      text-align: right;
      font-weight: 600;
      color: #8B5CF6;
    }

    .quest-video-progress.is-success .quest-video-progress-fill {
      background: linear-gradient(90deg, #10B981, #059669);
    }

    .quest-video-progress.is-error .quest-video-progress-fill {
      background: linear-gradient(90deg, #EF4444, #DC2626);
    }

    #questEditorModal .quest-editor-actions {
      display: flex;
      gap: 12px;
      margin-top: 16px;
    }

    #questEditorModal .quest-editor-action {
      flex: 1;
      padding: 14px;
      border-radius: 12px;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      border: none;
    }

    #questEditorModal .quest-editor-action.cancel {
      background: #F3F4F6;
      color: #6B7280;
      border: 1px solid #E5E7EB;
    }

    #questEditorModal .quest-editor-action.delete {
      background: #FEE2E2;
      color: #B91C1C;
      border: 1px solid #FCA5A5;
    }

    #questEditorModal .quest-editor-action.save {
      background: linear-gradient(135deg, #8B5CF6, #6366F1);
      color: #FFFFFF;
    }

    #questVideoPreviewModal {
      z-index: 1400;
      background: rgba(15, 23, 42, 0.82);
    }

    #questVideoPreviewModal .quest-video-preview-shell {
      width: min(96vw, 920px);
      max-height: 92vh;
      background: #0F172A;
      border: 1px solid rgba(148, 163, 184, 0.28);
      border-radius: 16px;
      box-shadow: 0 24px 56px rgba(2, 6, 23, 0.6);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    #questVideoPreviewModal .quest-video-preview-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 16px;
      background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(139, 92, 246, 0.26));
      border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    }

    #questVideoPreviewModal .quest-video-preview-title {
      font-size: 14px;
      font-weight: 700;
      color: #E5E7EB;
      line-height: 1.3;
      min-width: 0;
    }

    #questVideoPreviewModal .quest-video-preview-stage {
      padding: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 280px;
      max-height: calc(92vh - 70px);
      overflow: auto;
    }

    #questVideoPreviewModal #questVideoPreviewModalPlayer {
      width: auto;
      max-width: 100%;
      max-height: calc(92vh - 98px);
      border-radius: 12px;
      background: #000000;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
      object-fit: contain;
    }

    @media (max-width: 720px) {
      #questEditorModal .quest-editor-body {
        padding: 16px;
      }

      #questEditorModal .quest-difficulty-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      #questEditorModal .quest-reward-grid {
        grid-template-columns: 1fr;
      }

      #questEditorModal .quest-video-grid {
        grid-template-columns: 1fr;
      }

      #questEditorModal #questVideoHeroSelect {
        min-width: 100%;
      }

      #questEditorModal #questVideoBossSelect {
        min-width: 100%;
      }

      #questEditorModal .quest-video-actions-row .btn-secondary,
      #questEditorModal .quest-video-actions-row .btn-primary {
        flex: 1 1 100%;
      }

      #questEditorModal .quest-video-gender-actions .btn-primary {
        flex: 1 1 100%;
      }

      #questEditorModal .quest-video-gender-previews {
        grid-template-columns: 1fr;
      }

      #questEditorModal .quest-video-assets-controls {
        width: 100%;
      }

      #questEditorModal .quest-video-asset-add {
        width: 100%;
      }

      #questEditorModal .quest-video-boss-controls,
      #questEditorModal .quest-video-rewards-controls {
        width: 100%;
      }

      #questEditorModal #questVideoRewardSelect {
        min-width: 100%;
      }

      #questEditorModal .quest-video-reward-add {
        width: 100%;
      }

      #questVideoPreviewModal .quest-video-preview-shell {
        width: 98vw;
        max-height: 94vh;
      }

      #questVideoPreviewModal .quest-video-preview-stage {
        padding: 10px;
        min-height: 220px;
        max-height: calc(94vh - 64px);
      }

      #questVideoPreviewModal #questVideoPreviewModalPlayer {
        max-height: calc(94vh - 84px);
      }
    }

    .resource-categories {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
      gap: 20px;
    }

    .resource-category {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 16px;
    }

    .resource-category h4 {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .resource-category h4 i {
      color: #6366F1;
    }

    .resource-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .resource-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      background: #F9FAFB;
      border-radius: 8px;
    }

    .item-icon {
      font-size: 16px;
    }

    .item-name {
      flex: 1;
      font-size: 13px;
      font-weight: 500;
      color: #1F2937;
    }

    .item-tiers {
      font-size: 11px;
      color: #9CA3AF;
    }

    /* Tile System Styles */
    .tile-categories {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
      gap: 20px;
    }

    .tile-category {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 16px;
    }

    .tile-category h4 {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .tile-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
      gap: 12px;
    }

    .tile-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      cursor: pointer;
    }

    .tile-preview {
      width: 48px;
      height: 48px;
      border: 2px solid #E5E7EB;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      transition: all 0.2s;
    }

    .tile-preview.path {
      background: #FEF3C7;
      color: #92400E;
    }

    .tile-preview.building {
      background: #EEF2FF;
      color: #6366F1;
    }

    .tile-preview.deco {
      background: #D1FAE5;
      color: #059669;
    }

    .tile-item:hover .tile-preview {
      border-color: #6366F1;
      transform: scale(1.05);
    }

    .tile-item span {
      font-size: 11px;
      color: #6B7280;
    }

    /* Map Templates */
    .map-templates h4 {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 16px;
    }

    .template-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 16px;
    }

    .template-card {
      background: #FFFFFF;
      border: 2px solid #E5E7EB;
      border-radius: 12px;
      padding: 16px;
      display: flex;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .template-card:hover {
      border-color: #6366F1;
    }

    .template-card.selected {
      border-color: #6366F1;
      background: #EEF2FF;
    }

    .template-icon {
      width: 40px;
      height: 40px;
      background: #EEF2FF;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      color: #6366F1;
    }

    .template-info {
      flex: 1;
    }

    .template-name {
      font-size: 14px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 2px;
    }

    .template-desc {
      font-size: 12px;
      color: #6B7280;
    }

    .map-generator-form .form-row {
      display: flex;
      gap: 16px;
      flex-wrap: wrap;
    }

    .map-generator-form .form-group {
      flex: 1;
      min-width: 150px;
    }

    .map-generator-form label {
      display: block;
      font-size: 13px;
      font-weight: 500;
      color: #374151;
      margin-bottom: 6px;
    }

    .map-generator-form input,
    .map-generator-form select {
      width: 100%;
      padding: 10px 12px;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      font-size: 14px;
    }

    /* Map Grid Editor */
    .map-editor-header-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 12px;
    }

    .map-editor-header-row h4 {
      margin: 0;
      font-size: 18px;
      font-weight: 700;
      color: #111827;
    }

    .map-editor-header-row .btn-primary {
      height: 40px;
      padding: 0 16px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      white-space: nowrap;
    }

    .map-editor-panel {
      display: grid;
      grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
      gap: 16px;
      padding: 16px;
      border: 1px solid #E5E7EB;
      border-radius: 16px;
      background: #FFFFFF;
      margin-bottom: 24px;
      align-items: start;
    }

    .map-editor-controls {
      display: flex;
      flex-direction: column;
      gap: 12px;
      align-self: start;
      height: auto;
      max-height: 72vh;
      overflow-y: auto;
      padding: 12px;
      border: 1px solid #E5E7EB;
      border-radius: 14px;
      background: #F8FAFC;
    }

    .map-editor-field label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 6px;
    }

    .map-editor-field {
      padding: 10px;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      background: #FFFFFF;
    }

    .map-editor-input,
    .map-editor-input-row input,
    .map-editor-input-row select,
    .map-editor-field textarea {
      width: 100%;
      padding: 10px 12px;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      font-size: 13px;
      background: #F9FAFB;
      color: #1F2937;
      transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    }

    .map-editor-input,
    .map-editor-input-row input,
    .map-editor-input-row select {
      height: 40px;
    }

    .map-editor-field textarea {
      min-height: 72px;
    }

    .map-editor-input:focus,
    .map-editor-input-row input:focus,
    .map-editor-input-row select:focus,
    .map-editor-field textarea:focus {
      outline: none;
      border-color: #6366F1;
      background: #FFFFFF;
      box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
    }

    .map-editor-field input::placeholder,
    .map-editor-field textarea::placeholder {
      color: #9CA3AF;
    }

    .map-editor-input-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .map-editor-input-row input {
      flex: 1;
      min-width: 0;
    }

    .map-editor-input-row select {
      flex: 1;
      min-width: 0;
    }

    .map-editor-input-row span {
      font-size: 12px;
      color: #6B7280;
    }

    .map-editor-color-row {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .map-editor-color-row input[type="color"] {
      width: 42px;
      height: 32px;
      padding: 0;
      border: none;
      background: none;
      cursor: pointer;
    }

    .map-editor-tool-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .map-tool-btn.active {
      background: #6366F1;
      color: #FFFFFF;
      border-color: #6366F1;
    }

    .map-editor-options {
      display: flex;
      flex-direction: column;
      gap: 6px;
      font-size: 12px;
      color: #4B5563;
    }

    .map-editor-options input {
      margin-right: 6px;
    }

    .map-editor-actions {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 8px;
    }

    .map-editor-group {
      padding: 10px;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      background: #FFFFFF;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .map-editor-group-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    .map-editor-group-title {
      font-size: 12px;
      font-weight: 700;
      color: #374151;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .map-editor-resource-grid {
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 10px;
    }

    .map-editor-resource-grid .resource-card {
      flex-direction: column;
      align-items: stretch;
      border-radius: 10px;
      padding: 10px;
      gap: 8px;
      cursor: pointer;
    }

    .map-editor-resource-grid .resource-card.is-selected {
      border-color: #6366F1;
      box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
    }

    .map-editor-resource-grid .resource-card.is-placed {
      border-color: #10B981;
    }

    .map-editor-resource-grid .resource-image {
      width: 100%;
      height: 110px;
      border-radius: 10px;
    }

    .map-editor-resource-grid .resource-image img {
      object-fit: contain;
      background: #F8FAFC;
    }

    .map-editor-resource-grid .resource-info {
      width: 100%;
    }

    .map-editor-resource-grid .resource-name {
      font-size: 13px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .map-editor-resource-grid .resource-desc {
      font-size: 11px;
      margin-bottom: 6px;
    }

    .map-editor-resource-grid .resource-tags {
      gap: 4px;
    }

    .map-editor-resource-grid .resource-actions {
      width: 100%;
      justify-content: space-between;
      padding-top: 6px;
      border-top: 1px dashed #E5E7EB;
      gap: 6px;
    }

    .map-editor-resource-grid .btn-icon {
      width: 28px;
      height: 28px;
    }

    .map-editor-canvas {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 10px;
    }

    .map-editor-visuals {
      display: grid;
      grid-template-columns: minmax(320px, 1fr) minmax(220px, 0.7fr) minmax(320px, 1fr);
      gap: 12px;
      align-items: stretch;
    }

    .map-editor-preview {
      display: flex;
      flex-direction: column;
      gap: 8px;
      width: 100%;
      max-width: 100%;
      height: 100%;
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 12px;
    }

    .map-editor-title {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: #6B7280;
      align-self: flex-start;
    }

    .map-editor-stage {
      position: relative;
      width: 100%;
      max-width: 100%;
      aspect-ratio: 9 / 16;
      border: 1px dashed #CBD5F5;
      border-radius: 12px;
      background: #F8FAFC;
      overflow: hidden;
    }

    .map-editor-stage.is-placement-armed {
      cursor: crosshair;
      box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    }

    .tile-set-card.is-selected {
      border-color: #10B981;
      box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
    }

    .map-editor-stage canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      image-rendering: pixelated;
      touch-action: none;
    }

    #mapEditorCanvas {
      z-index: 1;
    }

    #mapPathCanvas {
      z-index: 2;
    }

    .map-editor-grid {
      z-index: 4;
      pointer-events: none;
    }

    .map-editor-path {
      z-index: 2;
      pointer-events: auto;
    }

    .map-placement-layer {
      position: absolute;
      inset: 0;
      z-index: 3;
      pointer-events: none;
    }

    .map-placement-node {
      position: absolute;
      border: 2px solid rgba(59, 130, 246, 0.7);
      background: rgba(59, 130, 246, 0.1);
      border-radius: 10px;
      box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
      pointer-events: auto;
      cursor: grab;
      overflow: hidden;
      display: flex;
      align-items: flex-end;
      justify-content: center;
    }

    .map-placement-node.is-new {
      animation: mapPlacementFlash 1.2s ease-in-out 0s 2;
    }

    .map-placement-node.nature {
      border-color: rgba(34, 197, 94, 0.7);
      background: rgba(34, 197, 94, 0.12);
    }

    .map-placement-node.npc {
      border-color: rgba(168, 85, 247, 0.7);
      background: rgba(168, 85, 247, 0.12);
    }

    .map-placement-node.dragging {
      cursor: grabbing;
    }

    .map-placement-node.active {
      outline: 2px solid rgba(15, 23, 42, 0.45);
      outline-offset: 2px;
    }

    @keyframes mapPlacementFlash {
      0%,
      100% {
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2), 0 0 0 0 rgba(245, 158, 11, 0);
      }
      35% {
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2), 0 0 0 4px rgba(245, 158, 11, 0.9);
      }
      70% {
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2), 0 0 0 0 rgba(245, 158, 11, 0);
      }
    }

    .map-placement-node img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      pointer-events: none;
    }

    .map-placement-label {
      position: absolute;
      left: 6px;
      bottom: 6px;
      font-size: 10px;
      font-weight: 600;
      color: #111827;
      background: rgba(255, 255, 255, 0.85);
      padding: 2px 6px;
      border-radius: 8px;
      pointer-events: none;
      max-width: calc(100% - 12px);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .map-editor-hint {
      font-size: 12px;
      color: #6B7280;
      text-align: center;
    }

    .map-editor-warning {
      font-size: 11px;
      color: #F97316;
    }

    .map-style-meta {
      font-size: 11px;
      color: #6B7280;
      margin-top: 6px;
    }

    .map-style-swatch {
      display: inline-block;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      margin-right: 4px;
      border: 1px solid rgba(15, 23, 42, 0.15);
      vertical-align: middle;
    }

    #mapStyleNotes {
      width: 100%;
      padding: 8px 10px;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      font-size: 12px;
      margin-top: 8px;
      resize: vertical;
    }

    .map-placement-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
      max-height: 180px;
      overflow-y: auto;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      padding: 8px;
      background: #F9FAFB;
      font-size: 12px;
      color: #374151;
    }

    .map-path-order {
      width: 100%;
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      min-height: 260px;
      height: 100%;
    }

    .map-path-order-hint {
      font-size: 11px;
      color: #9CA3AF;
    }

    .map-path-order-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      padding-right: 4px;
    }

    .map-path-order-item {
      display: grid;
      grid-template-columns: 44px 1fr 16px;
      align-items: center;
      gap: 8px;
      padding: 6px 8px;
      border-radius: 10px;
      border: 1px solid #E5E7EB;
      background: #F9FAFB;
      cursor: grab;
    }

    .map-path-order-item.fixed {
      cursor: default;
      opacity: 0.85;
    }

    .map-path-order-item.dragging {
      opacity: 0.55;
    }

    .map-path-order-thumb {
      width: 44px;
      height: 44px;
      border-radius: 8px;
      border: 1px solid #E5E7EB;
      background: #FFFFFF;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      color: #94A3B8;
      font-size: 18px;
    }

    .map-path-order-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .map-path-order-content {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .map-path-order-name {
      font-size: 12px;
      font-weight: 600;
      color: #111827;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .map-path-order-index {
      font-size: 10px;
      font-weight: 700;
      color: #94A3B8;
    }

    .map-path-order-meta {
      font-size: 11px;
      color: #6B7280;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
      margin-top: 2px;
    }

    .map-path-order-tag {
      padding: 2px 6px;
      border-radius: 999px;
      background: #E0E7FF;
      color: #4338CA;
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
    }

    .map-path-order-tag.nature {
      background: #DCFCE7;
      color: #166534;
    }

    .map-path-order-tag.npc {
      background: #F3E8FF;
      color: #6B21A8;
    }

    .map-path-order-tag.start {
      background: #FEE2E2;
      color: #B91C1C;
    }

    .map-path-order-handle {
      color: #94A3B8;
    }

    .map-path-order-empty {
      text-align: center;
      padding: 18px 12px;
      color: #9CA3AF;
      font-size: 12px;
      border-radius: 10px;
      border: 1px dashed #E5E7EB;
      background: #F9FAFB;
    }

    .map-placement-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
    }

    .map-placement-row input,
    .map-placement-row select {
      padding: 6px 8px;
      border: 1px solid #E5E7EB;
      border-radius: 6px;
      font-size: 12px;
    }

    .map-placement-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      padding: 6px 8px;
      border-radius: 6px;
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
    }

    .map-placement-item.active {
      border-color: #6366F1;
      box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    }

    .map-placement-item span {
      font-size: 11px;
    }

    .map-placement-remove {
      padding: 4px 6px;
      font-size: 11px;
      line-height: 1;
    }

    .map-prompt-output {
      width: 100%;
      min-height: 120px;
      padding: 10px;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      font-size: 12px;
      font-family: 'Noto Sans KR', sans-serif;
      resize: vertical;
    }

    .map-editor-result {
      width: 100%;
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-height: 260px;
      height: 100%;
    }

    .map-result-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 12px;
    }

    .map-result-card {
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 10px;
      background: #F9FAFB;
      display: flex;
      flex-direction: column;
      gap: 8px;
      align-items: center;
    }

    .map-result-title {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: #6B7280;
    }

    .map-editor-result img {
      width: 100%;
      border-radius: 10px;
      border: 1px solid #E5E7EB;
      display: none;
    }

    .map-progress {
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding: 8px 10px;
      border-radius: 10px;
      background: #F8FAFC;
      border: 1px solid #E5E7EB;
    }

    .map-progress-bar {
      width: 100%;
      height: 8px;
      background: #E2E8F0;
      border-radius: 999px;
      overflow: hidden;
    }

    .map-progress-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #38BDF8, #6366F1);
      transition: width 0.2s ease;
    }

    .map-progress-meta {
      display: flex;
      justify-content: space-between;
      font-size: 11px;
      color: #6B7280;
    }

    .stage-detail-flow {
      display: flex;
      gap: 12px;
      overflow-x: auto;
      padding-bottom: 6px;
    }

    .stage-detail-flow-item {
      min-width: 120px;
      background: #F9FAFB;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
    }

    .stage-detail-flow-thumb {
      position: relative;
      width: 90px;
      height: 160px;
      border-radius: 10px;
      overflow: hidden;
      background: #E5E7EB;
    }

	    .stage-detail-flow-thumb img {
	      position: absolute;
	      inset: 0;
	      width: 100%;
	      height: 100%;
	      object-fit: cover;
	      transition: opacity 0.35s ease;
	    }

		    .stage-detail-flow-thumb img.stage-detail-base {
		      opacity: 1;
		      object-fit: contain;
		      padding: 8px;
		      box-sizing: border-box;
		      background: rgba(255, 255, 255, 0.92);
		    }

	    .stage-detail-flow-item.is-detailed .stage-detail-flow-thumb img.stage-detail-base {
	      opacity: 1;
	    }
	
		    .stage-detail-flow-item.is-detailed .stage-detail-flow-thumb::after {
		      content: 'DONE';
	      position: absolute;
	      top: 8px;
	      right: 8px;
	      padding: 3px 6px;
	      border-radius: 999px;
	      font-size: 10px;
	      font-weight: 800;
	      letter-spacing: 0.02em;
	      color: #ffffff;
	      background: linear-gradient(135deg, #10B981, #059669);
		      box-shadow: 0 6px 16px rgba(5, 150, 105, 0.25);
		    }

	    .stage-detail-flow-thumb img.stage-detail-after {
	      inset: auto;
	      width: 40px;
	      height: 40px;
	      bottom: 8px;
	      right: 8px;
	      border-radius: 10px;
	      border: 2px solid #7C3AED;
	      box-shadow: 0 8px 20px rgba(124, 58, 237, 0.25);
	      opacity: 0;
	      transform: translateY(6px);
	      transition: opacity 0.35s ease, transform 0.35s ease;
	    }

	    .stage-detail-flow-item.is-detailed .stage-detail-flow-thumb img.stage-detail-after {
	      opacity: 1;
	      transform: translateY(0);
	    }

    .stage-detail-flow-label {
      font-size: 12px;
      color: #6B7280;
      text-align: center;
      max-width: 100px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .stage-detail-inline-progress {
      margin-top: 6px;
      padding: 6px 8px;
      border-radius: 8px;
      border: 1px solid #E5E7EB;
      background: #FFFFFF;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .stage-detail-inline-progress.is-hidden {
      display: none;
    }

    .stage-detail-inline-progress-bar {
      width: 100%;
      height: 6px;
      background: #E2E8F0;
      border-radius: 999px;
      overflow: hidden;
    }

    .stage-detail-inline-progress-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #7C3AED, #2563EB);
      transition: width 0.2s ease;
    }

    .stage-detail-inline-progress-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 10px;
      color: #6B7280;
      gap: 8px;
    }

    .stage-detail-inline-progress.is-success .stage-detail-inline-progress-fill {
      background: linear-gradient(90deg, #10B981, #059669);
    }

    .stage-detail-inline-progress.is-success .stage-detail-inline-progress-meta {
      color: #065F46;
    }

    .stage-detail-inline-progress.is-error .stage-detail-inline-progress-fill {
      background: linear-gradient(90deg, #EF4444, #DC2626);
    }

    .stage-detail-inline-progress.is-error .stage-detail-inline-progress-meta {
      color: #991B1B;
    }

    @media (max-width: 960px) {
      .map-editor-panel {
        grid-template-columns: 1fr;
      }

      .map-editor-stage {
        max-width: 100%;
      }

      .map-editor-controls {
        max-height: none;
        overflow: visible;
        padding: 12px;
      }

      .map-editor-visuals {
        grid-template-columns: 1fr;
      }

      .map-editor-preview {
        width: 100%;
      }
    }

    @media (max-width: 1200px) {
      .map-editor-visuals {
        grid-template-columns: minmax(320px, 1fr) minmax(220px, 0.7fr) minmax(320px, 1fr);
      }
    }

    .maps-list .empty-state {
      text-align: center;
      padding: 40px;
      color: #9CA3AF;
    }

    .maps-list .empty-state i {
      font-size: 48px;
      margin-bottom: 16px;
      display: block;
    }

    /* ============================================ */
    /* Sample Gallery Styles */
    /* ============================================ */
    .sample-stats {
      display: flex;
      gap: 16px;
      margin-bottom: 20px;
    }

    .sample-stats .stat-card {
      background: linear-gradient(135deg, #6366F1, #8B5CF6);
      color: white;
      padding: 16px 24px;
      border-radius: 12px;
      text-align: center;
      min-width: 120px;
    }

    .sample-stats .stat-value {
      font-size: 28px;
      font-weight: 700;
      margin-bottom: 4px;
    }

    .sample-stats .stat-label {
      font-size: 12px;
      opacity: 0.9;
    }

    .sample-filters {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 20px;
      padding-bottom: 16px;
      border-bottom: 1px solid #E5E7EB;
    }

    .sample-filter {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 16px;
      border: 1px solid #E5E7EB;
      border-radius: 20px;
      background: #FFFFFF;
      font-size: 13px;
      font-weight: 500;
      color: #6B7280;
      cursor: pointer;
      transition: all 0.2s;
    }

    .sample-filter:hover {
      border-color: #6366F1;
      color: #6366F1;
    }

    .sample-filter.active {
      background: #6366F1;
      border-color: #6366F1;
      color: white;
    }

    .sample-filter .count {
      background: rgba(0,0,0,0.1);
      padding: 2px 8px;
      border-radius: 10px;
      font-size: 11px;
    }

    .sample-filter.active .count {
      background: rgba(255,255,255,0.2);
    }

    .sample-gallery {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 16px;
    }

    .sample-card {
      background: #FFFFFF;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      overflow: hidden;
      cursor: pointer;
      transition: all 0.2s;
    }

    .sample-card:hover {
      transform: translateY(-4px);
      box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    }

    .sample-card-image {
      width: 100%;
      aspect-ratio: 1;
      object-fit: contain;
      background: #F9FAFB;
      background-image:
        linear-gradient(45deg, #E5E7EB 25%, transparent 25%),
        linear-gradient(-45deg, #E5E7EB 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #E5E7EB 75%),
        linear-gradient(-45deg, transparent 75%, #E5E7EB 75%);
      background-size: 16px 16px;
      background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    }

    .sample-card-info {
      padding: 12px;
    }

    .sample-card-name {
      font-size: 13px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .sample-card-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .sample-card-category {
      font-size: 11px;
      padding: 3px 8px;
      border-radius: 4px;
      background: #EEF2FF;
      color: #6366F1;
    }

    .sample-card-size {
      font-size: 11px;
      color: #9CA3AF;
    }

    .loading-spinner {
      text-align: center;
      padding: 60px;
      color: #9CA3AF;
    }

    .loading-spinner i {
      font-size: 32px;
      display: block;
      margin-bottom: 12px;
    }

    .spin {
      animation: spin 1s linear infinite;
    }

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

    /* Sample Modal */
    .sample-modal {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.85);
      z-index: 2000;
      display: none;
      justify-content: center;
      align-items: center;
      backdrop-filter: blur(8px);
    }

    .sample-modal.show {
      display: flex;
    }

    .sample-modal-content {
      position: relative;
      max-width: 90vw;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .sample-modal-close {
      position: absolute;
      top: -40px;
      right: 0;
      background: none;
      border: none;
      color: white;
      font-size: 24px;
      cursor: pointer;
      padding: 8px;
    }

    .sample-modal img {
      max-width: 100%;
      max-height: 70vh;
      border-radius: 12px;
      background: white;
      box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    }

    .sample-modal-info {
      margin-top: 16px;
      text-align: center;
      color: white;
    }

    .sample-modal-info h4 {
      font-size: 18px;
      font-weight: 600;
      margin-bottom: 8px;
    }

    .sample-modal-info p {
      font-size: 14px;
      opacity: 0.8;
      margin-bottom: 4px;
    }

    /* Asset Gallery Styles */
    .asset-gallery-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
    .asset-gallery-title h2 { font-size: 24px; font-weight: 700; color: #1F2937; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
    .asset-gallery-title h2 i { color: #6366F1; }
    .asset-gallery-title p { font-size: 14px; color: #6B7280; }
    .asset-gallery-actions { display: flex; gap: 8px; }
    .asset-category-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
    .asset-filter { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid #E5E7EB; border-radius: 20px; background: white; color: #6B7280; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
    .asset-filter:hover { background: #F3F4F6; border-color: #D1D5DB; }
    .asset-filter.active { background: linear-gradient(135deg, #6366F1, #8B5CF6); color: white; border-color: #6366F1; }
    .asset-stats-row { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
    .asset-stat-card { flex: 1; min-width: 120px; background: white; border: 1px solid #E5E7EB; border-radius: 12px; padding: 16px; text-align: center; }
    .asset-stat-value { font-size: 28px; font-weight: 700; color: #1F2937; margin-bottom: 4px; }
    .asset-stat-label { font-size: 12px; color: #6B7280; }
    .asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
    .asset-card { background: white; border: 1px solid #E5E7EB; border-radius: 16px; overflow: hidden; cursor: pointer; transition: all 0.3s; }
    .asset-card:hover { transform: translateY(-6px); box-shadow: 0 12px 32px rgba(0,0,0,0.12); border-color: #6366F1; }
    .asset-card-image { width: 100%; aspect-ratio: 1; object-fit: cover; background: #F9FAFB; }
    .asset-card-info { padding: 14px; }
    .asset-card-name { font-size: 14px; font-weight: 600; color: #1F2937; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .asset-card-meta { display: flex; justify-content: space-between; align-items: center; }
    .asset-card-category { font-size: 11px; padding: 4px 10px; border-radius: 6px; font-weight: 500; }
    .asset-card-category.characters { background: #DBEAFE; color: #2563EB; }
    .asset-card-category.npcs { background: #FCE7F3; color: #DB2777; }
    .asset-card-category.maps { background: #D1FAE5; color: #059669; }
    .asset-card-category.buildings { background: #FEF3C7; color: #D97706; }
    .asset-card-category.nature { background: #ECFCCB; color: #65A30D; }
    .asset-card-category.items { background: #E0E7FF; color: #4F46E5; }
    .asset-card-category.quests { background: #FEE2E2; color: #DC2626; }
    .asset-card-category.ui { background: #F3E8FF; color: #7C3AED; }
    .asset-card-type { font-size: 11px; color: #9CA3AF; }
    .asset-loading { text-align: center; padding: 80px 20px; color: #9CA3AF; }
    .asset-loading i { font-size: 40px; display: block; margin-bottom: 16px; }
    .asset-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); z-index: 2000; display: none; justify-content: center; align-items: center; backdrop-filter: blur(10px); }
    .asset-modal.show { display: flex; }
    .asset-modal-content { position: relative; background: white; border-radius: 20px; max-width: 600px; width: 90%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 25px 50px rgba(0,0,0,0.3); }
    .asset-modal-close { position: absolute; top: 16px; right: 16px; background: rgba(0,0,0,0.1); border: none; width: 36px; height: 36px; border-radius: 50%; color: white; font-size: 18px; cursor: pointer; z-index: 10; }
    .asset-modal-close:hover { background: rgba(0,0,0,0.3); }
    .asset-modal-image { width: 100%; aspect-ratio: 1; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; }
    .asset-modal-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
    .asset-modal-info { padding: 24px; }
    .asset-modal-info h3 { font-size: 20px; font-weight: 700; color: #1F2937; margin-bottom: 8px; }
    .asset-modal-info > p { font-size: 14px; color: #6B7280; margin-bottom: 8px; }
    .asset-modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
    .asset-modal-tags span { font-size: 11px; padding: 4px 10px; background: #F3F4F6; color: #6B7280; border-radius: 12px; }
    .asset-modal-actions { display: flex; gap: 12px; margin-top: 16px; }
    .asset-modal-actions button { flex: 1; }

    /* Image Generator Modal */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.6);
      z-index: 1000;
      display: flex;
      justify-content: center;
      align-items: center;
      backdrop-filter: blur(4px);
    }

    .image-generator-panel {
      background: white;
      border-radius: 16px;
      width: 90%;
      max-width: 900px;
      max-height: 90vh;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }

    .generator-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 24px;
      background: linear-gradient(135deg, #8B5CF6, #6366F1);
      color: white;
    }

    .generator-title {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 18px;
      font-weight: 600;
    }

    .generator-close {
      background: rgba(255, 255, 255, 0.2);
      border: none;
      color: white;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s;
    }

    .generator-close:hover {
      background: rgba(255, 255, 255, 0.3);
    }

    .generator-body {
      padding: 20px 24px;
      overflow-y: auto;
      flex: 1;
    }

    .generator-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }

    .gen-tab {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 10px 16px;
      border: 1px solid #E5E7EB;
      background: white;
      border-radius: 20px;
      font-size: 14px;
      color: #6B7280;
      cursor: pointer;
      transition: all 0.2s;
    }

    .gen-tab:hover {
      border-color: #8B5CF6;
      color: #8B5CF6;
    }

    .gen-tab.active {
      background: linear-gradient(135deg, #8B5CF6, #6366F1);
      color: white;
      border-color: transparent;
    }

    /* Badge/Sticker Creation Modal */
    .create-modal {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.6);
      z-index: 2000;
      display: none;
      justify-content: center;
      align-items: center;
      backdrop-filter: blur(4px);
    }
    .create-modal.show { display: flex; }
    .create-modal-content {
      background: white;
      border-radius: 20px;
      width: 90%;
      max-width: 500px;
      max-height: 90vh;
      overflow: hidden;
      box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    }
    .create-modal-header {
      padding: 20px 24px;
      background: linear-gradient(135deg, #6366F1, #8B5CF6);
      color: white;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .create-modal-header.sticker-header {
      background: linear-gradient(135deg, #FF6B9D, #FF8C42);
    }
    .create-modal-header h3 {
      font-size: 18px;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .create-modal-close {
      background: rgba(255,255,255,0.2);
      border: none;
      color: white;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      cursor: pointer;
      font-size: 18px;
    }
    .create-modal-close:hover { background: rgba(255,255,255,0.3); }
    .create-modal-body {
      padding: 24px;
      overflow-y: auto;
      max-height: 60vh;
    }

    .map-resource-picker-modal {
      max-width: 980px;
    }

    .map-resource-picker-header {
      justify-content: space-between;
    }

    .map-resource-picker-actions {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .map-resource-picker-actions .btn-secondary {
      background: rgba(255,255,255,0.2);
      border: 1px solid rgba(255,255,255,0.35);
      color: #FFFFFF;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 600;
      border-radius: 10px;
    }

    .map-resource-picker-hint {
      font-size: 12px;
      color: #6B7280;
      margin-bottom: 12px;
    }

    .map-resource-picker-grid {
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      max-height: 55vh;
      overflow-y: auto;
    }

    .map-resource-picker-card {
      cursor: pointer;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      padding: 12px;
      background: #FFFFFF;
      display: flex;
      gap: 12px;
      align-items: center;
      transition: all 0.2s ease;
    }

    .map-resource-picker-card:hover {
      border-color: #6366F1;
      box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
    }

    .map-resource-picker-image {
      width: 54px;
      height: 54px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #E5E7EB;
      background: #F8FAFC;
      flex-shrink: 0;
      overflow: hidden;
    }

    .map-resource-picker-image img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .map-resource-picker-name {
      font-size: 13px;
      font-weight: 700;
      color: #111827;
    }

    .map-resource-picker-desc {
      font-size: 11px;
      color: #6B7280;
    }
    .create-form-group {
      margin-bottom: 20px;
    }
    .create-form-group label {
      display: block;
      font-size: 14px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 8px;
    }
    .create-form-group input,
    .create-form-group textarea,
    .create-form-group select {
      width: 100%;
      padding: 12px 16px;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      font-size: 14px;
      transition: border-color 0.2s;
      box-sizing: border-box;
    }
    .create-form-group input:focus,
    .create-form-group textarea:focus { outline: none; border-color: #6366F1; }
    .create-form-group textarea { resize: vertical; min-height: 80px; }
    .color-picker-row {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }
    .color-option {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      border: 3px solid transparent;
      cursor: pointer;
      transition: all 0.2s;
    }
    .color-option:hover { transform: scale(1.1); }
    .color-option.selected {
      border-color: #1F2937;
      box-shadow: 0 0 0 2px white, 0 0 0 4px #6366F1;
    }
    .create-modal-footer {
      padding: 16px 24px;
      background: #F9FAFB;
      display: flex;
      gap: 12px;
      justify-content: flex-end;
    }
    .btn-cancel {
      padding: 12px 24px;
      background: white;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      font-size: 14px;
      font-weight: 500;
      color: #6B7280;
      cursor: pointer;
    }
    .btn-cancel:hover { background: #F3F4F6; }
    .btn-generate {
      padding: 12px 24px;
      background: linear-gradient(135deg, #6366F1, #8B5CF6);
      border: none;
      border-radius: 12px;
      font-size: 14px;
      font-weight: 600;
      color: white;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .btn-generate:hover { opacity: 0.9; }
    .btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }
    .btn-generate .spinner {
      width: 16px;
      height: 16px;
      border: 2px solid rgba(255,255,255,0.3);
      border-top-color: white;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes gritPulse {
      0%, 100% { transform: scale(1); opacity: 1; }
      50% { transform: scale(1.05); opacity: 0.9; }
    }
    @keyframes gritRotate {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }
    .preview-result {
      margin-top: 20px;
      padding: 16px;
      background: #F3F4F6;
      border-radius: 12px;
      text-align: center;
      display: none;
    }
    .preview-result.show { display: block; }
    .preview-result img {
      max-width: 150px;
      max-height: 150px;
      border-radius: 12px;
      margin-bottom: 12px;
    }
    .preview-result p {
      font-size: 14px;
      color: #10B981;
      font-weight: 500;
    }

    .element-presets {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 12px;
      margin-bottom: 20px;
    }

    .element-preset-card {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      background: #F9FAFB;
      border: 1px solid #E5E7EB;
      border-radius: 12px;
      transition: all 0.2s;
    }

    .element-preset-card:hover {
      border-color: #8B5CF6;
      box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
    }

    .preset-preview {
      width: 48px;
      height: 48px;
      background: linear-gradient(135deg, #E0E7FF, #C7D2FE);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      color: #6366F1;
    }

    .preset-info {
      flex: 1;
    }

    .preset-name {
      font-weight: 600;
      color: #1F2937;
      font-size: 14px;
    }

    .preset-desc {
      font-size: 12px;
      color: #6B7280;
      margin-top: 2px;
    }

    .generate-btn {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 8px 14px;
      background: linear-gradient(135deg, #8B5CF6, #6366F1);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: transform 0.2s, box-shadow 0.2s;
    }

    .generate-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    }

    .custom-generator {
      background: #F9FAFB;
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 20px;
    }

    .custom-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 12px;
    }

    .custom-form textarea {
      width: 100%;
      min-height: 80px;
      padding: 12px;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      font-size: 14px;
      resize: vertical;
      font-family: inherit;
    }

    .custom-form textarea:focus {
      outline: none;
      border-color: #8B5CF6;
    }

    .custom-options {
      display: flex;
      gap: 10px;
      margin-top: 12px;
      flex-wrap: wrap;
    }

    .custom-options select {
      padding: 10px 14px;
      border: 1px solid #E5E7EB;
      border-radius: 8px;
      font-size: 14px;
      background: white;
      cursor: pointer;
    }

    .custom-options select:focus {
      outline: none;
      border-color: #8B5CF6;
    }

    .generate-custom-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 10px 20px;
      background: linear-gradient(135deg, #8B5CF6, #6366F1);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      margin-left: auto;
      transition: all 0.2s;
    }

    .generate-custom-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    }

    .generation-result {
      background: #F0FDF4;
      border: 1px solid #BBF7D0;
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 20px;
    }

    .result-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }

    .result-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;
      color: #166534;
    }

    .result-actions {
      display: flex;
      gap: 8px;
    }

    .result-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 14px;
      border: 1px solid #E5E7EB;
      background: white;
      border-radius: 8px;
      font-size: 13px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .result-btn:hover {
      border-color: #10B981;
    }

    .result-btn.primary {
      background: #10B981;
      color: white;
      border-color: transparent;
    }

    .result-btn.primary:hover {
      background: #059669;
    }

    .result-content {
      display: flex;
      gap: 16px;
      flex-wrap: wrap;
    }

    .result-image {
      width: 200px;
      height: 200px;
      background: white;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      border: 1px solid #E5E7EB;
    }

    .result-image img {
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
    }

    .loading-spinner {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      color: #6366F1;
    }

    .loading-spinner i {
      font-size: 32px;
    }

    .loading-spinner span {
      font-size: 12px;
      color: #6B7280;
    }

    .spin {
      animation: spin 1s linear infinite;
    }

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

    .result-prompt {
      flex: 1;
      min-width: 200px;
      font-size: 13px;
      color: #374151;
      line-height: 1.6;
      background: white;
      padding: 12px;
      border-radius: 8px;
      max-height: 200px;
      overflow-y: auto;
    }

    .recent-generations {
      margin-top: 20px;
    }

    .recent-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;
      color: #1F2937;
      margin-bottom: 12px;
    }

    .recent-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
      gap: 10px;
    }

    .recent-item {
      aspect-ratio: 1;
      background: #F9FAFB;
      border: 1px solid #E5E7EB;
      border-radius: 10px;
      overflow: hidden;
      cursor: pointer;
      transition: all 0.2s;
    }

    .recent-item:hover {
      border-color: #8B5CF6;
      transform: scale(1.05);
    }

    .recent-item img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .recent-empty {
      grid-column: 1 / -1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      padding: 30px;
      color: #9CA3AF;
      font-size: 14px;
    }

    .recent-empty i {
      font-size: 32px;
    }

    /* ============================================ */
    /* 모바일 반응형 스타일 */
    /* ============================================ */

    /* 태블릿 (768px 이하) */
    @media (max-width: 768px) {
      /* 헤더 */
      .app-header {
        padding: 8px 12px;
      }

      .header-icon {
        width: 32px;
        height: 32px;
      }

      .header-icon i {
        font-size: 16px;
      }

      .header-title {
        font-size: 14px;
      }

      .btn-primary {
        padding: 8px 12px;
        font-size: 12px;
      }

      /* 탭 */
      .tabs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }

      .tabs {
        min-width: max-content;
      }

      .tab {
        padding: 10px 12px;
        font-size: 12px;
        white-space: nowrap;
      }

      .tab i {
        font-size: 12px;
      }

      /* 메인 컨텐츠 */
      .main-content {
        padding: 12px;
      }

      /* 스토리 카드 */
      .story-card {
        padding: 14px 16px;
      }

      .story-header {
        gap: 12px;
      }

      .story-icon {
        width: 40px;
        height: 40px;
      }

      .story-title {
        font-size: 14px;
      }

      .story-desc {
        font-size: 12px;
      }

      .story-meta {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
      }

      .meta-divider {
        display: none;
      }

      .meta-item {
        font-size: 12px;
      }

      /* 퀘스트 카드 */
      .quest-card {
        padding: 16px;
        gap: 12px;
      }

      .quest-icon {
        width: 40px;
        height: 40px;
      }

      .quest-title {
        font-size: 14px;
      }

      .quest-desc {
        font-size: 12px;
      }

      .quest-meta {
        flex-wrap: wrap;
        gap: 8px;
      }

      /* 미리보기 레이아웃 */
      .preview-layout {
        flex-direction: column;
        min-height: auto;
      }

      .preview-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
        padding: 12px;
        max-height: 200px;
        overflow-y: auto;
      }

      .preview-sidebar-title {
        font-size: 13px;
        margin-bottom: 12px;
      }

      .preview-section {
        margin-bottom: 12px;
      }

      .preview-item {
        padding: 10px 12px;
      }

      .preview-controls {
        gap: 10px;
        margin-bottom: 16px;
      }

      .preview-control-btn {
        padding: 8px 14px;
        font-size: 12px;
      }

      .preview-main {
        padding: 16px 12px;
        min-height: 600px;
      }

      .phone-mockup {
        width: 320px;
        height: 640px;
        border-radius: 36px;
        padding: 8px;
      }

      .phone-screen {
        border-radius: 30px;
      }

      /* 전체화면 - 완전한 전체화면 */
      .fullscreen-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
      }

      .fullscreen-phone {
        width: 100% !important;
        max-width: none !important;
        height: 100vh !important;
        height: 100dvh !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
      }

      .fullscreen-phone .phone-screen {
        width: 100% !important;
        height: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        border-radius: 0 !important;
      }

      .fullscreen-phone .app-preview {
        height: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        border-radius: 0 !important;
      }

      .fullscreen-phone .app-preview-nav {
        padding-bottom: max(16px, env(safe-area-inset-bottom, 16px)) !important;
      }

      /* 에디터 레이아웃 */
      .editor-layout {
        flex-direction: column;
      }

      .editor-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #F3F4F6;
        padding: 16px;
        max-height: 250px;
        overflow-y: auto;
      }

      .editor-main {
        padding: 16px;
      }

      /* 뱃지 섹션 */
      .badge-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
      }

      .badge-card {
        padding: 16px !important;
      }

      .badge-icon-large {
        width: 60px !important;
        height: 60px !important;
        font-size: 28px !important;
      }

      .badge-name {
        font-size: 13px !important;
      }

      .sticker-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
      }

      /* 테이블 */
      .events-table {
        font-size: 12px;
      }

      .events-table th,
      .events-table td {
        padding: 10px 8px !important;
      }
    }

    /* 모바일 (480px 이하) */
    @media (max-width: 480px) {
      /* 헤더 */
      .app-header {
        padding: 8px 10px;
      }

      .header-title {
        font-size: 13px;
      }

      .btn-primary {
        padding: 6px 10px;
        font-size: 11px;
      }

      .btn-primary span {
        display: none;
      }

      /* 탭 */
      .tab {
        padding: 8px 10px;
        font-size: 11px;
        flex: none;
        min-width: 70px;
      }

      .tab i {
        font-size: 14px;
      }

      /* 탭 텍스트 숨기고 아이콘만 표시 */
      .tab span:not(.tab-count) {
        display: none;
      }

      .tab-count {
        display: none;
      }

      /* 메인 컨텐츠 */
      .main-content {
        padding: 10px;
      }

      #previewTab {
        margin: -10px;
      }

      /* 스토리 카드 */
      .story-card {
        padding: 12px;
        border-radius: 10px;
      }

      .story-header {
        gap: 10px;
        margin-bottom: 10px;
      }

      .story-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
      }

      .story-icon i {
        font-size: 16px;
      }

      .story-title {
        font-size: 13px;
      }

      .story-desc {
        font-size: 11px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }

      .story-badge {
        font-size: 10px;
        padding: 3px 8px;
      }

      .story-meta {
        padding: 6px 10px;
        border-radius: 6px;
      }

      .meta-item {
        font-size: 11px;
      }

      .meta-item i {
        font-size: 12px;
      }

      /* 퀘스트 카드 */
      .quest-card {
        padding: 12px;
        border-radius: 12px;
        gap: 10px;
      }

      .quest-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 16px;
      }

      .quest-title {
        font-size: 13px;
      }

      .quest-desc {
        font-size: 11px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }

      .quest-story-tag {
        font-size: 10px;
        padding: 3px 8px;
      }

      .quest-exp {
        font-size: 12px;
      }

      .quest-arrow {
        font-size: 16px;
      }

      .epic-badge {
        font-size: 9px;
        padding: 2px 6px;
      }

      /* 미리보기 */
      .preview-sidebar {
        max-height: 150px;
        padding: 10px;
      }

      .preview-item {
        padding: 8px 10px;
        gap: 10px;
      }

      .preview-item-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
      }

      .preview-item-title {
        font-size: 13px;
      }

      .preview-item-subtitle {
        font-size: 11px;
      }

      .preview-controls {
        gap: 8px;
        margin-bottom: 12px;
      }

      .preview-controls {
        justify-content: center;
      }

      /* 모바일에서는 전체화면 버튼만 표시 */
      #zoomInBtn, #zoomOutBtn {
        display: none !important;
      }

      #fullscreenBtn {
        padding: 14px 28px;
        font-size: 15px;
        background: linear-gradient(135deg, #6366F1, #8B5CF6);
        color: white;
        border: none;
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
      }

      #fullscreenBtn i {
        font-size: 18px;
      }

      #fullscreenBtn::after {
        content: none;
      }

      .fullscreen-text {
        display: inline !important;
      }

      /* 전체화면 - 모바일 최적화 */
      .fullscreen-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: #000 !important;
        overflow: hidden !important;
      }

      .fullscreen-overlay.show {
        display: flex !important;
        flex-direction: column !important;
      }

      .fullscreen-phone {
        width: 100% !important;
        max-width: none !important;
        height: 100% !important;
        flex: 1 !important;
        min-height: 0 !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
      }

      .fullscreen-phone .phone-screen {
        width: 100% !important;
        height: 100% !important;
        flex: 1 !important;
        min-height: 0 !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
      }

      .fullscreen-phone .app-preview {
        height: 100% !important;
        flex: 1 !important;
        min-height: 0 !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
      }

      .fullscreen-phone .app-preview-body {
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
      }

      .fullscreen-phone .app-preview-nav {
        flex-shrink: 0 !important;
        padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)) !important;
        background: rgba(17, 24, 39, 0.98) !important;
      }

      .preview-main {
        padding: 12px 8px;
        min-height: 450px;
      }

      .phone-mockup {
        width: 240px;
        height: 480px;
        border-radius: 28px;
        padding: 6px;
      }

      .phone-screen {
        border-radius: 24px;
      }

      .phone-notch {
        width: 60px;
        height: 18px;
      }

      .phone-content i {
        font-size: 32px;
      }

      .phone-content p {
        font-size: 11px;
      }

      /* 에디터 */
      .editor-sidebar {
        padding: 12px;
        max-height: 200px;
      }

      .sidebar-title {
        font-size: 13px;
      }

      /* 뱃지 섹션 */
      .badge-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
      }

      .badge-card {
        padding: 14px !important;
      }

      .badge-icon-large {
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
      }

      .sticker-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
      }

      .sticker-card {
        padding: 12px !important;
      }

      /* 서브탭 */
      .badge-subtabs {
        gap: 4px !important;
        padding: 8px !important;
      }

      .badge-subtab {
        padding: 8px 12px !important;
        font-size: 12px !important;
      }

      /* 테이블 */
      .events-table {
        font-size: 11px;
        display: block;
        overflow-x: auto;
      }

      .events-table th,
      .events-table td {
        padding: 8px 6px !important;
        white-space: nowrap;
      }

      /* 폼 요소 */
      .form-group label {
        font-size: 12px;
      }

      .form-group input,
      .form-group textarea,
      .form-group select {
        font-size: 14px;
        padding: 10px 12px;
      }

      /* 버튼 그룹 */
      .btn-group {
        flex-wrap: wrap;
        gap: 8px;
      }

      .btn-group button {
        flex: 1;
        min-width: 100px;
      }
    }

    /* 작은 모바일 (360px 이하) */
    @media (max-width: 360px) {
      .header-title {
        font-size: 12px;
      }

      .tab {
        min-width: 60px;
        padding: 8px;
      }

      .phone-mockup {
        width: 200px;
        height: 400px;
      }

      .badge-subtab {
        padding: 6px 10px !important;
        font-size: 11px !important;
      }
    }

    /* 가로 모드 지원 */
    @media (max-height: 500px) and (orientation: landscape) {
      .preview-layout {
        flex-direction: row;
      }

      .preview-sidebar {
        width: 200px;
        max-height: none;
        border-right: 1px solid #E5E7EB;
        border-bottom: none;
      }

      .preview-main {
        padding-top: 20px;
      }

      .phone-mockup {
        width: 180px;
        height: 360px;
      }
    }

    /* 터치 디바이스 최적화 */
    @media (hover: none) and (pointer: coarse) {
      .story-card:hover,
      .quest-card:hover,
      .preview-item:hover {
        transform: none;
        box-shadow: none;
      }

      .story-card:active,
      .quest-card:active,
      .preview-item:active {
        background: #F9FAFB;
      }

      /* 터치 타겟 최소 크기 보장 */
      .tab,
      .btn-primary,
      .sidebar-add-btn,
      .badge-subtab {
        min-height: 44px;
      }
    }

    /* 스크롤바 스타일 (모바일) */
    @media (max-width: 768px) {
      .tabs-container::-webkit-scrollbar,
      .preview-sidebar::-webkit-scrollbar,
      .editor-sidebar::-webkit-scrollbar {
        height: 4px;
        width: 4px;
      }

      .tabs-container::-webkit-scrollbar-thumb,
      .preview-sidebar::-webkit-scrollbar-thumb,
      .editor-sidebar::-webkit-scrollbar-thumb {
        background: #D1D5DB;
        border-radius: 2px;
      }

      .tabs-container::-webkit-scrollbar-track,
      .preview-sidebar::-webkit-scrollbar-track,
      .editor-sidebar::-webkit-scrollbar-track {
        background: transparent;
      }
    }

    /* ============================================ */
    /* 스토리 상세 & 에디터 페이지 모바일 최적화 */
    /* ============================================ */

    /* 태블릿 (768px 이하) */
    @media (max-width: 768px) {
      /* 스토리 상세 레이아웃 */
      .story-detail-layout {
        flex-direction: column;
      }

      .story-detail-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
        max-height: 250px;
        overflow-y: auto;
        padding: 12px;
      }

      .story-detail-main {
        padding: 16px;
      }

      /* 스토리 헤더 */
      .story-detail-header {
        flex-direction: column;
        gap: 16px;
      }

      .story-map-container {
        width: 100%;
        height: 200px;
      }

      .story-info-panel {
        padding: 16px;
      }

      .story-info-title {
        font-size: 20px;
      }

      .story-info-desc {
        font-size: 13px;
      }

      /* 스토리 통계 */
      .story-stats {
        gap: 12px;
      }

      .story-stat {
        padding: 10px;
      }

      .story-stat-value {
        font-size: 18px;
      }

      /* NPC 그리드 */
      .npc-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
      }

      .npc-card {
        padding: 14px !important;
      }

      .npc-avatar {
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
      }

      .npc-name {
        font-size: 14px !important;
      }

      .npc-role {
        font-size: 11px !important;
      }

      .npc-dialogue {
        font-size: 12px !important;
        -webkit-line-clamp: 2 !important;
      }

      /* 상점 그리드 */
      .shop-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
      }

      .shop-card {
        padding: 14px !important;
      }

      /* 챕터 트리 */
      .chapter-header {
        padding: 8px 10px;
      }

      .chapter-icon {
        width: 24px;
        height: 24px;
        font-size: 11px;
      }

      .chapter-title {
        font-size: 12px;
      }

      .chapter-meta {
        font-size: 10px;
      }

      .quest-tree-item {
        padding: 6px 10px;
      }

      .quest-tree-icon {
        width: 22px;
        height: 22px;
        font-size: 11px;
      }

      .quest-tree-title {
        font-size: 11px;
      }

      /* 섹션 타이틀 */
      .section-title {
        font-size: 15px !important;
        margin-bottom: 12px !important;
      }

      /* 헤더 버튼 그룹 */
      .app-header > div[style*="display: flex"] {
        gap: 4px !important;
      }

      .app-header .btn-primary {
        padding: 6px 10px;
        font-size: 11px;
      }

      .app-header .btn-primary i {
        font-size: 14px;
      }

      /* 모바일에서 버튼 텍스트 숨기기 */
      .app-header .btn-primary span,
      .app-header .btn-primary:not(:has(i))::after {
        display: none;
      }
    }

    /* 모바일 (480px 이하) */
    @media (max-width: 480px) {
      /* 스토리 상세 */
      .story-detail-sidebar {
        max-height: 200px;
        padding: 10px;
      }

      .story-detail-main {
        padding: 12px;
      }

      .story-map-container {
        height: 160px;
        border-radius: 12px;
      }

      .story-map-title {
        font-size: 16px;
      }

      .story-map-subtitle {
        font-size: 12px;
      }

      .story-info-panel {
        padding: 14px;
        border-radius: 12px;
      }

      .story-info-title {
        font-size: 18px;
      }

      .story-info-desc {
        font-size: 12px;
        line-height: 1.5;
      }

      .story-video-panel .btn-primary {
        width: 100%;
        justify-content: center;
      }

      /* 스토리 통계 - 수평 스크롤 */
      .story-stats {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
      }

      .story-stat {
        flex-shrink: 0;
        min-width: 80px;
        padding: 8px;
      }

      .story-stat-icon {
        width: 32px;
        height: 32px;
      }

      .story-stat-value {
        font-size: 16px;
      }

      .story-stat-label {
        font-size: 10px;
      }

      /* 스토리 태그 */
      .story-tags {
        flex-wrap: wrap;
        gap: 6px !important;
      }

      .story-tag {
        font-size: 11px !important;
        padding: 4px 8px !important;
      }

      /* NPC 그리드 - 1열 */
      .npc-grid {
        grid-template-columns: 1fr !important;
      }

      .npc-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 12px !important;
      }

      .npc-avatar {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
        flex-shrink: 0 !important;
      }

      .npc-info {
        flex: 1;
        min-width: 0;
      }

      .npc-dialogue {
        display: none !important;
      }

      /* 상점 카드 */
      .shop-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
      }

      .shop-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
      }

      .shop-name {
        font-size: 14px !important;
      }

      .shop-owner {
        font-size: 11px !important;
      }

      .shop-items {
        flex-wrap: wrap !important;
      }

      .shop-item-badge {
        font-size: 10px !important;
        padding: 3px 6px !important;
      }

      /* 챕터 사이드바 - 가로 스크롤 */
      .story-detail-sidebar {
        display: flex;
        flex-direction: column;
      }

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

      #storyJourneyDnDHost {
        display: none;
      }

      .chapter-item {
        margin-bottom: 4px;
      }

      .quest-list {
        margin-left: 12px;
        margin-top: 6px;
      }

      /* 헤더 */
      #storyDetailPage .app-header,
      #editorPage .app-header {
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 8px;
      }

      #storyDetailPage .header-left,
      #editorPage .header-left {
        flex: 1;
        min-width: 0;
      }

      #storyDetailPage .header-title,
      #editorPage .header-title {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
      }

      .header-back {
        width: 32px;
        height: 32px;
        padding: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
      }

      /* 버튼 그룹 - 아이콘만 */
      #storyDetailPage .app-header > div:last-child {
        display: flex !important;
        gap: 4px !important;
      }

      #storyDetailPage .app-header .btn-primary,
      #editorPage .app-header .btn-primary {
        padding: 8px !important;
        min-width: 36px;
        justify-content: center;
      }

      /* AI 이미지 생성 버튼 숨기기 (모바일) */
      #openImageGenerator {
        display: none !important;
      }

      /* 섹션 타이틀 */
      .section-title {
        font-size: 14px !important;
        padding: 10px 0 !important;
      }
    }

    /* 작은 모바일 (360px 이하) */
    @media (max-width: 360px) {
      .story-detail-main {
        padding: 10px;
      }

      .story-map-container {
        height: 140px;
      }

      .story-info-title {
        font-size: 16px;
      }

      .story-stat {
        min-width: 70px;
        padding: 6px;
      }

      .story-stat-value {
        font-size: 14px;
      }

      .npc-avatar {
        width: 38px !important;
        height: 38px !important;
        font-size: 18px !important;
      }

      .npc-name {
        font-size: 13px !important;
      }

      .npc-role {
        font-size: 10px !important;
      }

      #storyDetailPage .header-title,
      #editorPage .header-title {
        max-width: 120px;
        font-size: 12px;
      }
    }

    /* 퀘스트 에디터 모바일 추가 스타일 */
    @media (max-width: 768px) {
      /* 퀘스트 폼 */
      .quest-form {
        padding: 16px;
      }

      .quest-form-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
      }

      .form-row {
        flex-direction: column;
        gap: 12px;
      }

      .form-group {
        width: 100%;
      }

      .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
      }

      .form-group input,
      .form-group textarea,
      .form-group select {
        font-size: 15px;
        padding: 12px;
        border-radius: 10px;
      }

      /* 아이콘 선택기 */
      .icon-selector {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 8px !important;
      }

      .icon-option {
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
      }

      /* 보상 입력 */
      .reward-input-group {
        flex-direction: column;
        gap: 10px;
      }

      .reward-input {
        width: 100%;
      }

      /* 액션 버튼 */
      .form-actions {
        flex-direction: column;
        gap: 10px;
      }

      .form-actions button {
        width: 100%;
        padding: 14px;
        font-size: 15px;
      }
    }

    /* 하단 고정 버튼 (모바일) */
    @media (max-width: 480px) {
      .mobile-bottom-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px;
        background: #FFFFFF;
        border-top: 1px solid #E5E7EB;
        display: flex;
        gap: 10px;
        z-index: 100;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
      }

      .mobile-bottom-actions button {
        flex: 1;
        padding: 14px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
      }

      /* 하단 버튼 있을 때 콘텐츠 패딩 */
      .has-bottom-actions {
        padding-bottom: 80px !important;
      }
    }

    /* 모바일 드로어 (챕터 목록) */
    @media (max-width: 480px) {
      .mobile-drawer-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 200;
        display: none;
      }

      .mobile-drawer-overlay.open {
        display: block;
      }

      .mobile-drawer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 70vh;
        background: #FFFFFF;
        border-radius: 20px 20px 0 0;
        z-index: 201;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        overflow: hidden;
      }

      .mobile-drawer.open {
        transform: translateY(0);
      }

      .mobile-drawer-handle {
        width: 40px;
        height: 4px;
        background: #D1D5DB;
        border-radius: 2px;
        margin: 12px auto;
      }

      .mobile-drawer-content {
        max-height: calc(70vh - 30px);
        overflow-y: auto;
        padding: 0 16px 20px;
      }

      /* 모바일에서 사이드바 숨기고 드로어로 대체 */
      .story-detail-sidebar.mobile-hidden {
        display: none;
      }

      /* 챕터 보기 버튼 */
      .mobile-chapter-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 12px;
        background: #F3F4F6;
        border: none;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        color: #4B5563;
        margin-bottom: 16px;
        cursor: pointer;
      }

      .mobile-chapter-toggle i {
        font-size: 16px;
      }
    }

    /* 데스크탑에서 모바일 전용 요소 숨기기 */
    @media (min-width: 769px) {
      .mobile-chapter-toggle {
        display: none !important;
      }

      .mobile-drawer-overlay,
      .mobile-drawer {
        display: none !important;
      }
    }

    /* 태블릿/모바일에서 챕터 토글 표시 */
    @media (max-width: 768px) {
      .mobile-chapter-toggle {
        display: flex !important;
        order: -1;
        margin: 0 0 12px 0;
      }

      .story-detail-layout {
        flex-direction: column;
      }

      /* 모바일에서 사이드바를 숨기고 드로어로 대체 */
      .story-detail-sidebar {
        display: none !important;
      }

      .story-detail-main {
        order: 1;
      }
    }

    /* 모바일 최적화 추가 */
    @media (max-width: 480px) {
      /* 스토리 상세 메인 레이아웃 조정 */
      .story-detail-layout {
        padding: 12px;
        background: #F9FAFB;
      }

      /* 모바일 챕터 토글 버튼 강조 */
      .mobile-chapter-toggle {
        background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
        border: 1px solid #C7D2FE;
        color: #4F46E5;
        font-weight: 600;
      }

      .mobile-chapter-toggle:active {
        transform: scale(0.98);
      }

      /* 드로어 내 챕터 스타일 */
      #mobileChapterTree .chapter-header {
        padding: 12px;
      }

      #mobileChapterTree .chapter-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
      }

      #mobileChapterTree .chapter-title {
        font-size: 14px;
      }

      #mobileChapterTree .chapter-meta {
        font-size: 11px;
      }

      #mobileChapterTree .quest-tree-item {
        padding: 10px 12px;
      }

      #mobileChapterTree .quest-tree-icon {
        width: 26px;
        height: 26px;
      }

      #mobileChapterTree .quest-tree-title {
        font-size: 13px;
      }
    }

    /* ============================================ */
    /* 에디터 페이지 모바일 최적화 (추가) */
    /* ============================================ */

    /* 태블릿 (768px 이하) */
    @media (max-width: 768px) {
      /* 에디터 페이지 레이아웃 */
      #editorPage .editor-layout {
        flex-direction: column;
      }

      #editorPage .editor-sidebar {
        width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
        padding: 12px;
        order: 2;
      }

      #editorPage .editor-main {
        padding: 16px;
        order: 1;
      }

      /* 배너 */
      .editor-banner {
        padding: 16px 20px;
        gap: 14px;
        margin-bottom: 20px;
      }

      .banner-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
      }

      .banner-text h2 {
        font-size: 17px;
      }

      .banner-text p {
        font-size: 13px;
      }

      /* 프리셋 그리드 - 2열 */
      .preset-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        overflow-x: visible;
        padding-bottom: 0;
      }

      .preset-card {
        min-width: unset;
        padding: 16px;
      }

      .preset-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
      }

      .preset-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
      }

      .preset-title {
        font-size: 14px;
      }

      .preset-desc {
        font-size: 12px;
        margin-bottom: 12px;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }

      .preset-ai-btn {
        font-size: 12px;
        padding: 8px 12px;
        background: #EEF2FF;
        border-radius: 6px;
        width: 100%;
        justify-content: center;
      }

      .custom-story-btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
      }

      /* 사이드바 빈 상태 */
      .sidebar-empty {
        padding: 20px;
      }

      .sidebar-empty-icon {
        width: 50px;
        height: 50px;
      }

      .sidebar-empty h3 {
        font-size: 15px;
      }

      .sidebar-empty p {
        font-size: 12px;
      }

      .sidebar-create-btn {
        padding: 10px 16px;
        font-size: 13px;
      }
    }

    /* 모바일 (480px 이하) */
    @media (max-width: 480px) {
      #editorPage .editor-main {
        padding: 12px;
      }

      #editorPage .editor-sidebar {
        padding: 10px;
      }

      /* 배너 - 세로 배치 */
      .editor-banner {
        flex-direction: column;
        text-align: center;
        padding: 16px;
        gap: 12px;
      }

      .banner-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
      }

      .banner-text h2 {
        font-size: 16px;
      }

      .banner-text p {
        font-size: 12px;
      }

      /* 프리셋 섹션 타이틀 */
      .preset-section-title {
        font-size: 14px;
        margin-bottom: 12px;
      }

      /* 프리셋 그리드 - 1열 */
      .preset-grid {
        grid-template-columns: 1fr;
        gap: 10px;
      }

      .preset-card {
        padding: 14px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
      }

      .preset-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        margin-bottom: 0;
        flex-shrink: 0;
      }

      .preset-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
      }

      .preset-title {
        font-size: 14px;
      }

      .preset-desc {
        display: none;
      }

      .preset-ai-btn {
        margin-left: auto;
        width: auto;
        padding: 8px 12px;
        font-size: 11px;
        white-space: nowrap;
      }

      .custom-story-btn {
        padding: 12px;
        font-size: 13px;
        margin-top: 8px;
      }

      /* 사이드바 헤더 */
      .sidebar-header {
        padding: 8px 0;
      }

      .sidebar-title {
        font-size: 13px;
      }

      .sidebar-add-btn {
        width: 32px;
        height: 32px;
      }

      /* AI 이미지 생성 모달 모바일 */
      .img-gen-modal .modal-body {
        padding: 12px;
      }

      .img-gen-tabs {
        gap: 4px;
        padding: 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
      }

      .img-gen-tab {
        padding: 8px 12px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
      }

      .element-preset-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
      }

      .element-preset-card {
        padding: 10px !important;
      }

      .element-preset-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
      }

      .element-preset-name {
        font-size: 11px !important;
      }

      .element-preset-category {
        font-size: 9px !important;
      }

      /* 생성 설정 섹션 */
      .generation-settings {
        padding: 12px;
      }

      .setting-group label {
        font-size: 12px;
      }

      .setting-group select,
      .setting-group input {
        font-size: 14px;
        padding: 10px;
      }

      .generate-btn {
        padding: 12px;
        font-size: 14px;
      }

      /* 결과 영역 */
      .generation-result {
        padding: 12px;
      }

      .result-image {
        max-height: 200px;
      }

      .result-actions {
        flex-direction: column;
        gap: 8px;
      }

      .result-actions button {
        width: 100%;
      }
    }

    /* 작은 모바일 (360px 이하) */
    @media (max-width: 360px) {
      .editor-banner {
        padding: 12px;
      }

      .banner-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
      }

      .banner-text h2 {
        font-size: 15px;
      }

      .preset-card {
        padding: 12px;
        gap: 10px;
      }

      .preset-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
      }

      .preset-title {
        font-size: 13px;
      }

      .preset-ai-btn {
        padding: 6px 10px;
        font-size: 10px;
      }

      .element-preset-grid {
        grid-template-columns: repeat(2, 1fr) !important;
      }

      .element-preset-card {
        padding: 8px !important;
      }

      .element-preset-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
      }

      .element-preset-name {
        font-size: 10px !important;
      }
    }

    /* 에디터 모바일 드로어 (사이드바 대체) */
    @media (max-width: 480px) {
      /* 에디터 사이드바를 하단 드로어로 변환 옵션 */
      #editorPage .editor-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 60vh;
        background: #FFFFFF;
        border-radius: 20px 20px 0 0;
        border: none;
        border-top: 1px solid #E5E7EB;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 100;
        transform: translateY(calc(100% - 60px));
        transition: transform 0.3s ease;
        padding: 0;
        order: unset;
      }

      #editorPage .editor-sidebar::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #D1D5DB;
        border-radius: 2px;
      }

      #editorPage .editor-sidebar.expanded {
        transform: translateY(0);
      }

      #editorPage .editor-sidebar .sidebar-header {
        padding: 24px 16px 12px;
        cursor: pointer;
      }

      #editorPage .editor-sidebar .sidebar-content {
        padding: 0 16px 16px;
        max-height: calc(60vh - 60px);
        overflow-y: auto;
      }

      /* 에디터 메인에 하단 여백 추가 */
      #editorPage .editor-main {
        padding-bottom: 80px;
      }
    }

    /* 터치 디바이스 최적화 - 에디터 */
    @media (hover: none) and (pointer: coarse) {
      .preset-card:active {
        transform: scale(0.98);
        background: #F9FAFB;
      }

      .preset-ai-btn:active {
        background: #C7D2FE;
      }

      .element-preset-card:active {
        transform: scale(0.95);
        background: #EEF2FF;
      }

      .custom-story-btn:active {
        background: #EEF2FF;
      }

      /* 터치 타겟 최소 크기 */
      .preset-ai-btn,
      .custom-story-btn,
      .sidebar-add-btn,
      .sidebar-create-btn {
        min-height: 44px;
      }
    }

    /* Safe Area 지원 (노치 있는 기기) */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
      @media (max-width: 480px) {
        #editorPage .editor-sidebar {
          padding-bottom: env(safe-area-inset-bottom);
        }

        .mobile-bottom-actions {
          padding-bottom: calc(12px + env(safe-area-inset-bottom));
        }

        #mobileChapterDrawer .mobile-drawer-content {
          padding-bottom: calc(20px + env(safe-area-inset-bottom));
        }
      }
    }
