:root {
  --bg: oklch(0.235 0 0);
  --panel: oklch(0.2891 0 0);
  --panel-2: oklch(0.3485 0 0);
  --text: oklch(0.9067 0 0);
  --muted: oklch(0.7572 0 0);
  --gold: oklch(0.8868 0.1822 95.3226);
  --red: oklch(0.7044 0.1872 23.1825);
  --green: oklch(0.8003 0.1821 151.7035);
  --line: oklch(1 0 0 / 0.06);
}
/* 라이트 모드: 로아도쓰 라이트 팔레트로 변수 오버라이드(부모가 body.light-mode 토글).
   강조(골드) → 블루. 대부분 var()라 자동 반영되고, 아래는 변수 밖 하드코딩 색 보정. */
body.light-mode {
  --bg: oklch(0.969 0.0062 255.0686);
  --panel: oklch(1 0 0);
  --panel-2: oklch(0.9678 0.0154 257.2288);
  --text: oklch(0.252 0 0);
  --muted: oklch(0.4495 0 0);
  --gold: oklch(0.6059 0.1986 256.4605);
  --red: oklch(0.6598 0.1899 23.9196);
  --green: oklch(0.6271 0.17 149.2097);
  --line: oklch(0.9266 0.0092 258.0793);
  color-scheme: light;
  background: var(--bg);
  color: var(--text);
}
body.light-mode .panel { box-shadow: 0 4px 16px oklch(0.2512 0.0989 259.3376 / 0.06); }
/* 골드(→블루) 배경 버튼은 라이트에서 흰 글자(대비) */
body.light-mode .alkkagi-btn, body.light-mode .key.active, body.light-mode .solve-btn, body.light-mode .tag-alk { color: oklch(1 0 0); }
/* 다크 hover 배경 → 라이트 hover */
body.light-mode .tool-btn:hover:not(:disabled), body.light-mode .key:hover, body.light-mode .opt-corner summary:hover { background: oklch(0.9653 0.0069 247.8906); }
/* 골드 틴트 배경 → 블루 틴트 */
body.light-mode .vs-row.row-rec { background: oklch(0.6059 0.1986 256.4605 / 0.1); }
body.light-mode .close-hint { background: oklch(0.6059 0.1986 256.4605 / 0.1); }
body.light-mode .slot.shield { box-shadow: 0 0 6px oklch(0.6059 0.1986 256.4605 / 0.5); }
/* Vue 마운트 완료 전 날 것 템플릿(오버레이·{{}}) 노출 방지 — 마운트되면 v-cloak 제거됨 */
[v-cloak] { display: none !important; }
* { box-sizing: border-box; }
/* 글꼴·배경·색·margin·color-scheme 은 body.content-page 가 더 높은 특정도로 이미 정의한다.
   여기서 다시 선언하면 콘텐츠 페이지 레이아웃(flex column, min-height)과 어긋난다. */
