/* 엔드필드 육성 트래커 — 밝은 게임 UI 테마 (SPEC 6장) */
:root {
  --bg: #e6e7e9;
  --bg-panel: #f4f4f5;
  --grid: rgba(20, 22, 26, 0.055);
  --ink: #121316;
  --ink-2: #3a3d43;
  --sub: #7a7e86;
  --line: #c9cbcf;
  --yellow: #ffe100;
  --yellow-deep: #f2c500;
  --dark-panel: rgba(18, 19, 22, 0.86);
  --dark-panel-2: rgba(18, 19, 22, 0.62);
  --refined: #2f8cff;
  --unrefined: #a3a7ae;
  --warn: #e5484d;

  /* 성급/품질 색은 app.js(RARITY_COLOR, QUALITY_COLOR)에서 --rc 로 넘긴다 */
  --q-gray: #B2B2B2;

  /* 속성 색 */
  --el-물리: #8d939b;
  --el-열기: #ff6a3d;
  --el-전기: #e2b100;
  --el-냉기: #2fb3ff;
  --el-자연: #46b868;

  --font: 'Barlow', 'Noto Sans KR', 'Noto Sans JP', system-ui, sans-serif;
  --font-num: 'Barlow Condensed', 'Barlow', 'Noto Sans KR', 'Noto Sans JP', sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-weight: 500;
  color: var(--ink);
  background-color: var(--bg);
  /* 얇은 격자선 + 군데군데 사선 */
  background-image:
    linear-gradient(115deg, transparent 0 62%, rgba(255, 225, 0, 0.16) 62% 62.6%, transparent 62.6% 64%, rgba(20, 22, 26, 0.05) 64% 64.3%, transparent 64.3%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  background-attachment: fixed;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---------- 장식: 세로 글자 ---------- */
.deco-vertical {
  position: fixed; left: 6px; top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font-family: var(--font-num); font-weight: 700; font-size: 11px; letter-spacing: 0.5em;
  color: rgba(18, 19, 22, 0.28);
  pointer-events: none; user-select: none;
}
@media (max-width: 640px) { .deco-vertical { display: none; } }

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px var(--gutter);
  background: rgba(244, 244, 245, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar::after { /* 노란 사선 띠 */
  content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px;
  background: repeating-linear-gradient(115deg, var(--yellow) 0 10px, transparent 10px 16px);
  opacity: 0.9;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 28px; height: 28px; flex: none; background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 62% 100%, 0 100%);
  position: relative;
}
.brand-mark::after { content: ''; position: absolute; inset: 7px; background: var(--yellow); clip-path: polygon(0 0, 100% 0, 0 100%); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-sub { font-family: var(--font-num); font-weight: 700; font-size: 10px; letter-spacing: 0.18em; color: var(--sub); }
.brand-main { font-weight: 900; font-size: 18px; letter-spacing: -0.01em; }
.brand-badge { /* "비공식 팬 사이트" — 검정 바탕 노란 글자, 오른쪽 아래 모서리 사선 (brand-mark 와 같은 무늬) */
  flex: none; align-self: flex-end; margin-bottom: 1px;
  padding: 2px 7px 2px 6px; background: var(--ink); color: var(--yellow);
  font-size: 10px; font-weight: 800; line-height: 1.4; letter-spacing: 0.02em; white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, 100% 62%, calc(100% - 5px) 100%, 0 100%);
}
.topbar-code { font-family: var(--font-num); font-size: 10px; letter-spacing: 0.12em; color: var(--sub); margin-left: auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
@media (max-width: 640px) { .topbar-code { display: none; } .topbar .topbar-guide { margin-left: auto; } }
@media (max-width: 420px) { .topbar { gap: 8px; flex-wrap: wrap; row-gap: 6px; } .topbar .pill.ghost-solid { padding: 0 8px; } .brand { flex: none; } .brand-text { white-space: nowrap; } .brand-sub { display: none; } }

.app { padding: 20px var(--gutter) 64px; max-width: 1360px; margin: 0 auto; }
.loading, .error { color: var(--sub); }
.error { color: var(--warn); font-weight: 700; }

/* ---------- 공통 부품 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border: 1.5px solid var(--ink); border-radius: 999px;
  background: var(--bg-panel); font-weight: 700; font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
.pill:hover { background: #fff; }
.pill.is-active, .pill.primary { background: var(--yellow); }
.pill.ghost { border-style: dashed; color: var(--sub); border-color: var(--sub); }

.count-chip { font-family: var(--font-num); font-weight: 700; font-size: 13px; letter-spacing: 0.06em; color: var(--ink-2); }
.count-chip b { font-weight: 900; font-size: 18px; color: var(--ink); }

/* 성급/품질: 색으로만 표시 (--rc) */
.q-band { height: 5px; background: var(--rc, var(--q-gray)); }
/* 성급 아이콘 (위키와 같은 화살촉, 진한 회색) */
.rarity-icons { display: inline-flex; align-items: center; align-self: flex-start; gap: 1px; line-height: 0; }
.rarity-icons img, .rarity-icons svg { width: 22px; height: 22px; display: block; }
.weapon-title .rarity-icons img, .weapon-title .rarity-icons svg { width: 18px; height: 18px; }
.hero-name + .rarity-icons { margin-top: -4px; }

/* 속성/직업 아이콘: 위키처럼 사각형 타일 + 흰 문양 */
.icon-tile {
  width: 24px; height: 24px; flex: none; display: inline-grid; place-items: center;
  background: var(--c, var(--ink)); color: #fff; border-radius: 2px;
  font-weight: 900; font-size: 12px; line-height: 1;
}
.icon-tile img { width: 82%; height: 82%; object-fit: contain; }
.icon-tile.lg { width: 30px; height: 30px; font-size: 14px; }
.tag-icon { display: inline-flex; align-items: center; gap: 6px; }

/* 꺾쇠 장식 카드 */
.bracket { position: relative; }
.bracket::before, .bracket::after {
  content: ''; position: absolute; width: 10px; height: 10px; pointer-events: none;
  border-color: var(--ink); border-style: solid; z-index: 2;
}
.bracket::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.bracket::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* 섹션 머리글 */
.section { margin-top: 28px; }
.section-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.section-head h2::before { content: ''; width: 6px; height: 18px; background: var(--yellow); box-shadow: 2px 0 0 var(--ink); }
.section-head .en { font-family: var(--font-num); font-weight: 700; font-size: 11px; letter-spacing: 0.2em; color: var(--sub); }
.section-head .tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.panel { background: var(--bg-panel); border: 1px solid var(--line); }

/* 라벨+큰 숫자 */
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-family: var(--font-num); font-weight: 700; font-size: 11px; letter-spacing: 0.16em; color: var(--sub); text-transform: uppercase; }
.stat-value { font-family: var(--font-num); font-weight: 900; font-size: 34px; line-height: 0.95; }
.stat-value small { font-size: 0.48em; font-weight: 700; color: var(--sub); margin-left: 2px; }
.on-dark .stat-label, .on-dark .stat-value small { color: rgba(255, 255, 255, 0.55); }

/* ========== 메인: 카드 목록 ========== */
/* 목록 위 소개 (index 만): 검정 띠 + 노랑 세로줄, PC 에서 큰 글자 한 줄 */
.list-intro { position: relative; margin: 0 0 18px; padding: 12px 18px 12px 20px; background: var(--ink); color: #fff; border-left: 6px solid var(--yellow); }
.list-intro::after { /* 오른쪽 끝 노란 사선 (상단 띠와 같은 무늬) */
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 64px;
  background: repeating-linear-gradient(115deg, var(--yellow) 0 6px, transparent 6px 12px); opacity: 0.85; pointer-events: none;
}
.list-intro p { margin: 0; padding-right: 72px; word-break: keep-all; overflow-wrap: break-word; }
.list-intro-title { font-size: 20px; font-weight: 900; letter-spacing: -0.01em; line-height: 1.35; }
.list-intro .list-intro-sub { margin-top: 2px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.72); line-height: 1.5; }
.list-intro .list-intro-note { margin-top: 2px; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.5); line-height: 1.5; }
@media (max-width: 520px) { .list-intro { padding: 10px 12px 10px 14px; } .list-intro::after { width: 28px; } .list-intro p { padding-right: 30px; } .list-intro-title { font-size: 17px; } .list-intro-sub { font-size: 12px; } }
.list-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.list-head h1 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -0.02em; }
.list-head .en { font-family: var(--font-num); font-weight: 700; letter-spacing: 0.24em; font-size: 12px; color: var(--sub); }
.list-head .count-chip { margin-left: auto; }

