/* ===========================================================================
   데미지 계산기 CSS — 게임 "연구 모드" 테마 (어두운 화면 하나)
   1) 토큰  2) 기본  3) 레이아웃  4) 컴포넌트  5) 화면별
   색 역할: 금색(--gold*) = 테두리·제목·선택/켜짐, 청록(--focus) = 포커스·공식
   새 규칙은 파일 끝에 붙이지 말고 해당 섹션 안에 넣을 것.
   =========================================================================== */

/* --- 1. 토큰 ------------------------------------------------------------ */
:root {
  color-scheme: dark;

  --plane: #090d14;
  --surface: #131a26; /* 패널 */
  --surface-2: #0b1019; /* 패인 칸 (입력·트레이) */
  --surface-3: #1b2434; /* 버튼 */
  --ink: #ece6d6;
  --ink-2: #a8b0be;
  --muted: #6d7889;
  --line: #273246;
  --line-soft: #1a2333;
  --border: rgba(214, 178, 94, 0.22);

  --gold: #d6b25e;
  --gold-2: #f4d88f;
  --gold-dim: #8c7038;
  --frame: rgba(214, 178, 94, 0.32);
  --focus: #56c2ff;

  --series-1: var(--focus);
  --good: #4fd383;
  --critical: #ff6161;
  --leader: #ffb126;
  --accent-bg: rgba(214, 178, 94, 0.14);
  --accent-ink: var(--gold-2);

  /* 속성 */
  --el-fire: #ff6a4d;
  --el-water: #4ea3ff;
  --el-wind: #f2c230;
  --el-light: #f1e4b8;
  --el-dark: #b07cff;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --shadow-1:
    0 0 0 1px #04070b, 0 10px 28px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-2: 0 0 0 1px #04070b, 0 14px 36px rgba(0, 0, 0, 0.6);
  --inset: inset 0 2px 4px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px var(--gold), 0 0 12px rgba(214, 178, 94, 0.35);
  --num: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
}

/* --- 2. 기본 ------------------------------------------------------------ */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  /* 연구소 격자 + 위쪽 금빛 */
  background:
    radial-gradient(
      1100px 520px at 50% -180px,
      rgba(214, 178, 94, 0.13),
      transparent 65%
    ),
    linear-gradient(rgba(120, 150, 200, 0.035) 1px, transparent 1px) 0 0 / 28px
      28px,
    linear-gradient(90deg, rgba(120, 150, 200, 0.035) 1px, transparent 1px) 0
      0 / 28px 28px,
    var(--plane);
  background-attachment: fixed;
  font:
    14px/1.55 -apple-system,
    BlinkMacSystemFont,
    "Pretendard",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    system-ui,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  accent-color: var(--gold);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  background: linear-gradient(180deg, #fff4cf 10%, var(--gold) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6));
}
h2 {
  font-size: 14px;
  color: var(--gold-2);
}
h3 {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 650;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
}
.empty {
  color: var(--muted);
  padding: 28px 0;
  text-align: center;
  font-size: 13px;
}
code {
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
}

/* --- 3. 레이아웃 --------------------------------------------------------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 72px;
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#statusbar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0 18px;
}

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

/* 카드 = 금테 패널 + 네 모서리 장식 */
.card {
  position: relative;
  background: linear-gradient(180deg, #172031 0%, var(--surface) 140px);
  border: 1px solid var(--frame);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-1);
}
.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  --c: var(--gold);
  background:
    linear-gradient(var(--c), var(--c)) left top / 14px 2px,
    linear-gradient(var(--c), var(--c)) left top / 2px 14px,
    linear-gradient(var(--c), var(--c)) right top / 14px 2px,
    linear-gradient(var(--c), var(--c)) right top / 2px 14px,
    linear-gradient(var(--c), var(--c)) left bottom / 14px 2px,
    linear-gradient(var(--c), var(--c)) left bottom / 2px 14px,
    linear-gradient(var(--c), var(--c)) right bottom / 14px 2px,
    linear-gradient(var(--c), var(--c)) right bottom / 2px 14px;
  background-repeat: no-repeat;
}
/* 패널 제목 띠: 카드 안쪽 여백(16/18)만큼 끌어 올려 가득 채운다 */
.card > h2,
.calc-res .cardhead,
.calc-stats .cardhead,
.ocr-head {
  margin: -16px -18px 14px;
  padding: 10px 18px;
  background: linear-gradient(
    90deg,
    rgba(214, 178, 94, 0.16),
    rgba(214, 178, 94, 0.02) 70%
  );
  border-bottom: 1px solid var(--frame);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.card > h2,
.cardhead h2,
.ocr-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 #000;
}
.card > h2::before,
.calc-stats .cardhead h2::before,
.ocr-head h2::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  transform: rotate(45deg);
  background: var(--gold-2);
  box-shadow: 0 0 8px var(--gold);
}
.cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cardhead h2 {
  margin: 0;
}

/* 칩 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--ink-2);
  background: rgba(11, 16, 25, 0.8);
  border: 1px solid var(--line);
}
.chip.warn {
  color: var(--critical);
  border-color: color-mix(in srgb, var(--critical) 60%, transparent);
}

/* 속성 점 */
.eldot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
  box-shadow: 0 0 6px currentColor;
}
.eldot.Fire {
  background: var(--el-fire);
  color: var(--el-fire);
}
.eldot.Water {
  background: var(--el-water);
  color: var(--el-water);
}
.eldot.Wind {
  background: var(--el-wind);
  color: var(--el-wind);
}
.eldot.Light {
  background: var(--el-light);
  color: var(--el-light);
}
.eldot.Dark {
  background: var(--el-dark);
  color: var(--el-dark);
}

/* 표 */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
  background: rgba(214, 178, 94, 0.06);
  border-bottom: 1px solid var(--frame);
  white-space: nowrap;
}
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr {
  transition: background 100ms;
}
tbody tr:hover td {
  background: rgba(86, 194, 255, 0.06);
}