.container { max-width: 760px; width: 94%; margin: 0 auto; padding: 18px 0 60px; display: flex; flex-direction: column; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 0 10px oklch(0 0 0 / 0.5); padding: 18px; margin-bottom: 18px;
}
.board-toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 10px; }
.tool-btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-weight: 700; cursor: pointer; transition: 0.15s; white-space: nowrap; flex-shrink: 0; }
.tool-btn:hover:not(:disabled) { background: oklch(0.4091 0 0); }
.tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.vs-head { display: flex; justify-content: space-between; color: var(--gold); font-weight: 700; margin: 2px 6px 8px; }
.board-scroll { overflow-x: auto; }
.vs-row { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 8px 0; padding: 4px 2px; border-radius: 8px; }
.vs-row.row-rec { background: oklch(0.8868 0.1822 95.3226 / 0.12); }
.ln { color: var(--muted); font-size: 0.8em; width: 40px; text-align: center; flex: 0 0 auto; }
.cells { display: flex; gap: 6px; }
.sum { min-width: 32px; text-align: center; font-weight: 800; font-size: 1.05em; }
.sum.win { color: var(--green); }
.sum.lose { color: var(--red); }
.sum.tie { color: var(--muted); }
.vs { color: var(--muted); font-weight: 700; }
.slot {
  width: 46px; height: 46px; border-radius: 8px; font-size: 1.2em; font-weight: 700;
  background: var(--bg); color: var(--text); border: 1px solid var(--panel-2);
  cursor: pointer; transition: 0.15s;
}
.slot:hover { border-color: var(--gold); }
.slot.filled { background: var(--panel-2); }
.slot.shield { border: 2px solid var(--gold); box-shadow: 0 0 6px oklch(0.8868 0.1822 95.3226 / 0.5); }
.slot.selected { outline: 2px solid var(--gold); outline-offset: 1px; }
.alkkagi-btn { width: 100%; margin: 8px 0 4px; padding: 12px; font-weight: 700; border: none; border-radius: 8px; background: var(--gold); color: #000; cursor: pointer; transition: 0.15s; }
.alkkagi-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px oklch(0 0 0 / 0.4); }
.keypad-title { color: var(--muted); font-size: 0.9em; margin: 8px 0 6px; }
.keypad { display: flex; flex-wrap: wrap; gap: 8px; }
.key {
  min-width: 46px; height: 42px; padding: 0 12px; border-radius: 8px; font-weight: 700;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); cursor: pointer; transition: 0.15s;
}
.key:hover { background: oklch(0.4091 0 0); }
.key.active { background: var(--gold); color: #000; }
.key-shield { color: var(--gold); }
.keypad-block { margin-bottom: 14px; }
.roll-block { margin-bottom: 4px; }
.key-clear { color: var(--muted); }
.key:disabled { opacity: 0.35; cursor: not-allowed; }
.key:disabled:hover { background: var(--panel-2); }
.section-toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.9em; font-weight: 700; cursor: pointer; user-select: none; padding: 4px 2px 10px; }
.section-toggle:hover { color: var(--text); }
.section-toggle-arrow { color: var(--gold); font-size: 0.8em; width: 0.9em; display: inline-block; }
.input-section { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; transition: opacity 0.15s; }
.input-section.roll-input { border-left: 3px solid var(--gold); }
.input-section.inactive { opacity: 0.5; }
.shield-hint { color: var(--gold); font-weight: 700; }
.options-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 4px; }
.chk { color: var(--muted); font-size: 0.9em; display: flex; align-items: center; gap: 6px; }
.solve-btn {
  width: 100%; margin-top: 12px; padding: 14px; font-size: 1.05em; font-weight: 700;
  border: none; border-radius: 8px; background: var(--gold); color: #000; cursor: pointer; transition: 0.15s;
}
.solve-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px oklch(0 0 0 / 0.4); }
.solve-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.result-card.best { text-align: center; padding: 10px 0 14px; }
.result-error { color: var(--red); font-weight: 700; text-align: center; padding: 6px 0; }
.engine-badge { text-align: center; color: var(--muted); font-size: 0.8em; margin-bottom: 6px; }
.engine-badge strong { color: var(--gold); }
.rec-line { font-size: 1.15em; }
.tag-alk { background: var(--gold); color: #000; border-radius: 6px; padding: 1px 8px; font-size: 0.75em; margin-left: 6px; font-weight: 700; }
.tag-alk-sm { color: var(--gold); font-size: 0.8em; margin-left: 6px; }
.rec-winrate { font-size: 1.8em; font-weight: 800; margin-top: 6px; }
.close-hint { margin: 8px auto 0; max-width: 30em; font-size: 0.9em; color: var(--gold); background: oklch(0.8868 0.1822 95.3226 / 0.10); border-radius: 8px; padding: 7px 12px; line-height: 1.5; }
.close-hint .line2 { color: var(--text); font-weight: 700; }
.mitjang-advice { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; text-align: center; }
.mitjang-headline { font-size: 1.15em; font-weight: 800; margin-bottom: 4px; }
.mitjang-detail { color: var(--muted); font-size: 0.9em; }
.rec-yes { color: var(--green); }
.rec-no { color: var(--gold); }
.other-title { color: var(--muted); font-size: 0.85em; margin: 14px 0 6px; }
.opt-row { display: flex; justify-content: space-between; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 0.95em; }
.footnote { color: var(--muted); font-size: 0.8em; text-align: center; margin-top: 6px; order: 3; }
.update-box { order: 2; text-align: right; margin-top: -14px; margin-bottom: -6px; padding-right: 2px; color: oklch(0.6268 0 0); font-size: 12px; transition: color 0.3s ease; }
@media (max-width: 560px) {
  /* 칸은 38px 이 상한이고, 화면이 좁아지면 flex 축소로 함께 줄어든다.
     min-width 기본값(auto)이 글자 폭에서 멈춰 375px 에서 보드가 53px 넘치고
     내 필드 왼쪽 끝·상대 필드 오른쪽 끝 칸이 잘렸다.
     하한을 풀고 aspect-ratio 로 정사각을 지킨다. */
  .slot { width: 38px; height: auto; aspect-ratio: 1; min-width: 0; padding: 0; font-size: 0.95em; }
  .cells { gap: 3px; min-width: 0; }
  .ln { width: 20px; font-size: 0.66em; }
  .sum { min-width: 24px; font-size: 0.95em; }
  .vs-row { gap: 4px; }
  /* 보드만 패널 여백을 빌려 가로 20px 을 더 쓴다 */
  .board-scroll { margin-inline: -10px; padding-inline: 2px; }
}
/* 화면공유 중 결과 패널 좌측 상단에 뜨는 옵션(가로 2열).
   position:absolute로 흐름에서 빼서, 펼쳐도 패널 높이가 늘어나지 않고
   그 위에 겹쳐 뜨는 팝오버 형태 - 빈 공간을 그대로 사용. */
.panel.result { position: relative; }
.opt-corner-row { position: absolute; top: 18px; left: 18px; z-index: 6; }
.opt-corner summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex; align-items: center;
  font-size: 0.82em; font-weight: 700; color: var(--muted);
  padding: 5px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.opt-corner summary::-webkit-details-marker { display: none; }
.opt-corner summary:hover { background: oklch(0.4091 0 0); color: var(--text); border-color: var(--gold); }
.opt-corner[open] summary { color: var(--gold); border-color: var(--gold); }
.opt-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin-top: 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; box-shadow: 0 8px 22px oklch(0 0 0 / 0.45);
  animation: opt-pop-in 0.16s ease-out;
}
@keyframes opt-pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
/* .opt-more .chk(display:block, 2클래스)와 동일 우선순위라 소스순서에 밀리던 문제 ->
   3클래스로 확실히 이기게 해 flex 정렬(체크박스+글자 간격/수직중앙)이 항상 적용되도록 함. */
