/* ===== 그룹 1: 전역 변수 및 리셋 (CSS Variables & Reset) ===== */
:root{
  /* Maple equipment inventory palette */
  --maple-orange:#f8c46b;
  --maple-orange-light:rgba(248,196,107,0.25);
  --maple-orange-dark:#d99634;

  --maple-purple:#7aa9ff;
  --maple-purple-light:rgba(122,169,255,0.22);
  --maple-purple-dark:#4a7edb;

  --maple-green:#55c79a;
  --maple-green-light:rgba(85,199,154,0.2);
  --maple-green-dark:#2e9e74;

  --maple-teal:#63ced4;
  --maple-teal-light:rgba(99,206,212,0.25);
  --maple-teal-dark:#2b98a0;

  --maple-gold:#f3d98f;
  --maple-gold-light:rgba(243,217,143,0.25);
  --maple-gold-dark:#cba75b;

  --maple-red:#f67474;
  --maple-red-light:rgba(246,116,116,0.2);
  --maple-red-dark:#d15252;

  --bg-primary:#667eea;  /* body gradient colors 유지 */
  --bg-secondary:#764ba2;
  --bg-card:#ffffff;
  --bg-accent:#e5ecfa;
  --maple-panel-bg:#f4f6fb;
  --maple-panel-inner:#ffffff;
  --maple-panel-muted:#e9eef8;
  --maple-border:#d4dcec;
  --maple-shadow:0 18px 36px rgba(28,38,54,0.18);

  --text-primary:#1f2a37;
  --text-secondary:#4b5563;
  --text-muted:#7a8597;
  --text-light:#aab4c5;

  --line:#cfd6e4;
  --line-weak:#e6ebf5;
  --line-strong:#b6c0d3;

  --blue:#55adff;
  --blue-light:rgba(85,173,255,0.22);
  --blue-dark:#2f7ad8;

  --toggle-h:36px;
  --job-top-crop:24px;
  --job-card-w:210px;
  --job-card-h:240px;
  --job-bar-h:44px;
  --preview-thumb-size: 56px;
  --preview-thumb-size-mobile: 44px;
}

* {
    margin: 0;
    padding: 0;
    user-select: none;
    box-sizing: border-box;
    /* 커서 하드웨어 가속 - GPU 레이어로 분리하여 메인 스레드 블로킹과 무관하게 부드러운 커서 유지 */
    cursor: inherit;
}

html, body {
    height: 100%
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin:0;
    color:var(--text-primary);
    /* 커서를 별도 GPU 레이어로 강제 분리 */
    will-change: cursor;
}

/* 이미지 분석 중 커서 스타일 - 사용자에게 대기 상태 명확히 표시 */
body.analyzing {
    cursor: wait !important;
}

body.analyzing * {
    cursor: wait !important;
}

/* ===== 그룹 2: 레이아웃 컨테이너 (Layout Containers) ===== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--maple-panel-bg);
    border: 1px solid var(--maple-border);
    border-radius: 18px;
    box-shadow: var(--maple-shadow);
    padding: 20px;
}

.content {
    /* padding: 12px; */
    display: flex;
    flex-direction: column;
    /* gap: 20px; */
}

.panel-wrapper {
    position: relative;
    display: flex;
    /* 데스크톱 레이아웃만 최소 높이 적용 (모바일은 responsive.css에서 해제) */
    min-height: 640px;
}

.panel {
    background: var(--maple-panel-inner);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(22, 34, 51, 0.08);
    color: var(--text-primary);
}