/* ---------- 목록 검색·정렬·필터 (app.js renderListTools, 규칙 listfilter.mjs) ---------- */
.list-tools { margin: -4px 0 16px; padding: 10px 12px; background: var(--bg-panel); border: 1px solid var(--line); border-left: 4px solid var(--ink); }
.lt-main { display: flex; gap: 8px; align-items: center; }
/* 입력칸 기본 너비를 무시하고 남는 폭만 (360px 에서 필터 버튼이 밖으로 나가지 않게). 선택 팝업의 .pk-search { flex: none } 보다 구체적으로 */
.lt-main .lt-search { flex: 1 1 0; width: 0; min-width: 0; }
.lt-sort { flex: none; height: 38px; padding: 0 28px 0 10px; border: 1.5px solid var(--ink); background: #fff; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); max-width: 46%; }
.lt-sort:focus { outline: 3px solid var(--yellow); }
.lt-toggle { flex: none; height: 38px; gap: 6px; }
.lt-toggle .lt-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--ink); color: var(--yellow); font-size: 11px; }
.lt-caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; transition: transform 0.12s ease; }
.lt-toggle.is-open .lt-caret { transform: rotate(180deg); }
.lt-filters { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; }
.lt-filters[hidden] { display: none; }
.lt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.lt-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.lt-label { min-width: 34px; }
.list-chip .icon-tile { width: 18px; height: 18px; font-size: 10px; margin-left: -4px; }
.list-chip.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.lt-switch { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; cursor: pointer; user-select: none; }
.lt-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lt-knob { position: relative; width: 36px; height: 20px; border: 1.5px solid var(--ink); border-radius: 10px; background: #fff; flex: none; transition: background 0.12s ease; }
.lt-knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--ink); transition: transform 0.12s ease; }
.lt-switch input:checked + .lt-knob { background: var(--yellow); }
.lt-switch input:checked + .lt-knob::after { transform: translateX(16px); }
.lt-switch input:focus-visible + .lt-knob { outline: 3px solid var(--yellow); outline-offset: 2px; }
.list-empty { padding: 36px 16px; text-align: center; border: 1.5px dashed var(--line); background: var(--bg-panel); }
.list-empty p { margin: 0 0 12px; font-weight: 800; }
@media (max-width: 640px) {
  .list-tools { padding: 8px; }
  .lt-row { gap: 8px; }
  .lt-switch { margin-left: 0; }
  .lt-label { width: 100%; }
}
@media (max-width: 420px) { .lt-main { gap: 6px; } .lt-sort { padding: 0 6px; font-size: 12px; max-width: 38%; } .lt-toggle { padding: 0 8px; } }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}
@media (max-width: 420px) { .cards { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; } }

.op-card {
  display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--line);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.op-card:hover { transform: translateY(-2px); box-shadow: 0 6px 0 -2px var(--ink); }