.opt-corner .opt-grid .chk { display: flex; margin-top: 0; font-size: 0.8em; white-space: nowrap; }

/* 화면 인식 / 보정 */
/* 자동 배지 + 스캔 메시지를 한 묶음으로 - 액션 버튼들 사이에 안 끼고 같이 붙어다님 */
.scan-info { display: flex; align-items: baseline; flex-wrap: wrap; }
.scan-status { font-size: 0.85rem; color: var(--muted); margin-left: 0.5rem; word-break: keep-all; }
.auto-dot { font-size: 0.8rem; font-weight: 700; color: var(--gold); white-space: nowrap; }
.tool-btn.scan-go { border-color: var(--gold); }
.vs-row.scan-warn { outline: 2px solid #e6c200; outline-offset: 2px; border-radius: 6px; }
.opt-more { display: inline-block; margin-left: 0.5rem; }
.opt-more summary { cursor: pointer; color: var(--muted); }
.opt-more .chk { display: block; margin-top: 0.4rem; }
.cal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 50; }
.cal-modal { background: var(--panel); padding: 16px; border-radius: 10px; max-width: 95vw; }
.cal-modal canvas { display: block; touch-action: none; cursor: crosshair; max-width: 100%; }
.cal-help { color: var(--text); font-size: 0.9rem; margin-bottom: 8px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.cal-help-link { color: var(--gold); font-weight: 700; text-decoration: none; white-space: nowrap; }
.cal-help-link:hover { text-decoration: underline; }
.cal-btns { margin-top: 10px; display: flex; gap: 8px; justify-content: flex-end; }

/* 화면 공유 가이드 링크(툴바 아래, 우측 끝, 공유 시작 전에만) */
.share-hint { text-align: right; margin-top: -2px; margin-bottom: 10px; }
.share-hint a { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-decoration: none; cursor: pointer; }
.share-hint a:hover { color: var(--gold); text-decoration: underline; }

/* 화면 공유 가이드 모달(보정 예시 사진 + 단계 설명) */
.guide-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.guide-modal { background: var(--panel); padding: 20px; border-radius: 12px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; }
.guide-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.guide-header h3 { margin: 0; font-size: 1.1em; color: var(--text); }
.guide-close { background: transparent; border: none; color: var(--muted); font-size: 1.1em; cursor: pointer; line-height: 1; padding: 4px; border-radius: 6px; transition: 0.15s; }
.guide-close:hover { color: var(--text); background: var(--panel-2); }
.guide-img { display: block; width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.guide-caption { text-align: center; color: var(--gold); font-weight: 700; font-size: 0.9em; margin: 8px 0 14px; }
.guide-steps { margin: 0 0 16px; padding-left: 1.3em; color: var(--text); font-size: 0.92em; line-height: 1.6; }
.guide-steps li { margin-bottom: 8px; }
.guide-steps li:last-child { margin-bottom: 0; }
.guide-steps strong { color: var(--gold); }
.guide-ok { width: 100%; }

/* 리롤 두 주사위 선택 카드: 승자는 골드 강조, 패자는 흐리게 */
.rr-opts { display: flex; gap: 12px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.rr-opt {
  display: flex; align-items: center; gap: 9px; padding: 9px 16px;
  border-radius: 12px; border: 1.5px solid var(--line); color: var(--muted); opacity: 0.7;
}
.rr-opt .rr-die { font-weight: 800; font-size: 1.45em; line-height: 1; color: var(--text); }
.rr-opt .rr-p { font-weight: 700; font-size: 1.05em; }
.rr-opt.rr-win {
  border-color: var(--gold);
  background: color-mix(in oklab, var(--gold) 12%, transparent);
  color: var(--text); opacity: 1;
}
.rr-opt.rr-win .rr-die { color: var(--gold); }
.rr-opt.rr-win .rr-p { color: var(--green); }
.rr-tag { background: var(--gold); color: #000; font-size: 0.72em; font-weight: 800; border-radius: 5px; padding: 2px 7px; }