/* 입력 = 패인 슬롯 */
input,
select,
textarea {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--inset);
  transition:
    border-color 120ms,
    box-shadow 120ms;
}
input[type="number"] {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
input::placeholder {
  color: var(--muted);
}
input:hover,
select:hover {
  border-color: #36435b;
}
input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--focus);
  box-shadow:
    var(--inset),
    0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent);
}
select option {
  background: var(--surface);
  color: var(--ink);
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a8b0be' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
  cursor: pointer;
}
textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  line-height: 1.5;
}

/* 버튼 = 튀어나온 게임 버튼 */
button.btn {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid #3a475e;
  background: linear-gradient(180deg, #26324a, var(--surface-3));
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 2px 0 #04070b;
  transition:
    filter 120ms,
    transform 60ms;
}
button.btn:hover {
  filter: brightness(1.15);
}
button.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
button.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
button.btn.primary {
  background: linear-gradient(180deg, #f2d68b, #c89b45 55%, #a87c2f);
  border-color: #f6df9f;
  color: #1d1406;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 2px 0 #3d2a0b,
    0 0 14px rgba(214, 178, 94, 0.3);
}
button.btn.quiet {
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 9px;
}
button.btn.quiet:hover {
  color: var(--gold-2);
  background: rgba(214, 178, 94, 0.08);
  filter: none;
}
button.btn.danger {
  color: var(--critical);
  border-color: color-mix(in srgb, var(--critical) 45%, #3a475e);
}
button.btn.danger:hover {
  background: color-mix(in srgb, var(--critical) 16%, var(--surface-3));
}
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* 세그먼트 = 탭 레일, 고른 것은 금색 */
.seg {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--inset);
}
.seg button {
  appearance: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 5px 14px;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  background: none;
  transition:
    background 120ms,
    color 120ms;
}
.seg button:hover:not([disabled]):not([aria-pressed="true"]) {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}
.seg button[aria-pressed="true"] {
  color: #1d1406;
  background: linear-gradient(180deg, #f2d68b, #c89b45);
  border-color: #f6df9f;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 10px rgba(214, 178, 94, 0.35);
}

/* 몬스터 아이콘 = 금테 초상 */
.ic {
  display: block;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  object-fit: cover;
  flex: none;
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 0 1px #04070b;
}

.ic.md {
  width: 28px;
  height: 28px;
}
.ic.sk {
  width: 24px;
  height: 24px;
  border-color: #3a475e;
}
.ic.lg {
  width: 52px;
  height: 52px;
  border: 2px solid var(--gold);
  border-radius: var(--r-md);
  box-shadow:
    0 0 0 1px #04070b,
    0 0 14px rgba(214, 178, 94, 0.35);
}

.el {
  font-size: 11.5px;
  color: var(--muted);
}

/* 검색 자동완성 */
.search {
  position: relative;
  max-width: 440px;
}
.search input {
  width: 100%;
  height: 44px;
  font-size: 14px;
  padding: 10px 13px 10px 34px;
  border-radius: var(--r-md);
  /* 돋보기 */
  background: var(--surface-2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='%238c7038' stroke-width='1.6'/%3E%3Cpath d='M10.4 10.4L14 14' stroke='%238c7038' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
    11px center / 15px no-repeat;
}
.suggest {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--frame);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  max-height: 340px;
  overflow-y: auto;
  padding: 4px;
}
.suggest:empty {
  display: none;
}
.suggest div {
  display: flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
}
.suggest div:hover,
.suggest div.on {
  background: var(--accent-bg);
  border-color: var(--frame);
}

/* 적 제목 옆: 불러온 적 (아이콘 + 이름 + × 칩, × 로 해제)
   위아래 음수 여백으로 칩이 커도 소제목 줄 높이는 그대로 */
.calc h3 > .enemyfrom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: -8px 0 -8px 4px;
  padding: 2px 6px 2px 2px;
  border: 1px solid var(--gold-2);
  border-radius: 999px;
  background: rgba(214, 178, 94, 0.08);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  color: var(--ink-2);
}
.calc h3 > .enemyfrom > span {
  padding-right: 2px;
}
/* 칩 안 아이콘: 둥글게 */
.calc h3 > .enemyfrom .ic {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: none;
}
/* 칩의 × (선택 해제) */
.calc h3 > .enemyfrom .enemyfromx {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.calc h3 > .enemyfrom .enemyfromx:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--ink);
}
/* 소제목 옆 버튼 묶음 (컨텐츠 종류): 위아래 음수 여백으로 소제목 줄 높이는 그대로 */
.calc h3 > .seg {
  margin: -7px 0 -7px 4px;
  letter-spacing: 0;
}
.calc h3 > .seg button {
  padding: 3px 12px;
  font-size: 12px;
}
/* 몬스터 칩 옆: "○○ 버프 적용 중" (컨텐츠 종류 보너스) — 최종값과 같은 금색 */
.calc h3 > .efchip {
  margin: -6px 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(214, 178, 94, 0.14);
  color: var(--gold);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}
/* 불러온 적의 스탯 표: [이름] [기본] [+] [룬 입력] [최종] — 내 몬스터 스탯 표와 같은 모양 */
.stattab.estattab {
  grid-template-columns: 5.5em minmax(56px, 1fr) auto minmax(72px, 1fr) minmax(64px, 1fr);
  margin-bottom: 10px;
}
.stattab .st-f {
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding-right: 2px;
}
/* 컨텐츠 종류 보너스가 붙은 최종값 */
.stattab .st-f.on {
  color: var(--gold);
}
/* 적 리더: [스탯 ▼] [수치] % — 기본 칸부터 끝까지 */
.stattab .st-lead {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.stattab .st-lead > select {
  flex: 1 1 0;
  min-width: 0;
}
.stattab .st-lead > .ofmax {
  flex: 1 1 0;
}
.stattab .st-lead input {
  width: 100%;
  min-width: 0;
  text-align: right;
}
/* PvE 프리셋으로 불러온 적의 스탯 칸 · 리더 스탯 "없음" 일 때 수치 칸: 음영 + 잠금 */
.fld.locked input,
.fld.locked select,
.stattab .st-lead input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* 소제목 줄 오른쪽 끝 버튼 (구분선 뒤 — 적 "몬스터 불러오기") */
.calc h3 > .h3end {
  order: 2;
}
/* 적 칸 불러오기 패널: [몬스터 | 던전] + 검색 또는 [던전 ▼] + 몬스터 목록 — 적 제목 아래, 칸 묶음 위 */
.enemypick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.enemypick .enemymode {
  align-self: flex-start;
}
.enemypick .enemymode button {
  padding: 3px 12px;
  font-size: 12px;
}
.enemypick select {
  height: 36px;
}
/* PvE 던전 몬스터: 던전 선택 아래에 겹쳐 뜨는 드롭다운 (검색 드롭다운과 같은 판 — 아래 칸을 밀지 않음)
   웨이브마다 한 줄 [라벨] [아이콘 카드 …] (가운데 정렬, 넘치면 줄바꿈·스크롤) */
.dunpick {
  position: relative;
  display: flex;
  flex-direction: column;
}
.dunwaves {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--frame);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
}
/* 웨이브 라벨은 카드 줄 위에 (5마리 웨이브도 한 줄에 들어가게 — 카드·아이콘 크기는 모든 웨이브 같게) */
.dunwave {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dunwave .wl {
  font-size: 11.5px;
  color: var(--muted);
}
.dunmons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.duncard {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.duncard:hover {
  border-color: var(--gold-2);
  background: var(--accent-bg);
}
.duncard[aria-pressed="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(214, 178, 94, 0.35);
}
.duncard .ic {
  width: 44px;
  height: 44px;
}
.enemysearch {
  max-width: none;
}
.enemysearch input {
  height: 36px;
  font-size: 13px;
}
.enemysearch .suggest div {
  gap: 8px;
}

/* 계산기 (web/calc.js) */
.calc-mon {
  display: flex;
  align-items: center;
  gap: 14px 18px;
  flex-wrap: wrap;
}
.calc-mon .search {
  flex: 1 1 280px;
}
.calc-mon .suggest div {
  gap: 8px;
}
.calc-who {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 14px 4px 4px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
}
.calc-who b {
  font-size: 16px;
  color: var(--gold-2);
  text-shadow: 0 1px 0 #000;
}
.calc-who .sub {
  font-size: 12px;
  color: var(--ink-2);
}
/* 디폴트 화면 (몬스터 없음): 아이콘 자리 = 점선 네모, 이름 자리는 비워 둔다 (몬스터를 고를 때 헤더가 움직이지 않게) */
.calc-who .ic-empty {
  width: 52px;
  height: 52px;
  flex: none;
  border: 2px dashed var(--frame);
  border-radius: var(--r-sm);
}
.calc-who .who-empty {
  width: 150px;
  height: 38px;
}
.calc-specbar :disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
/* 디폴트 화면 본문: 패널 대신 큰 점선 박스 */
.calc-empty {
  display: grid;
  place-items: center;
  height: 60vh;
  min-height: 280px;
  border: 2px dashed var(--frame);
  border-radius: var(--r-lg);
  color: var(--gold-2);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 #000, 0 0 14px rgba(214, 178, 94, 0.25);
}
/* 몬스터를 고르기 전: 검색창 테두리를 금색으로 (시작점 표시) */
.calc-mon.nomon .search input {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(214, 178, 94, 0.25), 0 0 10px rgba(214, 178, 94, 0.18);
}
/* 앱 제목 = 디폴트 화면으로 가는 링크 (제목 글자 그라데이션 그대로) */
h1 .home {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
/* 로고: 스카우터 렌즈 (네온 블루 + 과녁 HUD) — index.html 인라인 SVG, 같은 그림이 favicon.svg.
   그림 둘레 여백 없이 잘라(viewBox) 제목 글자에 바로 붙인다, 제목 줄 높이 안에 */
h1 .logo {
  width: 32px;
  height: 30px;
  flex: none;
  filter: drop-shadow(0 0 6px rgba(86, 194, 255, 0.35));
}
.elrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.calc-specbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.calc-specbar input {
  width: 160px;
}
/* 사진 업로드로 채운 스펙 표시 */
.calc-specbar .ocr-chip {
  color: var(--focus);
  border-color: color-mix(in srgb, var(--focus) 50%, transparent);
  white-space: nowrap;
}
.calc-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch; /* 스펙·상황 패널 높이 같게 */
}
@media (max-width: 860px) {
  .calc-cols {
    grid-template-columns: 1fr;
  }
}
/* 소제목: ▌제목 ───────── */
.calc h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 9px;
  color: var(--ink);
  font-size: 14.5px;
  letter-spacing: 0.02em;
}
.calc h3::before {
  content: "";
  width: 3px;
  height: 15px;
  flex: none;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}
.calc h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.card > h2 + h3 {
  margin-top: 4px;
}
/* 내 몬스터 패널: 스탯·아티팩트·유물 사이 간격은 고정 (오른쪽 패널이 더 길면 남는 높이는 패널 아래 빈 공간으로) */
.spec-card > h3:not(:nth-of-type(1)) {
  margin-top: 42px;
}
/* 전투 설정 패널: 스킬 칸이 늘어나는 곳이라 아래에 최소 여백 */
.calc-cols > .card:last-child {
  padding-bottom: 40px;
}
/* 소제목 아래 칸 묶음 = 트레이 */
.card > .fgrid,
.card > .togs,
.card > .relic,
.card > .leadrow,
.card > .stattab,
.card > .artigrid {
  padding: 10px;
  background: rgba(4, 7, 11, 0.35);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.fgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px 10px;
}
.fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--ink-2);
  min-width: 0;
}
/* 정수 입력 칸 라벨 뒤 피해 증가 % (적 약화 효과 개수 = +100%) — 라벨이 길어 두 칸 너비, 한 줄로 */
.fgrid > .fld.cntfld {
  grid-column: span 2;
}
.fld.cntfld > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 입력칸은 숫자 3자리 너비만 (라벨만 넓게) */
.fld.cntfld input {
  width: 72px;
}
/* 최대값이 있는 칸: [ 3 ] / 10 */
.ofmax {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
}
.ofmax > input {
  flex: 0 1 auto;
}
/* 살아있는 아군 수 [ ] / [ ] */
.alivepair {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fld.alivefld .alivepair input {
  width: 56px;
}
.fld .cnt-pct {
  color: var(--gold-2);
  font-weight: 600;
}
.fld input,
.fld select {
  width: 100%;
  min-width: 0;
  height: 36px;
}
/* 스킬 설명 팝업 (web/calc.js showTip) — body 에 붙고 화면 기준으로 놓인다 */
.skilltip {
  position: absolute;
  z-index: 1000;
  max-width: 340px;
  padding: 10px 12px;
  border: 1px solid var(--frame);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  pointer-events: none;
}
.skilltip b {
  display: block;
  color: var(--gold-2);
  font-size: 13px;
  margin-bottom: 4px;
}
.skilltip p {
  margin: 0;
}
/* 규칙의 참고 문구 (드래곤 나이트 S2) — 설명과 구분 */
.skilltip p.tipnote {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--frame);
  color: var(--gold-2);
  font-size: 0.95em;
  white-space: pre-line; /* 규칙 tip 문장의 \n 을 줄바꿈으로 */
}
/* 남은 체력: 제목 줄 오른쪽 끝에 [% | HP] */
/* % 칸의 ↑↓ 는 calc.js numberKeys 가 1 씩 — 마우스 화살표(0.01 씩)는 숨긴다 */
input[data-step1] {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[data-step1]::-webkit-inner-spin-button,
input[data-step1]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fld-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 18px;
}
.fld-h .seg {
  padding: 1px;
}
.fld-h .seg button {
  padding: 0 7px;
  font-size: 11px;
  line-height: 16px;
}
.togs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.togs + .fgrid {
  margin-top: 10px;
}
/* 칸을 줄 전체에 고르게 나눈다 (버프·디버프·몬스터 효과) */
.togs.fill > .tog {
  flex: 1 1 0;
  justify-content: center;
}
.togs.fill {
  align-items: flex-start;
}
/* 전투 효과 줄 끝의 치명타 O/X: 그림 칸과 같은 높이 */
/* 전투 효과 4칸: 각자 내용 폭에서 시작해 남는 폭을 똑같이 나눠 갖는다 (양옆 여백이 네 칸 모두 같음). 치명타 글자는 줄바꿈 안 함 */
.togs.buffs > .tog {
  flex: 1 1 auto;
}
.togs.fill > .tog.critcell {
  white-space: nowrap;
}
.tog.critcell {
  align-self: stretch;
  cursor: default;
  gap: 18px;
  padding: 2px 0; /* 간격 +4px 를 양옆 안쪽 여백 2px 씩으로 상쇄 — 칸 폭은 그대로 */
}
.tog.critcell .seg {
  padding: 2px;
}
.tog.critcell .seg button {
  padding: 2px 12px;
}
/* 몬스터 효과: 데보라를 켜면 체크박스가 드롭다운(약 2칸 폭)으로 바뀌니 그림↔체크박스 간격을 미리 조금 좁힌다 */
.togs.support > .tog.img {
  gap: 14px;
}
/* 몬스터 효과 8칸: 4칸 × 2줄 (데보라·미리내·닥터 마테오·미리암 / 을동·루시퍼·벨라스카·헤르테이트) */
.togs.support {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
/* 루시퍼·벨라스카·헤르테이트: 켜면 [그림][값 ▾] 버튼, 누르면 아래에 설정 칸 */
.suppop {
  position: relative;
}
.suppop .popbtn {
  height: var(--tog-img);
  padding: 0 22px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a8b0be' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 7px center / 10px 6px;
  box-shadow: var(--inset);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
.suppop .popbtn[aria-expanded="true"] {
  border-color: var(--gold-2);
}
/* 설정 칸은 그 몬스터 칸과 같은 폭 (칸 왼쪽~오른쪽 끝) */
.poppanel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--gold-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  cursor: default;
}
.poppanel .fld {
  gap: 3px;
  font-size: 11px;
}
.poppanel .fld input {
  width: 100%;
  padding: 3px 6px;
  font-size: 12px;
}
.poppanel > button.btn {
  padding: 3px 6px;
  font-size: 11.5px;
}
/* 헤르테이트 보스/일반: 장식 없는 작은 두 칸, 고른 쪽만 금색 */
.poppanel .seg {
  display: flex;
  gap: 2px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
.poppanel .seg button {
  flex: 1 1 0;
  padding: 2px 0;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.poppanel .seg button[aria-pressed="true"] {
  color: #1d1406;
  background: var(--gold);
  border-color: var(--gold-2);
  box-shadow: none;
}
.tog.img.on > img {
  cursor: pointer;
}
.tog.img.on > select {
  height: var(--tog-img);
  padding: 0 22px 0 6px;
  background-position: right 6px center;
  font-size: 12.5px;
}
/* 방어력 감소: [그림 체크박스] [적용 턴 입력] — 두 label 로 나눠 "적용 턴" 을 눌러도 체크가 바뀌지 않게 */
.tog.img.turns {
  gap: 12px;
}
.tog.img.turns > label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.tog.img.turns .turnsin {
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: text;
  white-space: nowrap;
}
.tog.img.turns input[type="number"] {
  width: 40px;
  padding: 2px 5px;
  text-align: right;
  appearance: textfield;
  -moz-appearance: textfield;
}
.tog.img.turns input[type="number"]::-webkit-inner-spin-button,
.tog.img.turns input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* 적 칸 묶음 안의 디버프 (받는 치명피해 감소 뒤 빈칸): 입력칸 높이에 맞춘다 */
/* 적: 3열 고정 — 받는 치명피해 감소 오른쪽 두 칸에 디버프 묶음 */
.enemygrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* 디버프 묶음: 방어력 감소(필요한 만큼) + 낙인(남는 폭 전부), 패널 오른쪽 끝까지 */
.debuffs {
  grid-column: 2 / -1;
  align-self: end;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.debuffs > .tog.img {
  padding-top: 5px;
  padding-bottom: 5px;
}
.debuffs > .turns {
  flex: none;
}
.debuffs > .tog.img:not(.turns) {
  flex: none;
}
/* 아군 리더 스킬: [스탯] [수치 %] 한 줄 */
.leadrow {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 10px;
}
.leadrow > .fld {
  flex: 1 1 100px;
}
.leadrow .seg {
  height: 36px;
}
.leadrow .seg button {
  padding-top: 0;
  padding-bottom: 0;
}
/* 신속 룬: 입력칸 줄에 맞춘 [문구 … 체크박스] */
/* 스탯 표: [이름] [기본] [+] [룬 입력] — 체·공·방·속·치명피해 + 마지막 줄 신속 룬 */
.stattab {
  display: grid;
  grid-template-columns: 5.5em minmax(56px, 1fr) auto minmax(80px, 1.2fr);
  align-items: center;
  gap: 6px 10px;
}
.stattab .st-h {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-align: right;
}
.stattab .st-l {
  font-size: 13px;
  color: var(--ink-2);
}
/* 기본 스탯 = 고정 값 판 */
.stattab .st-b {
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
}
.stattab .st-b input {
  width: 100%;
  text-align: right;
}
.stattab .st-p {
  color: var(--good);
  font-weight: 700;
}
/* 룬 = 인게임 스탯 화면의 초록 숫자 */
.stattab > input {
  width: 100%;
  min-width: 0;
  color: var(--good);
  text-align: right;
}
/* 신속 룬: 줄 전체가 눌리는 칸, 체크박스는 룬 입력칸 오른쪽 끝에 맞춤 */
.stattab .st-swift {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
}
.stattab .st-swift input {
  width: 18px;
  height: 18px;
  margin: 0 4px 0 0;
  cursor: pointer;
}
/* 룬·아티팩트 숫자칸: 화살표(스핀 버튼)를 숨겨 오른쪽 여백을 줄인다 — 키보드 ↑↓·휠은 그대로 */
.stattab input[type="number"],
.artigrid input[type="number"] {
  padding-right: 8px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stattab input[type="number"]::-webkit-inner-spin-button,
.stattab input[type="number"]::-webkit-outer-spin-button,
.artigrid input[type="number"]::-webkit-inner-spin-button,
.artigrid input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* 아티팩트 20칸: 2열 × 10줄 (세로로 채움) */
.artigrid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr; /* 오른쪽 열(긴 치명피해 이름)을 조금 넓게 */
  grid-template-rows: repeat(10, auto);
  grid-auto-flow: column;
  gap: 6px 18px;
}
.fld.hfld {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.fld.hfld input {
  flex: none;
  width: 54px;
  text-align: right;
}
@media (max-width: 560px) {
  .artigrid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }
}
/* 고른 스킬 칸 */
.skillpanel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  box-shadow: var(--inset);
}
.skillrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.skillrow .formula {
  font-family: var(--num);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--focus);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px color-mix(in srgb, var(--focus) 35%, transparent);
}
/* 오른쪽 끝 [사용자 설정] ↔ × : 높이를 같게 고정 (열고 닫을 때 같은 줄의 공식·칩이 위아래로 움직이지 않게) */
.skillrow .btn {
  margin-left: auto;
  height: 26px;
  padding-top: 0;
  padding-bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.skillrow .chip {
  padding: 1px 8px;
  font-size: 11px;
  color: var(--gold-2);
  border-color: var(--frame);
}
.skillpanel .hint {
  margin: 0;
}
/* [사용자 설정]: [스킬 레벨][사용자 설정 피해 증가 %] / [협공][방어 무시][폭탄] */
.skilledit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skilledit .editrow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  align-items: end;
}
/* 협공: 체크박스 줄 안의 [협공 ▾] */
.tog.coopsel {
  cursor: default;
  padding-top: 3px;
  padding-bottom: 3px;
}
.tog.coopsel select {
  height: 28px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 12.5px;
}
/* 방어 무시: 한 칸 안에 [체크박스 방어 무시] [ 100 ] % (협공 칸처럼) */
/* 높이는 폭탄 칸과 같게: 기본 .tog 여백 그대로, % 칸은 글자 줄 높이 안에 */
.tog.ignsel {
  gap: 6px;
  cursor: default;
}
.tog.ignsel > label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.tog.ignsel input[type="number"] {
  width: 40px;
  height: 18px;
  margin: -1px 0;
  padding: 0 5px;
  line-height: 16px;
  text-align: right;
  font-size: 12px;
  border-radius: 3px;
  box-shadow: none;
  appearance: textfield; /* 위아래 화살표 없음 — 칸 밖으로 삐져나오고 숫자를 가린다 */
  -moz-appearance: textfield;
}
.tog.ignsel input[type="number"]::-webkit-inner-spin-button,
.tog.ignsel input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* 협공·방어 무시·폭탄 한 줄: 협공 드롭다운은 글자 폭만 */
.skilledit .togs {
  flex-wrap: nowrap;
}
.tog.coopsel select {
  width: auto;
}
button.btn.quiet.editx {
  font-size: 18px;
  line-height: 1;
  padding: 2px 8px;
}
/* 밖에 둘 입력(타수·내 체력 % 등)이 없는 스킬은 빈 줄을 숨긴다 */
.skillpanel > .fgrid:empty {
  display: none;
}
/* 패시브 추가 공격 칸 (고른 스킬 칸 아래) */
.skillpanel.extra {
  border-left-color: var(--focus);
}
.skillrow .skillname {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tog {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  cursor: pointer;
  user-select: none;
  transition:
    background 120ms,
    border-color 120ms,
    box-shadow 120ms;
}
.tog:hover {
  border-color: var(--gold-dim);
}
.tog:has(input:checked),
.tog.on {
  background: var(--accent-bg);
  color: var(--accent-ink);
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(214, 178, 94, 0.28);
}
/* 그림 체크박스 (버프·디버프·몬스터 효과): [그림][체크박스]. 크기는 --tog-img 한 곳에서 */
.tog.img {
  --tog-img: 24px;
  padding: 6px 8px;
  gap: 20px;
}
.tog.img img {
  width: var(--tog-img);
  height: var(--tog-img);
  border-radius: 4px;
  display: block;
}
.tog.img input[type="checkbox"] {
  appearance: none;
  width: var(--tog-img);
  height: var(--tog-img);
  margin: 0;
  border: 1.5px solid #4a5870;
  border-radius: 4px;
  background: var(--surface-2) center / 75% no-repeat;
  box-shadow: var(--inset);
  cursor: pointer;
}
.tog.img input[type="checkbox"]:checked {
  border-color: var(--gold-2);
  background-color: var(--gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%231d1406' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  box-shadow: 0 0 8px rgba(214, 178, 94, 0.5);
}
/* 스위치 토글 (스킬 칸 — 2타 피해량 증가·2회 추가 공격): [라벨 앞 슬라이더] */
.tog.switch input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 30px;
  height: 16px;
  margin: 0;
  border: 1px solid #4a5870;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--inset);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.tog.switch input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 120ms, background 120ms;
}
.tog.switch input[type="checkbox"]:checked {
  border-color: var(--gold-2);
  background: var(--gold-dim);
}
.tog.switch input[type="checkbox"]:checked::before {
  transform: translateX(14px);
  background: var(--gold-2);
}
.tog.switch input:focus-visible,
.tog.img input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.relic {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}
.relic select {
  padding: 5px 26px 5px 8px;
}
.skillseg {
  display: flex;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.skillseg button,
.calc-res .cardhead h2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.skillseg button[aria-pressed="true"] .ic.sk {
  border-color: #6b4f18;
}
.skillseg button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
/* 고른 스킬에 따라 자동으로 켜지는 패시브 (슈타르크 S3) — 누를 수는 없지만 켜진 것처럼 */
.skillseg button[disabled][aria-pressed="true"] {
  opacity: 1;
  cursor: default;
}
.skillseg .skillform {
  align-self: center;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.skillseg.alt {
  margin-top: 4px;
}
/* 호문쿨루스: [스킬 버튼][▾] — ▾ 를 누르면 아래에 그 슬롯의 진화 스킬 트리 */
.skillseg .homu {
  position: relative;
  display: inline-flex;
}
.skillseg .homu > button[data-act="skill"] {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.skillseg .homudd {
  justify-content: center;
  width: 20px;
  padding: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
/* ▾ 는 가상 요소로 (버튼 hover 배경이 덮지 않게) */
.skillseg .homudd::after {
  content: "";
  width: 10px;
  height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a8b0be' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat center / 10px 6px;
}
.skillseg .homudd[aria-expanded="true"] {
  border-color: var(--gold-2);
}
.homulist {
  right: auto;
  width: max-content;
  min-width: 100%;
  gap: 2px;
  padding: 5px;
}
.skillseg .homulist button {
  justify-content: flex-start;
  padding: 4px 10px 4px 6px;
  font-size: 12.5px;
  font-weight: 600;
}
.skillseg .homulist button.t1 {
  padding-left: 24px;
}
.skillseg .homulist button.t2 {
  padding-left: 42px;
}

/* 결과: 최종 데미지 (+ 아티팩트 추가 피해) — 최종 스탯은 내 몬스터 패널 아래 */
.calc-out {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}
/* 입력 패널(스펙·전투 설정)과 결과(최종 스탯·최종 데미지) 사이 구분선: 가운데가 밝은 금색 한 줄 */
.calc-cols + .calc-out {
  position: relative;
  margin-top: 6px;
  padding-top: 22px;
}
.calc-cols + .calc-out::before {
  content: "";
  position: absolute;
  top: 0;
  left: 4%;
  right: 4%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-2) 50%, transparent);
  opacity: 0.55;
}
/* 아티팩트 추가 피해 패널: 최종 데미지 카드 바로 아래 (같은 열, 카드 아래 여백 + 칸 간격을 줄여 붙임) */
.calc-out .calc-arti {
  margin-top: -20px;
}
.calc-out .card {
  border-color: rgba(214, 178, 94, 0.5);
}
/* 카드 아래 오른쪽 끝: [아티팩트 추가 피해] 스위치 */
.calc-res .cardfoot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.calc-res .cardhead h2 .hint {
  font-weight: 500;
}
.calc-res table td,
.calc-res table th {
  font-variant-numeric: tabular-nums;
}
/* 최종 데미지 표: 열 폭 고정 (숫자 자리수·버프가 바뀌어도 열이 움직이지 않게) — 타격 | 예측 | 최소 ~ 최대 | 적 체력 */
.calc-res:not(.calc-arti) table {
  table-layout: fixed;
}
.calc-res:not(.calc-arti) th:nth-child(1) {
  width: 16%;
}
.calc-res:not(.calc-arti) th:nth-child(2) {
  width: 18%;
}
.calc-res:not(.calc-arti) th:nth-child(3) {
  width: 32%;
}
.calc-res:not(.calc-arti) th:nth-child(4) {
  width: 34%;
}
.calc-res tbody td:first-child {
  font-family: var(--num);
  color: var(--muted);
  font-size: 12px;
}
/* 방어력 감소가 적용된 타격 표시 (적용 턴 1 이상일 때) */
.calc-res .hit-brk {
  width: 16px;
  height: 16px;
  margin-left: 6px;
  vertical-align: -3px;
  border-radius: 3px;
}
.calc-res tbody td b {
  color: var(--ink);
  font-size: 14px;
}
.calc-res tbody td:last-child {
  color: var(--ink-2);
}
/* 합계 = 금빛 큰 숫자 */
.calc-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.calc-total .big {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff6d6 15%, var(--gold) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(214, 178, 94, 0.4));
}
.calc-res .range {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.calc-warn {
  color: var(--critical);
  font-size: 12.5px;
}
/* 최종 스탯 = 인게임 스탯 창 */
.statlist {
  display: grid;
  gap: 2px;
  font-size: 13px;
}
.statlist div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  color: var(--ink-2);
  background: rgba(4, 7, 11, 0.35);
  border-left: 2px solid var(--gold-dim);
  border-radius: 2px;
}
.statlist b {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* 사진 업로드 (web/ocr.js) — 계산기 대신 보이는 화면 */
/* 몬스터 검색창 옆 [사진 업로드]: 검색창과 같은 높이, 같은 가운데 줄 */
.calc-ocrbar .btn {
  height: 44px;
  padding: 0 16px;
}
.ocr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ocr-head h2 {
  margin: 0;
}
.ocr-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.ocr-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.ocr-slot.empty {
  border-style: dashed;
  cursor: pointer;
}
.ocr-slot.empty:hover,
.ocr-slot.over {
  border-color: var(--series-1);
  background: var(--accent-bg);
}
.ocr-slot.bad {
  border-color: var(--critical);
}
.ocr-req {
  font-size: 12px;
  color: var(--critical);
  margin-left: 4px;
}
.ocr-opt {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}
.ocr-thumb {
  cursor: zoom-in;
}
.ocr-plus {
  color: var(--muted);
  margin: 0 2px;
}
.ocr-items input.ocr-in-check {
  border-color: var(--leader);
  box-shadow: 0 0 0 1px var(--leader);
}
.ocr-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.78);
  cursor: zoom-out;
}
.ocr-modal img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: default;
  border-radius: var(--r-sm);
}
.ocr-modal-x {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 28px;
  line-height: 1;
  color: #fff;
  background: none;
  border: 0;
  cursor: pointer;
}
.ocr-slot-in {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.ocr-thumb {
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: var(--surface);
  border-radius: var(--r-sm, 6px);
}
.ocr-slot-f {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}
.ocr-slot-f .hint {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ocr-slot .calc-warn {
  margin: 0;
  font-size: 12.5px;
}
.linkish {
  color: var(--accent-ink);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
}
.ocr-res-t {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.ocr-mon {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 6px;
}
/* 확인 결과: 룬 | 아티팩트·유물 상자 */
.ocr-res {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.25fr);
  gap: 14px;
  align-items: start;
  margin-top: 8px;
}
.ocr-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.ocr-box {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.ocr-box-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.ocr-box > .calc-warn {
  margin: 8px 12px 0;
  font-size: 12.5px;
}
.ocr-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ocr-items tr:last-child td {
  border-bottom: 0;
}
.ocr-items td:first-child {
  padding-left: 12px;
}
.ocr-raw {
  display: block;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}
/* 직접 입력 줄: 고르기 칸 안 글자가 읽은 줄의 글자 시작(12px)과 맞게 — 칸 4 + 테두리 1 + 안쪽 7 */
.ocr-items .ocr-row.typed td:first-child {
  padding-left: 4px;
}
.ocr-row.typed .ocr-raw {
  padding-left: 8px;
}
.ocr-row.typed select {
  margin-top: 4px;
  max-width: 100%;
  padding-left: 7px;
  padding-right: 26px; /* 오른쪽 화살표 여유 */
}
.ocr-row.typed td.num input {
  width: 72px;
}
/* 유물: 문구 + 연필 (수정) */
.ocr-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ocr-relic-ed {
  flex-wrap: wrap;
}
.ocr-relic-ed select {
  padding: 5px 26px 5px 8px;
}
.ocr-edit {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.ocr-edit:hover,
.ocr-edit.on {
  color: var(--accent-ink);
  background: var(--accent-bg);
}
.ocr-edit:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 1px;
}
button.btn.ocr-retry {
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
}
.ocr-st.typed {
  color: var(--ink-2);
}
/* 분석 중: 돌아가는 원 + 진행 막대 (web/ocr.js setBusy 가 제자리에서 고친다) */
.ocr-busy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.ocr-spin {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--series-1);
  border-radius: 50%;
  animation: ocr-spin 0.8s linear infinite;
}
@keyframes ocr-spin {
  to {
    transform: rotate(360deg);
  }
}
.ocr-bar {
  width: 120px;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.ocr-bar > i {
  display: block;
  height: 100%;
  background: var(--series-1);
  border-radius: inherit;
  transition: width 0.4s ease;
}
@media (prefers-reduced-motion: reduce) {
  .ocr-spin {
    animation-duration: 2.4s;
  }
}
/* 확인 체크 (web/ocr.js ackBox): 누르면 그 줄의 확인 필요가 풀린다 */
.ocr-stc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ocr-ack {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1.5px solid var(--leader);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition:
    background 120ms,
    border-color 120ms;
}
.ocr-ack:hover:not(:disabled) {
  background: color-mix(in srgb, var(--leader) 14%, var(--surface));
}
.ocr-ack.on {
  border-color: var(--good);
  background: var(--good);
}
.ocr-ack.on::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.ocr-ack:disabled {
  border-color: var(--line);
  cursor: default;
}
.ocr-ack:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 2px;
}
.ocr-items .ocr-row.acked td {
  background: none;
}
.ocr-note.done {
  color: var(--muted);
}
/* 룬: 스탯 이름은 줄바꿈하지 않는다 (확인 필요 문구는 오른쪽 칸에서 줄바꿈) */
.ocr-box.rune td:first-child {
  white-space: nowrap;
}
.ocr-items .ocr-row.added td {
  background: none;
}
.ocr-add td {
  padding: 6px 12px 8px;
}
button.btn.ocr-addbtn {
  padding: 4px 10px;
  font-size: 12.5px;
}
.ocr-items td,
.ocr-items th {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}
.ocr-items td.num {
  white-space: nowrap;
}
.ocr-items td.num input {
  width: 84px;
  font-variant-numeric: tabular-nums;
}
.ocr-row.check td,
.ocr-row.manual td {
  background: color-mix(in srgb, var(--leader) 10%, transparent);
}
.ocr-row.manual td {
  background: color-mix(in srgb, var(--critical) 9%, transparent);
}
.ocr-st {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.ocr-st.check {
  color: var(--leader);
}
.ocr-st.manual {
  color: var(--critical);
}
.ocr-note {
  font-size: 12.5px;
  color: var(--ink-2);
}
.ocr-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
@media (max-width: 900px) {
  .ocr-res {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .ocr-slots {
    grid-template-columns: 1fr;
  }
  .ocr-items td.num input {
    width: 72px;
  }
}

/* 최종 스탯: 스킬 효과(패시브 스택·인드라 뇌신·드루이드 야수 형태 등)로 오른 만큼 — [스킬 효과] 스위치를 켜면 값 옆에.
   제목 띠는 다른 카드 제목과 같은 높이로 고정하고, 스위치는 그 안에 들어가게 (생기거나 켤 때 아래 줄이 움직이지 않게) */
.calc-stats .cardhead {
  flex-wrap: nowrap;
  justify-content: flex-start;
}
/* 최종 스탯 = 내 몬스터 패널 아래 (오른쪽 패널이 길어 남는 자리) — 테두리 있는 상자. 제목 띠는 상자 여백만큼 끌어 올림 */
.spec-card > .calc-stats {
  position: relative;
  margin-top: 42px;
  padding: 12px 14px 14px;
  border: 1px solid rgba(214, 178, 94, 0.55);
  border-radius: var(--r-md);
  background: rgba(4, 7, 11, 0.3);
  box-shadow: 0 0 12px rgba(214, 178, 94, 0.08);
}
/* 위 입력칸들과 구분선 (결과 위 구분선과 같은 모양): 상자 위 여백 가운데 */
.spec-card > .calc-stats::before {
  content: "";
  position: absolute;
  top: -22px;
  left: 4%;
  right: 4%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-2) 50%, transparent);
  opacity: 0.55;
}
.spec-card > .calc-stats .cardhead {
  margin: -12px -14px 12px;
  padding: 9px 14px;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.calc-stats .cardhead .fxtog {
  margin-left: auto;
}
/* 전투 효과 버프 "적용 중" 칩 (제목 옆 한 줄) — 스킬 줄 칩(.skillrow .chip)과 같은 모양, 색만 네온 블루 */
.calc-stats .statchips {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.calc-stats .statchips .chip {
  padding: 1px 8px;
  font-size: 11px;
  white-space: nowrap;
  color: var(--focus);
  border-color: color-mix(in srgb, var(--focus) 40%, transparent);
}
/* 스탯 칸: 넓은 패널이라 여러 열 */
.spec-card > .calc-stats .statlist {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.tog.switch.fxtog {
  margin: -4px 0;
  padding: 2px 8px;
  font-size: 11.5px;
  line-height: 16px;
}
.statlist .fxup {
  color: var(--gold-2);
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1;
}

/* ------------------------------------------------------------------ 공용 팝업 (web/dialog.js — alert·confirm 대신, 로그인 폼) */
.dlg-back {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 6, 10, 0.62);
  backdrop-filter: blur(2px);
  animation: dlg-fade 120ms ease-out;
}
.dlg {
  width: min(380px, 100%);
  padding: 18px 20px 16px;
  background: linear-gradient(180deg, #172031 0%, var(--surface) 120px);
  border: 1px solid var(--frame);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2), 0 0 24px rgba(214, 178, 94, 0.08);
  animation: dlg-pop 140ms ease-out;
}
.dlg > h2 {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--gold-2);
}
.dlg-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dlg-msg {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-line;
}
.dlg-body .fld input {
  height: 38px;
  font-size: 14px;
}
.dlg-err {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--critical);
}
.dlg-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.dlg-auth .dlg-btns .btn.primary {
  flex: 1;
  height: 38px;
}
/* 팝업 안 글자 링크 (회원가입 · 비밀번호 찾기) */
.dlg-links {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}
.linkbtn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.linkbtn:hover {
  color: var(--gold-2);
  text-decoration: underline;
}
@keyframes dlg-fade {
  from { opacity: 0; }
}
@keyframes dlg-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
}

/* 헤더 오른쪽 계정 (로그인 전 [로그인] / 후 아이디 + [로그아웃]) — 우측 메뉴가 생기면 그쪽으로 */
.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.account .acc-who {
  font-size: 13px;
  font-weight: 650;
  color: var(--gold-2);
}