/* 네비게이션 바 관련 스타일 */
.wf-topbar {
    top:0;
    background: linear-gradient(180deg, #dfe5f2 0%, #cfd7e6 100%);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 16px rgba(20, 30, 50, 0.12);
    z-index:10
}
.wf-container{max-width:1392px;margin:0 auto;padding:8px 12px}
.wf-nav{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    z-index: 10;
}
.wf-nav__btn{
    appearance:none;
    border:1px solid var(--line);
    background: var(--maple-panel-muted);
    color: var(--text-secondary);
    border-radius:8px;
    padding:8px 12px;
    cursor:pointer;
    transition:all 0.3s ease;
    box-shadow: inset 0 -2px 0 rgba(255,255,255,0.6);
}
.wf-nav__btn:hover{
    background:#f6f8fc;
    color:var(--text-primary);
}
.wf-nav__btn.is-active{
    background:linear-gradient(135deg, #6cb5ff 0%, #4a8ef0 100%);
    border-color:var(--blue-dark);
    color:#fff;
    box-shadow:0 10px 20px rgba(74,142,240,0.35);
}

.wf-page{display:none;}
.wf-page.is-active{display:block}
.wf-canvas{display:flex;justify-content:stretch}
.wf-frame{
    width:100%;
    min-height:1024px;
    box-shadow:0 4px 20px rgba(0,0,0,0.1);
}
.navbar{height:64px;border:1px solid var(--line);display:flex;align-items:center;padding:0 16px;background:linear-gradient(180deg,#f3f6fb,#dfe5f1);box-shadow:inset 0 -1px 0 rgba(255,255,255,0.6)}

/* 헤더 스타일 (그룹 2에서 제외, 별도 배치) */
.header {
    background: linear-gradient(180deg, #f8fafc 0%, #dfe5f1 100%);
    color: var(--text-primary);
    padding: 16px; /* 기존 30px -> 16px로 축소 */
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.8;
}


/* ===== 그룹 3: 버튼 시스템 (Button System) ===== */
.btn{appearance:none;border:1px solid var(--line);background:var(--maple-panel-muted);color:var(--text-primary);padding:10px 14px;border-radius:10px;cursor:pointer;transition:all 0.25s ease;box-shadow:inset 0 -1px 0 rgba(255,255,255,0.7)}
.btn.btn-primary{background:linear-gradient(135deg, #6cb5ff, #3f7fe0);border-color:var(--blue-dark);color:#fff;box-shadow:0 6px 16px rgba(63,127,224,0.35)}
.btn.btn-primary:disabled{opacity:.6;cursor:not-allowed;filter:grayscale(10%);box-shadow:none}
.btn.is-disabled{opacity:.55; cursor:not-allowed; position:relative}
.btn.is-disabled::before{content:""; position:absolute; left:-10%; top:50%; width:120%; height:2px; background:var(--maple-red); transform:rotate(-25deg); transform-origin:center; pointer-events:none; z-index:1}
.btn.is-disabled:hover::after{content:'추후 개발 예정'; position:absolute;left:50%;top:-30px;transform:translateX(-50%); background:var(--text-primary);color:#fff;border-radius:6px;padding:4px 8px;font-size:11px;white-space:nowrap}

.job-btn {
    position: absolute;
    top: 20px;
    right: 0;
    transform: translate(0, +12px);
    z-index: 5;
    height: 44px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px 18px 0 0;
    background: linear-gradient(180deg, #f8fafc 0%, #dfe5f1 100%);
    color: var(--text-primary);
    font-weight: 700;
    border: 1px solid var(--line);
    box-shadow: 0 6px 16px rgba(23,35,52,0.15);
    transition: transform 220ms cubic-bezier(0.2,0.8,0.2,1);
}

.skill-btn {
    position: absolute;
    top: 20px;
    right: 54px;
    transform: translate(0, +12px);
    z-index: 5;
    height: 44px;
    padding: 0 14px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 18px 18px 0 0;
    background: linear-gradient(180deg, #78c0ff 0%, #4a8ef0 100%);
    color: #fff;
    font-weight: 700;
    border: 1px solid #4a8ef0;
    box-shadow: 0 8px 18px rgba(74,142,240,0.35);
    transition: transform 220ms cubic-bezier(0.2,0.8,0.2,1);
}

.job-btn[aria-pressed="true"] {
    transform: translate(0, -20px);
}
.job-btn[aria-pressed="false"] {
    transform: translate(0, -12px);
}

.skill-btn[aria-pressed="true"] {
    transform: translate(0, -20px);
}
.skill-btn[aria-pressed="false"] {
    transform: translate(0, -12px);
}

.job-btn[aria-pressed="false"]:hover,
.skill-btn[aria-pressed="false"]:hover {
    transform: translate(0, -20px);
    outline: none;
}

/* ===== 그룹 4: 드롭존 및 업로드 (Dropzone & Upload) ===== */

/* WF1 업로드 섹션 */
.panel.upload-share-capture {
    width: 100%;
    max-width: 100%;
    height: 600px;
    margin: 16px 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: var(--maple-panel-inner);
    box-shadow: var(--maple-shadow);
    /* 업로드 패널을 컬럼 플렉스 컨테이너로 만들어 드롭존이 사용 가능한 높이를 채울 수 있도록 함 */
    display:flex;
    flex-direction:column;
    position: absolute;
    top: 16px; /* match job section position */
    left: 0px; /* match content padding */
    right: 12px; /* full width initially */
    z-index: 9; /* 직업 섹션(7)과 스킬 섹션(8) 위에 표시 */

    /* Initially covering the entire area */
    transform: translateX(0); /* normal position initially */

    /* Smooth slide animation - width와 position 변경 시 부드러운 전환 */
    transition: width 420ms cubic-bezier(.2,.9,.2,1), left 420ms cubic-bezier(.2,.9,.2,1), right 420ms cubic-bezier(.2,.9,.2,1);
}
/* 패널에 명시적 높이가 있을 때 드롭존이 남은 세로 공간을 채우도록 보장 (>800px 경우) */
.panel.upload-share-capture .dropzone{
    flex:1 1 auto; /* grow and shrink as needed */
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:0; /* allow flex children to shrink inside constrained container */
}

/* 업로드 슬롯이 드롭존 전체 영역을 차지하고 내용을 중앙 정렬하도록 함 */
.panel.upload-share-capture .upload-slot{
    flex:1 1 auto;
    min-height:0; /* override large min-heights so flex works */
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:0 12px; /* keep horizontal padding but remove large vertical padding */
}

.dropzone{
    border:2px dashed var(--line);
    border-radius:14px;
    background: #f5f7fb;
    padding:18px 20px;
    cursor:pointer;
    transition:
        background 0.28s ease,
        border-color 0.28s ease,
        box-shadow 0.28s ease,
        transform 0.28s ease;
}
.dropzone .upload-slot{cursor:pointer}

.dropzone:hover{
    background:#ffffff;
    border-color:var(--blue);
    box-shadow:0 10px 24px rgba(85,173,255,0.25);
}

.dropzone.dragover,
.dropzone.is-drag-over{
    background:#ffffff;
    border-color:var(--blue-dark);
    box-shadow:0 14px 30px rgba(47, 122, 216, 0.35);
    transform:translateY(-3px) scale(1.01);
}

.dropzone.dragover .upload-title,
.dropzone.is-drag-over .upload-title{
    color:#b45309;
}

.dropzone.dragover .upload-hint,
.dropzone.is-drag-over .upload-hint{
    color:#bc4bff;
}

.upload-share-capture .upload-title{color:#1976d2;}
.upload-share-capture .upload-hint{color:#ef4444;}

/* 좁은 화면에서 레이아웃 흐름 고려 - dropzone-note를 static으로 전환하되 중앙 정렬 유지 */

/* dropzone 컨테이너를 position:relative로 설정해 내부 절대 위치 요소가 동작하도록 함 */
.dropzone{position:relative}
.upload-icon{font-size:42px}
.upload-title{color:var(--text-primary);font-weight:600;text-align:center}
.upload-hint{color:var(--text-muted);font-size:12px;text-align:center}
.muted{color:var(--text-muted);text-align:center;line-height:1.3}
.actions{display:flex;gap:12px;margin-top:12px}

/* When upload panel slides to left after image upload */
.panel.upload-share-capture.slide-left {
    transform: translateX(0); /* stays in position but width changes */
}
.panel.upload-share-capture.compact-preview .preview-area {
    max-height: 120px; /* 더 축소된 세로 높이 */
    overflow: hidden;
    padding: 6px;
}
.panel.upload-share-capture.compact-preview .image-grid { max-height: 120px }

/* 전역적으로 preview-area 기본 세로 높이 낮춤 */
.preview-area { max-height: 160px }
.image-grid { max-height: 160px }
.panel.upload-share-capture .dropzone {
    position: relative;
    z-index: 25; /* ensure dropzone is topmost inside panel */
}

/* ===== 그룹 5: 미리보기 시스템 (Preview System) ===== */

.preview-area{border:1px solid var(--line);border-radius:12px;background:#ffffff;box-shadow:inset 0 -1px 0 rgba(255,255,255,0.6)}
.image-grid{display:flex;gap:0;overflow-x:auto;overflow-y:hidden;padding:6px 8px 6px;scroll-snap-type:x proximity;max-height:180px;background:#f5f7fb;border-radius:10px}
.image-item{position:relative;flex:0 0 auto;width:64px;border:1px solid var(--line);border-radius:8px;padding:4px;background:#ffffff;scroll-snap-align:start;min-height:60px;margin-right:4px;box-shadow:0 3px 8px rgba(24,32,44,0.08)}
.preview-canvas{display:block;width:var(--preview-thumb-size);height:var(--preview-thumb-size);margin:0 auto;border-radius:6px;background:#f8fafc;border:1px solid var(--line-weak);object-fit:cover}
.image-item{margin-left:-14px;box-shadow:0 2px 6px rgba(0,0,0,.06)}
.image-item:first-child{margin-left:0}

/* 추가 미리보기 스타일들 (그룹 5에 통합) */
.image-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: flex-start;
    max-height: 280px;
    overflow: hidden;
    padding: 5px;
    position: relative;
    min-width: 0;
}

.image-item {
    text-align: center;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 70px;
    min-height: 50px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    transform: translateZ(0);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 2px;
    position: relative;
    z-index: 1;
}

.image-item canvas {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

/* WF-1 전용 이미지 그리드 스타일 */

/* ===== 그룹 6: 직업 선택 시스템 (Job Selection System) ===== */

/* WF2 */

/* job selection section - fixed at right 2/3 position, always behind upload section */
.job-select-section {
    height: 600px; /* WF-1 안에서 세로 고정 (요청대로 600px) */
    max-height: 600px;
    position: absolute;
    top: 16px; /* match upload panel margin */
    left: calc(33.333% + 12px); /* positioned at 1/3 point + padding */
    right: 0px; /* match content padding */
    z-index: 7; /* 업로드 섹션(9) 아래, 스킬 섹션(8) 위에 표시 */
    margin: 16px 0px;
    background: var(--maple-panel-inner);
    border-radius: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    box-shadow: var(--maple-shadow);
    overflow: hidden; /* 스크롤 없게 */
    transition: height 260ms ease, opacity 220ms ease;
    
    /* Always visible but covered by upload panel initially */
    visibility: visible;
    opacity: 1;
    
    /* Smooth slide animation - width와 left 변경 시 부드러운 전환 */
    transition: width 420ms cubic-bezier(.2,.9,.2,1), left 420ms cubic-bezier(.2,.9,.2,1);
}

/* WF-2: 버튼형 탭 + 내부 이미지(중앙부 크롭) */
.tabs{display:grid;grid-template-columns:repeat(6,1fr);gap:12px;margin-bottom:16px}
.tab{appearance:none;border:1px solid var(--line);background:var(--maple-panel-muted);border-radius:12px;padding:8px 10px;cursor:pointer;text-align:center;width:100%;color:var(--text-secondary);transition:all 0.25s ease;display:grid;grid-template-rows:64px auto;gap:6px;align-items:center;justify-items:center;box-shadow:inset 0 -1px 0 rgba(255,255,255,0.6)}
.tab .label{font-weight:800;font-size:14px}
.tab.is-selected{background:linear-gradient(135deg, #6cb5ff, #4a8ef0);border-color:var(--blue-dark);color:#fff;box-shadow:0 10px 20px rgba(74,142,240,0.3)}
.tab-with-image .tab-thumb{width:100%;height:64px;overflow:hidden;border-radius:10px;background:transparent;border:1px solid transparent;display:flex;align-items:center;justify-content:center}
.tab-with-image .tab-thumb img{width:100%;height:100%;object-fit:contain;object-position:center var(--y,35%);background:transparent}
/* 이미지 숨김 애니메이션: 화면이 충분히 좁아지면 이미지가 부드럽게 사라지고 레이블만 남김 */
.char_tab .job-tabs-list a.tab-with-image img{
    /* 기본 상태에서 애니메이션 가능하도록 max-height/opacity 전환 준비 */
    max-height:76px;
    opacity:1;
    transition: max-height .35s ease, opacity .25s ease, transform .25s ease;
    display:block;
}

/* 모바일 높이 보정 */
.job-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px 20px;justify-content:flex-start}
.job-card{width:var(--job-card-w);height:var(--job-card-h);border:1px solid var(--line);border-radius:12px;position:relative;overflow:hidden;background:#fdfefe;box-shadow:0 10px 18px rgba(20,30,50,0.12);transition:transform 0.2s ease, box-shadow 0.2s ease;will-change:transform;transform:translateZ(0)}
.job-thumb{width:100%;height:calc(var(--job-card-h) - var(--job-bar-h));background:linear-gradient(180deg,#f0f4fb 0%,#e0e6f2 100%);position:relative;overflow:hidden;border-radius:12px 12px 0 0}
.job-thumb img{width:100%;height:calc((var(--job-card-h) - var(--job-bar-h)) + var(--job-top-crop));object-fit:cover;display:block;border-radius:0 12px 0 0;transform:translateY(calc(-1 * var(--job-top-crop)))}
.job-bar{position:absolute;left:0;right:0;bottom:0;height:var(--job-bar-h);background:linear-gradient(180deg,#6cb5ff 0%,#4a8ef0 100%);color:#fff;display:flex;align-items:center;justify-content:center;border-radius:0 0 12px 12px}
.job-title{font-size:13px;font-weight:800;letter-spacing:.2px;line-height:1}

/* 반응형 조정: 직업 카드의 이미지 및 카드 크기를 화면 폭에 따라 유연하게 축소 */
.job-grid{
    grid-template-columns: repeat(auto-fit, minmax(clamp(120px, 18vw, 220px), 1fr));
    gap: 12px;
}

:root{
    /* 카드 크기 clamp fallback: 최소/권장/최대 */
    --job-card-w-min: 120px;
    --job-card-w-max: 260px;
    --job-card-h-min: 150px;
}

.job-card{
    width: clamp(var(--job-card-w-min), 22vw, var(--job-card-w));
    height: auto; /* 높이를 내용에 맞게 유연화 */
    display:flex;
    flex-direction:column;
}

.job-thumb{height: auto; aspect-ratio: 4 / 5; /* 일정 비율 유지 */}
.job-thumb img{height:100%; width:100%; object-fit:cover;}
.job-bar{height: clamp(34px, 4.2vw, var(--job-bar-h));}
.job-title{font-size: clamp(11px, 1.2vw, 13px);}

/* 직업 탭 시스템 */
.char_tab{margin-bottom:16px}
.char_tab .job-tabs-list{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:24px;list-style:none;padding:0;margin:0}
.char_tab .job-tabs-list li{display:block;flex:0 0 auto}
.char_tab .job-tabs-list .job-tab{display:block;flex:0 0 auto}
.char_tab .job-tabs-list a{display:grid;grid-template-rows:64px auto;gap:6px;align-items:center;justify-items:center;text-decoration:none;border-radius:999px;padding:8px 16px;background:#f3f4f6;color:var(--text-primary);transition:all .25s ease;overflow:visible}
.char_tab .job-tabs-list a.tab-with-image{position:relative}
.char_tab .job-tabs-list a.tab-with-image img{height:76px;width:auto;object-fit:contain;display:block;background:transparent;pointer-events:none;filter:drop-shadow(0 1px 2px rgba(0,0,0,.08));max-width:100%;}

/* ===== job-pill 통일 스타일 (이미지 왼쪽, 텍스트 오른쪽) ===== */
.char_tab .job-tabs-list{display:flex;align-items:center;gap:12px;flex-wrap:nowrap;overflow-x:visible;overflow-y:visible;scrollbar-width:none;-ms-overflow-style:none;padding:0;margin:0}
.char_tab .job-tabs-list li{overflow:visible}
.char_tab .job-tabs-list a.job-pill,
.char_tab .job-tabs-list a.tab-with-image{position:relative}
.char_tab .job-tabs-list a.job-pill:hover,
.char_tab .job-tabs-list a.job-pill:focus,
.char_tab .job-tabs-list a.job-pill.is-selected,
.char_tab .job-tabs-list a.tab-with-image:hover,
.char_tab .job-tabs-list a.tab-with-image:focus,
.char_tab .job-tabs-list a.tab-with-image.is-selected{z-index:5}
.char_tab .job-tabs-list::-webkit-scrollbar{display:none}

.char_tab .job-tabs-list li{display:block;flex:0 0 auto}

.char_tab .job-tabs-list a.job-pill {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(15,23,42,0.04);
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
    min-width: clamp(88px, 10vw, 160px);
    max-width: clamp(140px, 20vw, 260px);
    height: 56px;
    box-sizing: border-box;
    overflow: visible;
    flex: 0 1 auto;
}

.char_tab .job-tabs-list a.job-pill img {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 12px;
    margin: 0;
    z-index: 0;
    pointer-events: none;
}

.char_tab .job-tabs-list a.job-pill .label {
    display: block;
    flex: 1;
    position: relative;
    z-index: 1;
    text-align: left;
    font-size: 16px;
    line-height: 1;
    color: inherit;
    padding-left: 44px;
    padding-right: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 컴팩트 모드: 필이 컨테이너를 벗어날 때 이미지를 숨겨 한 줄 레이아웃 유지 */
.char_tab .job-tabs-list.compact a.job-pill img {
    max-width: 0;
    max-height: 0;
    width: auto;
    height: auto;
    opacity: 0;
    margin: 0;
    transition: opacity .25s ease, max-width .35s ease, max-height .35s ease;
    pointer-events: none;
}

.char_tab .job-tabs-list.compact a.job-pill {
    min-width: 120px;
    max-width: 200px;
    padding-left: 12px;
}

.char_tab .job-tabs-list a.job-pill:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(2,6,23,0.12);
}

.char_tab .job-tabs-list a.job-pill.is-selected,
.char_tab .job-tabs-list a.job-pill[aria-pressed="true"] {
    background: linear-gradient(180deg, #fff6e0 0%, #ffdf8a 100%);
    color: #1f2937;
    border-color: rgba(0,0,0,0.06);
}

/* === 박스 폴백: 공간이 매우 부족하면 네모칸(텍스트만)으로 정리 === */
.char_tab .job-tabs-list.boxed{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 0;
}
.char_tab .job-tabs-list.boxed li{flex: 0 0 auto; width: 100%}
.char_tab .job-tabs-list.boxed .job-tab{flex: 0 0 auto; width: 100%}
.char_tab .job-tabs-list.boxed a.job-pill{
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-width: 0;
    max-width: none;
    padding: 0 10px;
    border-radius: 10px;
}
.char_tab .job-tabs-list.boxed a.job-pill img{
    max-width: 0;
    max-height: 0;
    opacity: 0;
    width: auto;
    height: auto;
    margin: 0;
    transition: opacity .2s ease, max-width .25s ease, max-height .25s ease;
    pointer-events: none;
}
.char_tab .job-tabs-list.boxed a.job-pill .label{padding:0;text-align:center;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}


/* 작은 화면에서 이미지가 탭 컨테이너를 벗어나지 않도록 방지 */
.char_tab .job-tabs-list a .label{font-weight:800;font-size:14px}
.char_tab .job-tabs-list a.is-selected{background:#2f3651;color:#fff}
.char_tab .job-tabs-list a:hover{transform:translateY(-2px)}

/* 배지 및 칭호 시스템 */
.badge{position:absolute;top:0;left:8px;height:54px;padding:6px 4px 4px;font-size:11px;color:#fff;display:flex;align-items:center;justify-content:center;border-radius:6px 6px 0 0;writing-mode:vertical-rl;transform:rotate(180deg);box-shadow:0 2px 6px rgba(0,0,0,.15)}
.badge-archer{background:linear-gradient(135deg, var(--maple-orange), var(--maple-orange-dark))}
.badge-warrior{background:linear-gradient(135deg, var(--maple-red), var(--maple-red-dark))}
.badge-wizard{background:linear-gradient(135deg, var(--maple-purple), var(--maple-purple-dark))}
.badge-thief{background:linear-gradient(135deg, var(--maple-teal), var(--maple-teal-dark))}
.badge-pirate{background:linear-gradient(135deg, var(--maple-green), var(--maple-green-dark))}
.pill{position:absolute;top:8px;right:8px;border-radius:16px;padding:2px 8px;background:linear-gradient(135deg, var(--maple-teal), var(--maple-teal-dark));color:#fff;font-size:11px;font-weight:700}
.job-card .badge, .job-card .pill{display:none}
.job-card.selected{outline:2px solid var(--blue-dark);outline-offset:0;box-shadow:0 8px 24px rgba(74,142,240,0.35);transform:scale(1.02)}
.job-card:hover{transform:translateY(-2px) translateZ(0);box-shadow:0 10px 24px rgba(0,0,0,.18)}

/* 넥슨 구조 호환 리스트 (jobGrid = .char_info_list_item) */
.job-select-section .char_info_list_item {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--col-w), var(--col-w)));
    --item-height: clamp(105px, 12vh + 2rem, 160px);
    --col-w: clamp(105px, 8vw + 1rem, 135px);
    gap: clamp(6px, 1vw, 10px);
    margin: 0 auto;
    padding: 0;
    justify-content: space-around;
    list-style: none;
    --job-bar-h: 34px;
}

.job-select-section .char_info_list_item li {
    width: auto;
    height: auto;
    float: none;
    position: relative;
    background: url('https://lwi.nexon.com/maplestory/guide/char_list_top.png') center top no-repeat;
    margin: 0;
    transition: all .5s ease;
}

.job-select-section .char_info_list_item li a {
    display: block;
    height: auto;
    aspect-ratio: 190/206;
    position: relative;
    border-radius: 0 12px 0 12px;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    cursor: pointer;
}

.job-select-section .char_info_list_item li a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: calc(100% - 44px);
    background: linear-gradient(135deg, rgba(255,179,102,0.1), rgba(212,160,255,0.1));
    transition: background .25s ease;
    pointer-events: none;
}

.job-select-section .char_info_list_item li img {
    display: block;
    width: 100%;
    object-fit: cover;
    transform: none;
}

.job-select-section .char_info_list_item li span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 34px;
    background: linear-gradient(180deg, #6cb5ff 0%, #4a8ef0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .25s ease;
    padding: 0 6px;
    box-sizing: border-box;
}

.job-select-section .char_info_list_item li span::after {
    content: "";
    position: absolute;
    right: 0;
    top: -16px;
    width: 0;
    height: 0;
    border-right: 28px solid #4a8ef0;
    border-top: 16px solid transparent;
}

.job-select-section .char_info_list_item li span em {
    font-style: normal;
    color: #fff;
    font-weight: 800;
    font-size: clamp(11px, 1.2vw, 16px);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.job-select-section .char_info_list_item li:hover {
    transform: translateY(-4px);
}

.job-select-section .char_info_list_item li:hover a::before {
    background: linear-gradient(135deg, rgba(108,181,255,0.25), rgba(74,142,240,0.25));
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    z-index: 1;
    position: absolute;
    pointer-events: none;
    content: "";
    display: block;
}

.job-select-section .char_info_list_item li:hover span {
    background: linear-gradient(135deg, #8fd0ff 0%, #4a8ef0 100%);
}

.job-select-section .char_info_list_item li:hover span::after {
    border-right-color: #4a8ef0;
}

.job-select-section .char_info_list_item:after {
    content: "";
    display: block;
    clear: both;
}

.job-select-section .char_info_list_item li.selected a {
    outline: 2px solid var(--blue-dark);
    outline-offset: -2px;
    box-shadow: 0 10px 22px rgba(74, 142, 240, 0.35);
}


/* 넥슨 구조 호환 리스트 (jobGrid = .char_info_list_item) */
/* char_info_list_item 크기 - 동적 조절로 모든 카드 표시 */
.job-select-section
.char_info_list_item {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--col-w), var(--col-w)));
    --item-height: clamp(105px, 12vh + 2rem, 160px); /* 아이템 높이 동적 조절 */
    --col-w: clamp(105px, 8vw + 1rem, 135px); /* 너비 동적 조절 */
    gap: clamp(6px, 1vw, 10px); /* gap 동적 조절 */
    /* max-height 제한 제거: 모든 카드가 표시되도록 */
    margin: 0 auto;
    padding: 0;
    justify-content: space-around;
    list-style: none;
    --job-bar-h: 34px;
}

.job-select-section
.char_info_list_item li {
    width: auto;
    height: auto;
    float: none;
    position: relative;
    background: url('https://lwi.nexon.com/maplestory/guide/char_list_top.png') center top no-repeat;
    margin: 0;
    /* 성능 최적화: all 대신 transform만 애니메이션, 시간 단축 */
    transition: transform 0.2s ease;
    /* GPU 가속 활성화 */
    will-change: transform;
    transform: translateZ(0);
}

.job-select-section
.char_info_list_item li a {
    display: block;
    height: auto;
    aspect-ratio: 190/206;
    position: relative;
    border-radius: 0 12px 0 12px;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    cursor: pointer;
}

.job-select-section
.char_info_list_item li a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: calc(100% - 44px);
    background: linear-gradient(135deg, rgba(255,179,102,0.1), rgba(212,160,255,0.1));
    transition: background .25s ease;
    pointer-events: none;
}

.job-select-section
.char_info_list_item li img {
    display: block;
    width: 100%;
    object-fit: cover;
    transform: none;
}

.job-select-section 
.char_info_list_item li span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 34px;
    background: linear-gradient(180deg, var(--maple-orange) 0%, var(--maple-orange-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .25s ease;
    padding: 0 6px;
    box-sizing: border-box;
}

.job-select-section
.char_info_list_item li span::after {
    content: "";
    position: absolute;
    right: 0;
    top: -16px;
    width: 0;
    height: 0;
    border-right: 28px solid var(--maple-orange-dark);
    border-top: 16px solid transparent;
}

.job-select-section
.char_info_list_item li span em {
    font-style: normal;
    color: #fff;
    font-weight: 800;
    font-size: clamp(11px, 1.2vw, 16px);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.job-select-section
.char_info_list_item li:hover {
    /* GPU 가속된 transform만 사용 */
    transform: translateY(-4px) translateZ(0);
}

.job-select-section
.char_info_list_item li:hover a::before {
    background: linear-gradient(135deg, rgba(255,179,102,0.3), rgba(212,160,255,0.3));
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    z-index: 1;
    position: absolute;
    pointer-events: none;
    content: "";
    display: block;
}

.job-select-section
.char_info_list_item li:hover span {
    background: linear-gradient(135deg, var(--maple-purple) 0%, var(--maple-purple-dark) 100%);
}

.job-select-section
.char_info_list_item li:hover span::after {
    border-right-color: #4a8ef0;
}

.job-select-section
.char_info_list_item:after {
    content: "";
    display: block;
    clear: both;
}

.job-select-section
.char_info_list_item li.selected a {
    outline: 2px solid var(--blue-dark);
    outline-offset: -2px;
    box-shadow: 0 10px 22px rgba(74,142,240,0.35);
}

/* ===== 그룹 7: 토스트 및 알림 (Toast & Notifications) ===== */

.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:linear-gradient(135deg, var(--maple-orange), var(--maple-purple));color:#fff;padding:10px 14px;border-radius:10px;display:flex;gap:12px;align-items:center;box-shadow:0 8px 24px rgba(0,0,0,.2);z-index:20}
.toast.hidden{display:none}
.toast-undo{appearance:none;border:0;background:linear-gradient(135deg, var(--maple-teal), var(--maple-teal-dark));color:#fff;border-radius:8px;padding:6px 10px;cursor:pointer}

/* ===== 그룹 8: 스킬 선택 시스템 (Skill Selection System) ===== */

.skill-selection-section {
    height: 600px; /* WF-1 안에서 세로 고정 (요청대로 600px) */
    max-height: 600px;
    overflow: auto;
    transition: height 260ms ease, opacity 220ms ease;
    position: absolute;
    top: 16px;
    left: calc(33.333% + 12px); /* positioned at 1/3 point + padding */
    right: 0px; /* match content padding */
    z-index: 8; /* 업로드 섹션(9) 아래, 직업 섹션(7) 위에 표시 */
    margin: 16px 0px;
    border: 1px solid var(--line);
    background: var(--maple-panel-inner);
    display: none;
    border-radius: 14px;
    box-shadow: var(--maple-shadow);
    
    /* Always visible but covered by upload panel initially */
    visibility: visible;
    opacity: 1;
}

.skill-selection-section.hidden {
    /* 숨김 상태는 max-height/opacity로 부드럽게 전환하도록 유지
       display:none는 JS에서 필요한 경우에만 직접 설정하도록 허용
       (즉, CSS에서 강제 제거하지 않음) */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    /* display는 제거하여 transition이 동작하게 함 */
}

.skill-selection-section skillGridContainer {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* 버튼의 aria-pressed가 true일 때 표시되도록 보장 */
#skillBtn[aria-pressed="true"] + .skill-selection-overlay,
#skillBtn[aria-pressed="true"] ~ .skill-selection-overlay {
    display: block !important;
    max-height: 640px;
    opacity: 1;
}

/* 스킬 그리드 (필수/선택) */
.skill-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);    
    gap: 6px; /* 기본 gap을 더 타이트하게 */
}

/* 스킬 그리드 내 스킬 이름 오버플로우 처리 - 타이트한 레이아웃에 맞게 조정 */
.skill-grid .skill-item .skill-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 50px); /* 패딩과 아이콘을 고려한 더 타이트한 값 */
    min-width: 0;
    flex: 1;
}

.skill-selection-section .skill-grid .skill-item .skill-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 50px);
    min-width: 0;
    flex: 1;
}

.skill-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* 스택 토글(2중첩/3중첩) 미니 스위치 */

.skill-toolbar .toggle-btn button:hover {
    background: rgba(0, 0, 0, 0.04);
}

.skill-toolbar .toggle-btn #stackToggleSlider {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: #3b82f6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: transform 0.25s ease;
    pointer-events: none;
    border-radius: 0;
}

.skill-toolbar .toggle-btn[data-state="right"] #stackToggleSlider {
    transform: translateX(100%);
}

/* 액션 버튼 컨테이너 */
.skill-toolbar .action-buttons {
    display: flex;
    width: 300px;
    flex-direction: column;
    align-items: center;
}

.skill-toolbar .action-buttons .stack-switch {
    width: 100%;
    height: 36px;
}

.skill-toolbar .action-buttons .toggle-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 0 0;
    border-radius: 10px 10px 0 0;
    background: #f3f4f6;
    box-shadow: 1.34783px 1.34783px 2.69565px 0 rgba(24,24,24,0.08) inset, -2.69565px -2.69565px 4.04348px 0 rgba(255,255,255,0.80) inset;
    user-select: none;
    overflow: hidden;
}

.skill-toolbar .action-buttons .toggle-btn button {
    width: 50%;
    background: transparent;
    border: 0;
    font-size: 14px;
    font-weight: 600;
    padding: 0 16px;
    height: 100%;
    cursor: pointer;
}

.skill-toolbar .action-buttons .toggle-btn span {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    border-radius: 134.783px;
    background: linear-gradient(135deg, var(--maple-orange), var(--maple-purple));
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform .3s ease, width .3s ease;
    padding: 0 16px;
    pointer-events: none;
}

.skill-toolbar .action-buttons .toggle-btn[data-state="left"] span {
    transform: translateX(0);
}

.skill-toolbar .action-buttons .toggle-btn[data-state="right"] span {
    transform: translateX(100%);
}

.skill-toolbar .action-buttons #startOptimizationBtn {
    grid-column: 2;
    justify-self: center;
    width: 100%;
    font-size: 2rem; /* 기존 3.5rem -> 2rem */
    border-radius: 0;
    border: 0;
}

.skill-toolbar .action-buttons #clearSelectionBtn {
    display: none;
}

.skill-toolbar .action-buttons .btn {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.skill-toolbar .action-buttons #clearSelectionBtn {
    display: none; /* default hidden until JS shows it */
    background: #6c757d;
    color: white;
}
.skill-toolbar .action-buttons #startOptimizationBtn img.start-btn-icon {
    height: 80px;
    vertical-align: middle;
}

.skill-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.skill-row{display:flex;align-items:center;gap:8px}
.skill-row .icon{width:18px;height:18px;border:1px solid var(--line-weak);border-radius:4px;background:linear-gradient(135deg, var(--maple-teal-light), var(--maple-purple-light))}

/* 스킬 선택 UI - 선택되지 않은 스킬을 흐리게 표시 */
.skill-item:has(input[type="checkbox"]:not(:checked)) {
    opacity: 0.5;
    filter: grayscale(0.3);
}

.skill-item:has(input[type="checkbox"]:not(:checked)):hover {
    opacity: 0.7;
    filter: grayscale(0.1);
}

/* 구형 브라우저 지원을 위한 대체 방법 */
.skill-item input[type="checkbox"]:not(:checked) ~ * {
    opacity: 0.6;
}

.skill-item:hover input[type="checkbox"]:not(:checked) ~ * {
    opacity: 0.8;
}

.skill-selection-section .result-card {
    background: rgba(255, 255, 255, 0.98);
    border: 0;
    box-shadow: none;
}

.skill-item {
    /* Replaced inline JS styles: base skill item */
    position: relative; /* label을 절대위치로 배치하기 위한 컨테이너 */
    display: flex;
    align-items: center;
    height: 52px;
    max-height: 52px;
    overflow: hidden;
    gap: 8px;
    padding: 8px; /* 패딩을 더 타이트하게 */
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--line-weak);
    height: 52px; /* 높이를 더 타이트하게 */
    max-height: 52px; /* 최대 높이 제한 */
    overflow: hidden;
}

/* skill-selection-manager.js에서 이동한 구체 스타일들 */
.skill-image {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    display: block;
}

.skill-icon-fallback {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.skill-checkbox {
    margin: 0;
    flex-shrink: 0;
    display: none; /* 기존 동작 유지: 화면에서 보이지 않음 */
}

.skill-label-wrapper {
    cursor: pointer;
    flex: 1;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-weight: 400;
}

.skill-item.main-skill {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border-color: #ffb74d;
}

.skill-item.sub-skill {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    border-color: #ba68c8;
}

.skill-icon {
    flex-shrink: 0;
    position: relative;
}

.skill-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.85rem;
}

.skill-type {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 600;
}

.main-skill .skill-type {
    background: #ff9800;
    color: white;
}

.sub-skill .skill-type {
    background: #9c27b0;
    color: white;
}

/* 스킬 선택 리스트(.skill-item) 전용 라벨: 절대 위치로 우측 정렬 */
.skill-item .skill-category-label {
    position: absolute;
    right: 3%;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 0; /* 절대위치이므로 margin 제거 */
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    pointer-events: none; /* 라벨에 마우스 이벤트가 가지 않도록 함 */
    z-index: 0; /* 스킬 이름보다 뒤에 위치 */
    opacity: 0.52; /* 약간 투명하게 하여 텍스트 가독성 확보 */
    text-align: center; /* 텍스트를 중간(가운데) 정렬 */
}

.skill-category-label.required {
    background-color: #dc3545;
    color: white;
}

.skill-category-label.optional {
    background-color: #28a745;
    color: white;
}

#skillGridContainer {
    display: flex;
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
}


/* ===== 그룹 9: 결과 표시 시스템 (Result Display System) ===== */

.result-section{border:1px solid var(--line);background:var(--maple-panel-inner);border-radius:14px;padding:16px;box-shadow:0 8px 18px rgba(23,35,52,0.12)}
.ok-title{margin:0 0 4px;color:var(--text-primary);font-size:18px;font-weight:800}
.ok-desc{margin:0 0 12px;color:var(--text-secondary);font-size:12px;font-weight:600}
.result-subtitle{margin:12px 0 8px;font-size:14px;font-weight:800;color:var(--text-primary)}
.combo-cards{display:grid;grid-template-columns:repeat(3,208px);gap:12px}
.combo-card{border:1px solid var(--line);border-radius:10px;padding:10px;width:208px;background:#ffffff;box-shadow:0 6px 14px rgba(24,32,44,0.08)}
.combo-head{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.core-icon{width:20px;height:20px;border:1px solid var(--line-weak);border-radius:4px;background:linear-gradient(135deg, var(--maple-teal-light), var(--maple-purple-light))}
.meta{font-size:11px;font-weight:700;color:var(--text-muted)}
.meta-warn{color:var(--maple-red)}
.chip{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:2px 8px;font-size:10px;font-weight:800;color:#fff}
.chip-danger{background:linear-gradient(135deg, var(--maple-red), var(--maple-red-dark))}
.stat-cards{display:grid;grid-template-columns:repeat(3,280px);gap:12px}
.stat-card{border:1px solid var(--line);border-radius:10px;padding:12px;width:280px;background:#ffffff;box-shadow:0 6px 14px rgba(24,32,44,0.08)}
.stat-title{color:var(--text-muted);font-size:12px;font-weight:700}
.stat-value{font-size:16px;font-weight:800;color:var(--text-primary)}
.skill-chips{display:flex;gap:8px;flex-wrap:wrap}
.chip-outline{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:10px;padding:8px 10px}
.chip-outline .label{font-size:12px;font-weight:700}
.chip-outline .count{font-size:12px;font-weight:700}

/* 스킬 선택 UI - 선택되지 않은 스킬을 흐리게 표시 */
.skill-category-label.optional {
    background-color: #28a745;
    color: white;
}

#skillGridContainer {
    display: flex;
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
}

/* === WF-3 모드 3단 토글 슬라이더 === */
.skill-toolbar .mode-toggle{display:flex;align-items:center;}
.three-stage-toggle{position:relative;display:inline-grid;grid-template-columns:repeat(3,1fr);width:300px;height:36px;background:#f3f4f6;overflow:visible; border-bottom: none;}
.three-stage-toggle .mode-labels{display:contents}
.three-stage-toggle .mode-labels span{display:flex;align-items:center;justify-content:center;font-size:14px;color:#374151;cursor:pointer;user-select:none}
.three-stage-toggle .toggle-slider{position:absolute;top:0;left:0;width:33.3333%;height:100%;background:#3b82f6;color:#fff;display:flex;align-items:center;justify-content:center;font-weight:600;transition:transform .25s ease;pointer-events:none}

/* WF-3 가이드 배지 (말풍선) */
.mode-badge{display:inline-flex;align-items:center;margin-left:6px;padding:3px 8px;border-radius:8px;font-size:11px;font-weight:800;vertical-align:middle;line-height:1;position:relative;white-space:nowrap}
.mode-badge.recommended{background:#ffd84d;color:#1b1b1b;border:1px solid #ccac18;box-shadow:0 1px 2px rgba(0,0,0,.12)}
.mode-badge.recommended:before{content:"";position:absolute;left:-7px;top:50%;transform:translateY(-50%);width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-right:7px solid #ffd84d}
.mode-badge.recommended:after{content:"";position:absolute;left:-8px;top:50%;transform:translateY(-50%);width:0;height:0;border-top:8px solid transparent;border-bottom:8px solid transparent;border-right:8px solid #ccac18}

/* 배지를 토글 위로 띄워 슬라이더와 겹치지 않게: 중앙 라벨 기준 절대 배치 */
.three-stage-toggle .guide-label{position:relative}
.three-stage-toggle .guide-label .mode-badge{position:absolute;margin:0;top:-26px;left:50%;transform:translateX(-50%);z-index:3}
.three-stage-toggle .toggle-slider{z-index:2}
/* 위쪽 꼬리(아웃라인 포함)로 변경 */
.three-stage-toggle .guide-label .mode-badge.recommended:before{left:50%;top:100%;transform:translateX(-50%);border-left:7px solid transparent;border-right:7px solid transparent;border-right-color:transparent;border-left-color:transparent;border-top:7px solid #ffd84d;border-bottom:0}
.three-stage-toggle .guide-label .mode-badge.recommended:after{left:50%;top:calc(100% + 1px);transform:translateX(-50%);border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #ccac18;border-bottom:0}

/* WF-3: 모드 설명(#modeDescription)을 어떤 레이아웃에서도 토글 아래로 고정 */
.skill-selection-section #modeDescription,
.current-mode-description{display:block;width:100%;clear:both}
/* flex 컨텍스트일 때 줄바꿈 강제 */
.skill-selection-section #modeDescription{flex-basis:100%;order:2}
.skill-selection-section .skill-toolbar{order:1}
/* grid 컨텍스트일 때 한 줄 전체 차지 */
.skill-selection-section #modeDescription{grid-column:1/-1}

.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mode-toggle .optimization-mode-settings {
  margin-bottom: 0;
}

.mode-toggle #modeDescription {
  width: 300px;
  padding: 0px 12px;
  background: #f8f9fa;
  border-radius: 0 0 8px 8px;
  border-left: 4px solid #007bff;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  border-top: none;
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  font-weight: 700;
}


.file-input {
    display: none;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.control-group {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.control-group h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}
/* WF-2 전용: 분석 버튼 비활성화 시 확실한 회색 처리 */
#analyzeBtn:disabled {
    background: #9aa0a6 !important;
    border-color: #9aa0a6 !important;
    color: #f1f5f9 !important;
    filter: grayscale(10%);
}

.results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.result-card {
    height: 100%;
    background: white;
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-top: 4px solid #4facfe;
}

.result-card h3 {
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
}

.result-card .icon {
    font-size: 1.5rem;
    margin-right: 10px;
    color: #4facfe;
}


/* 썸네일 시스템 - 한 줄에 15개 배치, 공간 부족시 겹치기 */
.image-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: flex-start;
    max-height: 280px;
    overflow: hidden;
    padding: 5px;
    position: relative;
    /* 15개가 들어갈 최소 공간 계산: 15 * (70px + 2px) = 1080px */
    min-width: 0; /* flex 축소 허용 */
}

/* 데스크톱 - 공간에 따라 겹치기 조절 */

/* 모바일 최적화 */

/* 아주 작은 화면에서는 더 많이 겹치기 */

/* 처리된 이미지 영역을 위한 preview-card 스타일 유지 */
.preview-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.preview-card h4 {
    color: #333;
    margin-bottom: 15px;
}

/* 처리된 이미지용 캔버스 스타일 */
#processedCanvas {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    /* 🎯 픽셀아트 화질 보존을 위한 렌더링 최적화 */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.stats-grid {
    display: grid;
    gap: 12px;
}

.stat-item {
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}


/* ===== 그룹 10: 진행률 바 시스템 (Progress Bar System) ===== */

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    width: 0%;
    transition: width 0.3s ease;
}

.log-area {
    background: #f6f8fc;
    color: #1f2a37;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    height: 200px;
    overflow-y: auto;
    margin-top: 20px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}



/* 처리된 이미지 영역 스타일 (기존 방식 유지) */
#processedArea.preview-area:not(.hidden) {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
    background: transparent;
    padding: 0;
    box-shadow: none;
}


/* 로딩 상태 스타일 */
.loading-state {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #4facfe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.loading-status {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
    min-height: 20px;
}

/* 처리된 결과 스타일 */
.processed-result {
    text-align: center;
}

/* 로딩 상태의 프로그레스바 스타일 개선 */
.loading-state .progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.loading-state .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(79, 172, 254, 0.4);
}

/* 설정 버튼 스타일 */
.settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

#optimizationProgress {
    display: none;
    margin-top: 10px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative; /* 텍스트를 내부에 절대배치하기 위함 */
}

#progressFill {
    width: 0%;
    height: 100%;
    background-color: #4CAF50;
    transition: width 0.3s ease;
    border-radius: 10px;
    position: relative;
    z-index: 1;
}

/* 프로그레스바 내부 텍스트 - 중앙 정렬, 대비 확보 */
.progress-bar-text,
#progressText {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3; /* fill보다 위에 렌더링 */
    color: #ffffff; /* 밝은 텍스트로 대비 확보 */
    font-weight: 700;
    font-size: 0.95rem;
    text-shadow: 0 2px 6px rgba(0,0,0,0.45);
    pointer-events: none; /* 텍스트에 마우스이벤트 전달 방지 */
}

/* 프로그레스바 내부에서 작은 보조 텍스트(세부 상태)를 우측에 표시할 경우 */
.progress-bar .progress-subtext {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.9);
    font-size: 0.8rem;
    z-index: 3;
}

/* ===== 5단계 스텝 인디케이터 스타일 ===== */
.step-indicator-container {
    width: 100%;
    padding: 20px 0;
    margin: 20px 0;
}

.step-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.step-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50px;
    right: 50px;
    height: 4px;
    background: #e9ecef;
    z-index: 0;
}

.step-progress-line {
    position: absolute;
    top: 20px;
    left: 50px;
    right: 50px;
    height: 4px;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    z-index: 1;
    transition: width 0.5s ease;
    width: 0%;
    max-width: calc(100% - 100px);
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-node {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    border: 4px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    color: #999;
    transition: all 0.3s ease;
    position: relative;
}

.step-node.completed {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.step-node.completed::after {
    content: '✓';
    font-size: 1.2rem;
}

.step-node.in-progress {
    background: #FF9800;
    border-color: #FF9800;
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 152, 0, 0);
    }
}

.step-label {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    text-align: center;
    transition: color 0.3s ease;
}

.step-item.completed .step-label {
    color: #4CAF50;
}

.step-item.in-progress .step-label {
    color: #FF9800;
}

.step-status-message {
    text-align: center;
    margin-top: 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    min-height: 30px;
}

/* ===== 그룹 11: 모달 시스템 (Modal System) ===== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px 25px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.setting-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}

.setting-select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.setting-select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.current-setting {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #4facfe;
    margin-top: 10px;
}

.current-setting strong {
    color: #333;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e1e8ed;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* 모바일 반응형 모달 */

/* 반응형 아틀라스 배치 스타일 */
.atlas-responsive-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.atlas-responsive-container > div {
    text-align: center;
    flex: 1;
}

/* 아틀라스 캔버스의 최대 크기 제한 */
.atlas-responsive-container canvas {
    max-width: 224px;
    max-height: 160px;
    border: 2px solid #666;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* 화면이 768px 이상일 때 아틀라스를 가로로 배치 */

/* 스킬 선택 UI - 선택되지 않은 스킬을 흐리게 표시 */
.skill-item:has(input[type="checkbox"]:not(:checked)) {
    opacity: 0.5;
    filter: grayscale(0.3);
}

.skill-item:has(input[type="checkbox"]:not(:checked)):hover {
    opacity: 0.7;
    filter: grayscale(0.1);
}

/* 구형 브라우저 지원을 위한 대체 방법 */
.skill-item input[type="checkbox"]:not(:checked) ~ * {
    opacity: 0.6;
}

.skill-item:hover input[type="checkbox"]:not(:checked) ~ * {
    opacity: 0.8;
} 

#skillGridContainer {
    display: flex;
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
}

.optimization-results {
    margin: 20px 0;
    position: relative;
    z-index: 9;
}

.optimization-results .result-card {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 16px rgba(40, 167, 69, 0.2);
    margin-bottom: 20px;
}

.optimization-results .result-card h3 {
    color: #28a745;
    border-bottom: 2px solid #28a745;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.optimization-section {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.optimization-section h4 {
    color: #007bff;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.combination-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.combination-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

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

.combination-title {
    font-weight: 600;
    color: #495057;
}

.combination-score {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.combination-cores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.core-tag {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
}

.core-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}

.core-number {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}


.validation-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.validation-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.validation-status.valid {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}


.summary-stat {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.efficiency-ranking {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.ranking-header {
    background: linear-gradient(135deg, #ffc107, #ff8f00);
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    text-align: center;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.ranking-item:hover {
    background-color: #f8f9fa;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-position {
    background: #007bff;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.ranking-position.gold {
    background: linear-gradient(135deg, #ffd700, #ffb300);
}

.ranking-position.silver {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
}

.ranking-position.bronze {
    background: linear-gradient(135deg, #cd7f32, #b8722c);
}

.ranking-details {
    flex: 1;
    margin-left: 12px;
}

.ranking-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 2px;
}

.ranking-subtitle {
    font-size: 0.85rem;
    color: #6c757d;
}

.ranking-score {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h4 {
    margin-bottom: 8px;
    color: #495057;
}

.empty-state p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 미달성 스킬 카드 스타일 */
.missing-skills-section {
    margin-top: 20px;
}

.missing-skills-section h5 {
    color: #e74c3c;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 1.1rem;
}

.missing-skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.missing-skill-card {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border: 1px solid #e17055;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(225, 112, 85, 0.1);
    transition: all 0.3s ease;
    opacity: 0.9;
}

.missing-skill-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(225, 112, 85, 0.2);
    opacity: 1;
}

.missing-skill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(225, 112, 85, 0.2);
}

.missing-skill-title {
    font-weight: 600;
    color: #d63031;
    font-size: 0.9rem;
}

.missing-skill-status {
    font-size: 0.8rem;
    color: #e74c3c;
    font-weight: 500;
}

.missing-skill-content {
    padding: 5px 0;
}

.missing-skill-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.missing-skill-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.missing-skill-name {
    font-weight: 600;
    color: #2d3436;
    font-size: 0.95rem;
}

.missing-skill-type {
    font-size: 0.8rem;
    color: #636e72;
    font-style: italic;
}

.missing-skill-item .skill-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    opacity: 0.7;
    filter: grayscale(30%);
}

.missing-skill-item .skill-icon-placeholder {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(225, 112, 85, 0.2);
    border-radius: 6px;
    font-size: 1.2rem;
    opacity: 0.7;
}


/* 효율성 평가 시스템 스타일 - Task 30.5 */
/* 기본 성공 스타일 (가이드 모드 기본값) */
.optimization-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #b8dabc;
    border-radius: 10px;
    padding: 20px;
}

.optimization-failure {
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
    border: 1px solid #f1aeb5;
    border-radius: 10px;
    padding: 20px;
}

.optimization-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 성공/실패 공통: 통계 카드 좌측 파란 보더 강조 (스크린샷과 동일하게) */
.optimization-stats .stat-card {
    border-left: 4px solid #4facfe;
}

/* 통계 아이템이 1~2개만 있을 때도 좌우 빈 공간 없이 꽉 차도록 */
.optimization-stats .stat-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.optimization-stats .stat-label {
    margin-bottom: 0;
}

.optimization-stats .stat-value {
    font-size: 1.15rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
    display: block;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.efficiency-breakdown {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 15px;
}

.efficiency-breakdown h6 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1rem;
}

.breakdown-grid {
    display: grid;
    gap: 12px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-label {
    font-weight: 500;
    color: #2c3e50;
    flex: 1;
}

.breakdown-score-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 2;
}

.breakdown-score {
    font-weight: 600;
    color: #2c3e50;
    min-width: 40px;
    text-align: right;
}

.breakdown-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.breakdown-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.breakdown-weight {
    font-size: 0.8rem;
    color: #6c757d;
    min-width: 35px;
    text-align: center;
}

/* 효율성 순위 스타일 */
.ranking-container {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ranking-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 12px 15px;
    display: grid;
    grid-template-columns: 60px 1fr 100px 120px;
    gap: 15px;
    font-weight: 600;
    font-size: 0.9rem;
}

.ranking-list {
    max-height: 400px;
    overflow-y: auto;
}

.ranking-item {
    display: grid;
    grid-template-columns: 60px 1fr 100px 120px;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
    transition: background-color 0.2s ease;
}

.ranking-item:hover {
    background-color: #f8f9fa;
}

.ranking-item.top-three {
    background: linear-gradient(135deg, #fff3cd, #fdf2d9);
}

.ranking-item:last-child {
    border-bottom: none;
}

.rank-number {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    color: #2c3e50;
}

.rank-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rank-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.rank-cores {
    font-size: 0.8rem;
    color: #6c757d;
}

.rank-combination {
    font-size: 0.75rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.rank-score {
    font-size: 1.1rem;
    font-weight: 600;
    color: #28a745;
}

.rank-score-bar {
    width: 60px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.rank-score-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.rank-breakdown {
    display: flex;
    justify-content: center;
}

.breakdown-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 0.75rem;
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mini-label {
    color: #6c757d;
    font-size: 0.7rem;
}

.mini-value {
    color: #2c3e50;
    font-weight: 600;
}

.ranking-more {
    padding: 12px 15px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

/* 실패 전용 구형 통계 블록 제거 -> 성공/실패 공통 .optimization-stats/.stats-grid 사용 */
.failure-stats { display: none; }

.error-message {
    color: #721c24;
    font-weight: 500;
    margin-bottom: 10px;
}

/* 30.7.4: 향상된 진행률 표시 및 로딩 인디케이터 - 2025 트렌드 */
.enhanced-progress-container {
    /* 글라스모피즘 + 네온 그라데이션 */
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.95) 0%, 
        rgba(118, 75, 162, 0.95) 50%,
        rgba(102, 126, 234, 0.95) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 24px;
    padding: 32px;
    margin: 24px 0;
    color: white;
    
    /* 네온 글로우 효과 */
    box-shadow: 
        0 8px 32px rgba(102, 126, 234, 0.4),
        0 0 60px rgba(118, 75, 162, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    
    /* 테두리 글로우 */
    border: 1px solid rgba(255, 255, 255, 0.18);
    
    /* 부드러운 등장 애니메이션 */
    animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* 미세한 배경 애니메이션 */
    background-size: 200% 200%;
    animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
               gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

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

.enhanced-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.enhanced-progress-title {
    font-size: 1.4em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.3px;
}

.enhanced-progress-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: white;
    border-right-color: rgba(255, 255, 255, 0.8);
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.enhanced-progress-cancel-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 0.95em;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.enhanced-progress-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.enhanced-progress-cancel-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.enhanced-progress-bar-container {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    height: 14px;
    margin: 16px 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.enhanced-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        #10b981 0%, 
        #34d399 25%, 
        #6ee7b7 50%, 
        #34d399 75%, 
        #10b981 100%);
    background-size: 200% 100%;
    border-radius: 16px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 
        0 0 20px rgba(16, 185, 129, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(16, 185, 129, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
        background-position: 0% 50%;
    }
    50% {
        box-shadow: 
            0 0 30px rgba(16, 185, 129, 0.8),
            0 0 60px rgba(52, 211, 153, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
        background-position: 100% 50%;
    }
}

.enhanced-progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    animation: progress-shimmer 1.5s ease-in-out infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.enhanced-progress-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
    font-size: 0.95em;
}

.enhanced-progress-stat {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.enhanced-progress-stat:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.enhanced-progress-stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.enhanced-progress-stat-label {
    opacity: 0.9;
    font-size: 0.9em;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.enhanced-progress-message {
    text-align: center;
    margin-top: 16px;
    font-style: italic;
    opacity: 0.95;
    font-size: 1.05em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

.enhanced-performance-metrics {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
    font-size: 0.9em;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.enhanced-performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.enhanced-performance-item {
    text-align: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.enhanced-performance-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.enhanced-performance-value {
    display: block;
    font-weight: 700;
    font-size: 1.3em;
    color: #10b981;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    margin-bottom: 4px;
}

.enhanced-performance-label {
    opacity: 0.85;
    font-size: 0.85em;
    margin-top: 4px;
    font-weight: 500;
}

/* 향상된 버튼 스타일 */
.enhanced-calc-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    position: relative;
    overflow: hidden;
}

.enhanced-calc-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.enhanced-calc-btn:hover::before {
    left: 100%;
}

.enhanced-calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.enhanced-calc-btn:disabled {
    background: #6c757d;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.enhanced-calc-btn.processing {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3); }
    50% { box-shadow: 0 6px 25px rgba(255, 193, 7, 0.5); }
    100% { box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3); }
}

.enhanced-calc-btn.completed {
    background: linear-gradient(135deg, #28a745, #20c997);
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
} 

/* === 향상된 최적화 결과 표시 스타일 === */
.core-item.enhanced {
    background: rgba(248, 249, 250, 0.95);
    padding: 24px;
    border-radius: 16px;
    border: 2px solid rgba(52, 144, 220, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(8px);
}

.core-number {
    font-weight: 700;
    font-size: 1.4rem;
    color: #2c5aa0;
    text-shadow: none;
    margin-bottom: 4px;
}

.core-location {
    font-size: 1rem;
    color: #495057;
    font-weight: 500;
    text-shadow: none;
    background: rgba(108, 117, 125, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.core-skills.enhanced {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.skill-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid rgba(222, 226, 230, 0.6);
}

.skill-row:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.skill-row.main {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 5px solid #f39c12;
    border-color: rgba(243, 156, 18, 0.3);
}

.skill-row.sub {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 5px solid #3498db;
    border-color: rgba(52, 152, 219, 0.3);
}

.skill-label {
    font-weight: 700;
    min-width: 70px;
    color: #2c3e50;
    text-shadow: none;
    font-size: 1rem;
    text-align: center;
    background: rgba(52, 73, 94, 0.1);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(52, 73, 94, 0.2);
}

.skill-display {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.skill-display.unknown {
    opacity: 0.5;
}

.skill-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    background: white;
}

.skill-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

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

.skill-icon-placeholder {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #6c757d;
    text-shadow: none;
}

.skill-names {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.skill-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #2c3e50;
    line-height: 1.25;
}

.skill-name-en {
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
    opacity: 0.85;
}

.no-cores-message {
    text-align: center;
    padding: 40px;
    font-size: 1.1rem;
    color: #6c757d;
    background: rgba(248, 249, 250, 0.9);
    border-radius: 12px;
    border: 2px dashed rgba(108, 117, 125, 0.3);
    backdrop-filter: blur(5px);
    font-weight: 500;
}

/* 향상된 애니메이션 효과 */
.core-item.enhanced {
    animation: slideInUp 0.5s ease-out;
}

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


/* 스킬 타입별 특별 효과 */
.skill-row.main .skill-icon {
    border-color: #f39c12;
    box-shadow: 0 3px 12px rgba(243, 156, 18, 0.3);
}

.skill-row.sub .skill-icon {
    border-color: #3498db;
    box-shadow: 0 3px 12px rgba(52, 152, 219, 0.3);
}

.skill-row.main .skill-label {
    background: rgba(243, 156, 18, 0.15);
    border-color: rgba(243, 156, 18, 0.3);
    color: #d68910;
}

.skill-row.sub .skill-label {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.3);
    color: #2980b9;
}

/* 다음 버튼을 오른쪽으로 정렬하는 CTA 행 */
.cta-row {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

/* ===== 그룹 12: 유틸리티 클래스 (Utility Classes) ===== */

/* 자동 설정 섹션 - 통합된 토글 구역 */
.auto-settings-section {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  margin-top: 5px;
  margin-bottom: 5px;
}

.auto-job-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.auto-skill-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}
.switch{position:relative;display:inline-block;width:44px;height:24px}
.switch input{opacity:0;width:0;height:0}
.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:var(--line-weak);border-radius:999px;transition:.2s}
.slider:before{position:absolute;content:"";height:18px;width:18px;left:3px;top:3px;background:var(--bg-card);border-radius:50%;transition:.2s}
.switch input:checked + .slider{background:linear-gradient(135deg, var(--maple-orange), var(--maple-purple))}
.switch input:checked + .slider:before{transform:translateX(20px)}
.switch-label{font-size:12px;color:var(--text-muted)}

.hidden {
    display: none !important;
}

/* ===== 그룹 13: 레거시 플레이스홀더 스타일 ===== */

/* 디버그 전용 레거시 플레이스홀더 오버레이 */

#legacy-dom-placeholders {
    display: none;
}

#legacy-dom-placeholders div {
    font-weight: 700;
    margin-bottom: 6px;
    color: #93c5fd;
}

#atlasProgressBar {
    width: 0%;
}


/* ===== 그룹 15: 최적화 결과 스타일 ===== */

/* WF-1 내부 조합 결과 표시 - panel-wrapper 아래에 배치 */
#wf-1 .panel-result {
    position: relative; /* 또는 absolute - 상황에 따라 선택 */
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
    width: 100%;
    box-sizing: border-box;
    z-index: 5;
}

#wf-1 .panel-result.show-results {
    display: block;
}

#wf-1 .panel-result #optimizationResultsSection {
    margin: 0;
    padding: 0;
    height: auto;
    max-height: none;
    background: transparent;
    border: none;
    box-shadow: none;
}

#wf-1 .panel-result .result-section {
    background: transparent;
    border: none;
    padding: 0;
}


/* === 최적화 결과 전용 스타일 === */
.optimization-results-section {
    margin: 15px 0;
    padding: 0;
    position: relative;
    z-index: 10;
    background: #f8fff8;
    border: 2px solid #28a745;
    border-radius: 8px;
}

.optimization-results-container {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
}

.optimization-results-container h3 {
    margin: 0 0 8px 0;
    color: #155724;
    font-size: 1.2em;
}

/* === 모드별 성공 스타일 (트렌디한 글래스모피즘 디자인) === */

/* 정확 모드 성공 - 파란색 글래스모피즘 */
.optimization-results-container.exact-mode-success {
    --accent-color-1: #007bff;
    --accent-color-2: #0056b3;
    
    /* 글래스모피즘 배경 */
    background: linear-gradient(135deg, 
        rgba(207, 226, 255, 0.95) 0%, 
        rgba(182, 212, 254, 0.95) 100%);
    backdrop-filter: blur(10px) saturate(180%);
    
    /* 부드러운 테두리 */
    border: 2px solid rgba(0, 123, 255, 0.3);
    border-radius: 20px;
    
    /* 다층 섀도우로 입체감 */
    box-shadow: 
        0 8px 32px rgba(0, 123, 255, 0.2),
        0 2px 8px rgba(0, 123, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    
    /* 부드러운 등장 애니메이션 */
    animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.optimization-results-container.exact-mode-success h3 {
    color: var(--accent-color-2);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 가이드 모드 성공 - 녹색 글래스모피즘 */
.optimization-results-container.guide-mode-success {
    --accent-color-1: #28a745;
    --accent-color-2: #20c997;
    
    background: linear-gradient(135deg, 
        rgba(212, 237, 218, 0.95) 0%, 
        rgba(195, 230, 203, 0.95) 100%);
    backdrop-filter: blur(10px) saturate(180%);
    border: 2px solid rgba(40, 167, 69, 0.3);
    border-radius: 20px;
    box-shadow: 
        0 8px 32px rgba(40, 167, 69, 0.2),
        0 2px 8px rgba(40, 167, 69, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.optimization-results-container.guide-mode-success h3 {
    color: var(--accent-color-2);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 유연 모드 성공 - 주황색 글래스모피즘 */
.optimization-results-container.flexible-mode-success {
    --accent-color-1: #ff9800;
    --accent-color-2: #f57c00;
    
    background: linear-gradient(135deg, 
        rgba(255, 224, 178, 0.95) 0%, 
        rgba(255, 204, 128, 0.95) 100%);
    backdrop-filter: blur(10px) saturate(180%);
    border: 2px solid rgba(255, 152, 0, 0.3);
    border-radius: 20px;
    box-shadow: 
        0 8px 32px rgba(255, 152, 0, 0.2),
        0 2px 8px rgba(255, 152, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.optimization-results-container.flexible-mode-success h3 {
    color: var(--accent-color-2);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 성공 컨테이너 내부 요소들 트렌디 스타일 */
.optimization-results-container .results-summary,
.optimization-results-container .optimization-stats {
    backdrop-filter: blur(5px);
    border-radius: 16px;
    margin-top: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.optimization-results-container .stat-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.optimization-results-container .core-item {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: slideInUp 0.5s ease-out;
}

/* 애니메이션 정의 (fadeInUp가 없다면 추가) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.optimization-cores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 4px;
}

.optimization-cores-grid .core-item {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #28a745;
    border-radius: 4px;
    padding: 6px;
    font-size: 0.9em;
    line-height: 1.2;
}

.optimization-cores-grid .core-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    margin-bottom: 4px;
    color: #155724;
    font-size: 1em;
    line-height: 1.1;
}

.optimization-cores-grid .core-skills {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 4px;
}

.optimization-cores-grid .skill-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin: 4px 0;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9em;
    line-height: 1.2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    transform: translateZ(0);
}

.optimization-cores-grid .skill-card.main {
    background: linear-gradient(135deg, #fff9c4 0%, #ffeaa7 100%);
    border-color: #fdcb6e;
    color: #2d3436;
    font-weight: 600;
}

.optimization-cores-grid .skill-card.sub {
    background: linear-gradient(135deg, #dfe6e9 0%, #b2bec3 100%);
    border-color: #74b9ff;
    color: #2d3436;
    font-weight: 500;
}

.optimization-cores-grid .skill-card .skill-icon {
    width: 32px;
    height: 32px;
    overflow: visible;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.optimization-cores-grid .skill-card .skill-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

.optimization-cores-grid .skill-card .skill-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.optimization-cores-grid .skill-card .skill-name {
    font-size: 13px;
    color: #495057;
    flex: 1;
}

.optimization-cores-grid .skill-card .skill-icon-fallback {
    display: none;
    width: 32px;
    height: 32px;
    background: transparent;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #999;
    font-weight: normal;
    text-align: center;
    line-height: 32px;
}

.core-image-container img {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 6px;
    object-fit: contain;
    display: block;
}

.clear-results-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s;
}

.clear-results-btn:hover {
    background: #5a6268;
}

/* ==== Debug-only legacy placeholder overlay ==== */

/* === 최적화 결과 Nodestone 아이콘 스타일 === */
.result-nodestone-icon {
    height: 1em;
    vertical-align: top;
    margin: 0 2px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    transition: all 0.2s ease;
    position: relative;
    top: 0.1em;
}

.result-nodestone-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* === 스킬별 중첩 카드 스타일 === */
.nested-skill-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: none;
    border-radius: 4px;
    background: transparent;
}

.nested-skill-item .skill-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.nested-skill-item .skill-name {
    font-size: 13px;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-nesting-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 2;
    background: #111827;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.skill-nesting-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 4px;
}

.stat-item.skill-nesting-container {
    grid-column: 1 / -1;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

/* === 최적화 결과 컨테이너 스타일 === */
.optimization-result {
    margin-top: 20px;
    padding: 20px;
    border: 2px solid #28a745;
    border-radius: 8px;
    background: #f8fff8;
}

.optimization-result h4 {
    color: #28a745;
    margin-bottom: 15px;
}

.optimization-result h5 {
    margin-top: 15px;
}

.optimal-cores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.optimal-core-card {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
}

/* === 이미지 분석 중 오버레이 스타일 === */
.analysis-overlay {
    background: linear-gradient(135deg, #4A90E2 0%, #5CA8FF 100%);
    border: 2px solid #2E7DD2;
}

.analysis-overlay-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.analysis-overlay h2 {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 16px;
    color: white;
}

.analysis-overlay p {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.95);
}

.analysis-spinner {
    width: 40px;
    height: 40px;
}

/* === 코어 이미지 컨테이너 스타일 === */
.core-image-container {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.loading-core-image {
    font-size: 16px;
    color: #666;
}

.core-image-error {
    font-size: 12px;
    color: #999;
}

/* === 스킬 이름 컨테이너 스타일 === */
.skill-names {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.skill-name-en {
    display: none;
}

/* === 빈 스킬 메시지 스타일 === */
.no-skills-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 20px;
}

/* 🎯 결과 테이블 캔버스 공통 픽셀아트 렌더링 최적화 */
.results canvas,
table canvas,
td canvas,
tr canvas {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
}

/* 코어 분석 결과 캔버스 전용 스타일 */
canvas[id*="extractedCore"],
canvas[id*="matchedCore"] {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
}

.skill-name {
    font-size: 13px;
    color: #495057;
    flex: 1;
    position: relative; /* 라벨보다 위에 보이게 하기 위한 stacking context */
    z-index: 2;
}

/* 최적화 결과 카드(.skill-card) 내 라벨은 인라인 배치 */
.optimization-cores-grid .skill-card .skill-name-container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.optimization-cores-grid .skill-card .skill-category-label {
    position: static;
    transform: none;
    margin-left: 8px;
    opacity: 0.9;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ===== 그룹 16: 모드 실패 메시지 스타일 (Mode Failure Styles) ===== */

/* 모던 애니메이션 */
@keyframes modeFailureFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 공통 모드 실패 카드 - 트렌디한 디자인 */
/* ===== 카드 기반 실패 디자인 ===== */
.mode-failure {
    position: relative;
    max-width: 500px;
    margin: 2rem auto;
    --mode-failure-radius: 10px;
    border-radius: var(--mode-failure-radius);
    overflow: hidden;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: modeFailureFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mode-failure::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color-1), var(--accent-color-2));
}

.mode-failure-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 3rem 2.5rem;
    text-align: center;
    box-sizing: border-box;
}

.mode-failure-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--accent-color-1), var(--accent-color-2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: iconPulse 2s ease-in-out infinite;
}

.mode-failure-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.mode-failure-message {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    font-weight: 400;
}

.mode-failure-suggestion {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.mode-failure-suggestion:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.mode-failure-suggestion-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #495057;
    margin: 0;
    font-weight: 500;
}

.mode-failure-button {
    background: linear-gradient(135deg, var(--accent-color-1), var(--accent-color-2));
    border: none;
    border-radius: 12px;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.mode-failure-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.mode-failure-button:hover::before {
    width: 300px;
    height: 300px;
}

.mode-failure-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.mode-failure-button:active {
    transform: translateY(-1px) scale(0.98);
}

/* 정확 모드 실패 - 파란색 그라데이션 (토글 색상과 일치) */
.exact-mode-failure {
    --accent-color-1: #007bff;
    --accent-color-2: #0056b3;
}

/* 가이드 모드 실패 - 녹색 그라데이션 (토글 색상과 일치) */
.guide-mode-failure {
    --accent-color-1: #28a745;
    --accent-color-2: #20c997;
}

/* 유연 모드 실패 - 주황색 그라데이션 (토글 색상과 일치) */
.flexible-mode-failure {
    --accent-color-1: #ff9800;
    --accent-color-2: #f57c00;
}

/* ===== 추가 실패 디자인 컴포넌트 ===== */
.failure-details-card {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.failure-details-card h4 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.failure-details-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.failure-details-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.failure-details-list li:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.95rem;
}

.detail-value {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.95rem;
}

.failure-suggestions-card {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.failure-suggestions-card h4 {
    margin: 0 0 1rem 0;
    color: #856404;
    font-size: 1.1rem;
    font-weight: 600;
}

.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestions-list li {
    position: relative;
    padding: 0.5rem 0 0.5rem 1.5rem;
    color: #856404;
    font-size: 0.95rem;
    line-height: 1.5;
}

.suggestions-list li:before {
    /* bullet removed - keep spacing tidy */
    content: none;
    display: none;
}

.failure-stats-card {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.failure-stats-card h4 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ===== 실패 통계 카드 내부 그리드 충돌 방지 및 중첩 해제 ===== */
.failure-stats-card .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.failure-stats-card .stat-card {
    width: auto !important; /* 기존 전역 고정폭 무시 */
    min-width: 0; /* 아이템 축소 시 오버플로우 방지 */
    position: relative;
    z-index: 1;
    margin: 0; /* 중첩 원인으로 여분 마진 제거 */
}

.failure-stats-card .stat-card .stat-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 모바일에서 카드들이 겹치지 않도록 강제 세로 정렬 - moved to responsive.css */

/* 반응형 디자인: 해당 규칙들은 static/prototypes/css/responsive.css로 이동되었습니다 */

/* ===== 모드별 테마 적용 (mode-failure 내부 요소에 토글 색상 반영) ===== */
.mode-failure .mode-failure-title {
    color: var(--accent-color-2, #1a1a1a);
}

.mode-failure .failure-details-card h4 {
    color: var(--accent-color-2, #495057);
}

.mode-failure .detail-value {
    color: var(--accent-color-2, #1a1a1a);
}

.mode-failure .failure-suggestions-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,255,255,0.99));
    border: 2px solid var(--accent-color-1, #ffd84d);
}

.mode-failure .failure-suggestions-card h4 {
    color: var(--accent-color-1, #856404);
}

.mode-failure .suggestions-list li {
    color: var(--accent-color-1, #856404);
}

.mode-failure .failure-details-list li {
    border-bottom-color: rgba(0,0,0,0.06);
}


/* ===== 실패 카드: 스킬 섹션과 동일한 좌우 확장 레이아웃 ===== */
/* 결과 패널 내에서 카드가 좌우로 늘어나도록 조정하여 스킬 섹션과 시각적 일관성 유지 */
#optimizationResultsContainer .mode-failure,
.panel-result .mode-failure {
    max-width: none; /* 제한 제거 */
    width: 100%;
    margin: 0 0 16px 0; /* 위/아래 간격만 유지 */
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    background: transparent; /* 내부 컨텐츠에서 배경 제어 */
}

#optimizationResultsContainer .mode-failure .mode-failure-content,
.panel-result .mode-failure .mode-failure-content {
    padding-left: 2rem;
    padding-right: 2rem;
}


/* ===== 모드별 콘텐츠 테두리 강조 ===== */
/* 토글 색상과 일치하도록 .mode-failure-content의 좌측 강조선을 각 모드에 적용합니다. */
.exact-mode-failure .mode-failure-content {
    
    border-radius: var(--mode-failure-radius);
    border: 2px solid var(--accent-color-1, #007bff);
}

.guide-mode-failure .mode-failure-content {
    
    border-radius: var(--mode-failure-radius);
    border: 2px solid var(--accent-color-1, #28a745);
}

.flexible-mode-failure .mode-failure-content {
    border-radius: var(--mode-failure-radius);
    border: 2px solid var(--accent-color-1, #ff9800);
}

/* 세부 리스트가 좌우 여백을 이용해 넓게 표시되도록 조정 */
.failure-details-list li {
    gap: 1rem;
}