.op-card:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.op-thumb { position: relative; aspect-ratio: 456 / 564; overflow: hidden; background: linear-gradient(160deg, #d9dadd, #c5c7cb); }
.op-thumb > img { width: 100%; height: 100%; object-fit: cover; }
.op-tiles { position: absolute; top: 6px; right: 6px; z-index: 1; display: flex; gap: 3px; }
.op-tiles .icon-tile { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85); }
.op-card.not-owned .op-thumb::after { /* 미보유: 검은 반투명 오버레이 */
  content: ''; position: absolute; inset: 0; background: rgba(10, 11, 13, 0.62);
}
.op-card.not-owned .op-thumb .tag-none {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 10px; text-align: center;
  font-family: var(--font-num); font-weight: 700; font-size: 11px; letter-spacing: 0.3em; color: rgba(255, 255, 255, 0.7);
}
.op-body { padding: 8px 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.op-name { font-weight: 900; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.op-level { display: flex; align-items: baseline; gap: 3px; line-height: 1; flex: none; }
.op-level .stat-label { font-size: 9px; }
.op-level .v { font-family: var(--font-num); font-weight: 900; font-size: 24px; }
.op-level .v.empty { color: var(--line); }
.op-card .q-band { height: 6px; } /* 미보유여도 성급 색은 그대로 */

/* ========== 캐릭터 페이지 ========== */
.crumbs { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0; min-height: 420px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero-art {
  position: relative; overflow: hidden; min-height: 340px;
  background:
    repeating-linear-gradient(115deg, rgba(18, 19, 22, 0.06) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #f1f1f2, #d4d6d9);
  border: 1px solid var(--line);
}
.hero-art .art-stripe { /* 노란 사선 띠 (::before/::after는 꺾쇠 장식이 사용) */
  position: absolute; left: -10%; right: -10%; top: 58%; height: 46px;
  background: var(--yellow); transform: rotate(-18deg); opacity: 0.9;
}
.hero-art .q-band { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; z-index: 1; }
.hero-art img { position: relative; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; max-height: 560px; margin: 0 auto; }
.hero-info { border-top: 6px solid var(--rc, var(--q-gray)) !important; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 14px; padding: 22px 22px 22px 26px; background: var(--bg-panel); border: 1px solid var(--line); border-left: none; }
.hero-info > * { position: relative; }
.hero-watermark { /* 큰 영문 코드풍 장식 */
  position: absolute !important; right: -6px; bottom: 64px; z-index: 0;
  font-family: var(--font-num); font-weight: 900; font-size: clamp(90px, 13vw, 170px); line-height: 0.8;
  color: rgba(18, 19, 22, 0.05); letter-spacing: -0.02em; pointer-events: none; user-select: none; white-space: nowrap;
}
.hero-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-meta .stat-value { font-family: var(--font); font-size: 15px; font-weight: 800; line-height: 1.3; }
.hero-info .paste-zone { margin-top: auto; }
@media (max-width: 860px) { .hero-info { border-left: 1px solid var(--line); border-top: none; padding: 18px 16px; } }
.hero-name { margin: 0; font-size: clamp(30px, 4.4vw, 46px); font-weight: 900; letter-spacing: -0.02em; line-height: 1; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.hero-tags .sep { width: 1px; height: 14px; background: var(--line); }
.hero-stats { /* 밝은 배경 위 반투명 어두운 패널 */
  padding: 16px 18px; background: var(--dark-panel); color: #fff;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}
.hero-info { container-type: inline-size; }

.paste-zone {
  border: 2px dashed var(--line); padding: 14px 16px; color: var(--sub); font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.35);
}
.paste-zone .en { font-family: var(--font-num); letter-spacing: 0.18em; font-size: 11px; }

/* 전투 스킬 */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.skill { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; padding: 14px; background: var(--bg-panel); border: 1px solid var(--line); }
.skill-icons { display: flex; flex-direction: column; gap: 6px; }
.skill-icons img { width: 52px; height: 52px; background: var(--ink); border-radius: 50%; padding: 4px; }
.skill-icons.multi img { width: 40px; height: 40px; }
.skill-type { font-family: var(--font-num); font-weight: 700; font-size: 11px; letter-spacing: 0.14em; color: var(--sub); }
.skill-type b { font-family: var(--font); font-size: 12px; letter-spacing: 0; color: var(--ink); margin-right: 6px; }
.skill-names { margin: 4px 0 8px; display: flex; flex-direction: column; gap: 2px; }
.skill-names span { font-weight: 800; font-size: 14px; line-height: 1.25; }

/* 재능 / 정예화 */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.talents { padding: 6px 16px; }
.talent { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.talent:last-child { border-bottom: none; }
.talent-name { font-weight: 800; font-size: 14px; min-width: 0; }
.talent .frac { font-family: var(--font-num); font-weight: 900; font-size: 22px; min-width: 44px; text-align: right; }
.talent .frac small { font-size: 0.6em; color: var(--sub); font-weight: 700; }

.track { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.track-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 4px; }
.track-step {
  position: relative; padding: 10px 8px 9px 14px; min-height: 58px;
  background: #dcdde0; color: var(--sub);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%);
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.track-step .k { font-weight: 800; font-size: 11px; white-space: nowrap; }
.track-step .n { font-family: var(--font-num); font-weight: 900; font-size: 22px; line-height: 1; letter-spacing: 0.02em; }
.track-step.done { background: var(--ink); color: var(--yellow); }
.track-step.done.combo { background: #3a3d43; color: #fff; }
.track-legend { font-size: 12px; color: var(--sub); font-weight: 600; }

/* 무기 */
.weapon { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 0; }
@media (max-width: 720px) { .weapon { grid-template-columns: 1fr; } }
.weapon-art { position: relative; background: linear-gradient(160deg, #f4f4f5, #d7d9dc); border: 1px solid var(--line); display: grid; place-items: center; min-height: 180px; overflow: hidden; }
.weapon-art .art-stripe { position: absolute; inset: auto -20% 18% -20%; height: 26px; background: var(--yellow); transform: rotate(-14deg); }
.weapon-art img { position: relative; width: 78%; max-width: 220px; }
.weapon-art .q-band { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; }
.weapon-body { padding: 16px 18px; background: var(--bg-panel); border: 1px solid var(--line); border-left: none; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 720px) { .weapon-body { border-left: 1px solid var(--line); border-top: none; } }
.weapon-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.weapon-title h3 { margin: 0; font-size: 22px; font-weight: 900; }
.weapon-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.essence { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; background: none; border: none; padding: 0; cursor: pointer; }
.essence .slot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); background: #c4c6ca; }
.essence.on .slot { background: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 225, 0, 0.35); }
.essence.off { color: var(--sub); }
.weapon-skills { display: flex; flex-direction: column; gap: 6px; }
.wskill { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; background: var(--dark-panel-2); color: #fff; }
.wskill-name { font-weight: 700; font-size: 13px; }
.wskill .frac { font-family: var(--font-num); font-weight: 900; font-size: 20px; }
.wskill .frac small { color: rgba(255, 255, 255, 0.55); font-size: 0.65em; }
.wskill.maxed .frac { color: var(--yellow); }

/* 장비 세트 */
.set-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.gear-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.gear { display: flex; flex-direction: column; background: var(--bg-panel); border: 1px solid var(--line); }
.gear-head { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 12px; align-items: center; }
.gear-icon { width: 64px; height: 64px; background: linear-gradient(160deg, #3a3d43, #121316); padding: 4px; }
.gear-slot { font-family: var(--font-num); font-weight: 700; font-size: 11px; letter-spacing: 0.12em; color: var(--sub); }
.gear-slot b { font-family: var(--font); letter-spacing: 0; color: var(--ink); font-size: 12px; margin-right: 4px; }
.gear-name { font-weight: 900; font-size: 14px; line-height: 1.25; margin: 2px 0 4px; }
.gear-sub { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); font-weight: 700; flex-wrap: wrap; }
.gear-sub .lv { font-family: var(--font-num); font-weight: 900; font-size: 15px; color: var(--ink); }
.gear-stats { list-style: none; margin: 0; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.gstat {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; grid-template-areas: "ico name val" ". step step";
  gap: 8px 8px; align-items: center; padding: 8px 8px; background: rgba(18, 19, 22, 0.05); font-size: 13px;
}
.gstat > .ico, .gstat > .refined-check, .gstat > .refine-ico { grid-area: ico; }
.gstat > .name { grid-area: name; }
.gstat > .val { grid-area: val; text-align: right; }
.gstat > .stage-step { grid-area: step; justify-self: end; }
.gstat .ico { width: 12px; height: 12px; transform: rotate(45deg) scale(0.85); background: var(--unrefined); }
.gstat.refined .ico { background: var(--refined); }
.gstat .name { font-weight: 700; min-width: 0; }
.gstat .val { font-family: var(--font-num); font-weight: 800; font-size: 16px; }
.gstat .stage { font-family: var(--font-num); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; color: var(--sub); min-width: 46px; text-align: right; }
.gstat.refined .stage { color: var(--refined); }
.gstat .stage.bad { color: var(--warn); }
.gear-empty { flex: 1; display: grid; place-items: center; min-height: 140px; color: var(--sub); font-weight: 700; font-size: 13px;
  background: repeating-linear-gradient(115deg, rgba(18, 19, 22, 0.04) 0 2px, transparent 2px 10px); }
.gear-empty .gear-slot { display: block; text-align: center; margin-bottom: 4px; }
.gear .q-band { margin-top: auto; height: 6px; }
.gear-icon { box-shadow: inset 0 -4px 0 var(--rc, var(--q-gray)); }
.set-effects { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; background: var(--dark-panel); color: #fff; }
.set-effects .label { font-family: var(--font-num); font-weight: 700; font-size: 11px; letter-spacing: 0.18em; color: rgba(255, 255, 255, 0.55); margin-right: 4px; }
.set-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid rgba(255, 255, 255, 0.3); font-weight: 700; font-size: 13px; }
.set-chip .frac { font-family: var(--font-num); font-weight: 900; font-size: 16px; }
.set-chip.active { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.set-chip.none { color: rgba(255, 255, 255, 0.55); border-style: dashed; }
.note { font-size: 12px; color: var(--sub); font-weight: 600; margin-top: 6px; }

/* ========== 2단계: 입력 ========== */
/* 숫자 입력 */
.num-input, .num-select {
  font-family: var(--font-num); font-weight: 900; font-size: inherit; line-height: 1; color: inherit;
  background: transparent; border: none; border-bottom: 2px dashed currentColor; padding: 0 2px; margin: 0;
  width: 1.4em; -moz-appearance: textfield; appearance: textfield;
}
.num-input::-webkit-outer-spin-button, .num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-input:focus, .num-select:focus { outline: 2px solid var(--yellow); outline-offset: 2px; border-bottom-style: solid; }
.num-input.big { width: 1.25em; }
.num-input.small { width: 1.4em; }
.gstat .num-input { width: 4.2em; font-size: 16px; text-align: right; }
.num-select { width: auto; cursor: pointer; padding-right: 2px; }
.num-select option { color: var(--ink); font-size: 16px; }
.on-dark .num-input, .on-dark .num-select, .num-input.dark { color: #fff; }

/* 작은 버튼 / 큰 버튼 */
.pill.mini { height: 22px; padding: 0 8px; font-size: 11px; font-family: var(--font-num); letter-spacing: 0.08em; border-width: 1.5px; }
.stat-label .pill.mini { margin-left: 6px; vertical-align: middle; }
.on-dark .pill.mini { background: transparent; color: var(--yellow); border-color: var(--yellow); }
.on-dark .pill.mini:hover { background: var(--yellow); color: var(--ink); }
.pill.big { height: 42px; padding: 0 22px; font-size: 15px; }
.pill:disabled { opacity: 0.5; cursor: default; }

/* 드롭다운 */
.pick {
  height: 32px; max-width: 100%; padding: 0 28px 0 10px; border: 1.5px solid var(--ink); border-radius: 999px;
  background: #fff url("ui/select-arrow.svg") no-repeat right 10px center / 9px;
  font: inherit; font-weight: 700; font-size: 13px; color: var(--ink); appearance: none; cursor: pointer; min-width: 0;
}
.pick:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }

.crumbs-tools { margin-left: auto; display: flex; gap: 6px; }
.register-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 16px 18px; background: var(--dark-panel); color: rgba(255, 255, 255, 0.75); font-size: 13px; font-weight: 600; }
.warn-box { border-left: 4px solid var(--warn); background: rgba(229, 72, 77, 0.08); padding: 8px 12px; font-size: 13px; font-weight: 600; color: #9b1c20; }
.warn-box ul { margin: 4px 0 0; padding-left: 18px; }

/* 정예화 트랙 칸 = 버튼 */
button.track-step { border: none; font: inherit; text-align: left; cursor: pointer; }
button.track-step:hover { filter: brightness(1.08); outline: 2px solid var(--yellow); outline-offset: -2px; }
button.track-step:focus-visible { outline: 3px solid var(--yellow); outline-offset: -3px; }

/* 장비 */
.set-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.set-name { display: flex; flex-direction: column; gap: 2px; }
.set-name input { height: 32px; min-width: 200px; padding: 0 12px; border: 1.5px solid var(--ink); background: #fff; font: inherit; font-weight: 800; font-size: 14px; }
.set-name input:focus { outline: 3px solid var(--yellow); }
.gear-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.manual-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0 12px 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); cursor: pointer; align-self: flex-start; }
.refined-check { width: 14px; height: 14px; margin: 0; accent-color: var(--refined); }
.gear .gear-empty { min-height: 90px; }

/* 메인 카드: 저장 안 된 변경 표시 */
.tag-dirty { position: absolute; z-index: 1; left: 6px; top: 6px; padding: 2px 6px; background: var(--yellow); color: var(--ink); font-size: 10px; font-weight: 800; }

/* 저장 바 */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 10px var(--gutter); background: var(--ink); color: #fff; box-shadow: 0 -4px 0 var(--yellow); }
.savebar-inner { max-width: 1360px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.savebar-count { font-weight: 800; }
.savebar-msg { font-size: 13px; font-weight: 600; }
.savebar-msg.ok { color: #9be39f; }
.savebar-msg.error, .savebar-msg.conflict { color: #ffb3b5; }
.savebar-msg ul { margin: 4px 0 0; padding-left: 18px; max-height: 120px; overflow: auto; }
.savebar-actions { margin-left: auto; display: flex; gap: 8px; }
.savebar .pill { background: transparent; color: #fff; border-color: #fff; }
.savebar .pill.primary { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
body.has-savebar .app { padding-bottom: 120px; }

/* 관리자 남/여 전환 */
.hero-name-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.gender-switch { display: inline-flex; gap: 4px; }
.gender-switch .pill.mini { height: 26px; min-width: 34px; justify-content: center; font-family: var(--font); font-size: 13px; letter-spacing: 0; }

/* ========== 조작: [«] [‹] 값 [›] [»] — 앱 전체 같은 버튼 (테두리 네모, 32px) ========== */
.stepper { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.stepper .sv { display: inline-flex; align-items: baseline; justify-content: center; padding: 0 4px; }
.step-row { display: inline-flex; gap: 4px; }
.step {
  flex: none; width: 32px; height: 32px; padding: 0 0 2px; margin: 0;
  border: 1.5px solid currentColor; border-radius: 4px; background: rgba(255, 255, 255, 0.6); cursor: pointer;
  font: 700 22px/1 var(--font-num); color: var(--ink); display: inline-grid; place-items: center;
}
.step:hover:not(:disabled) { background: var(--yellow); color: var(--ink); border-color: var(--ink); }
.step:active:not(:disabled) { transform: translateY(1px); }
.step:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.step:disabled { opacity: 0.25; cursor: default; }
/* 어두운 바탕 (상단 패널, 무기 스킬 줄) */
.on-dark .step { color: #fff; background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.55); }
.on-dark .step:hover:not(:disabled) { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }

/* 라벨 / [아이콘] 숫자 / 버튼 줄 (상단 3칸, 무기 수치 칸) */
.scell { gap: 6px; }
.scell-value { display: flex; align-items: center; gap: 8px; height: 44px; }
.scell-num { font-family: var(--font-num); font-weight: 900; font-size: 40px; line-height: 1; display: inline-flex; align-items: baseline; white-space: nowrap; }
.scell-num small { font-size: 0.45em; font-weight: 700; color: var(--sub); margin-left: 2px; }
.on-dark .scell-num small { color: rgba(255, 255, 255, 0.55); }
.scell .num-input { width: 1.25em; }
.weapon-stats .scell-num { font-size: 34px; }
.weapon-stats .scell-value { height: 40px; }

/* 단계 아이콘 (정예화 문장 / 잠재 별): 어두운 타일 위 흰·노랑 */
.stage-ico {
  flex: none; width: 40px; height: 40px; display: inline-grid; place-items: center; background: #1b1c20; border-radius: 3px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.stage-ico img, .stage-ico svg { width: 100%; height: 100%; display: block; object-fit: contain; }
.stage-ico svg { padding: 3px; }
.stage-ico .dim { opacity: 0.3; filter: grayscale(1); }
.stage-ico svg.glow { filter: drop-shadow(0 0 2px rgba(255, 225, 0, 0.9)); }
.stage-ico.blank { background: none; box-shadow: none; } /* 레벨 칸: 아이콘 자리만 비워 숫자 위치를 맞춤 */
.hero-stats .stage-ico { background: rgba(255, 255, 255, 0.06); }
.hero-stats .stage-ico.blank { background: none; }
.weapon-stats .stage-ico { width: 36px; height: 36px; }
/* 무기 돌파: ">-" 모양 × 돌파 횟수 (게임 화면처럼 어두운 알약 바탕) */
.break-ico { flex: none; display: inline-flex; align-items: center; height: 36px; padding: 0 12px; background: #1b1c20; border-radius: 18px; }
.break-ico svg { height: 18px; width: auto; display: block; }

/* 장비 단조: 원 3등분 */
.refine-ico { width: 18px; height: 18px; display: block; }
.refine-ico svg { width: 100%; height: 100%; display: block; }

/* 전투 스킬: RANK 1…9 → M1…M3 한 줄. 숫자와 M 칸을 같은 줄 중앙에 */
.skill-main { min-width: 0; }
.skill-type { display: flex; align-items: center; gap: 0 6px; flex-wrap: wrap; }
.skill-tools { margin-left: auto; display: inline-flex; gap: 4px; }
.skill-levels { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.skill-levels .stat-value { display: inline-flex; align-items: center; font-size: 30px; line-height: 1; }
.skill-levels .stepper .sv { min-width: 2.4em; }
.skill-levels .sv .m { color: #c99700; font-weight: 900; }
.mastery { display: inline-flex; align-items: center; gap: 3px; height: 32px; }
.mastery i {
  font: normal 700 11px/1 var(--font-num); letter-spacing: 0.04em; padding: 0 5px; height: 22px; display: inline-grid; place-items: center;
  color: var(--sub); border: 1.5px solid var(--line); background: transparent;
}
.mastery i.on { background: var(--ink); color: var(--yellow); border-color: var(--ink); }
.pill.mini.reset { font-family: var(--font); font-size: 13px; padding: 0 6px; letter-spacing: 0; }
.pill.mini.reset-all { font-family: var(--font); font-size: 12px; letter-spacing: 0; }

/* 재능: 숫자만 */
.talent { grid-template-columns: 1fr auto; }
.talent .frac { min-width: 0; }

/* 무기 */
.weapon-title { align-items: flex-start; }
.weapon-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.weapon-name .rarity-icons img, .weapon-name .rarity-icons svg { width: 18px; height: 18px; }
.weapon-type { color: var(--sub); font-weight: 700; font-size: 13px; padding-top: 6px; }
.weapon-tools { margin-left: auto; }
.weapon-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: start; gap: 14px 16px; }
.weapon-stats .stat-label .pill.mini { margin-left: 4px; }
.weapon .essence { height: 40px; }
.wskill { grid-template-columns: minmax(0, 1fr) auto auto; }
.wskill .frac { display: inline-flex; align-items: center; gap: 4px; }
.wskill .stepper .sv { min-width: 1em; }
.wskill-tools { display: inline-flex; gap: 4px; }
@media (max-width: 520px) {
  .wskill { grid-template-columns: minmax(0, 1fr) auto; }
  .wskill-name { grid-column: 1 / -1; }
}

/* 장비 카드 도구 줄: 직접 입력 + ↺ / MAX */
.gear-tools { display: flex; align-items: center; gap: 6px; margin: 0 12px 6px; }
.gear-tools .manual-toggle { margin: 0; }
.gear-btns { margin-left: auto; display: inline-flex; gap: 4px; }
.gstat .stepper .sv { min-width: 3.6em; }

/* 섹션 머리글 도구: 한 줄, 높이 맞춤 */
.section-head .tools { align-items: center; }
.tool-h { display: inline-flex; align-items: center; height: 32px; }
.pick-btn::after { content: ''; width: 9px; height: 6px; background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.gear-pick { align-items: center; }

/* ========== 무기·장비 선택 팝업 ========== */
.picker {
  width: min(920px, calc(100vw - 24px)); max-height: min(86vh, 900px); padding: 0; border: none; border-radius: 0;
  background: var(--bg-panel); color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink), 0 18px 60px rgba(0, 0, 0, 0.35);
}
.picker::backdrop { background: rgba(10, 11, 13, 0.55); }
.pk-inner { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; max-height: inherit; }
.pk-head, .pk-search, .pk-filters { flex: none; }
.pk-list { flex: 1 1 auto; }
.pk-head { display: flex; align-items: center; gap: 10px; border-bottom: 3px solid var(--yellow); padding-bottom: 8px; }
.pk-head h2 { margin: 0; font-size: 18px; font-weight: 900; }
.pk-close { margin-left: auto; width: 34px; height: 34px; border: 1.5px solid var(--ink); border-radius: 50%; background: none; font-size: 22px; line-height: 1; cursor: pointer; }
.pk-close:hover { background: var(--yellow); }
.pk-search { height: 38px; padding: 0 12px; border: 1.5px solid var(--ink); background: #fff; font: inherit; font-size: 14px; font-weight: 600; }
.pk-search:focus { outline: 3px solid var(--yellow); }
.pk-filters { display: flex; flex-direction: column; gap: 6px; }
.pk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pk-row .stat-label { min-width: 34px; }
.pk-row .pick { height: 30px; flex: 0 1 260px; }
.chip.pill.mini { height: 26px; font-family: var(--font); font-size: 12px; letter-spacing: 0; gap: 5px; }
.qdot { width: 10px; height: 10px; background: var(--rc); display: inline-block; border: 1px solid rgba(0, 0, 0, 0.25); }
.pk-list { overflow-y: auto; min-height: 120px; margin: 0 -6px; padding: 4px 6px; }
.pk-count { font-family: var(--font-num); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; color: var(--sub); margin-bottom: 6px; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pk-empty { padding: 30px 0; text-align: center; color: var(--sub); font-weight: 700; }
.pcard {
  display: flex; flex-direction: column; padding: 0; text-align: left; cursor: pointer; background: #fff;
  border: 1px solid var(--line); border-bottom: 5px solid var(--rc, var(--q-gray)); font: inherit; color: inherit;
}
.pcard:hover { box-shadow: 0 0 0 2px var(--ink); }
.pcard:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.pcard.is-current { box-shadow: 0 0 0 3px var(--yellow), 0 0 0 4.5px var(--ink); }
.pc-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 1; background: linear-gradient(160deg, #3a3d43, #121316); }
.pc-thumb img { width: 86%; height: 86%; object-fit: contain; }
.pc-badge { position: absolute; left: 0; top: 0; padding: 2px 6px; background: var(--yellow); color: var(--ink); font-size: 10px; font-weight: 800; }
.pc-body { display: flex; flex-direction: column; gap: 4px; padding: 7px 8px 8px; min-width: 0; }
.pc-name { font-weight: 800; font-size: 13px; line-height: 1.25; }
.pc-body .rarity-icons img, .pc-body .rarity-icons svg { width: 14px; height: 14px; }
.pc-sub { font-size: 11px; font-weight: 700; color: var(--ink-2); line-height: 1.3; }
.pc-sub b { font-family: var(--font-num); font-size: 13px; color: var(--ink); }
.pc-q { font-size: 10px; font-weight: 700; color: var(--sub); }
@media (max-width: 640px) {
  .picker { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; box-shadow: none; }
  .pk-inner { padding: 12px 12px 14px; height: 100%; }
  .pk-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .pc-name { font-size: 12px; }
}

/* 상단 3칸이 좁으면(정보 칸 내용 폭 480px 미만) 칸마다 한 줄: 라벨 | 아이콘+숫자 | 버튼 — 모든 줄이 같은 열 */
@container (max-width: 480px) {
  .hero-stats { grid-template-columns: 1fr; gap: 10px; }
  .hero-stats .scell { display: grid; grid-template-columns: 80px minmax(0, 1fr); grid-template-areas: "label value" "label steps"; align-items: center; gap: 6px 8px; }
  .hero-stats .scell > .stat-label { grid-area: label; align-self: start; padding-top: 4px; }
  .hero-stats .scell-value { grid-area: value; }
  .hero-stats .step-row { grid-area: steps; }
  .hero-stats .stat-label { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
  .hero-stats .stat-label .pill.mini { margin-left: 0; }
  .hero-stats .scell-num { font-size: 34px; }
  .hero-stats .stage-ico { width: 36px; height: 36px; }
}

/* 전투 스킬 카드: 숫자 + M 칸이 한 줄에 들어가도록 */
.skill { padding: 12px; gap: 8px 10px; }
.skill-icons img { width: 44px; height: 44px; }
.skill-icons.multi img { width: 36px; height: 36px; }
.skill-levels { flex-wrap: nowrap; gap: 6px; }
.skill-levels .stepper { gap: 2px; }
.skill-levels .stepper .sv { min-width: 0; padding: 0 3px; }
.mastery i { padding: 0 3px; height: 20px; font-size: 10px; }
/* 레벨 입력칸이 숫자 칸 높이를 늘리지 않게 (정예화·잠재 숫자와 기준선 맞춤) */
.scell .num-input { height: 1em; line-height: 1; padding: 0; box-sizing: content-box; font-size: 1em; }
/* 라벨 줄 높이 통일 (MAX·↺ 버튼이 있는 칸과 없는 칸) */
.scell > .stat-label { display: flex; align-items: center; gap: 4px; min-height: 22px; }
.scell > .stat-label .pill.mini { margin-left: 2px; }
@container (max-width: 480px) { .hero-stats .scell > .stat-label { flex-direction: column; align-items: flex-start; } }

/* 휴대폰: 무기 수치 칸 2열 */
@media (max-width: 520px) {
  .weapon-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .weapon-stats .scell-num { font-size: 28px; }
  .weapon-stats .stage-ico { width: 30px; height: 30px; }
  .break-ico { padding: 0 7px; height: 30px; }
  .break-ico svg { height: 13px; }
}

/* ========== 성급 / 품질 / 속성 색 (CSP: HTML 에 style= 를 쓰지 않으므로 클래스로) ========== */
.rc-op-6, .rc-w-6 { --rc: #FE6F1F; }
.rc-op-5, .rc-w-5 { --rc: #FFCA33; }
.rc-op-4, .rc-w-4 { --rc: #B284FB; }
.rc-w-3 { --rc: #38C4FC; }
/* 장비 품질: schema.mjs QUALITY_ORDER 순서 (노랑, 보라, 파랑, 초록, 회색) */
.q-0 { --rc: #FFCA33; }
.q-1 { --rc: #B284FB; }
.q-2 { --rc: #37BEF4; }
.q-3 { --rc: #B5D755; }
.q-4 { --rc: #B2B2B2; }
/* 속성 타일 (data-el = data 의 element 값) */
.icon-tile.el { --c: var(--q-gray); }
.icon-tile[data-el="물리"] { --c: var(--el-물리); }
.icon-tile[data-el="열기"] { --c: var(--el-열기); }
.icon-tile[data-el="전기"] { --c: var(--el-전기); }
.icon-tile[data-el="냉기"] { --c: var(--el-냉기); }
.icon-tile[data-el="자연"] { --c: var(--el-자연); }
.sub { color: var(--sub); }
.gear-empty.tall { min-height: 120px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 상단 "데이터" 버튼 */
.pill.ghost-solid { height: 30px; font-size: 12px; background: transparent; }
.pill.ghost-solid:hover { background: var(--yellow); }

/* ========== 데이터 관리 팝업 ========== */
.datadlg { width: min(640px, calc(100vw - 24px)); }
.data-note { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.data-row { display: flex; flex-wrap: wrap; gap: 8px; }
.data-hint { margin: 0; font-size: 12px; font-weight: 600; color: var(--sub); }
.data-result { padding: 8px 12px; font-size: 13px; font-weight: 700; border-left: 4px solid var(--warn); background: rgba(229, 72, 77, 0.08); color: #9b1c20; }
.data-result ul { margin: 4px 0 0; padding-left: 18px; font-weight: 600; max-height: 160px; overflow: auto; }
.data-sub { margin: 6px 0 0; font-size: 14px; font-weight: 900; }
.backup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.backup-list li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #fff; border: 1px solid var(--line); }
.bk-time { font-family: var(--font-num); font-weight: 800; font-size: 15px; }
.bk-count { font-size: 12px; font-weight: 700; color: var(--sub); }
.backup-list .pill { margin-left: auto; }
@media (max-width: 640px) { .picker.datadlg { width: calc(100vw - 16px); height: auto; max-height: calc(100dvh - 16px); margin: auto; box-shadow: 0 0 0 1.5px var(--ink), 0 18px 60px rgba(0, 0, 0, 0.35); } }

/* ========== 하단 표기 ========== */
.site-footer { max-width: 1360px; margin: 0 auto; padding: 18px var(--gutter) 28px; border-top: 1px solid var(--line); font-size: 11px; font-weight: 600; color: var(--sub); line-height: 1.6; }
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 6px; }
.site-footer a { text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.site-footer a:hover { color: var(--ink); }
body.has-savebar .site-footer { padding-bottom: 96px; }

/* ========== 문서 페이지 (guide·privacy·terms.html, 원고 docs/pages_draft.md) ========== */
.doc-topbar { flex-wrap: wrap; row-gap: 8px; }
.doc-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.pill[aria-current="page"] { background: var(--yellow); }
@media (max-width: 640px) { .doc-nav { margin-left: auto; } }
.doc {
  max-width: 880px; margin: 24px auto 56px; padding: clamp(18px, 4vw, 40px);
  background: var(--bg-panel); border: 1px solid var(--line);
  font-size: 15px; line-height: 1.75; overflow-wrap: break-word;
}
.doc h1 { margin: 0 0 8px; font-size: 26px; font-weight: 900; letter-spacing: -0.01em; }
.doc h2 { margin: 34px 0 10px; padding-left: 10px; border-left: 4px solid var(--yellow-deep); font-size: 19px; font-weight: 900; line-height: 1.4; scroll-margin-top: 80px; }
.doc h3 { margin: 20px 0 6px; font-size: 15px; font-weight: 800; }
.doc p { margin: 0 0 10px; }
.doc ol, .doc ul { margin: 0 0 12px; padding-left: 22px; }
.doc li { margin: 3px 0; }
.doc strong { font-weight: 800; }
.doc a { text-decoration: underline; text-decoration-color: var(--yellow-deep); text-decoration-thickness: 2px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.doc a:hover { background: rgba(255, 225, 0, 0.35); }
.doc-meta { color: var(--sub); font-size: 13px; font-weight: 700; }
.doc-table-wrap { margin: 0 0 14px; overflow-x: auto; }
.doc table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; line-height: 1.6; }
.doc th, .doc td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc th { background: var(--ink); color: #fff; font-weight: 700; white-space: nowrap; }
@media (max-width: 520px) { .doc { margin: 12px 8px 40px; font-size: 14px; } .doc h1 { font-size: 22px; } .doc table { font-size: 13px; } .doc th, .doc td { padding: 6px 7px; } }
/* 예시 스샷 (누르면 크게 보기) */
.doc-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.doc-shot { margin: 0; }
.doc-shot-btn { display: block; width: 100%; padding: 0; border: 1.5px solid var(--line); background: var(--ink); cursor: zoom-in; }
.doc-shot-btn img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.doc-shot-btn:hover, .doc-shot-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.doc-shot figcaption { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--sub); }
/* 크게 보기 <dialog>: 원본 크기, 화면보다 크면 화면에 맞게 (휴대폰 폭에서도 화면 안) */
.shotdlg { padding: 0; border: none; background: transparent; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: visible; }
.shotdlg::backdrop { background: rgba(10, 11, 13, 0.9); }
.shotdlg-fig { margin: 0; }
.shotdlg img { display: block; width: auto; height: auto; max-width: calc(100vw - 16px); max-height: calc(100dvh - 84px); margin: 0 auto; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
.shotdlg figcaption, .shotdlg-hint { width: fit-content; max-width: 100%; margin: 6px auto 0; padding: 1px 10px; background: var(--ink); text-align: center; }
.shotdlg figcaption { color: #fff; font-size: 14px; font-weight: 800; }
.shotdlg-hint { margin-top: 2px; color: rgba(255, 255, 255, 0.75); font-size: 12px; font-weight: 600; }

/* ---------- 채널 응원 팝업 (#supportdlg, 4페이지 공통, support.mjs) ---------- */
/* dialog 자체는 여백 0 (바깥 클릭 = dialog 자신), 안쪽 칸 .supportdlg-box 에 여백 */
.supportdlg { padding: 0; border: none; background: transparent; width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: visible; color: var(--ink); }
.supportdlg::backdrop { background: rgba(10, 11, 13, 0.72); }
.supportdlg-box { position: relative; padding: 20px 20px 18px; background: var(--bg-panel); border: 1.5px solid var(--ink); border-top: 6px solid var(--yellow); max-height: calc(100dvh - 32px); overflow-y: auto; }
.supportdlg-box::after { /* 오른쪽 위 노란 사선 (상단 띠와 같은 무늬) */
  content: ''; position: absolute; top: 0; right: 0; width: 56px; height: 14px;
  background: repeating-linear-gradient(115deg, var(--ink) 0 6px, transparent 6px 11px); opacity: 0.85;
}
.supportdlg-title { margin: 0 0 10px; font-size: 19px; font-weight: 900; letter-spacing: -0.01em; }
.supportdlg-body { margin: 0 0 16px; font-size: 14px; line-height: 1.7; word-break: keep-all; overflow-wrap: break-word; }
.supportdlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.supportdlg-actions .pill { text-decoration: none; }
/* Gemini 사용 동의 창 (#consentdlg, 트래커만, app.js askConsent) — 응원 팝업과 같은 틀 */
.consentdlg { width: min(520px, calc(100vw - 32px)); }
.consentdlg-list { margin: 0 0 14px; padding-left: 20px; font-size: 14px; line-height: 1.65; word-break: keep-all; overflow-wrap: break-word; }
.consentdlg-list li + li { margin-top: 4px; }
.consentdlg-check { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 16px; padding: 10px 12px; background: rgba(255, 225, 0, 0.18); border-left: 4px solid var(--yellow); font-size: 14px; font-weight: 700; line-height: 1.6; word-break: keep-all; overflow-wrap: break-word; cursor: pointer; }
.consentdlg-check input { flex: none; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--ink); }
.consentdlg-check a { text-decoration: underline; text-underline-offset: 2px; }
.supportdlg-actions .pill:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- 스샷 붙여넣기 영역 / 인식 팝업 (app.js renderOcrDialog) ---------- */
.paste-zone { flex-wrap: wrap; cursor: default; }
.paste-zone .paste-text { flex: 1 1 200px; }
.paste-zone:focus-visible { outline: 3px solid var(--yellow); }
.paste-zone.drag, .ocr-thumbs.drag { border-color: var(--ink); background: rgba(255, 225, 0, 0.28); }
.ocrdlg { width: min(1080px, calc(100vw - 24px)); }
.ocr-body { flex: 1 1 auto; overflow-y: auto; min-height: 120px; display: flex; flex-direction: column; gap: 10px; margin: 0 -6px; padding: 2px 6px; }
.ocr-foot { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; border-top: 1.5px solid var(--line); padding-top: 10px; }
.ocr-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; border: 2px dashed var(--line); padding: 10px; }
.ocr-thumb { position: relative; margin: 0; background: var(--ink); color: #fff; }
.ocr-thumb.bad { outline: 2px solid var(--warn); }
.ocr-canvas { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; overflow: hidden; }
.ocr-canvas canvas { display: block; width: 100%; height: auto; }
.ocr-wait { font-size: 12px; color: var(--sub); }
.ocr-thumb figcaption { font-family: var(--font-num); font-size: 12px; font-weight: 700; padding: 3px 6px; }
.ocr-thumb .pk-close.mini { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; font-size: 16px; background: rgba(255, 255, 255, 0.9); color: var(--ink); }
.ocr-add { min-height: 84px; border: 1.5px dashed var(--sub); background: transparent; color: var(--sub); font-weight: 700; cursor: pointer; }
.ocr-add:hover { background: var(--yellow); color: var(--ink); }
.ocr-progress { margin: 30px 0; text-align: center; font-weight: 700; }
.ocr-load { display: block; width: min(420px, 100%); margin: -18px auto 24px; }
.ocr-banner { padding: 8px 12px; font-size: 13px; font-weight: 700; background: rgba(255, 225, 0, 0.35); border-left: 4px solid var(--yellow-deep); }
.ocr-unusable, .ocr-notes { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ocr-unusable ul, .ocr-notes { margin: 4px 0 0; padding-left: 18px; }
.ocr-table { display: flex; flex-direction: column; border-top: 1.5px solid var(--ink); }
.ocr-row { display: grid; grid-template-columns: 44px minmax(110px, 0.8fr) minmax(130px, 1fr) minmax(220px, 2fr); gap: 8px 12px; align-items: start; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ocr-row.ocr-head { font-size: 11px; font-weight: 800; color: var(--sub); letter-spacing: 0.04em; }
.ocr-row.check { background: rgba(255, 225, 0, 0.22); }
.ocr-row.off { opacity: 0.55; }
.ocr-row input[type="checkbox"] { width: 18px; height: 18px; }
.ocr-group-title { padding: 10px 4px 4px; font-size: 13px; font-weight: 900; border-bottom: 3px solid var(--yellow); }
.ocr-label { font-weight: 800; }
/* 아직 자동으로 읽지 않는 항목(재능 칸·정예화 트랙): 한 묶음으로 접고 안내 한 줄 */
.ocr-pending { border-bottom: 1px solid var(--line); }
.ocr-pending summary { cursor: pointer; padding: 8px 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.ocr-pending-n { margin-left: 6px; font-weight: 600; color: var(--sub); }
.ocr-pending .ocr-row { opacity: 0.85; }
.ocr-imgno { font-family: var(--font-num); font-size: 11px; color: var(--sub); margin-left: 4px; }
.ocr-badge { display: inline-block; margin-left: 4px; padding: 0 6px; font-size: 11px; font-weight: 800; background: var(--ink); color: var(--yellow); }
.ocr-badge.same { background: transparent; color: var(--sub); border: 1px solid var(--line); }
.ocr-current { font-size: 15px; font-weight: 500; color: var(--ink-2); word-break: keep-all; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ocr-replace { display: block; margin-top: 4px; font-weight: 800; color: #9b1c20; }
.ocr-read { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ocr-edit-block { display: flex; flex-direction: column; gap: 6px; }
.ocr-edit-block .pick { max-width: 100%; height: 34px; font-size: 15px; font-weight: 500; }
.ocr-pair { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.ocr-pair .stat-label { margin-left: 4px; }
.ocr-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; }
.ocr-stats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ocr-stats li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ocr-stats .name { min-width: 110px; font-size: 15px; font-weight: 500; }
.ocr-stats .stage { font-size: 11px; font-weight: 800; color: var(--refined); }
.ocr-stats .stage.bad { color: var(--warn); }
.ocr-raw { font-family: var(--font); font-size: 14px; font-weight: 500; color: var(--ink-2); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ocr-item-notes { margin: 0; padding-left: 16px; font-size: 12px; font-weight: 700; color: #9b1c20; }
.ocr-none { font-weight: 700; color: #9b1c20; }
.num-input.ocr-num { width: 4.6em; height: 32px; text-align: center; background: #fff; border: 1px solid var(--line);
  font-family: var(--font); font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2; }
.settings-status { margin: 0; font-size: 13px; font-weight: 700; }
.settings-key, .settings-model { flex: 1 1 240px; }
@media (max-width: 720px) {
  .ocr-row { grid-template-columns: 32px 1fr; }
  .ocr-row.ocr-head { display: none; }
  .ocr-row .ocr-current, .ocr-row .ocr-read { grid-column: 2; }
}
@media (max-width: 640px) {
  .picker.ocrdlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
  .ocr-thumbs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* 설정: 키 보이기 버튼, 인식 실험 / 확인 화면: 원본 응답 보기 */
.key-row { flex-wrap: nowrap; align-items: stretch; }
.key-row .settings-key { min-width: 0; }
.eye-btn { flex: none; width: 42px; border: 1.5px solid var(--ink); background: #fff; color: var(--sub); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.eye-btn svg { width: 22px; height: 22px; }
.eye-btn.on { background: var(--yellow); color: var(--ink); }
.eye-btn:focus-visible { outline: 3px solid var(--yellow); }
.settings-exp, .ocr-debug { border-top: 1.5px solid var(--line); padding-top: 8px; }
.settings-exp summary, .ocr-debug summary { cursor: pointer; font-size: 14px; font-weight: 900; }
.exp-group { border: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.exp-group legend { width: 100%; padding: 0; margin-bottom: 2px; }
.exp-group .ocr-check { font-size: 13px; }
.ocr-debug { margin-top: 8px; }
.ocr-debug-item { margin-top: 8px; font-size: 13px; }
.ocr-debug pre { margin: 4px 0 0; max-height: 320px; overflow: auto; padding: 8px 10px; background: var(--ink); color: #e8e8e8;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
