/* 한지 테마: 밝은 종이 바탕, 먹색 글씨, 인주(붉은 도장) 강조색 */
:root {
  /* 어두운 무협 테마 (설계문서 6.36): 먹빛 옻칠 바탕, 금박 선, 붉은 옻칠 포인트.
     인물 그림은 먹으로 그린 것이라 밝은 종이(족자) 위에만 올린다 → .arena, .figure, .cover 는 아래 "종이" 값을 다시 쓴다. */
  /* 2026-11-16 사용자: "너무 어둡다" → 먹빛에서 짙은 옻칠 나무색으로 한 단계 밝힘 */
  --bg: #2a2119;
  --panel: #362b21;
  --panel-2: #413429;
  --border: #6b5a41;
  --text: #f0e7d3;
  --muted: #b8aa90;
  --accent: #c23a2b;
  --accent-text: #fbf1dc;
  --gold: #c9a45c;
  --gold-dim: #8a7243;
  --ink: #d9c9a2; /* 굵은 선과 강조 글자 (밝은 테마에서는 먹색이었다) */
  --ink-fill: linear-gradient(180deg, #8f2217, #6b1710); /* 눌린 단추·고른 탭의 붉은 옻칠 */
  --danger: #f28c70; /* 어두운 바탕 위 경고 글자 (대비 4.5 이상) */
  --accent-ink: #f08468; /* 어두운 바탕 위 붉은 글자 (--accent는 바탕·테두리용) */
  --bar-track: #4a3d31;
  --bar-hp: #86b04c;
  --bar-mp: #5c8fcf;
  --bar-fatigue: #d39b48;
  --bar-insight: #a585c2;
  --radius: 6px;
  --gap: 16px;
  /* 종이(족자) 위에서 쓰는 값 */
  --paper: #f3ead4;
  --paper-ink: #2a251f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  /* 한지 결: 아주 옅은 가로 줄무늬를 겹친다 (그림 파일 없이 CSS만) */
  background-color: var(--bg);
  /* 옻칠한 나무 결 + 위쪽의 붉은 등불빛 + 가장자리 어둠 */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(160, 50, 30, 0.22), transparent 70%),
    radial-gradient(ellipse at 50% 120%, rgba(201, 164, 92, 0.08), transparent 60%),
    repeating-linear-gradient(92deg, rgba(255, 240, 210, 0.012) 0 2px, transparent 2px 7px);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Noto Serif KR", "Batang", "Apple SD Gothic Neo", "Malgun Gothic", serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* 세로 한 줄 배치. 폰(360px)에서는 좌우 16px 여백. */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px var(--gap);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.screen {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.title {
  margin: 48px 0 0;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  color: var(--ink);
}

/* 제목 아래 붉은 낙관(도장) */
.title::after {
  content: "무";
  display: block;
  width: 36px;
  height: 36px;
  margin: 12px auto 0;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.3rem;
  line-height: 36px;
  letter-spacing: 0;
}
/* 칸: 먹선 테두리 + 안쪽 가는 선 (화첩의 칸처럼) */
.panel {
  background: var(--panel);
  border: 1px solid rgba(201, 164, 92, 0.55);
  border-radius: 2px;
  box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px rgba(201, 164, 92, 0.25);
  padding: var(--gap);
}

.notice {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  white-space: normal;
  word-break: keep-all;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
}

/* 모든 단추: 각진 모서리, 아래 먹 그림자, 누르면 내려앉는다 */
.btn {
  border-radius: 2px;
  box-shadow: 0 2px 0 rgba(201, 164, 92, 0.35);
  transition: translate 0.08s ease, box-shadow 0.08s ease;
}

.btn:active:not(:disabled) {
  translate: 0 2px;
  box-shadow: 0 0 0 rgba(201, 164, 92, 0.35);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ink-fill);
  border-color: var(--ink);
  color: var(--accent-text);
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

/* ---------- 공통 글자 ---------- */

.heading {
  margin: 16px 0 0;
  padding-bottom: 6px;
  border-bottom: 3px double var(--ink);
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.subheading {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}

/* 칸 제목: 붉은 먹점 + 먹색 제목 + 옅은 한자 + 아래 붓선 */
.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  font-size: 1.02rem;
  letter-spacing: 0.08em;
}

.section-title::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  align-self: center;
  border-radius: 1px;
  background: var(--accent);
  rotate: 45deg;
}

.section-hanja {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.25em;
  opacity: 0.75;
}

.panel-head .section-title {
  flex: 1;
  border-bottom: none;
  padding-bottom: 0;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.error {
  margin: 0;
  color: var(--danger);
}

.error-box {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--danger);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9rem;
}

.story {
  margin: 0;
  word-break: keep-all;
}

/* ---------- 이름 입력 ---------- */

.label {
  color: var(--muted);
  font-size: 0.95rem;
}

.text-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.text-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- 문파 카드 ---------- */

.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  word-break: keep-all;
}

.card:hover {
  border-color: var(--accent);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-ink);
}

.card-title::before {
  content: "» ";
  color: var(--muted);
}

.card-desc {
  color: var(--text);
}

.card-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- 일과 ---------- */
.day {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
}

.stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
}

.stats dt {
  color: var(--muted);
}

.stats dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.list {
  margin: 0;
  padding-left: 1.2em;
}

.log li + li {
  margin-top: 4px;
}

/* ---------- 상단 상태 표시줄 ---------- */

.status-bar {
  position: sticky;
  top: 0;
  z-index: 15; /* 혈도 점(z-index 1) 같은 내용이 위로 비쳐 보이지 않게, 아래 탭(20)보다는 낮게 */
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: -32px calc(-1 * var(--gap)) 0;
  padding: 12px var(--gap);
  background: var(--panel);
  /* 두루마리: 위아래에 굵은 먹색 축, 그 안쪽에 가는 선 */
  border-top: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
  box-shadow:
    inset 0 2px 0 rgba(201, 164, 92, 0.25),
    inset 0 -2px 0 rgba(201, 164, 92, 0.25),
    0 3px 8px rgba(0, 0, 0, 0.45);
}

.status-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.seal {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 40px;
  text-align: center;
}

.status-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.status-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.small {
  font-size: 0.85rem;
}

.status-top .day {
  flex: none;
  font-size: 1rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 3em 1fr 5.5em;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.bar-label {
  color: var(--muted);
}

.bar {
  height: 8px;
  border-radius: 4px;
  background: var(--bar-track);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  /* 너비 대신 transform으로 줄인다 (2026-11-23 애니메이션 점검): 배치를 다시 계산하지 않는다 */
  transform: scaleX(var(--fill, 0));
  transform-origin: left center;
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

.bar-hp {
  background: var(--bar-hp);
}

.bar-mp {
  background: var(--bar-mp);
}

.bar-fatigue {
  background: var(--bar-fatigue);
}
/* 인연 */
.npc-seal {
  background: #c25a76;
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 4px #c25a76;
}

.choice-btn.is-teach {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.story-quote {
  margin: 8px 0 0;
  font-style: italic;
  word-break: keep-all;
}

.bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- 행동 버튼 (폰에서는 2열, 넓으면 3열) ---------- */

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 520px) {
  .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 수련 판: 위에 "修 練" 글자를 얹은 먹선 칸 */
.actions-board {
  position: relative;
  padding: 22px 12px 14px;
  border-top: 3px double var(--ink);
  border-bottom: 3px double var(--ink);
  background: rgba(255, 240, 210, 0.03);
}

.board-title {
  position: absolute;
  top: -0.85em;
  left: 50%;
  translate: -50% 0;
  padding: 0 14px;
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  white-space: nowrap;
}

.actions-board .warn {
  margin: 0 0 10px;
}

/* 현판: 두꺼운 먹선 테두리, 안쪽 가는 선, 모서리의 붉은 낙관 */
.action-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-height: 78px;
  padding: 12px 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--panel-2);
  box-shadow:
    inset 0 0 0 3px var(--panel-2),
    inset 0 0 0 4px rgba(201, 164, 92, 0.35),
    0 3px 0 rgba(201, 164, 92, 0.55);
  transition:
    translate 0.08s ease,
    box-shadow 0.08s ease,
    background 0.15s ease;
}

.action-btn:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--panel-2);
}

/* 누를 때: 판이 아래로 꾹 눌린다 */
.action-btn:active:not(:disabled),
.action-btn.is-stamped {
  translate: 0 3px;
  box-shadow:
    inset 0 0 0 3px var(--panel-2),
    inset 0 0 0 4px rgba(201, 164, 92, 0.35),
    0 0 0 rgba(201, 164, 92, 0.55);
}

.action-name {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
}

.action-tagline {
  font-size: 0.78rem;
  color: var(--accent-ink);
  letter-spacing: 0.05em;
}

.action-hint {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.35;
}

/* 낙관: 모서리에 비스듬히 찍힌 붉은 도장 */
.action-seal {
  position: absolute;
  top: -9px;
  right: -7px;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--accent);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--accent-ink);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 21px;
  text-align: center;
  rotate: 8deg;
  opacity: 0.85;
}

.action-btn:nth-child(even) .action-seal {
  rotate: -7deg;
}

/* 누르면 낙관이 커졌다가 "쿵" 찍히며 진해진다 */
.action-btn.is-stamped .action-seal {
  animation: seal-stamp 0.26s cubic-bezier(0.3, 0, 0.4, 1) both;
}

@keyframes seal-stamp {
  0% { scale: 2.2; opacity: 0; }
  60% { scale: 0.92; opacity: 1; background: var(--accent); color: var(--accent-text); }
  100% { scale: 1; opacity: 1; background: var(--accent); color: var(--accent-text); }
}

.action-btn:disabled {
  opacity: 0.4;
  box-shadow: none;
}

/* ---------- 윤회: 특성·환생·회귀 ---------- */

.samsara-line {
  margin: -20px 0 8px;
  text-align: center;
  color: var(--accent-ink);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.trait-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.trait-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 10px 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: translate 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

.trait-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.trait-card:active:not(:disabled) {
  translate: 0 2px;
}

.trait-card.is-picked {
  border-color: var(--accent);
  background: var(--ink-fill);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3px var(--accent);
}

.trait-hanja {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--accent-ink);
}

.trait-card.is-picked .trait-hanja {
  color: #e8a598;
}

.trait-name {
  font-weight: 700;
  font-size: 1.02rem;
}

.trait-text {
  font-size: 0.75rem;
  opacity: 0.85;
}

.trait-count {
  font-weight: 700;
  color: var(--accent-ink);
}

.perk-list li + li {
  margin-top: 4px;
}

.samsara-panel {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px var(--accent);
}

.path-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.path-hanja {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent-ink);
}

.endgame-panel {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px var(--accent);
}

.endgame-panel .bracket {
  margin: 8px 0;
}

/* ---------- 첫 5분 안내 (guide.js) ---------- */

.goal-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--accent);
  border-left-width: 5px;
  border-radius: 2px;
  background: var(--panel-2);
}

.goal-seal {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  line-height: 30px;
  text-align: center;
  rotate: -5deg;
}

.goal-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.goal-title {
  font-weight: 700;
  color: var(--accent-ink);
}

.goal-text {
  font-size: 0.86rem;
  line-height: 1.5;
  word-break: keep-all;
}

.goal-go {
  flex: none;
  padding: 6px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--ink-fill);
  color: var(--accent-text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* 추천 행동: 붉은 테가 은은하게 맥동, 위에 "추천" 표 */
.action-btn.is-recommended {
  border-color: var(--accent);
  animation: rec-pulse 1.8s ease-in-out infinite;
}

.action-btn.is-recommended::before {
  content: "추천";
  position: absolute;
  top: -10px;
  left: 8px;
  padding: 0 6px;
  border-radius: 2px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: inset 0 0 0 3px var(--panel-2), inset 0 0 0 4px rgba(158, 43, 30, 0.6), 0 3px 0 rgba(201, 164, 92, 0.55), 0 0 0 0 rgba(158, 43, 30, 0.35); }
  50% { box-shadow: inset 0 0 0 3px var(--panel-2), inset 0 0 0 4px rgba(158, 43, 30, 0.6), 0 3px 0 rgba(201, 164, 92, 0.55), 0 0 0 6px rgba(158, 43, 30, 0); }
}

/* 사부의 한마디 */
.hint-card {
  position: relative;
  padding: 10px 12px 10px;
  border: 1.5px dashed var(--ink);
  border-radius: 2px;
  background: var(--panel-2);
  animation: rise-in 0.35s ease both;
}

.hint-who {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-ink);
  letter-spacing: 0.1em;
}

.hint-text {
  margin: 2px 0 8px;
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: keep-all;
}

.hint-ok {
  width: auto;
}

@media (prefers-reduced-motion: reduce) {
  .action-btn.is-recommended {
    animation: none;
  }
}

/* ---------- 줄거리 (story.js) ---------- */

.chapter-panel {
  border-color: var(--ink);
}

.chapter-title {
  display: block;
  font-weight: 700;
  color: var(--accent-ink);
  letter-spacing: 0.1em;
}

.chapter-text {
  margin: 6px 0 0;
  line-height: 1.75;
  word-break: keep-all;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.chapter-item {
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: rgba(18, 16, 14, 0.5);
}

.chapter-item summary {
  cursor: pointer;
  font-size: 0.95rem;
}

.chapter-item .chapter-text {
  font-size: 0.9rem;
}

/* ---------- 새 버전 알림 띠 (update.js) ---------- */

.update-banner {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--ink-fill);
  color: var(--accent-text);
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(31, 27, 22, 0.35);
  animation: rise-in 0.3s ease both;
}

.update-banner button {
  padding: 4px 12px;
  border: 1.5px solid var(--accent-text);
  border-radius: 2px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- 일과 아래 탭 ---------- */

.tab-body {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  /* 아래 탭에 가리지 않게 */
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

.tab-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  translate: -50% 0;
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  gap: 4px;
  background: var(--panel);
  border-top: 5px solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(201, 164, 92, 0.25), 0 -3px 8px rgba(0, 0, 0, 0.45);
}

.tab-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-height: 56px;
  padding: 4px 0 2px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, translate 0.08s ease;
}

.tab-btn:active {
  translate: 0 2px;
}

.tab-icon {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.tab-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

/* 고른 탭: 먹색 현판에 붉은 테 */
.tab-btn.is-active {
  background: var(--ink-fill);
  border-color: var(--ink);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3px var(--accent);
}

.tab-btn.is-active .tab-icon {
  animation: tab-stamp 0.22s cubic-bezier(0.3, 0, 0.4, 1) both;
}

@keyframes tab-stamp {
  from { scale: 1.4; opacity: 0.4; }
  to { scale: 1; opacity: 1; }
}

/* 가운데 수련 칸: 위로 솟은 큰 현판. 고르지 않았을 때도 먹 테두리로 눈에 띈다 */
.tab-btn.is-main {
  margin-top: -18px;
  min-height: 74px;
  border: 2px solid var(--ink);
  background: var(--panel-2);
  color: var(--ink);
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.45), inset 0 0 0 2px var(--panel-2), inset 0 0 0 3px var(--accent);
}

.tab-btn.is-main .tab-icon {
  font-size: 1.8rem;
}

.tab-btn.is-main.is-active {
  background: var(--ink-fill);
  color: var(--accent-text);
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.45), inset 0 0 0 2px var(--ink), inset 0 0 0 3px var(--accent);
}

/* 알림 점: 붉은 인주 */
.tab-dot {
  position: absolute;
  top: 5px;
  right: calc(50% - 20px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--panel);
}

.tab-btn.is-active .tab-dot {
  box-shadow: 0 0 0 2px var(--ink);
}

.tab-tip {
  text-align: center;
}

/* 비무 탭 */
.actions-one {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* 혈도: 경맥 두 줄과 생사현관. 뚫린 혈은 먹점, 다음 혈은 붉게 맥동 */
.mer-channel {
  margin-top: 10px;
}

.mer-channel-name {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.15em;
}

.mer-line {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

/* 혈을 잇는 경맥 선 */
.mer-line::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 8%;
  right: 8%;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 10px);
}

.mer-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.mer-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--panel);
  z-index: 1;
}

.mer-name {
  font-size: 0.7rem;
  color: var(--muted);
}

.is-open > .mer-dot {
  border-color: var(--ink);
  background: radial-gradient(circle at 40% 35%, #5a5248, var(--ink) 70%);
}

.mer-node.is-open .mer-name {
  color: var(--ink);
  font-weight: 700;
}

.is-next > .mer-dot {
  border-color: var(--accent);
  animation: mer-pulse 1.6s ease-in-out infinite;
}

.mer-node.is-next .mer-name {
  color: var(--accent-ink);
  font-weight: 700;
}

@keyframes mer-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(158, 43, 30, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(158, 43, 30, 0); }
}

.mer-final {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.mer-final.is-open {
  color: var(--ink);
  font-weight: 700;
}

.mer-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mer-btn {
  margin-top: 8px;
}

/* 의뢰 게시판: 방문(榜文)처럼 붙은 종이 */
.quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.quest-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--ink);
  background: var(--panel-2);
  box-shadow: 0 2px 0 rgba(201, 164, 92, 0.15);
}

.quest-card.is-done {
  opacity: 0.55;
}

.quest-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quest-type {
  flex: none;
  padding: 0 6px;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 700;
  rotate: -3deg;
}

.quest-type.type-심부름 {
  border-color: var(--muted);
  color: var(--muted);
}

.quest-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.quest-reward {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.quest-foot .btn-small {
  width: auto;
  flex: none;
}

/* 약방: 약사 선생과 말풍선 */
.shop-keeper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 6px 0 10px;
}

.keeper-portrait {
  flex: none;
  width: 84px;
}

.speech {
  position: relative;
  flex: 1;
  min-width: 0;
  margin-bottom: 18px;
  padding: 8px 12px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 14px 14px 14px 2px;
  background: var(--panel-2);
  box-shadow: 0 2px 0 rgba(201, 164, 92, 0.25);
  animation: speech-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

/* 말풍선 꼬리: 약사 쪽(왼쪽 아래)으로 */
.speech::before {
  content: "";
  position: absolute;
  left: -9px;
  bottom: 8px;
  width: 14px;
  height: 14px;
  background: var(--panel-2);
  border-left: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  rotate: 45deg;
  skew: 10deg 10deg;
}

.speech-who {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-ink);
  letter-spacing: 0.1em;
}

.speech-text {
  margin: 2px 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
  word-break: keep-all;
}

.speech-note {
  display: inline-block;
  margin-top: 4px;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: var(--accent-ink);
  font-size: 0.72rem;
}

@keyframes speech-in {
  from { scale: 0.85; opacity: 0; transform-origin: left bottom; }
  to { scale: 1; opacity: 1; }
}

/* 비무대회 */
.tournament-panel.is-open {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px var(--accent);
}

.bracket {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bracket-row {
  display: grid;
  grid-template-columns: 3em 48px 1fr 2.6em;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.bracket-row .portrait {
  width: 48px;
}

.bracket-round {
  font-weight: 700;
  color: var(--muted);
}

.bracket-row.is-now {
  border: 2px solid var(--accent);
}

.bracket-row.is-now .bracket-round,
.bracket-row.is-now .bracket-res {
  color: var(--accent-ink);
}

.bracket-row.is-win .bracket-res {
  color: var(--ink);
  font-weight: 700;
}

.bracket-row.is-lose {
  opacity: 0.6;
}

.bracket-res {
  text-align: right;
  font-weight: 700;
}

/* 무공 탭 */
.skill-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.skill-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(18, 16, 14, 0.5);
}

.skill-desc {
  font-size: 0.86rem;
  line-height: 1.5;
}

/* ---------- 수련 장면 (행동을 고른 뒤 잠깐 덮이는 화면) ---------- */

.scene-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 16, 14, 0.92);
  backdrop-filter: blur(2px);
  cursor: pointer;
  animation: scene-in 0.25s ease both;
  outline: none;
}

.scene-overlay.is-leaving {
  animation: scene-out 0.18s ease both;
}

@keyframes scene-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scene-out {
  to { opacity: 0; }
}

.scene-card {
  width: min(100%, 380px);
  padding: 26px 22px 18px;
  border-top: 3px double var(--ink);
  border-bottom: 3px double var(--ink);
  background: var(--panel);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.scene-time {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  animation: rise-in 0.4s ease both;
}

/* 낙관 한자가 먹이 번지듯 크게 나타났다 자리 잡는다 */
.scene-seal {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--ink);
  animation: ink-bloom 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.scene-seal::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 27, 22, 0.22), rgba(31, 27, 22, 0.08) 55%, transparent 72%);
  animation: ink-spread 0.9s ease-out both;
  z-index: -1;
}

@keyframes ink-bloom {
  0% { scale: 1.8; opacity: 0; filter: blur(6px); }
  55% { opacity: 1; filter: blur(0); }
  100% { scale: 1; opacity: 1; }
}

@keyframes ink-spread {
  0% { scale: 0.2; opacity: 0; }
  40% { opacity: 1; }
  100% { scale: 1.25; opacity: 1; }
}

.scene-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent-ink);
  animation: rise-in 0.4s ease 0.2s both;
}

/* 문장: 붓으로 쓰듯 왼쪽에서 오른쪽으로 드러난다 */
.scene-line {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.7;
  word-break: keep-all;
  animation: brush-reveal 0.9s ease-out 0.25s both;
}

@keyframes brush-reveal {
  from { clip-path: inset(0 100% 0 0); opacity: 0.2; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}

@keyframes rise-in {
  from { translate: 0 6px; opacity: 0; }
  to { translate: 0 0; opacity: 1; }
}

.scene-gains {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  min-height: 1.6em;
}

.scene-gain {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  animation: gain-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3) var(--d, 0s) both;
}

.scene-gain.is-good {
  color: var(--ink);
}

.scene-gain.is-note {
  font-weight: 400;
  color: var(--muted);
}

@keyframes gain-pop {
  0% { translate: 0 10px; scale: 0.7; opacity: 0; }
  100% { translate: 0 0; scale: 1; opacity: 1; }
}

.scene-skip {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.8;
}

/* 효과음 단추 */
.sound-toggle {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.sound-toggle.is-off {
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .scene-overlay,
  .scene-seal,
  .scene-seal::before,
  .scene-line,
  .scene-gain,
  .scene-time,
  .scene-title,
  .action-btn.is-stamped .action-seal {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
  }
}

/* ---------- 전투 ---------- */

.fighters {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fighter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fighter-name {
  font-weight: 700;
}

.fighter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

/* 상태 이상 표식 */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-bleed {
  color: #a3271a;
}

.badge-poison {
  color: #4f7a2a;
}

.badge-blind {
  color: #6f6556;
}

.badge-stun {
  color: #8a5a10;
}

.badge-shield {
  color: var(--bar-mp);
}

/* 무공 목록 */
.skill-item {
  display: flex;
  flex-direction: column;
}

.skill-item + .skill-item {
  margin-top: 6px;
}

.skill-name {
  font-weight: 700;
}

.skill-meta {
  font-size: 0.8rem;
  color: var(--muted);
  word-break: keep-all;
}

.new-skill {
  color: var(--accent-ink);
}

.btn-continue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.btn-continue .action-hint {
  color: var(--accent-text);
  opacity: 0.8;
}

/* ---------- 폐관·사망·엔딩 ---------- */

.btn-danger {
  background: var(--ink-fill);
  border-color: #c23a2b;
  color: var(--accent-text);
  font-weight: 700;
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}

.ending-title {
  text-align: center;
  letter-spacing: 0.25em;
  border-bottom: none;
  font-size: 1.8rem;
}

.ending .panel.story {
  animation: ink-in 0.8s ease-out;
}

.death .ending-title {
  color: var(--danger);
}

@media (prefers-reduced-motion: reduce) {
  .ending .panel.story {
    animation: none;
  }
}

/* ---------- 이벤트·기연 ---------- */

.event-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.event-title {
  margin: 0;
  font-size: 1.5rem;
  color: var(--ink);
}

.fortune-seal {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 48px;
  text-align: center;
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 4px var(--accent);
}

.fortune-label {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--accent-ink);
}

/* 기연 등급: 緣 흔한 인연(붉은 테두리) / 寶 귀한 인연(붉은 도장) / 天 하늘이 내린 인연(먹빛 도장, 붉은 테, 맥동) */
.tier-common .fortune-seal {
  background: var(--panel);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.tier-legend .fortune-seal {
  background: var(--ink-fill);
  color: #f0c9a8;
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--accent);
  animation: legend-pulse 1.6s ease-in-out infinite;
}

.tier-legend .fortune-label {
  font-weight: 700;
}

@keyframes legend-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--accent), 0 0 0 0 rgba(158, 43, 30, 0.4); }
  50% { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--accent), 0 0 0 12px rgba(158, 43, 30, 0); }
}

/* 기연이 찾아온 순간: 화면 가운데 큰 도장이 쾅 찍혔다가 흩어진다 */
.fortune-flash {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(18, 16, 14, 0.88);
  pointer-events: none;
  animation: flash-out 1.7s ease both;
}

.fortune-flash-seal {
  width: 120px;
  height: 120px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 4.2rem;
  font-weight: 700;
  line-height: 120px;
  text-align: center;
  rotate: -6deg;
  animation: flash-stamp 0.5s cubic-bezier(0.3, 0, 0.4, 1) both;
}

.fortune-flash.tier-common .fortune-flash-seal {
  background: var(--panel);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 4px var(--accent);
}

.fortune-flash.tier-legend .fortune-flash-seal {
  background: var(--ink-fill);
  color: #f0c9a8;
  box-shadow: 0 0 0 4px var(--accent), 0 0 40px rgba(158, 43, 30, 0.6);
}

.fortune-flash-text {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: var(--ink);
  animation: rise-in 0.4s ease 0.35s both;
}

@keyframes flash-stamp {
  0% { scale: 3; opacity: 0; }
  60% { scale: 0.92; opacity: 1; }
  100% { scale: 1; opacity: 1; }
}

@keyframes flash-out {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* 길조 표시 (상단 상태 표시줄) */
.buff-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.buff-chip {
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: var(--accent-ink);
  font-size: 0.72rem;
  background: var(--panel-2);
}

/* 돈오 장면 */
.scene-epiphany .scene-seal {
  color: var(--accent-ink);
}

.scene-epiphany .scene-card {
  border-top-color: var(--accent);
  border-bottom-color: var(--accent);
}

.scene-extra {
  margin: 0;
  font-size: 0.88rem;
  color: var(--accent-ink);
  animation: rise-in 0.4s ease 1s both;
}

/* 기연은 테두리를 붉게, 등장할 때 먹이 번지듯 */
.event-screen.is-fortune .panel.story {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.event-screen.is-fortune .event-head {
  animation: ink-in 0.6s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .event-screen.is-fortune .event-head {
    animation: none;
  }
}

.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.choice-btn.is-fight {
  border-color: var(--danger);
}

.choice-btn.is-fight .action-hint {
  color: var(--danger);
}

/* ---------- OVR 카드 ---------- */

.ovr-card {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.ovr-main {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

.ovr-label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.ovr-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.ovr-title {
  font-size: 0.7rem;
  color: var(--accent-ink);
  text-align: center;
  word-break: keep-all;
}

.ovr-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.ovr-cell {
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  border-left: 3px solid var(--border);
}

.ovr-cell-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.ovr-cell-value {
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ovr-cell-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

/* ---------- 소지품·약방 ---------- */

.status-right {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.panel-head .subheading {
  margin: 0;
}

.list.plain {
  list-style: none;
  padding-left: 0;
}

.inv-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inv-item + .inv-item {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.inv-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.btn-small {
  width: auto;
  flex: none;
  min-height: 40px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

.fighter-enemy .fighter-name {
  color: var(--accent-ink);
}

.versus {
  align-self: center;
  color: var(--muted);
  font-size: 1.1rem;
}


/* ---------- 싸우는 화면 위 연출 층 ----------
   무공 이름, 무공 이펙트, 피해 숫자, 회피·막음·상태 이상이 모두 무대 위에 겹쳐 뜬다.
   --d 는 이 합에서 그 일이 일어난 시각(초). 몸짓과 같은 순서로 나타난다. */

.arena-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

/* 무공: 무대 전체에 이펙트, 쓴 사람 쪽 위에 이름 */
.arena-skill {
  position: absolute;
  inset: 0;
}

.arena-skill .fx {
  position: absolute;
  inset: 0;
}

.arena-skill.from-enemy .fx {
  transform: scaleX(-1);
}

.arena-skill-name {
  position: absolute;
  top: 8px;
  left: 50%;
  translate: -50% 0;
  padding: 2px 10px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  white-space: nowrap;
  color: var(--panel);
  opacity: 0;
  animation: skill-name 1.05s ease-out var(--d, 0s) both;
}

.arena-skill.from-player .arena-skill-name {
  left: 32%;
}

.arena-skill.from-enemy .arena-skill-name {
  left: 68%;
}

@keyframes skill-name {
  0% { opacity: 0; scale: 1.4; filter: blur(4px); }
  18% { opacity: 1; scale: 1; filter: blur(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* 인물 머리 위로 떠오르는 글자 */
.float-text {
  position: absolute;
  top: 34%;
  translate: -50% 0;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 4px var(--panel), 0 0 2px var(--panel);
  opacity: 0;
  animation: float-up 0.95s ease-out var(--d, 0s) both;
}

.float-text.at-player {
  left: 22%;
}

.float-text.at-enemy {
  left: 78%;
}

@keyframes float-up {
  0% { opacity: 0; transform: translateY(calc(10px - var(--lift, 0px))) scale(0.8); }
  20% { opacity: 1; transform: translateY(calc(0px - var(--lift, 0px))) scale(1.1); }
  35% { transform: translateY(calc(-4px - var(--lift, 0px))) scale(1); }
  100% { opacity: 0; transform: translateY(calc(-34px - var(--lift, 0px))) scale(1); }
}

.float-damage {
  color: var(--danger);
  font-size: 1.15rem;
}

.float-damage.is-big {
  font-size: 1.6rem;
}

.float-evade {
  color: var(--bar-mp);
  letter-spacing: 0.15em;
  font-size: 1.1rem;
}

.float-block,
.float-guard {
  color: var(--ink);
  font-size: 0.9rem;
}

.float-miss {
  color: var(--muted);
  font-size: 0.9rem;
}

.float-status {
  color: #8a5a10;
  font-size: 0.85rem;
}

.float-heal {
  color: #4f7a2a;
  font-size: 0.9rem;
}

.float-dot-bleed {
  color: var(--danger);
  font-size: 0.85rem;
}

.float-dot-poison {
  color: #4f7a2a;
  font-size: 0.85rem;
}

/* ---------- 인물 (흑백 수묵) ---------- */

.figure {
  display: block;
  line-height: 0;
}

.figure svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.figure.is-mirror svg,
.figure.is-mirror img {
  transform: scaleX(-1);
}

/* 전투 무대: 두 인물이 먹선 땅 위에서 마주 본다 */
.arena {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 6% 0;
  min-height: 170px;
  border-bottom: 3px solid var(--ink);
  background:
    radial-gradient(ellipse at 50% 100%, rgba(31, 27, 22, 0.08), transparent 70%),
    linear-gradient(180deg, transparent 70%, rgba(31, 27, 22, 0.04));
  overflow: hidden;
  container-type: inline-size;
}

/* --fw 인물 너비, --reach 상대 코앞까지 달려드는 거리 (무대 너비에서 계산) */
.combatant {
  --fw: min(36cqw, 150px);
  --reach: calc(100cqw - 1.55 * var(--fw));
  width: var(--fw);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 상대는 좌우를 뒤집어 마주 보게 한다. 뒤집는 것은 바깥 stage이고,
   안쪽 몸짓(translate)은 뒤집힌 좌표에서 움직이므로 keyframes 하나로 양쪽이 서로를 향한다 */
.fig-stage {
  position: relative;
  width: 100%;
  animation: fig-ready 1.8s ease-in-out infinite;
}

.combatant.side-enemy .fig-stage {
  animation-delay: -0.9s;
}

/* 겨누고 선 자세: 앞뒤로 살짝 흔들린다 */
@keyframes fig-ready {
  0%, 100% { translate: 0 0; }
  50% { translate: 3px 0; }
}

/* 잔상: 평소엔 안 보인다 */
.fig-ghost {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  filter: blur(1.5px);
}

.combatant.side-enemy .fig-stage {
  transform: scaleX(-1);
}

.fig-move,
.fig-react {
  width: 100%;
  transform-origin: center bottom;
}

.combatant-name {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
  text-align: center;
  word-break: keep-all;
}

/* 가만히 서 있을 때도 숨 쉬듯 */
.arena .figure svg,
.arena .figure img {
  animation: fig-breathe 2.4s ease-in-out infinite;
  transform-origin: center bottom;
}

@keyframes fig-breathe {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.012); }
}


/* 피한 자리에 남는 잔상 */
@keyframes ghost-stay {
  0% { opacity: 0.5; }
  100% { opacity: 0; }
}

@keyframes fig-dodge {
  0% { translate: 0 0; rotate: 0deg; }
  35% { translate: -40px -14px; rotate: -6deg; }
  60% { translate: -36px 0; rotate: 0deg; }
  100% { translate: 0 0; }
}

@keyframes fig-hit {
  0% { translate: 0 0; rotate: 0deg; filter: none; }
  18% { translate: -16px 0; rotate: -5deg; filter: brightness(0.5) contrast(1.4); }
  45% { translate: -9px 0; rotate: -2deg; }
  70% { translate: 2px 0; rotate: 0deg; filter: none; }
  100% { translate: 0 0; }
}

/* 무공에 맞음: 크게 밀려난다 */
@keyframes fig-hit-hard {
  0% { translate: 0 0; rotate: 0deg; filter: none; }
  15% { translate: -18px -5px; rotate: -10deg; filter: brightness(0.4) contrast(1.5); }
  50% { translate: -12px 0; rotate: -4deg; filter: none; }
  100% { translate: 0 0; rotate: 0deg; }
}

@keyframes fig-block {
  0% { translate: 0 0; }
  30% { translate: -10px 0; filter: drop-shadow(4px 0 0 rgba(31, 27, 22, 0.5)); }
  100% { translate: 0 0; filter: none; }
}

@keyframes fig-guard {
  0% { scale: 1; filter: none; }
  40% { scale: 1.06; filter: drop-shadow(0 0 6px rgba(31, 27, 22, 0.45)); }
  100% { scale: 1; filter: none; }
}

@keyframes fig-stun {
  0%, 100% { rotate: 0deg; }
  25% { rotate: -6deg; }
  50% { rotate: 5deg; }
  75% { rotate: -3deg; }
}

/* 결정타: 뒤로 나가떨어져 눕는다 */
@keyframes fig-ko {
  0% { rotate: 0deg; translate: 0 0; opacity: 1; }
  40% { rotate: -42deg; translate: -16px -28px; opacity: 1; animation-timing-function: ease-in; }
  100% { rotate: -84deg; translate: 96px -2px; opacity: 0.6; }
}

/* 맞는 순간 무대가 흔들린다 */
@keyframes arena-jolt {
  0%, 100% { translate: 0 0; }
  30% { translate: 3px 0; }
  65% { translate: -2px 0; }
}

@keyframes arena-shake {
  0%, 100% { translate: 0 0; }
  15% { translate: -5px 3px; }
  30% { translate: 5px -3px; }
  45% { translate: -4px -2px; }
  60% { translate: 3px 2px; }
  80% { translate: -2px 0; }
}

/* ---------- 무대 위 연출 조각 (ui.js stageFx). --d 초 뒤에 한 번 나타났다 사라진다 ---------- */

/* 맞는 순간: 검광(초승달)과 먹 튐 */
.impact {
  position: absolute;
  top: 54%;
  width: 96px;
  height: 96px;
  translate: -50% -50%;
}

.impact.at-enemy { left: 74%; }
.impact.at-player { left: 26%; scale: -1 1; }
.impact-skill { width: 140px; height: 140px; }
.impact-block { width: 70px; height: 70px; }

.impact::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset -10px 3px 0 var(--ink);
  opacity: 0;
  animation: slash-arc 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) var(--d, 0s) both;
}

.impact-skill::before { box-shadow: inset -15px 4px 0 var(--ink); }
.impact-block::before { display: none; }

.impact::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--ink) 0 5deg, transparent 5deg 36deg);
  -webkit-mask: radial-gradient(circle, transparent 28%, #000 30%, transparent 70%);
  mask: radial-gradient(circle, transparent 28%, #000 30%, transparent 70%);
  opacity: 0;
  animation: ink-burst 0.38s ease-out var(--d, 0s) both;
}

@keyframes slash-arc {
  0% { opacity: 0; rotate: -75deg; scale: 0.7; }
  25% { opacity: 1; }
  100% { opacity: 0; rotate: 55deg; scale: 1.15; }
}

@keyframes ink-burst {
  0% { opacity: 0; scale: 0.3; rotate: 0deg; }
  20% { opacity: 0.9; }
  100% { opacity: 0; scale: 1.4; rotate: 12deg; }
}

/* 박차고 나갈 때 발밑 먼지 */
.dust {
  position: absolute;
  bottom: 0;
  width: 64px;
  height: 16px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(31, 27, 22, 0.35), transparent 70%);
  opacity: 0;
  animation: dust-puff 0.45s ease-out var(--d, 0s) both;
}

.dust.at-player { left: 22%; }
.dust.at-enemy { left: 78%; }

@keyframes dust-puff {
  0% { opacity: 0; scale: 0.4 0.6; }
  20% { opacity: 1; }
  100% { opacity: 0; scale: 2 1.4; }
}

/* 무공을 펼칠 때 무대를 가로지르는 속도선 */

/* 무공 이름 뒤에 깔리는 먹빛 띠 (컷인) */
.cutin {
  position: absolute;
  top: 6px;
  left: -5%;
  right: -5%;
  height: 2.7rem;
  background: linear-gradient(90deg, transparent, var(--ink) 16%, var(--ink) 84%, transparent);
  rotate: -2deg;
  transform-origin: left center;
  opacity: 0;
  animation: cutin 1.05s ease-out var(--d, 0s) both;
}

.arena-skill.from-enemy .cutin {
  background: linear-gradient(90deg, transparent, var(--accent) 16%, var(--accent) 84%, transparent);
  transform-origin: right center;
  rotate: 2deg;
}

@keyframes cutin {
  0% { opacity: 0; transform: scaleX(0); }
  14% { opacity: 0.92; transform: scaleX(1); }
  72% { opacity: 0.92; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1); }
}

/* 결정타: 화면이 먹빛으로 번쩍이고 낙관이 찍힌다 */
.ko-flash {
  position: absolute;
  inset: 0;
  background: var(--ink-fill);
  opacity: 0;
  animation: ko-flash 0.5s ease-out var(--d, 0s) both;
}

@keyframes ko-flash {
  0% { opacity: 0; }
  10% { opacity: 0.85; }
  100% { opacity: 0; }
}

.ko-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  padding: 0 0.18em;
  font-size: 3.6rem;
  font-weight: 700;
  line-height: 1.25;
  border: 4px solid currentColor;
  border-radius: 6px;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  rotate: -8deg;
  opacity: 0;
  animation: ko-stamp 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) var(--d, 0s) both;
}

.ko-stamp.ko-lose,
.ko-stamp.ko-draw {
  color: var(--ink);
}

@keyframes ko-stamp {
  0% { opacity: 0; scale: 2.6; }
  60% { opacity: 1; scale: 0.94; }
  100% { opacity: 1; scale: 1; }
}

/* 그림 파일 인물: 바탕이 투명한 PNG(tools/transparent.ps1로 만든다). 발이 땅에 닿게 아래 정렬 */
.figure-img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: center bottom;
  filter: grayscale(1) contrast(1.05);
}

/* 짐승 그림은 가로로 길어 자리를 넓힌다 */
.combatant:has(.figure-img.is-beast) {
  width: min(52cqw, 230px);
}

.arena:has(.figure-img.is-beast) .combatant {
  --reach: calc(100cqw - 0.6 * var(--fw) - min(52cqw, 230px));
}

/* 심마: 내 그림을 먹빛으로 */
.figure-img.is-demon {
  filter: grayscale(1) brightness(0.35) contrast(1.6);
}

/* 생사경: 옅은 기운 */
.figure-img.is-aura {
  filter: grayscale(1) drop-shadow(0 0 6px rgba(31, 27, 22, 0.35));
}

/* 심마는 먹빛 안개처럼 흔들린다 */
.figure-svg.is-demon {
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.55));
}

/* 화면 곳곳의 작은 인물 그림 */
.portrait {
  flex: none;
  width: 64px;
}

.portrait-lg {
  width: 110px;
  margin: 0 auto;
}
/* 주화입마: 쓰러진 모습 */
.figure.is-fallen svg,
.figure.is-fallen img {
  transform: rotate(-80deg) translate(-10%, 10%);
  opacity: 0.8;
}

.event-head .portrait {
  width: 48px;
}

.versus-figures {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
}

.versus-figures .figure {
  width: 34%;
  max-width: 130px;
}

@media (prefers-reduced-motion: reduce) {
  .arena .figure svg,
  .arena .figure img,
  .fig-move,
  .fig-react,
  .fig-stage,
  .fig-ghost,
  .arena,
  .cutin,
  .ko-stamp {
    animation: none !important;
  }

  .impact,
  .dust,
  .thrust,
  .charge,
  .ko-flash {
    display: none;
  }

  .cutin {
    opacity: 0.9;
  }

  .ko-stamp {
    opacity: 1;
  }
}

/* ---------- 무공 연출 (fx) ----------
   싸우는 화면(arena) 위에 깔리는 층. 입자(i)마다 --dx/--dy/--rot/--x/--i 를 ui.js가 넣어 준다.
   --d 는 그 무공을 쓴 시각(초): 모든 입자는 --d 만큼 늦게 시작한다.
   상대가 쓴 무공은 좌우를 뒤집어 반대 방향으로 날아간다. */

.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.fx i {
  position: absolute;
  display: block;
  left: 50%;
  top: 50%;
  opacity: 0;
}

/* 화산: 매화 꽃잎이 사방으로 흩날린다 */
.fx-plum i,
.fx-bloom i {
  width: 12px;
  height: 12px;
  margin: -6px;
  border-radius: 80% 0 80% 0;
  background: #e8899c;
  box-shadow: 0 0 4px rgba(232, 137, 156, 0.6);
  animation: fx-petal 0.9s ease-out calc(var(--d, 0s) + var(--i) * 25ms) forwards;
}

.fx-bloom i {
  width: 16px;
  height: 16px;
  background: #d9506b;
  animation-duration: 1.1s;
}

.fx-bloom::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 80, 107, 0.55), transparent 70%);
  animation: fx-grow 0.9s ease-out var(--d, 0s) both;
}

@keyframes fx-petal {
  0% { opacity: 0; transform: translate(0, 0) rotate(0) scale(0.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(calc(var(--rot) + 360deg)) scale(1); }
}

/* 낙화검: 꽃잎이 위에서 아래로 쏟아진다 */
.fx-falling i {
  left: var(--x);
  top: -10%;
  width: 10px;
  height: 10px;
  border-radius: 80% 0 80% 0;
  background: #e8899c;
  animation: fx-fall 0.9s ease-in calc(var(--d, 0s) + var(--i) * 40ms) forwards;
}

@keyframes fx-fall {
  0% { opacity: 0; transform: translateY(0) rotate(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(130px) rotate(var(--rot)); }
}

/* 남궁 창궁: 하늘색 검광이 비스듬히 가른다 */
.fx-sky i {
  left: -20%;
  top: calc(20% + var(--i) * 18%);
  width: 140%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #7fb2e6, #ffffff, transparent);
  transform-origin: left center;
  animation: fx-slash 0.6s ease-out calc(var(--d, 0s) + var(--i) * 70ms) forwards;
}

@keyframes fx-slash {
  0% { opacity: 0; transform: rotate(-14deg) scaleX(0); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: rotate(-14deg) scaleX(1); }
}

/* 제왕검형: 굵은 금빛 검이 위에서 내리꽂힌다 */
.fx-emperor i {
  left: calc(42% + var(--i) * 16%);
  top: -40%;
  width: 6px;
  height: 80%;
  background: linear-gradient(180deg, transparent, #d9b45a, #fff3c4);
  box-shadow: 0 0 10px #d9b45a;
  animation: fx-drop 0.5s cubic-bezier(0.6, 0, 1, 1) calc(var(--d, 0s) + var(--i) * 90ms) forwards;
}

@keyframes fx-drop {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(120%); }
}

/* 천뢰검: 번개가 내리치고 화면이 번쩍인다 */
.fx-thunder::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--panel-2);
  animation: fx-blink 0.5s ease-out var(--d, 0s) both;
}

.fx-thunder i {
  left: calc(25% + var(--i) * 25%);
  top: 0;
  width: 26px;
  height: 100%;
  margin-left: -13px;
  background: #f2d64b;
  clip-path: polygon(40% 0, 75% 0, 55% 40%, 85% 40%, 30% 100%, 45% 55%, 15% 55%);
  filter: drop-shadow(0 0 6px #f2d64b);
  animation: fx-blink 0.55s steps(2, end) calc(var(--d, 0s) + var(--i) * 80ms) forwards;
}

@keyframes fx-blink {
  0% { opacity: 0; }
  15% { opacity: 1; }
  40% { opacity: 0.3; }
  55% { opacity: 1; }
  100% { opacity: 0; }
}

/* 나한권: 주먹 바람이 고리처럼 퍼진다 */
.fx-fist i,
.fx-roar i,
.fx-finger i {
  width: 30px;
  height: 30px;
  margin: -15px;
  border-radius: 50%;
  border: 3px solid #b07a35;
  animation: fx-ring 0.7s ease-out calc(var(--d, 0s) + var(--i) * 120ms) forwards;
}

@keyframes fx-ring {
  0% { opacity: 0.9; transform: scale(0.2); }
  100% { opacity: 0; transform: scale(5); }
}

/* 사자후: 음파가 겹겹이 퍼진다 */
.fx-roar i {
  border-color: #c99a3a;
  border-width: 2px;
  animation-duration: 0.9s;
  animation-delay: calc(var(--d, 0s) + var(--i) * 150ms);
}

/* 일지선: 한 점을 찌르고 잔물결 */
.fx-finger i {
  left: 62%;
  width: 14px;
  height: 14px;
  margin: -7px;
  border-color: #8a5a10;
  animation-duration: 0.6s;
}

.fx-finger::before {
  content: "";
  position: absolute;
  left: 20%;
  top: 50%;
  width: 42%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #8a5a10);
  animation: fx-thrust 0.25s ease-out var(--d, 0s) both;
  transform-origin: left center;
}

@keyframes fx-thrust {
  0% { transform: scaleX(0); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0.6; }
}

/* 반야장: 거대한 금빛 손바닥 기운 */
.fx-palm i {
  width: 70px;
  height: 70px;
  margin: -35px;
  border-radius: 45% 45% 40% 40%;
  background: radial-gradient(circle, rgba(232, 196, 104, 0.7), rgba(232, 196, 104, 0) 70%);
  animation: fx-palm 0.8s ease-out calc(var(--d, 0s) + var(--i) * 150ms) forwards;
}

@keyframes fx-palm {
  0% { opacity: 0; transform: translateX(-60px) scale(0.5); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateX(60px) scale(1.8); }
}

/* 호신강기(금강호체): 금빛 막이 몸을 감싼다 */
.fx-shield i,
.fx-bell i,
.fx-taijiShield i {
  width: 120px;
  height: 80px;
  margin: -40px -60px;
  border-radius: 50%;
  border: 3px solid #d9b45a;
  box-shadow: 0 0 14px rgba(217, 180, 90, 0.8), inset 0 0 14px rgba(217, 180, 90, 0.5);
  animation: fx-dome 1s ease-out calc(var(--d, 0s) + var(--i) * 200ms) forwards;
}

@keyframes fx-dome {
  0% { opacity: 0; transform: scale(0.4); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}

/* 금종조: 보이지 않는 종이 내려와 덮인다 */
.fx-bell i {
  border-radius: 50% 50% 12% 12%;
  border-color: #a57c32;
  animation-name: fx-bell;
}

@keyframes fx-bell {
  0% { opacity: 0; transform: translateY(-60px); }
  50% { opacity: 1; transform: translateY(0); }
  65% { transform: translateY(-4px); }
  100% { opacity: 0; transform: translateY(0); }
}

/* 태극권: 점선 원이 돌며 힘을 흩는다 */
.fx-taijiShield i {
  border-style: dashed;
  border-color: #3b5878;
  box-shadow: none;
  animation-name: fx-spin-fade;
}

@keyframes fx-spin-fade {
  0% { opacity: 0; transform: rotate(0) scale(0.6); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: rotate(270deg) scale(1.1); }
}

/* 태극검: 음양 태극이 돈다 */
.fx-taiji i {
  width: 74px;
  height: 74px;
  margin: -37px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 25%, #2a251f 0 6px, #f8f4ea 6px 25%, transparent 25%),
    radial-gradient(circle at 50% 75%, #f8f4ea 0 6px, #2a251f 6px 25%, transparent 25%),
    linear-gradient(90deg, #2a251f 50%, #f8f4ea 50%);
  border: 2px solid #2a251f;
  animation: fx-taiji 1s ease-in-out var(--d, 0s) both;
}

@keyframes fx-taiji {
  0% { opacity: 0; transform: rotate(0) scale(0.3); }
  30% { opacity: 0.4; }
  100% { opacity: 0; transform: rotate(540deg) scale(1.3); }
}

/* 양의검법: 두 갈래 호가 엇갈린다 */
.fx-twin i {
  width: 110px;
  height: 110px;
  margin: -55px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #2a251f;
  animation: fx-arc-a 0.8s ease-out var(--d, 0s) both;
}

.fx-twin i:nth-child(2) {
  border-top-color: transparent;
  border-bottom-color: #9a9083;
  animation-name: fx-arc-b;
}

@keyframes fx-arc-a {
  0% { opacity: 0; transform: rotate(-120deg); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(120deg); }
}

@keyframes fx-arc-b {
  0% { opacity: 0; transform: rotate(120deg); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(-120deg); }
}

/* 혈영조: 핏빛 손톱 자국 세 줄 */
.fx-claw i {
  left: 30%;
  top: calc(25% + var(--i) * 18%);
  width: 45%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #a3271a 30%, #e04b3a);
  transform-origin: left center;
  animation: fx-claw 0.5s ease-out calc(var(--d, 0s) + var(--i) * 60ms) forwards;
}

@keyframes fx-claw {
  0% { opacity: 0; transform: rotate(-25deg) scaleX(0); }
  30% { opacity: 1; }
  80% { opacity: 1; transform: rotate(-25deg) scaleX(1); }
  100% { opacity: 0; transform: rotate(-25deg) scaleX(1); }
}

/* 오독장: 초록 독 안개가 피어오른다 */
.fx-poison i {
  left: var(--x);
  top: 80%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 122, 42, 0.8), rgba(79, 122, 42, 0) 70%);
  filter: blur(1px);
  animation: fx-rise 1.1s ease-out calc(var(--d, 0s) + var(--i) * 60ms) forwards;
}

@keyframes fx-rise {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-80px) scale(2.2); }
}

/* 비도술: 작은 비도들이 날아간다 */
.fx-dagger i {
  left: 0;
  top: calc(18% + var(--i) * 16%);
  width: 26px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #6f6556 40%, #e6e1d6);
  clip-path: polygon(0 0, 85% 0, 100% 50%, 85% 100%, 0 100%);
  animation: fx-throw 0.5s linear calc(var(--d, 0s) + var(--i) * 70ms) forwards;
}

@keyframes fx-throw {
  0% { opacity: 0; transform: translateX(0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateX(110vw); }
}

/* 탈명섬: 눈부신 섬광 */
.fx-flash i {
  inset: 0;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, #ffffff 0%, var(--panel-2) 35%, rgba(255, 251, 230, 0) 75%);
  animation: fx-whiteout 0.6s ease-out var(--d, 0s) both;
}

@keyframes fx-whiteout {
  0% { opacity: 0; transform: scale(0.3); }
  20% { opacity: 1; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* 유수검: 물결이 흘러간다 */
.fx-water i {
  left: -50%;
  top: calc(20% + var(--i) * 18%);
  width: 200%;
  height: 10px;
  background: repeating-radial-gradient(circle at 10px -4px, transparent 0 8px, rgba(59, 88, 120, 0.55) 8px 10px, transparent 10px 20px);
  background-size: 20px 10px;
  animation: fx-flow 1s ease-in-out calc(var(--d, 0s) + var(--i) * 80ms) forwards;
}

@keyframes fx-flow {
  0% { opacity: 0; transform: translateX(-20%); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateX(25%); }
}

/* 검무환영: 잔상이 겹쳐 지나간다 */
.fx-dance i {
  top: 15%;
  width: 6px;
  height: 70%;
  margin-left: -3px;
  border-radius: 3px;
  background: linear-gradient(180deg, transparent, rgba(201, 164, 92, 0.6), transparent);
  filter: blur(1px);
  animation: fx-afterimage 0.9s ease-out calc(var(--d, 0s) + var(--i) * 90ms) forwards;
}

@keyframes fx-afterimage {
  0% { opacity: 0; transform: translateX(-90px) skewX(-20deg); }
  30% { opacity: 0.8; }
  100% { opacity: 0; transform: translateX(calc(40px + var(--i) * 20px)) skewX(-20deg); }
}

/* 공통: 무공 바탕이 될 때 큰 원 하나를 은은하게 */
@keyframes fx-grow {
  0% { opacity: 0; transform: scale(0.5); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: scale(4); }
}

@media (prefers-reduced-motion: reduce) {
  .fx,
  .fx::before,
  .fx i {
    animation: none !important;
    display: none;
  }
}

@keyframes ink-in {
  from {
    opacity: 0;
    filter: blur(6px);
    transform: scale(1.08);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill {
    transition: none;
  }
  /* 움직임을 줄인 사람에게는 무공 이름과 숫자를 움직이지 않고 그대로 보여 준다 */
  .arena-skill-name,
  .float-text {
    animation: none;
    opacity: 1;
  }
}

.result-banner {
  margin: 0;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
}

.result-win {
  color: var(--ink);
}

.result-lose {
  color: var(--danger);
  border-color: var(--danger);
}

.result-draw {
  color: var(--muted);
  border-color: var(--muted);
}

/* ---------- 다음 경지 ---------- */

.advance-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advance-panel.is-ready {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.btn-advance {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 56px;
}

.advance-panel.is-ready .btn-advance:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.advance-panel.is-ready .btn-advance:not(:disabled) .action-hint {
  color: var(--accent-text);
  opacity: 0.85;
}

.advance-title {
  text-align: center;
  letter-spacing: 0.2em;
}

.warn {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  word-break: keep-all;
}

/* ---------- 장비 (설계문서 6.25) ---------- */

.gear-slot-name {
  flex: none;
  width: 3.8em;
  white-space: nowrap;
  padding: 2px 0;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-size: 0.75rem;
  text-align: center;
  letter-spacing: 0.05em;
}

.gear-slot.is-empty .gear-slot-name {
  border-style: dashed;
  color: var(--muted);
}

.gear-tier {
  padding: 0 4px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 400;
}

.gear-name.tier-common .gear-tier { color: var(--muted); }
.gear-name.tier-fine .gear-tier { color: var(--bar-mp); }
.gear-name.tier-master .gear-tier { color: #8a5a10; }
.gear-name.tier-divine .gear-tier { color: var(--panel); background: var(--accent); border-color: var(--accent); }

.gear-panel .list + .muted {
  margin-top: 14px;
}

/* ---------- 인연 카드 (강호 탭 맨 위) ---------- */

.npc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.npc-card {
  display: flex;
  gap: 12px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line, rgba(31, 27, 22, 0.25));
  border-left: 4px solid var(--muted);
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}

.npc-card.is-ready {
  border-color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: 0 2px 0 rgba(31, 27, 22, 0.12);
}

.npc-portrait {
  flex: none;
  width: 72px;
  align-self: flex-end;
}

.npc-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.npc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.npc-name {
  word-break: keep-all;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.npc-tier {
  flex: none;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent-ink);
  font-size: 0.78rem;
}

.npc-skill {
  font-size: 0.85rem;
  color: var(--ink);
}

.npc-skill.is-taught {
  color: #4f7a2a;
}

.npc-visit {
  align-self: stretch;
  margin-top: 2px;
}

/* 의뢰 급 (하급~천급) */
/* ---------- 시작 화면 (설계문서 6.31) ----------
   순서: 붓이 가로지름(0.1~0.65초) → 먹 방울 → 제목 → 낙관 → 물음과 단추.
   기본 모양이 "다 나온 뒤"이고 애니메이션이 숨긴 데서 시작하므로, 움직임을 끄면 그대로 다 보인다. */

.cover {
  position: relative;
  flex: 1;
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
  justify-content: center;
  gap: 14px;
  padding-bottom: 90px;
  animation: cover-thud 0.28s linear 0.62s;
}

/* 붓이 다 지나간 순간 화면이 한 번 울린다 */
@keyframes cover-thud {
  0%, 100% { translate: 0 0; }
  25% { translate: 5px 2px; }
  55% { translate: -4px -1px; }
  80% { translate: 2px 0; }
}

.cover-hanja {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: var(--muted);
  animation: cover-fade 0.8s ease-out 1.1s both;
}

.cover-hanja::before,
.cover-hanja::after {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  margin: 0 10px;
  vertical-align: middle;
  background: var(--muted);
  opacity: 0.6;
}

/* 붓 자국이 놓이는 자리. 화면 양 끝까지 뚫고 나간다 */
.cover-stage {
  position: relative;
  height: 150px;
  margin: 6px calc(var(--gap) * -1);
}

.cover-brush {
  position: absolute;
  inset: 0;
  animation: cover-sweep 0.55s cubic-bezier(0.7, 0, 0.2, 1) 0.1s both;
}

@keyframes cover-sweep {
  0% { clip-path: inset(-20% 100% -20% 0); }
  100% { clip-path: inset(-20% -2% -20% 0); }
}

.cover-brush-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cover-ink {
  fill: var(--ink);
}

.cover-dry path {
  fill: var(--bg);
  opacity: 0.85;
}

.cover-splat {
  position: absolute;
  border-radius: 50%;
  background: var(--ink-fill);
  animation: cover-splat 0.3s cubic-bezier(0.2, 1.6, 0.4, 1) calc(0.6s + var(--i) * 20ms) both;
}

@keyframes cover-splat {
  0% { opacity: 0; scale: 0; }
  100% { opacity: 0.9; scale: 1; }
}

.cover-title {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  margin: 0;
  translate: 0 -54%;
  text-align: center;
  font-size: clamp(2.3rem, 11vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  white-space: nowrap;
  color: var(--panel);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  animation: cover-title 0.7s ease-out 0.55s both;
}

@keyframes cover-title {
  0% { opacity: 0; scale: 1.25; filter: blur(6px); }
  100% { opacity: 1; scale: 1; filter: blur(0); }
}

/* 낙관: 붓 자국 오른쪽 아래에 쾅 찍힌다 */
.cover-seal {
  position: absolute;
  right: 9%;
  bottom: -14px;
  width: 44px;
  height: 44px;
  border-radius: 5px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 44px;
  text-align: center;
  rotate: -6deg;
  box-shadow: 0 0 0 2px var(--bg), 0 2px 0 rgba(0, 0, 0, 0.25);
  animation: cover-seal 0.35s cubic-bezier(0.2, 1.5, 0.4, 1) 1.15s both;
}

@keyframes cover-seal {
  0% { opacity: 0; scale: 2.8; }
  60% { opacity: 1; scale: 0.92; }
  100% { opacity: 1; scale: 1; }
}

.cover-sub {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  animation: cover-fade 0.8s ease-out 1.3s both;
}

.cover-samsara {
  animation: cover-fade 0.8s ease-out 1.45s both;
}

.cover-ask {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
  animation: cover-rise 0.6s ease-out 1.6s both;
}

.cover-question {
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.cover-question::before,
.cover-question::after {
  content: "◆";
  margin: 0 12px;
  font-size: 0.6rem;
  vertical-align: middle;
  color: var(--accent-ink);
}

@keyframes cover-fade {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes cover-rise {
  0% { opacity: 0; translate: 0 14px; }
  100% { opacity: 1; translate: 0 0; }
}

/* 먼 산: 옅은 먹으로 겹친 능선 셋 */
.cover-mountains {
  position: absolute;
  left: calc(var(--gap) * -1);
  right: calc(var(--gap) * -1);
  bottom: -32px;
  height: 150px;
  pointer-events: none;
  background:
    linear-gradient(to top, var(--bg) 0, transparent 30%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 150' preserveAspectRatio='none'%3E%3Cpath d='M0,150 L0,96 C40,84 60,58 96,50 C120,44 136,70 168,78 C204,88 226,46 262,30 C290,18 312,52 344,66 C380,82 404,60 436,48 C470,36 500,70 536,80 C566,88 584,76 600,70 L600,150 Z' fill='%232a251f' opacity='0.14'/%3E%3Cpath d='M0,150 L0,118 C50,110 80,86 120,84 C160,82 180,104 226,106 C270,108 300,78 340,74 C384,70 410,98 452,102 C500,106 540,88 600,92 L600,150 Z' fill='%232a251f' opacity='0.2'/%3E%3Cpath d='M0,150 L0,136 C70,128 120,120 180,124 C250,128 300,116 370,118 C440,120 520,130 600,122 L600,150 Z' fill='%232a251f' opacity='0.27'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
  animation: cover-fade 1.6s ease-out 0.9s both;
}

/* 떨어지는 매화 꽃잎 */
.cover-sky {
  position: absolute;
  inset: -32px calc(var(--gap) * -1) 0;
  overflow: hidden;
  pointer-events: none;
}

.cover-petal {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 7px;
  border-radius: 80% 10% 80% 10%;
  background: #d9828f;
  opacity: 0;
  animation: cover-petal 12s linear infinite;
}

@keyframes cover-petal {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  8% { opacity: 0.7; }
  50% { transform: translate(36px, 48vh) rotate(200deg); }
  92% { opacity: 0.6; }
  100% { opacity: 0; transform: translate(-10px, 96vh) rotate(420deg); }
}

@media (prefers-reduced-motion: reduce) {
  .cover,
  .cover * {
    animation: none !important;
  }

  .cover-petal {
    display: none;
  }
}

/* 넓은 화면: 먼 산이 네모나게 잘려 보이지 않도록 양 끝을 흐린다 */
@media (min-width: 600px) {
  .cover-mountains {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  }
}
/* 제목용 붓글씨: 동해독도 (East Sea Dokdo, SIL OFL — fonts/OFL.txt). 게임 글(src/, data/)에 나오는 한글 전부와
   숫자·문장부호만 담아 넷으로 나눴다(합 약 197KB). 글을 새로 쓰다 없는 글자가 생기면 본문 글꼴로 나온다.
   한자는 이 글꼴에 없어 본문 글꼴(바탕)로 나온다. */
@font-face {
  font-family: "Murim Brush";
  src: url("fonts/EastSeaDokdo-game-0.woff2") format("woff2");
  font-display: block;
  unicode-range: U+20-7e, U+b7, U+2013-2014, U+2019, U+201c-201d, U+2026, U+3008-300f, U+ac00-ac01, U+ac04, U+ac07-ac08, U+ac10-ac17, U+ac19, U+ac1c-ac1d, U+ac70, U+ac74, U+ac77-ac78, U+ac80-ac81, U+ac83, U+ac89, U+ac8c, U+aca0, U+aca8-acaa, U+acac, U+acb0, U+acb9, U+acbc-acbd, U+acc1, U+acc4, U+ace0-ace1, U+ace4, U+ace7-ace8, U+acf1, U+acf3, U+acf5-acf6, U+acfc, U+ad00, U+ad11, U+ad18, U+ad1c, U+ad34, U+ad50, U+ad6c-ad6d, U+ad70, U+ad73-ad76, U+ad7c-ad7d, U+ad81, U+ad8c, U+ad90, U+ada4, U+adc0, U+add3, U+addc, U+ade0, U+adf8-adf9, U+adfc, U+ae00, U+ae08-ae09, U+ae0b, U+ae30, U+ae34, U+ae37-ae38, U+ae40, U+ae43, U+ae4a, U+ae4c, U+ae4e, U+ae50, U+ae54, U+ae5c-ae5d, U+ae65, U+ae68, U+aebc, U+aebe, U+aec4, U+aecd, U+aecf, U+aed8, U+aef4, U+af08, U+af2c-af2d, U+af34, U+af3d, U+af41-af43, U+af64, U+afb8, U+afbc, U+afc0, U+afc7-afc8, U+afd4, U+afe8, U+aff0, U+b00c, U+b010, U+b014, U+b044, U+b048, U+b04a, U+b04c, U+b053-b054, U+b057, U+b05d, U+b07c, U+b080, U+b098-b09a, U+b09c, U+b0a0-b0a1, U+b0a8-b0a9, U+b0ab-b0af, U+b0b1, U+b0b3-b0b4, U+b0b8, U+b0bc, U+b0c4, U+b0c8, U+b0d0, U+b0e5, U+b108-b109, U+b10c, U+b113, U+b118, U+b11b-b11c, U+b123;
}
@font-face {
  font-family: "Murim Brush";
  src: url("fonts/EastSeaDokdo-game-1.woff2") format("woff2");
  font-display: block;
  unicode-range: U+b124, U+b128, U+b137-b138, U+b140-b141, U+b144, U+b150, U+b154, U+b158, U+b178-b179, U+b17c, U+b180, U+b188, U+b18b, U+b18d, U+b192-b193, U+b1a8, U+b1cc, U+b204, U+b208, U+b20c, U+b220, U+b25c, U+b274, U+b290-b291, U+b294, U+b298-b299, U+b2a0, U+b2a5-b2a6, U+b2aa, U+b2ac, U+b2c8, U+b2cc, U+b2d0, U+b2d8-b2d9, U+b2e2, U+b2e4-b2e6, U+b2e8, U+b2eb-b2ee, U+b2f3-b2f5, U+b2f9, U+b2ff-b300, U+b304, U+b313-b314, U+b354-b355, U+b358, U+b35c, U+b35f, U+b364, U+b367, U+b369, U+b36b, U+b36e, U+b370, U+b38c, U+b3c4-b3c5, U+b3c8, U+b3cb-b3cc, U+b3d5, U+b3d9, U+b410, U+b418, U+b41c, U+b420, U+b428-b429, U+b450-b451, U+b454, U+b458, U+b460-b461, U+b465, U+b4a4, U+b4b7, U+b4b9, U+b4c8, U+b4dc-b4dd, U+b4e0, U+b4e3-b4e4, U+b4ec-b4ed, U+b4ef, U+b4f1, U+b514, U+b518, U+b51b-b51c, U+b524, U+b529-b52a, U+b530-b531, U+b534, U+b540, U+b545, U+b54c, U+b550, U+b5a0-b5a1, U+b5a8, U+b5b4, U+b5bb-b5bc, U+b5c0, U+b610-b611, U+b69d, U+b6ab, U+b6b1, U+b6f0, U+b728-b729, U+b72c, U+b738, U+b73b, U+b744, U+b754, U+b760, U+b77c-b77d, U+b780, U+b784, U+b78c-b78d, U+b78f-b791, U+b797-b798, U+b79c, U+b7ab, U+b7c9, U+b7ec, U+b7f0, U+b7f4, U+b7fc-b7fd, U+b7ff-b801, U+b807-b808, U+b824-b825, U+b828, U+b82c, U+b835, U+b837-b839, U+b840, U+b85c-b85d, U+b86d, U+b871, U+b8b0, U+b8cc, U+b8e8-b8e9, U+b8ec, U+b8f8, U+b8fb, U+b904, U+b958, U+b95c, U+b960, U+b974, U+b978, U+b97c, U+b984, U+b987, U+b98e, U+b9ac, U+b9b0, U+b9b4, U+b9bc, U+b9bf, U+b9c8-b9c9, U+b9cc, U+b9ce, U+b9d0-b9d1, U+b9d9, U+b9db, U+b9dd-b9de, U+b9e1, U+b9e3-b9e5, U+b9e8, U+b9f4, U+b9f9-b9fa, U+ba38-ba39, U+ba3c, U+ba40, U+ba48, U+ba4e, U+ba54, U+ba58, U+ba70-ba71, U+ba74, U+ba78, U+ba85, U+ba87, U+baa8-baa9, U+baab, U+bab0, U+bab8, U+babb, U+babd, U+bb34-bb36, U+bb38, U+bb3b-bb3c, U+bb47, U+bb49, U+bbc0, U+bbf8, U+bbfc, U+bbff-bc00, U+bc11, U+bc14-bc16, U+bc18, U+bc1b-bc1d, U+bc1f, U+bc24-bc25, U+bc29, U+bc30-bc31, U+bc34, U+bc38, U+bc40;
}
@font-face {
  font-family: "Murim Brush";
  src: url("fonts/EastSeaDokdo-game-2.woff2") format("woff2");
  font-display: block;
  unicode-range: U+bc43, U+bc49, U+bc84, U+bc88, U+bc8c, U+bc94-bc95, U+bc97, U+bca0, U+bca4, U+bcb4, U+bcbc-bcbd, U+bcc0, U+bcc4, U+bccd, U+bcd1, U+bcf4-bcf5, U+bcf8, U+bcfc, U+bd04-bd05, U+bd09, U+bd10, U+bd24, U+bd80-bd81, U+bd84, U+bd88-bd89, U+bd93, U+bd95, U+bd99, U+be0c, U+be44, U+be48, U+be57, U+be59-be5b, U+be60-be61, U+be68, U+be7c, U+be80, U+bea8, U+bed0, U+bed4, U+bed7, U+bf08-bf09, U+bf1b, U+bf51, U+bfb0, U+bfcc, U+bfd0, U+bfd4, U+c058, U+c05c, U+c090, U+c0ac-c0ad, U+c0af-c0b0, U+c0b4, U+c0b6, U+c0bc-c0bd, U+c0bf-c0c1, U+c0c8-c0c9, U+c0dd, U+c11c-c11e, U+c120, U+c124, U+c12c, U+c12f-c131, U+c136, U+c138, U+c13c, U+c148, U+c14b, U+c158, U+c168, U+c18c-c18d, U+c190, U+c19c, U+c19f, U+c1a1, U+c1a5, U+c1e0, U+c218-c219, U+c21c, U+c220, U+c228, U+c22b, U+c22d, U+c232, U+c26c, U+c270, U+c27c-c27d, U+c2a4, U+c2a8, U+c2ac, U+c2b4-c2b5, U+c2b7, U+c2b9, U+c2dc-c2dd, U+c2e0, U+c2e3-c2e4, U+c2ec-c2ed, U+c2ef, U+c2f6, U+c2f8, U+c2fc, U+c300, U+c30c-c30d, U+c313, U+c368-c369, U+c36c, U+c370, U+c379, U+c3df, U+c4f0-c4f1, U+c4f4, U+c4f8, U+c500, U+c528-c529, U+c52c, U+c539, U+c53b, U+c544-c545, U+c548-c54a, U+c54c, U+c54e, U+c553-c555, U+c557-c558, U+c55e, U+c560, U+c574, U+c57c-c57d, U+c580, U+c587, U+c591, U+c595, U+c597-c598, U+c5b4-c5b5, U+c5b8-c5b9, U+c5bb-c5bc, U+c5c4-c5c9, U+c5ce, U+c5d0, U+c5d4, U+c5ec-c5ee, U+c5f0, U+c5f4, U+c5fc-c5fd, U+c5ff-c601, U+c605-c606, U+c608, U+c61b, U+c624-c625, U+c628, U+c62c, U+c62e, U+c633-c634, U+c637, U+c640, U+c644, U+c648, U+c654-c655, U+c65c, U+c678, U+c67c, U+c694-c695, U+c6a9, U+c6b0, U+c6b4, U+c6b8, U+c6c0, U+c6c3, U+c6c5, U+c6cc, U+c6d0, U+c6d4, U+c6e0, U+c6ec, U+c704, U+c717, U+c720-c721, U+c724, U+c728, U+c73c-c73d, U+c740, U+c744, U+c74c, U+c751, U+c758, U+c774-c775, U+c778, U+c77c-c77d, U+c783-c785, U+c788-c78a, U+c78e, U+c790-c791, U+c794, U+c798, U+c7a0-c7a1, U+c7a3-c7a6, U+c7ac, U+c7c1;
}
@font-face {
  font-family: "Murim Brush";
  src: url("fonts/EastSeaDokdo-game-3.woff2") format("woff2");
  font-display: block;
  unicode-range: U+c800-c801, U+c804, U+c808, U+c80a, U+c810-c811, U+c813, U+c815-c816, U+c81c, U+c820, U+c838, U+c84c, U+c870-c871, U+c874, U+c878, U+c880, U+c885, U+c887, U+c88b-c88c, U+c8c4, U+c8fc-c8fd, U+c900, U+c904, U+c90d, U+c90f, U+c911, U+c918, U+c950, U+c954, U+c990, U+c998, U+c99d, U+c9c0-c9c1, U+c9c4, U+c9c8, U+c9d0-c9d1, U+c9d3, U+c9d6, U+c9d9-c9da, U+c9dc-c9dd, U+c9e0, U+c9e7, U+c9f1, U+c9f8, U+ca4d, U+ca61, U+cabc-cabd, U+cad3, U+cb48, U+cb50, U+cbe4, U+cc0c-cc0d, U+cc21-cc22, U+cc28-cc29, U+cc2c, U+cc2e, U+cc30, U+cc38, U+cc3b-cc3e, U+cc44-cc45, U+cc58-cc59, U+cc98-cc99, U+cc9c, U+cca0, U+cca9, U+ccab, U+ccad, U+ccb4, U+ccd0, U+cce4, U+cd08, U+cd0c, U+cd1d, U+cd5c, U+cd94-cd95, U+cd98, U+cd9c, U+cda4, U+cda9, U+cdb0, U+cdc4, U+cde8, U+ce21, U+ce35, U+ce58-ce59, U+ce5c, U+ce60-ce61, U+ce68-ce69, U+ce6d, U+ce74, U+ce78, U+ce7c, U+ce90, U+ce94, U+cea4, U+cee4, U+cef7, U+cf1c, U+cf30, U+cf54, U+cf69, U+cf85, U+cf8c, U+cfe0, U+d034, U+d06c, U+d070, U+d074, U+d07c, U+d0a4, U+d0a8, U+d0ac, U+d0c0-d0c1, U+d0c8, U+d0d0, U+d0d5, U+d0dc-d0dd, U+d0ed, U+d130-d131, U+d138, U+d143, U+d145, U+d14c, U+d15c, U+d17c, U+d1a0, U+d1b1, U+d1b5, U+d22c, U+d284, U+d290, U+d295, U+d2b8-d2b9, U+d2bc, U+d2c0, U+d2c8, U+d2f0, U+d2f4, U+d2f8, U+d30c, U+d310, U+d314, U+d320, U+d328, U+d33d, U+d37c, U+d399, U+d3b4, U+d3b8, U+d3bc, U+d3c8-d3c9, U+d3d0, U+d3ec-d3ed, U+d3f0, U+d3f4, U+d45c, U+d478-d479, U+d480, U+d488, U+d48d, U+d504, U+d50c, U+d53c, U+d540, U+d544, U+d54f, U+d551, U+d558-d559, U+d55c, U+d560, U+d568-d569, U+d56d, U+d574, U+d587-d589, U+d5a5, U+d5c8, U+d5cc, U+d5d0, U+d5d8, U+d5db, U+d5dd, U+d5e4, U+d600, U+d604, U+d608, U+d611, U+d614-d615, U+d61c, U+d638-d639, U+d63c, U+d640, U+d649, U+d654-d655, U+d658, U+d65c, U+d669, U+d683, U+d68c-d68d, U+d69f, U+d6a1, U+d6a8, U+d6c4, U+d6c8, U+d6d1, U+d6d7, U+d718, U+d71c, U+d720, U+d729, U+d734, U+d749, U+d750-d751, U+d754, U+d758-d759, U+d760-d761, U+d765, U+d769, U+d76c, U+d770, U+d788, U+d78c, U+d790, U+d798, U+ff5e;
}

.cover-title {
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-weight: 400;
  font-size: clamp(3.9rem, 19vw, 5.6rem);
  line-height: 1;
  letter-spacing: 0.03em;
  text-indent: 0.03em;
  translate: 0 -50%;
  top: 50%;
}

.cover-question {
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0.04em;
}

/* ---------- 강호 견문록 (설명집, 설계문서 6.32) ---------- */

.codex-btn {
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.cover-codex {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  animation: cover-fade 0.8s ease-out 1.6s both;
}

.cover-codex-seal {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}

.codex-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: rgba(31, 27, 22, 0.55);
  animation: cover-fade 0.18s ease-out both;
}

.codex-sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(560px, 100%);
  height: min(92vh, 92dvh);
  padding: 14px var(--gap) 0;
  border-top: 4px solid var(--ink);
  border-radius: 10px 10px 0 0;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(0deg, rgba(120, 100, 70, 0.035) 0 1px, transparent 1px 5px);
  animation: codex-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes codex-up {
  0% { translate: 0 40px; opacity: 0; }
  100% { translate: 0 0; opacity: 1; }
}

.codex-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.codex-seal {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 38px;
  text-align: center;
}

.codex-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.codex-title-main {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.codex-title-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.codex-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.codex-search {
  width: 100%;
}

.codex-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.codex-tabs::-webkit-scrollbar {
  display: none;
}

.codex-tab {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.codex-tab-hanja {
  font-weight: 700;
}

.codex-tab.is-active {
  border-color: var(--ink);
  background: var(--ink-fill);
  color: var(--accent-text);
}

.codex-body {
  flex: 1;
  overflow-y: auto;
  margin: 0 calc(var(--gap) * -1);
  padding: 4px var(--gap) 28px;
  overscroll-behavior: contain;
}

.codex-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.codex-entry {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(201, 164, 92, 0.4);
  border-left: 4px solid var(--accent);
  border-radius: 2px;
  background: var(--panel);
}

.codex-term {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.codex-term-name {
  font-size: 1.15rem;
  font-weight: 700;
}

.codex-term-hanja {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.codex-row {
  display: grid;
  grid-template-columns: 3.6em 1fr;
  gap: 8px;
  font-size: 0.92rem;
  line-height: 1.55;
}

.codex-label {
  align-self: start;
  margin-top: 2px;
  padding: 0 2px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.72rem;
  text-align: center;
  color: var(--muted);
  white-space: nowrap;
}

.codex-text {
  word-break: keep-all;
}

@media (prefers-reduced-motion: reduce) {
  .codex-overlay,
  .codex-sheet {
    animation: none !important;
  }
}

/* 견문록 갈래 줄: 마우스로 잡고 끌 수 있고, 마우스를 쓰는 기기에서는 가는 막대가 보인다 */
.codex-tabs {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.codex-tabs:active {
  cursor: grabbing;
}

@media (hover: hover) and (pointer: fine) {
  .codex-tabs {
    scrollbar-width: thin;
    padding-bottom: 6px;
  }

  .codex-tabs::-webkit-scrollbar {
    display: block;
    height: 6px;
  }

  .codex-tabs::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: var(--border);
  }
}

/* ---------- 상태창 얼굴 그림 ---------- */

.avatar {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
}

/* 얼굴 둘레만 보이게 자르는 틀 */
.avatar-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--panel);
}

.avatar-img {
  position: absolute;
  width: 300%;
  max-width: none;
  height: auto;
  filter: grayscale(1) contrast(1.05);
}

/* 구석의 문파 낙관 (틀 밖으로 살짝 나온다) */
.avatar-seal {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 1.5px var(--panel);
}

/* ============================================================
   넓은 화면 (PC) 배치 — 설계문서 6.35
   960px 이상이면: 왼쪽에 주인공 칸(늘 보임), 오른쪽 위에 탭, 그 아래 내용을 두 줄로.
   그보다 좁으면 지금까지의 휴대폰 배치 그대로다.
   ============================================================ */

.side-figure {
  display: none;
}

@media (min-width: 960px) {
  body {
    font-size: 17px;
  }

  /* 일과가 아닌 화면(시작·사건·결과 등)은 읽기 좋은 너비의 한 줄 */
  .app {
    max-width: 760px;
    padding: 40px 28px;
  }

  /* 싸움은 무대를 넓게 */
  .app:has(.arena) {
    max-width: 920px;
  }

  .arena {
    min-height: 240px;
  }

  .combatant {
    --fw: min(30cqw, 190px);
  }

  /* ---------- 일과 화면: 옆 칸 + 본문 ---------- */
  .app:has(.daily) {
    max-width: 1280px;
    padding: 24px 32px;
  }

  .daily {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 28px;
    row-gap: 18px;
    align-items: start;
  }

  /* 왼쪽 주인공 칸: 세로 두루마리 */
  .daily .status-bar {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: 24px;
    margin: 0;
    padding: 18px 18px 14px;
    gap: 9px;
    border: 1px solid rgba(201, 164, 92, 0.55);
    border-top: 6px solid var(--ink);
    border-bottom: 6px solid var(--ink);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
  }

  .daily .status-top {
    flex-wrap: wrap;
    row-gap: 10px;
    margin-bottom: 6px;
  }

  .daily .status-name {
    font-size: 1.25rem;
  }

  /* 날짜와 은자는 한 줄을 통째로 쓴다 */
  .daily .status-right {
    order: 9;
    flex: 1 0 100%;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
  }

  .daily .status-top .day {
    font-size: 1.1rem;
    font-weight: 700;
  }

  .side-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
  }

  .side-figure .figure {
    width: 190px;
  }

  .side-figure-realm {
    margin-top: 6px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
  }

  .side-figure-ovr {
    font-size: 0.85rem;
    color: var(--accent-ink);
  }

  /* 탭: 본문 위에 가로로 놓인 현판 다섯 */
  .daily .tab-bar {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    translate: none;
    width: auto;
    padding: 8px;
    gap: 8px;
    border-top: 0;
    border-bottom: 5px solid var(--ink);
    box-shadow: inset 0 -2px 0 rgba(201, 164, 92, 0.25), 0 3px 8px rgba(0, 0, 0, 0.45);
  }

  .daily .tab-btn {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 6px 0;
  }

  .daily .tab-btn:hover:not(.is-active) {
    background: rgba(201, 164, 92, 0.07);
    color: var(--ink);
  }

  .daily .tab-icon {
    font-size: 1.5rem;
  }

  .daily .tab-label {
    font-size: 1rem;
  }

  .daily .tab-btn.is-main {
    margin-top: 0;
    min-height: 52px;
    box-shadow: inset 0 0 0 2px var(--panel-2), inset 0 0 0 3px var(--accent);
  }

  .daily .tab-btn.is-main.is-active {
    box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 3px var(--accent);
  }

  .daily .tab-btn.is-main .tab-icon {
    font-size: 1.7rem;
  }

  /* 본문: 칸들을 두 줄로 흘린다. 안내와 목표는 가로를 통째로 쓴다 */
  .daily .tab-body {
    grid-column: 2;
    grid-row: 2;
    display: block;
    columns: 2;
    column-gap: 22px;
    padding-bottom: 32px;
  }

  .daily .tab-body > * {
    break-inside: avoid;
    margin: 0 0 18px;
  }

  .daily .tab-body > .hint-card,
  .daily .tab-body > .goal-banner,
  .daily .tab-body > .warn {
    column-span: all;
  }

  /* 단추에 마우스를 올리면 살짝 뜬다 */
  .btn:hover:not(:disabled),
  .action-btn:hover:not(:disabled) {
    filter: brightness(0.97);
    translate: 0 -1px;
  }

  /* 견문록: 가운데 뜨는 책 */
  .codex-overlay {
    align-items: center;
  }

  .codex-sheet {
    width: min(820px, 92vw);
    height: min(84vh, 760px);
    border: 1px solid var(--ink);
    border-top: 5px solid var(--ink);
    border-radius: 6px;
    padding-bottom: 0;
  }

  .codex-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .update-banner {
    bottom: 24px;
  }
}

/* 넓은 화면: 싸움의 양쪽 체력 칸을 좌우로 마주 놓는다 */
@media (min-width: 960px) {
  .fighters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
  }
}
/* ---------- 출신과 유년 (설계문서 6.34 2단계) ---------- */

.origin-screen {
  align-items: center;
  text-align: center;
  gap: 16px; /* 17번: 다른 화면과 같은 칸 사이 */
}

.origin-screen .panel,
.origin-screen .btn {
  align-self: stretch;
}

.origin-screen .panel {
  text-align: left;
}

.origin-lead {
  margin: 12px 0 0;
  letter-spacing: 0.2em;
  animation: cover-fade 0.6s ease-out both;
}

/* 먹이 번지고 그 위에 출신 한 글자가 찍힌다 */
.origin-reveal {
  position: relative;
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
}

.origin-blot {
  position: absolute;
  inset: 0;
  border-radius: 46% 54% 52% 48% / 50% 46% 54% 50%;
  background: var(--ink-fill);
  filter: blur(0.6px);
  animation: origin-blot 0.7s cubic-bezier(0.2, 0.9, 0.3, 1) 0.15s both;
}

.origin-demonic .origin-blot { background: #4a0f0a; }
.origin-noble .origin-blot { background: #1f2a3a; }

@keyframes origin-blot {
  0% { scale: 0; opacity: 0; rotate: -30deg; }
  60% { scale: 1.12; opacity: 1; }
  100% { scale: 1; opacity: 1; rotate: 0deg; }
}

.origin-hanja {
  position: relative;
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: 6rem;
  line-height: 1;
  color: var(--panel);
  animation: cover-seal 0.35s cubic-bezier(0.2, 1.5, 0.4, 1) 0.6s both;
}

.origin-name {
  margin: 4px 0 0;
  font-size: 2rem;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  animation: cover-fade 0.6s ease-out 0.9s both;
}

.origin-tagline {
  margin: 0;
  color: var(--accent-ink);
  animation: cover-fade 0.6s ease-out 1s both;
}

.origin-birth,
.origin-base {
  animation: cover-rise 0.6s ease-out 1.2s both;
}

.child-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--panel);
  border-top: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
}

.child-who {
  display: flex;
  align-items: center;
  gap: 10px;
}

.child-who-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.child-age {
  font-size: 1.5rem;
  font-weight: 700;
}

.origin-seal {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: var(--ink-fill);
  color: var(--accent-text);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 44px;
  text-align: center;
}

.origin-seal.origin-demonic { background: #6b1410; }
.origin-seal.origin-noble { background: #2c3e58; }
.origin-seal.origin-underworld { background: #3a3530; }
.origin-seal.origin-lowborn { background: #6f6556; }

.child-chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.child-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.child-chip-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.child-chip-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 지나온 해: 열 칸 */
.child-years {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.child-year {
  height: 5px;
  border-radius: 2px;
  background: var(--bar-track);
}

.child-year.is-past { background: var(--ink-fill); }
.child-year.is-now { background: var(--accent); }

.child-title {
  margin: 4px 0 0;
}

.child-gains {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.child-gain {
  padding: 4px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: var(--panel);
  font-weight: 700;
  animation: gain-pop 0.4s ease-out calc(0.15s + var(--i, 0) * 0.12s) both;
}

.child-gain.is-loss {
  border-color: var(--danger);
  color: var(--danger);
}

.child-log summary {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .origin-screen *,
  .child-gain {
    animation: none !important;
  }
}

/* ---------- 열다섯의 갈림길, 입문 조건, 생의 끝 (설계문서 6.34 3단계) ---------- */

.crossroad {
  display: grid;
  gap: var(--gap);
}

.crossroad-way {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--gap);
  border: 1px solid rgba(201, 164, 92, 0.55);
  border-top: 4px solid var(--ink);
  background: var(--panel);
}

.crossroad-way + .crossroad-way {
  border-top-color: var(--muted);
}

.crossroad-title {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
}

.crossroad-way p {
  margin: 0;
}

@media (min-width: 960px) {
  .crossroad {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.child-years.is-civil {
  grid-template-columns: repeat(8, 1fr);
}

.card.is-locked {
  opacity: 0.6;
  cursor: not-allowed;
}
.life-hanja {
  font-size: 3.6rem;
  letter-spacing: 0.05em;
}

/* ---------- 수명과 한 줄 평 (설계문서 6.34 4단계) ---------- */

.side-figure-life {
  font-size: 0.8rem;
  color: var(--muted);
}

.life-warn {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.epitaph {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px var(--gap);
  border-top: 3px double var(--ink);
  border-bottom: 3px double var(--ink);
}
/* ============================================================
   어두운 무협 테마의 덧칠 (설계문서 6.36)
   ============================================================ */

/* ---- 종이(족자) 구역: 먹 그림이 올라가는 곳은 예전 밝은 값으로 ---- */
.arena,
.figure,
.avatar-clip,
.origin-reveal {
  --ink: var(--paper-ink);
  --ink-fill: var(--paper-ink);
  --panel: #f8f4ea;
  --panel-2: #fbf7ee;
  --text: #1f1b16;
  --accent-ink: #9e2b1e;
  --danger: #a3271a;
  --muted: #6f6556;
  --accent: #9e2b1e;
  --danger: #a3271a;
  --bar-mp: #3b5878;
}

/* 싸움 무대: 걸어 둔 족자 그림 */
.arena {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(31, 27, 22, 0.1), transparent 70%),
    linear-gradient(180deg, #f6eeda, #eadfc4);
  border: 1px solid var(--gold-dim);
  border-bottom: 4px solid #2a251f;
  box-shadow: 0 0 0 4px #17130f, 0 0 0 5px var(--gold-dim), 0 12px 30px rgba(0, 0, 0, 0.6);
  color: #1f1b16;
}

.arena .figure {
  background: none;
  border: 0;
  box-shadow: none;
}

/* 무대 밖의 인물 그림: 작은 초상 족자 */
.figure {
  background: radial-gradient(ellipse at 50% 45%, #f7efdb 0%, #ebe0c5 62%, #d3c4a0 100%);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  box-shadow: 0 0 0 3px #17130f, 0 0 0 4px rgba(201, 164, 92, 0.45), 0 6px 16px rgba(0, 0, 0, 0.5);
  padding: 4px 4px 0;
}

.avatar-clip {
  background: #efe5cc;
  border-color: var(--gold);
}

/* ---- 칸: 옻칠 판에 금박 선 ---- */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid rgba(201, 164, 92, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.05), 0 8px 22px rgba(0, 0, 0, 0.35);
}

/* ---- 단추 ---- */
.btn {
  background: linear-gradient(180deg, #2c251d, #211c16);
  border-color: rgba(201, 164, 92, 0.45);
  color: var(--text);
}

.btn-primary {
  background: var(--ink-fill);
  border-color: var(--gold);
  color: var(--accent-text);
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, 0.25), 0 3px 0 #3d0c08;
}

.btn:disabled {
  opacity: 0.45;
}

.text-input {
  background: #17130f;
  border-color: rgba(201, 164, 92, 0.45);
  color: var(--text);
}

/* ---- 상태창과 탭: 검은 옻칠 현판 ---- */
.status-bar,
.tab-bar,
.child-head {
  background: linear-gradient(180deg, #231d17, #19150f);
  border-color: var(--gold-dim);
}

.daily .status-bar {
  border-color: rgba(201, 164, 92, 0.5);
  border-top-color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-btn.is-main {
  background: #241e17;
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: inset 0 0 0 2px #241e17, inset 0 0 0 3px rgba(201, 164, 92, 0.5);
}

.tab-btn.is-active,
.tab-btn.is-main.is-active {
  background: var(--ink-fill);
  border-color: var(--gold);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 2px #6b1710, inset 0 0 0 3px var(--gold);
}

/* ---- 제목 ---- */
.heading,
.event-title,
.origin-name {
  color: #f1e6cd;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

.status-name,
.npc-name,
.codex-term-name,
.child-age {
  color: #f1e6cd;
}

/* 겹쳐 뜨는 장면의 뒷배경 */
.codex-sheet {
  background-color: var(--bg);
  background-image: none;
}

.codex-entry {
  border-color: rgba(201, 164, 92, 0.3);
}

/* ============================================================
   시작 화면: 어두운 테마 (DESIGN-UI.md 1번)
   달이 뜬 밤, 먹빛 산 위로 핏빛 붓 자국이 한 번 지나간다. 단추는 금박.
   ============================================================ */

.cover {
  --cover-blood: #8f2217;
  --cover-blood-deep: #5c120b;
}

/* 달: 오른쪽 위에 걸린 흐린 보름달과 달무리 */
.cover::before {
  content: "";
  position: absolute;
  top: 3%;
  right: 6%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 40%, rgba(246, 236, 214, 0.9) 0, rgba(233, 222, 196, 0.75) 34%, rgba(233, 222, 196, 0.12) 36%, transparent 70%);
  filter: blur(0.4px);
  opacity: 0.55;
  pointer-events: none;
  animation: cover-fade 2.4s ease-out 0.2s both;
}

/* 발밑에서 올라오는 안개 */
.cover::after {
  content: "";
  position: absolute;
  left: calc(var(--gap) * -1);
  right: calc(var(--gap) * -1);
  bottom: 40px;
  height: 120px;
  background: linear-gradient(to top, rgba(233, 222, 196, 0.07), transparent);
  filter: blur(6px);
  pointer-events: none;
  animation: cover-mist 9s ease-in-out infinite alternate;
}

@keyframes cover-mist {
  from { translate: -12px 0; opacity: 0.7; }
  to { translate: 12px 0; opacity: 1; }
}

.cover-hanja {
  color: var(--gold);
  opacity: 0.85;
}

.cover-hanja::before,
.cover-hanja::after {
  background: var(--gold);
}

/* 붓 자국: 핏빛. 한가운데가 가장 짙고 끝으로 갈수록 마른다 */
.cover .cover-ink {
  fill: var(--cover-blood);
}

.cover .cover-brush-svg {
  filter: drop-shadow(0 0 22px rgba(160, 40, 25, 0.45));
}

.cover .cover-dry path {
  fill: var(--bg);
  opacity: 0.9;
}

.cover .cover-splat {
  background: var(--cover-blood);
}

.cover .cover-title {
  color: #f8efd9;
  text-shadow: 0 3px 0 rgba(40, 6, 3, 0.75), 0 0 18px rgba(0, 0, 0, 0.35);
}

/* 낙관: 붉은 붓 자국 위에서는 금박이 눈에 선다 */
.cover .cover-seal {
  background: linear-gradient(160deg, #e0bf78, #a8853f);
  color: #2a1608;
  box-shadow: 0 0 0 2px var(--bg), 0 3px 10px rgba(0, 0, 0, 0.6);
}

.cover .cover-sub {
  color: var(--muted);
  letter-spacing: 0.06em;
}

.cover .cover-question {
  color: #f1e6cd;
}

.cover .cover-question::before,
.cover .cover-question::after {
  color: var(--gold);
}

/* 단추: 이 화면에서 가장 눈에 띄어야 한다. 으뜸 단추는 금박 현판 */
.cover .buttons {
  gap: 14px;
}

.cover .btn {
  min-height: 58px;
  font-size: 1.1rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  border-radius: 2px;
}

.cover .btn-primary {
  background: linear-gradient(180deg, #e3c27c 0%, #c39f55 55%, #a07f3d 100%);
  border: 1px solid #f0d99a;
  color: #24160a;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 248, 220, 0.6), inset 0 -2px 0 rgba(90, 60, 15, 0.35), 0 4px 0 #5e4718, 0 10px 24px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 rgba(255, 245, 210, 0.5);
}

.cover .btn-primary .action-hint {
  color: #4a3311;
  letter-spacing: 0.02em;
  text-indent: 0;
}

.cover .btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.cover .btn:not(.btn-primary) {
  background: transparent;
  border: 1px solid rgba(201, 164, 92, 0.55);
  color: var(--gold);
}

.cover .btn:not(.btn-primary):disabled {
  border-style: dashed;
  color: var(--muted);
}

/* 먼 산: 달빛 받은 능선 셋. 뒤로 갈수록 옅다 */
.cover-mountains {
  height: 190px;
  background:
    linear-gradient(to top, var(--bg) 0, transparent 26%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 190' preserveAspectRatio='none'%3E%3Cpath d='M0,190 L0,120 C40,104 62,66 98,54 C122,46 138,82 170,92 C206,104 228,50 264,26 C292,10 314,58 346,78 C382,98 406,70 438,54 C472,38 502,84 538,98 C568,108 586,92 600,84 L600,190 Z' fill='%23e9dec4' opacity='0.06'/%3E%3Cpath d='M0,190 L0,150 C50,140 80,108 120,106 C160,104 180,132 226,134 C270,136 300,98 340,92 C384,86 410,124 452,128 C500,132 540,110 600,116 L600,190 Z' fill='%23e9dec4' opacity='0.09'/%3E%3Cpath d='M0,190 L0,172 C70,162 120,152 180,156 C250,160 300,146 370,148 C440,150 520,164 600,154 L600,190 Z' fill='%230b0907' opacity='0.9'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
}

/* 꽃잎: 어둠 속에서는 핏빛으로 */
.cover .cover-petal {
  background: #b5372a;
}

.cover-codex {
  background: rgba(29, 25, 21, 0.8);
  border-color: rgba(201, 164, 92, 0.5);
  color: var(--gold);
}

@media (prefers-reduced-motion: reduce) {
  .cover::after {
    animation: none !important;
  }
}

/* 휴대폰: 달을 작게, 왼쪽 위로 (가운데 글자와 견문록 단추를 가리지 않게) */
@media (max-width: 700px) {
  .cover::before {
    top: 1%;
    left: 2%;
    right: auto;
    width: 92px;
    height: 92px;
    opacity: 0.45;
  }
}

/* ============================================================
   수련 현판: 어두운 테마 (DESIGN-UI.md 2번)
   네모 칸 다섯이 아니라, 기둥에 걸린 나무 현판을 세로로 늘어놓는다.
   왼쪽에 큰 한자 한 글자(금테 원), 오른쪽에 이름·부제·얻는 것.
   .action-btn 은 수련·비무·대회·혈도 단추가 함께 쓴다.
   ============================================================ */

.actions,
.actions-one {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 12px;
}

/* 판: 겹줄과 회색 바탕을 걷어내고, 제목만 왼쪽에 금선과 함께 */
.actions-board {
  padding: 30px 0 4px;
  border: 0;
  background: none;
}

.board-title {
  top: 0;
  left: 0;
  translate: none;
  padding: 0 14px 0 0;
  background: none;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.6em;
  text-indent: 0;
}

.actions-board::before {
  content: "";
  position: absolute;
  top: 0.7em;
  left: 5.6em;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(201, 164, 92, 0.7), transparent);
}

/* 현판 한 장 */
.action-btn {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  grid-template-areas: "seal name" "seal tag" "seal hint";
  align-items: center;
  justify-items: start;
  column-gap: 16px;
  row-gap: 0;
  min-height: 84px;
  padding: 12px 18px 12px 14px;
  text-align: left;
  border: 1px solid #5a4630;
  border-radius: 3px;
  /* 옻칠한 나무: 세로 결 + 위에서 받는 빛 */
  background:
    linear-gradient(180deg, rgba(255, 235, 200, 0.07), transparent 38%),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 9px, rgba(255, 220, 170, 0.025) 9px 10px, transparent 10px 17px),
    linear-gradient(180deg, #33261a, #231910);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.55),
    inset 0 0 0 2px rgba(201, 164, 92, 0.22),
    0 4px 0 #120c07,
    0 10px 18px rgba(0, 0, 0, 0.45);
  color: var(--text);
  transition: translate 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}

/* 네 귀퉁이의 놋쇠 못 */
.action-btn::after {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  background:
    radial-gradient(circle at 3px 3px, #e3c27c 0 1.6px, #6e5627 2px, transparent 2.6px) top left / 7px 7px no-repeat,
    radial-gradient(circle at 3px 3px, #e3c27c 0 1.6px, #6e5627 2px, transparent 2.6px) top right / 7px 7px no-repeat,
    radial-gradient(circle at 3px 3px, #e3c27c 0 1.6px, #6e5627 2px, transparent 2.6px) bottom left / 7px 7px no-repeat,
    radial-gradient(circle at 3px 3px, #e3c27c 0 1.6px, #6e5627 2px, transparent 2.6px) bottom right / 7px 7px no-repeat;
  opacity: 0.8;
}

.action-btn:hover:not(:disabled) {
  background:
    linear-gradient(180deg, rgba(255, 235, 200, 0.12), transparent 42%),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 9px, rgba(255, 220, 170, 0.025) 9px 10px, transparent 10px 17px),
    linear-gradient(180deg, #3a2b1d, #271c12);
  border-color: var(--gold-dim);
  translate: 0 -1px;
  filter: none;
}

.action-btn:active:not(:disabled),
.action-btn.is-stamped {
  translate: 0 4px;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.55),
    inset 0 0 0 2px rgba(201, 164, 92, 0.22),
    0 0 0 #120c07,
    0 3px 8px rgba(0, 0, 0, 0.45);
}

/* 큰 한자: 금테를 두른 먹빛 원 안에 금박 글자 */
.action-seal {
  grid-area: seal;
  position: static;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #2a2018, #110c08 72%);
  box-shadow: 0 0 0 1.5px var(--gold), 0 0 0 4px #1a130d, 0 0 0 5px rgba(201, 164, 92, 0.35);
  color: #ecd596;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 58px;
  rotate: none !important;
  opacity: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.action-btn:nth-child(even) .action-seal {
  rotate: none;
}

/* 누르면 한자 원이 붉은 낙관으로 "쿵" 찍힌다 */
.action-btn.is-stamped .action-seal {
  animation: plaque-stamp 0.28s cubic-bezier(0.3, 0, 0.4, 1) both;
}

@keyframes plaque-stamp {
  0% { scale: 1.5; }
  55% { scale: 0.9; background: #9e2418; color: #fff1d6; box-shadow: 0 0 0 1.5px #f0d99a, 0 0 0 4px #5c120b, 0 0 22px rgba(194, 58, 43, 0.9); }
  100% { scale: 1; background: #8f2217; color: #fff1d6; box-shadow: 0 0 0 1.5px #f0d99a, 0 0 0 4px #5c120b, 0 0 12px rgba(194, 58, 43, 0.6); }
}

.action-name {
  grid-area: name;
  align-self: end;
  font-size: 1.25rem;
  letter-spacing: 0.14em;
  color: #f3e8cf;
  line-height: 1.25;
}

.action-tagline {
  grid-area: tag;
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.12em;
}

.action-hint {
  grid-area: hint;
  align-self: start;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

/* 부제가 없는 현판(대회·혈도 등)은 두 줄로 */
.action-btn:not(:has(.action-tagline)) {
  grid-template-areas: "seal name" "seal hint";
}

/* 추천: 금빛 테가 천천히 숨 쉬고, 오른쪽 위에 붉은 댕기 */
.action-btn.is-recommended {
  border-color: var(--gold);
  animation: plaque-glow 2.2s ease-in-out infinite;
}

.action-btn.is-recommended::before {
  content: "추천";
  top: -1px;
  left: auto;
  right: 18px;
  padding: 3px 7px 7px;
  border-radius: 0;
  background: linear-gradient(180deg, #a8291c, #7d1a11);
  color: #fdebd0;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  line-height: 1.2;
  /* 아래가 제비 꼬리처럼 갈라진 댕기 */
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}

@keyframes plaque-glow {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 2px rgba(201, 164, 92, 0.3), 0 4px 0 #120c07, 0 0 0 rgba(227, 194, 124, 0); }
  50% { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 2px rgba(227, 194, 124, 0.7), 0 4px 0 #120c07, 0 0 18px rgba(227, 194, 124, 0.35); }
}

.action-btn:disabled {
  opacity: 0.42;
  filter: grayscale(0.6);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55), 0 2px 0 #120c07;
}

.tab-tip {
  text-align: left;
  padding-left: 2px;
}

/* 넓은 화면: 현판을 조금 낮게 */
@media (min-width: 960px) {
  .action-btn {
    min-height: 78px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .action-btn.is-recommended,
  .action-btn.is-stamped .action-seal {
    animation: none !important;
  }
}

/* ============================================================
   칸 제목과 칸 모양: 어두운 테마 (DESIGN-UI.md 3번)
   모든 칸을 같은 네모 테두리로 두르지 않는다.
   - 보통 칸: 테두리 없이 네 귀퉁이에만 금박 꺾쇠
   - 이야기 칸(.story): 테두리도 바탕도 없이 왼쪽 금선 하나, 글을 크게
   - 기록·접는 칸: 바탕 없이 위에 가는 선만
   - 강조 칸(환생·생사경 이후·줄거리): 금테를 온전히 두른다
   ============================================================ */

/* ---- 화면 제목: 겹줄 대신 왼쪽의 붉은 낙관 조각과 길게 흐려지는 금선 ---- */
.heading {
  position: relative;
  margin: 14px 0 4px;
  padding: 0 0 10px 18px;
  border-bottom: 0;
  font-size: 1.7rem;
  letter-spacing: 0.14em;
}

.heading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  width: 6px;
  height: 1.15em;
  background: linear-gradient(180deg, #c23a2b, #7d1a11);
}

.heading::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), rgba(201, 164, 92, 0.15) 60%, transparent);
}

/* ---- 칸 제목: 이름 – 흐려지는 금선 – 한자 ---- */
.section-title {
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  border-bottom: 0;
  color: #f1e6cd;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

/* 붉은 마름모 대신 세로로 선 금박 쐐기 */
.section-title::before {
  width: 3px;
  height: 1.05em;
  border-radius: 0;
  background: linear-gradient(180deg, #ecd596, #a8853f);
  rotate: none;
}

.section-title > span:first-of-type {
  flex: none;
}

/* 이름과 한자 사이를 잇는 선 */
.section-title::after {
  content: "";
  flex: 1;
  order: 2;
  height: 1px;
  min-width: 12px;
  background: linear-gradient(90deg, rgba(201, 164, 92, 0.55), rgba(201, 164, 92, 0.06));
}

.section-hanja {
  order: 3;
  margin-left: 0;
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  opacity: 0.7;
}

.subheading:not(.section-title) {
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
}

/* ---- 보통 칸: 네 귀퉁이 금박 꺾쇠 ---- */
.panel {
  --corner: rgba(201, 164, 92, 0.75);
  position: relative;
  padding: 18px 18px 16px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(var(--corner), var(--corner)) top left / 16px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top left / 1px 16px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top right / 16px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top right / 1px 16px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom left / 16px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom left / 1px 16px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom right / 16px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom right / 1px 16px no-repeat,
    linear-gradient(180deg, rgba(255, 240, 210, 0.045), rgba(255, 240, 210, 0.015));
  box-shadow: none;
}

/* ---- 이야기 칸: 글이 주인공. 틀 없이 왼쪽 금선 하나 ---- */
.panel.story {
  padding: 6px 4px 6px 20px;
  background: none;
  border-left: 2px solid var(--gold);
  font-size: 1.08rem;
  line-height: 1.95;
  color: #efe5cf;
}

/* 첫 글자를 크게 (옛 책의 머리글자처럼) */
.panel.story::first-letter {
  font-size: 1.45em;
  line-height: 1;
  font-weight: 700;
  color: var(--gold);
  margin-right: 1px;
}

/* ---- 기록·접는 칸: 바탕 없이 위에 가는 선만 ---- */
.panel:has(> .list.log),
.panel.child-log,
details.panel {
  padding: 14px 4px 4px;
  background: none;
  border-top: 1px solid rgba(201, 164, 92, 0.3);
}

.log li {
  color: var(--muted);
  font-size: 0.9rem;
}

.log li:first-child {
  color: var(--text);
}

details.panel > summary {
  color: var(--gold);
  letter-spacing: 0.1em;
}

/* ---- 강조 칸: 금테를 온전히 ---- */
.samsara-panel,
.endgame-panel,
.chapter-panel {
  border: 1px solid var(--gold);
  background: linear-gradient(180deg, rgba(120, 30, 20, 0.22), rgba(255, 240, 210, 0.02));
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px rgba(201, 164, 92, 0.35);
}

/* 견문록 항목과 인연 카드는 제 모양이 있으니 꺾쇠를 쓰지 않는다 */
.codex-entry,
.npc-card {
  border-radius: 0;
}

/* 칸 안의 목록 구분선: 점선 대신 아주 옅은 실선 */
.inv-item + .inv-item {
  border-top-color: rgba(201, 164, 92, 0.16);
  border-top-style: solid;
}

/* ============================================================
   주인공 칸과 상태창 (DESIGN-UI.md 4번)
   PC 왼쪽 칸은 호패(戶牌): 위에 끈 구멍과 매듭 끈, 문파 색 테, 바탕에 옅은 문파 문양.
   막대는 얇은 검날에 눈금. 피로가 60을 넘으면 붉게.
   ============================================================ */

/* 문파 색: 초상 테, 문파 낙관, 현판 띠, 문파 사건 제목에만 쓴다 */
.sect-hwasan { --sect: #d27a8f; --sect-mark: "매화"; }
.sect-namgung { --sect: #6b93cf; --sect-mark: "구름"; }
.sect-shaolin { --sect: #d19a45; --sect-mark: "연꽃"; }
.sect-wudang { --sect: #8fbba6; --sect-mark: "태극"; }
.sect-cheonma { --sect: #9a2a50; --sect-mark: "불꽃"; }

.daily .avatar-clip {
  border-color: var(--sect, var(--gold));
}

.daily .avatar-seal {
  background: var(--sect, var(--accent));
  color: #140f0b;
}

/* 문파·경지·출신: 조각마다 끊기지 않게 */
.status-tags {
  display: flex;
  flex-wrap: wrap;
  row-gap: 2px;
  word-break: keep-all;
}

.status-tag {
  white-space: nowrap;
}

.status-tag + .status-tag::before {
  content: "·";
  margin: 0 6px;
  color: var(--muted);
}

.tag-sect {
  color: var(--sect, var(--gold));
  font-weight: 700;
}

/* ============================================================
   시작 화면 손보기 (DESIGN-UI.md 1a, 개선 지시서 A)
   고전 무협 소설의 표지처럼: 산이 네 겹으로 물러나고 그 사이에 안개가 낀다.
   달은 한 걸음 물러나 흐리게, 가까운 산은 더 어둡게. 메뉴는 마우스를 올리면 금빛.
   ============================================================ */

/* 달: 조금 흐리게, 달무리를 넓게 */
.cover::before {
  opacity: 0.42;
  box-shadow: 0 0 60px 18px rgba(233, 222, 196, 0.06);
}

/* 산: 먼 봉우리(가장 옅음) → 중간 능선 둘 → 가까운 산(가장 어둠). 능선 사이마다 안개 띠 */
.cover-mountains {
  height: 240px;
  background:
    /* 맨 앞 땅과 바탕을 잇는 어둠 */
    linear-gradient(to top, var(--bg) 0, transparent 22%),
    /* 가까운 산 */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 240' preserveAspectRatio='none'%3E%3Cpath d='M0,240 L0,206 C60,190 110,176 170,184 C230,192 270,170 330,166 C400,162 450,186 510,190 C550,192 580,184 600,180 L600,240 Z' fill='%23090706'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat,
    /* 안개 띠 (가까운 산과 중간 능선 사이) */
    linear-gradient(to top, transparent 22%, rgba(233, 222, 196, 0.07) 30%, transparent 40%),
    /* 중간 능선 둘 */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 240' preserveAspectRatio='none'%3E%3Cpath d='M0,240 L0,170 C50,160 80,128 120,126 C160,124 180,152 226,154 C270,156 300,118 340,112 C384,106 410,144 452,148 C500,152 540,130 600,136 L600,240 Z' fill='%231a1510'/%3E%3Cpath d='M0,240 L0,140 C40,124 62,86 98,74 C122,66 138,102 170,112 C206,124 228,70 264,46 C292,30 314,78 346,98 C382,118 406,90 438,74 C472,58 502,104 538,118 C568,128 586,112 600,104 L600,240 Z' fill='%23e9dec4' opacity='0.08'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat,
    /* 안개 띠 (먼 봉우리 아래) */
    linear-gradient(to top, transparent 48%, rgba(233, 222, 196, 0.05) 58%, transparent 70%),
    /* 먼 봉우리: 아주 옅게, 하늘에 녹아든다 */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 240' preserveAspectRatio='none'%3E%3Cpath d='M0,240 L0,96 C30,90 52,58 80,40 C100,28 112,56 136,66 C168,80 196,22 226,8 C248,0 266,40 290,58 C318,78 346,46 372,30 C400,14 424,52 452,64 C488,80 520,40 552,32 C576,26 590,40 600,46 L600,240 Z' fill='%23e9dec4' opacity='0.035'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
}

/* 표지처럼: 제목과 물음 사이를 넉넉히 */
.cover .cover-sub {
  margin-top: 30px;
  word-break: keep-all;
}

/* 보조 메뉴 단추: 뒤의 산이 비쳐 어지럽지 않게 먹빛으로 채운다 */
.cover .btn:not(.btn-primary) {
  background: rgba(18, 16, 14, 0.88);
}

.cover .cover-ask {
  margin-top: 30px;
}

/* 메뉴: 마우스를 올리면 금빛 테가 감돌고, 키보드로 고르면 금색 두 줄 */
.cover .btn {
  transition: translate 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
}

.cover .btn:not(.btn-primary):not(:disabled):hover {
  border-color: var(--gold);
  color: #f0d99a;
  background: rgba(201, 164, 92, 0.06);
  translate: 0 -1px;
}

.cover .btn-primary:not(:disabled):hover {
  filter: brightness(1.07);
  translate: 0 -1px;
  box-shadow: inset 0 1px 0 rgba(255, 248, 220, 0.6), inset 0 -2px 0 rgba(90, 60, 15, 0.35), 0 5px 0 #5e4718, 0 0 22px rgba(227, 194, 124, 0.35), 0 12px 26px rgba(0, 0, 0, 0.5);
}

.cover .btn:not(:disabled):active {
  translate: 0 2px;
  scale: 0.98;
}

.cover .btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--gold), 0 0 0 5px var(--bg), 0 0 0 6px rgba(201, 164, 92, 0.6);
}

/* ============================================================
   수련 탭 머리: 오늘의 목표 · OVR · 사부의 한마디 (DESIGN-UI.md 5번)
   셋이 같은 무게로 보이지 않게: 목표가 가장 크다(붉은 옻칠 깃발),
   OVR은 큰 숫자 하나와 작은 숫자 넷, 사부의 말은 작은 쪽지.
   ============================================================ */

/* 목표: 왼쪽의 붉은 옻칠 깃발 + 큰 제목 */
.goal-banner {
  position: relative;
  gap: 18px;
  padding: 18px 20px 18px 0;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(143, 34, 23, 0.32), rgba(143, 34, 23, 0.06) 55%, transparent),
    linear-gradient(180deg, rgba(201, 164, 92, 0.5), rgba(201, 164, 92, 0.5)) left top / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(201, 164, 92, 0.25), rgba(201, 164, 92, 0.25)) left bottom / 100% 1px no-repeat;
}

/* 깃발: 아래가 제비 꼬리처럼 갈라진 붉은 천에 금박 한 글자 */
.goal-seal {
  width: 52px;
  height: 66px;
  margin-top: -18px;
  margin-bottom: -6px;
  border-radius: 0;
  background: linear-gradient(180deg, #a8291c, #6b1710);
  color: #f0d99a;
  font-size: 1.5rem;
  line-height: 52px;
  rotate: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

.goal-title {
  color: #f3e8cf;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  line-height: 1.35;
}

.goal-text {
  margin-top: 2px;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.6;
}

.goal-go {
  padding: 8px 12px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
}

.goal-go:hover {
  background: rgba(201, 164, 92, 0.1);
}

/* OVR: 큰 숫자 하나. 상자 대신 아래 금선 */
.ovr-card {
  align-items: center;
  gap: 22px;
}

.ovr-main {
  min-width: 104px;
  padding: 2px 10px 10px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--gold);
}

.ovr-label {
  color: var(--gold);
  letter-spacing: 0.35em;
  text-indent: 0.35em;
}

.ovr-value {
  font-size: 3.1rem;
  line-height: 1;
  color: #f6ecd4;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

.ovr-title {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.ovr-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  row-gap: 10px;
}

.ovr-cell {
  padding: 0 0 0 10px;
  border-left: 1px solid rgba(201, 164, 92, 0.35);
}

.ovr-cell-label {
  color: var(--gold);
  letter-spacing: 0.12em;
}

.ovr-cell-value {
  font-size: 1.6rem;
  line-height: 1.15;
  color: #f1e6cd;
}

.ovr-cell-sub {
  color: var(--muted);
}

/* 깨달음은 한 단계 아래: 셋 아래 한 줄로, 작게 */
.ovr-cell.is-minor {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
  padding-top: 8px;
  border-left: 0;
  border-top: 1px dashed rgba(201, 164, 92, 0.22);
}

.ovr-cell.is-minor .ovr-cell-value {
  font-size: 1.05rem;
}

/* 사부의 한마디: 끈으로 매단 작은 한지 쪽지 */
.hint-card {
  max-width: 560px;
  padding: 14px 16px 12px 18px;
  border: 0;
  border-radius: 1px;
  background: linear-gradient(180deg, #ece1c3, #dccfaa);
  color: #2a251f;
  rotate: -0.4deg;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(90, 70, 40, 0.25);
}

.hint-card::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 22px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  background: #8f2217;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.hint-who {
  color: #8f2217;
}

.hint-text {
  color: #2a251f;
}

.hint-card .hint-ok {
  background: transparent;
  border: 1px solid rgba(42, 37, 31, 0.5);
  color: #2a251f;
  min-height: 34px;
}

.hint-card .hint-ok:hover {
  background: rgba(42, 37, 31, 0.08);
}

/* 못 하는 수련: 흐리게 + 까닭을 붉게 */
.action-btn.is-locked .action-hint {
  color: var(--danger);
  font-weight: 700;
}

/* ============================================================
   혈도·경맥 (DESIGN-UI.md 5a)
   아직 먼 혈: 빈 고리. 다음 혈: 붉게 맥동. 뚫린 혈: 금빛으로 켜짐.
   경맥 선은 뚫린 혈까지 금빛으로 흐른다(--lit). 조건은 등롱.
   ============================================================ */

.mer-line::before {
  height: 1px;
  top: 9px;
  background: repeating-linear-gradient(90deg, rgba(201, 164, 92, 0.3) 0 5px, transparent 5px 9px);
}

/* 흐르는 금빛 기운: 첫 혈에서 마지막으로 뚫린 혈까지 */
.mer-line::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 8%;
  width: calc(84% * var(--lit, 0));
  height: 3px;
  background: linear-gradient(90deg, #a8853f, #f0d99a);
  box-shadow: 0 0 8px rgba(240, 217, 154, 0.6);
}

.mer-dot {
  width: 20px;
  height: 20px;
  border: 1.5px solid rgba(201, 164, 92, 0.45);
  background: #17120e;
  position: relative;
  z-index: 2;
}

.mer-name {
  color: var(--muted);
}

.is-open > .mer-dot {
  border-color: #f0d99a;
  background: radial-gradient(circle at 40% 35%, #fff4d2, #e3c27c 45%, #a8853f 100%);
  box-shadow: 0 0 10px rgba(240, 217, 154, 0.7);
}

.mer-node.is-open .mer-name {
  color: #f0d99a;
}

.is-next > .mer-dot {
  border-color: #e2553f;
  background: radial-gradient(circle, rgba(194, 58, 43, 0.5), #17120e 70%);
  animation: mer-pulse-dark 1.6s ease-in-out infinite;
}

.mer-node.is-next .mer-name {
  color: #ee8a76;
}

@keyframes mer-pulse-dark {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226, 85, 63, 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(226, 85, 63, 0); }
}

.mer-final {
  color: var(--muted);
}

.mer-final.is-open {
  color: #f0d99a;
}

.mer-detail {
  border-top-color: rgba(201, 164, 92, 0.25);
}

/* 타통 조건: 등롱 줄 */
.mer-reqs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 2px;
  padding: 0;
  list-style: none;
}

.mer-req {
  display: grid;
  grid-template-columns: 16px auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
}

.mer-lamp {
  width: 12px;
  height: 16px;
  border-radius: 40% 40% 30% 30%;
  border: 1px solid rgba(201, 164, 92, 0.45);
  background: #1a1410;
}

.mer-req.is-ok .mer-lamp {
  border-color: #f0b25a;
  background: radial-gradient(circle at 50% 55%, #ffe3a0, #e0892f 60%, #8f3d16);
  box-shadow: 0 0 10px rgba(240, 160, 70, 0.75);
}

.mer-req-label {
  color: var(--text);
}

.mer-req-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.mer-req-state {
  min-width: 4.6em;
  text-align: right;
  font-size: 0.78rem;
  color: var(--danger);
}

.mer-req.is-ok .mer-req-state {
  color: #f0b25a;
}

@media (prefers-reduced-motion: reduce) {
  .is-next > .mer-dot {
    animation: none !important;
  }
}

/* ============================================================
   사건·기연·유년·생업 화면 (DESIGN-UI.md 6번, 개선 지시서 C)
   PC: 왼쪽 3할에 인물 족자(유년은 나이 패), 오른쪽 7할에 제목·글·선택지.
   선택지는 번호가 찍힌 두루마리 조각. 싸움·운은 꼬리표 낙관.
   기연이 오면 바탕이 먹빛에서 짙은 청록으로, 등불빛이 금빛으로.
   ============================================================ */

/* 인물 족자: 휴대폰에서도 지금보다 크게 */
.event-screen .portrait-lg {
  width: min(56vw, 200px);
}

.event-title {
  font-size: 1.7rem;
  letter-spacing: 0.08em;
  color: #f3e8cf;
}

/* 서술: 한 줄 길이를 읽기 좋게(한글 35~40자) */
.event-screen .panel.story,
.child-screen .panel.story {
  max-width: 40em;
}

/* 선택지: 두루마리 조각. 앞에 一 二 三 번호 */
.event-screen .buttons,
.child-screen .buttons {
  counter-reset: choice;
  gap: 10px;
}

.choice-btn {
  counter-increment: choice;
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-areas: "num label" "num hint";
  align-items: center;
  column-gap: 14px;
  min-height: 58px;
  padding: 12px 16px 12px 12px;
  border: 1px solid rgba(201, 164, 92, 0.35);
  border-left: 3px solid rgba(201, 164, 92, 0.35);
  border-radius: 0;
  background: linear-gradient(90deg, rgba(255, 240, 210, 0.06), rgba(255, 240, 210, 0.015));
  color: #efe5cf;
  font-size: 1.02rem;
  transition: border-color 0.15s ease, background 0.15s ease, translate 0.12s ease;
}

.choice-btn::before {
  content: counter(choice, korean-hangul-formal);
  grid-area: num;
  width: 30px;
  height: 30px;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  color: var(--gold);
  font-size: 0.9rem;
  line-height: 28px;
  text-align: center;
}

.choice-btn > span:first-child {
  grid-area: label;
}

.choice-btn .action-hint {
  grid-area: hint;
  justify-self: start;
  margin-top: 4px;
  padding: 0 7px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 0.74rem;
  color: var(--gold);
}

/* 마우스를 올리면 금빛 테와 왼쪽 먹선이 짙어지고 살짝 밀려 나온다 */
.choice-btn:not(:disabled):hover {
  border-color: var(--gold);
  border-left-color: #f0d99a;
  background: linear-gradient(90deg, rgba(201, 164, 92, 0.14), rgba(201, 164, 92, 0.02));
  translate: 4px 0;
}

.choice-btn:not(:disabled):hover::before {
  border-color: var(--gold);
  background: rgba(201, 164, 92, 0.15);
}

.choice-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--gold);
}

/* 싸움이 걸린 선택지: 붉은 꼬리표 */
.choice-btn.is-fight {
  border-left-color: #a8291c;
}

.choice-btn.is-fight .action-hint {
  color: #ee8a76;
}

.choice-btn:disabled {
  opacity: 0.45;
}

.choice-btn:disabled .action-hint {
  color: var(--danger);
}

/* 결과: 고른 선택지에 먹선이 그어지고, 얻은 것은 글보다 조금 늦게 떠오른다 */
.event-screen > p.muted:not(.small),
.child-screen > p.muted {
  justify-self: start;
  padding-bottom: 3px;
  background: linear-gradient(90deg, var(--gold), transparent) left bottom / 100% 1px no-repeat;
  color: var(--gold);
}

.event-screen .panel .list li,
.child-gain {
  animation: cover-rise 0.4s ease-out both;
}

.event-screen .panel .list li:nth-child(1) { animation-delay: 0.3s; }
.event-screen .panel .list li:nth-child(2) { animation-delay: 0.42s; }
.event-screen .panel .list li:nth-child(3) { animation-delay: 0.54s; }
.event-screen .panel .list li:nth-child(n + 4) { animation-delay: 0.66s; }

/* ---------- 장소별 분위기 (events.json의 place) ----------
   바탕 색(--place-bg), 위에서 내리는 빛(--place-glow), 아래에서 오르는 기운(--place-low)만 바꾼다.
   기연이면 위에서 내리는 빛이 금빛이 된다. */
body:has(.event-screen) {
  --place-bg: var(--bg);
  --place-glow: rgba(160, 50, 30, 0.22);
  --place-low: rgba(201, 164, 92, 0.08);
  background-color: var(--place-bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--place-glow), transparent 70%),
    radial-gradient(ellipse at 50% 120%, var(--place-low), transparent 60%),
    repeating-linear-gradient(92deg, rgba(255, 240, 210, 0.012) 0 2px, transparent 2px 7px);
  transition: background-color 0.6s ease;
}

/* 문파: 기본(붉은 등불) */
/* 객잔·주막: 따뜻한 호롱불 */
body:has(.event-screen.place-inn) { --place-bg: #17110b; --place-glow: rgba(214, 140, 60, 0.28); --place-low: rgba(150, 70, 30, 0.14); }
/* 산길: 저물녘 흙빛 */
body:has(.event-screen.place-road) { --place-bg: #15120f; --place-glow: rgba(150, 120, 90, 0.18); --place-low: rgba(90, 80, 60, 0.12); }
/* 마을·장터: 줄지은 붉은 등롱 */
body:has(.event-screen.place-market) { --place-bg: #161009; --place-glow: rgba(200, 70, 40, 0.3); --place-low: rgba(220, 150, 70, 0.12); }
/* 깊은 산: 서늘한 잿빛 초록 안개 */
body:has(.event-screen.place-mountain) { --place-bg: #0f1311; --place-glow: rgba(150, 170, 150, 0.14); --place-low: rgba(120, 150, 130, 0.12); }
/* 물가: 깊은 쪽빛 */
body:has(.event-screen.place-water) { --place-bg: #0c1218; --place-glow: rgba(110, 150, 190, 0.18); --place-low: rgba(70, 120, 160, 0.14); }
/* 절·사당: 향 연기와 바랜 금 */
body:has(.event-screen.place-temple) { --place-bg: #14120e; --place-glow: rgba(201, 164, 92, 0.2); --place-low: rgba(170, 160, 140, 0.1); }
/* 꿈: 쪽빛 보라 */
body:has(.event-screen.place-dream) { --place-bg: #100e18; --place-glow: rgba(140, 120, 200, 0.22); --place-low: rgba(90, 80, 150, 0.14); }

/* 장소 그림: 흰 종이에 먹으로 그린 산수를 뒤집어(먹선이 달빛처럼 밝게) 아주 옅게 깐다.
   큰 원본(1600px JPG)이라 흐림 없이 또렷하게 깐다. 그림이 없는 장소는 깔지 않는다. */
body:has(.event-screen)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--place-art, none) center 35% / cover no-repeat;
  filter: invert(1) grayscale(1) contrast(1.15);
  opacity: 0.13;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 95%);
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 95%);
  pointer-events: none;
}

body:has(.event-screen.place-inn) { --place-art: url("img/places/inn.webp"); }
body:has(.event-screen.place-road) { --place-art: url("img/places/road.webp"); }
body:has(.event-screen.place-market) { --place-art: url("img/places/market.webp"); }
body:has(.event-screen.place-mountain) { --place-art: url("img/places/mountain.webp"); }
body:has(.event-screen.place-water) { --place-art: url("img/places/water.webp"); }
body:has(.event-screen.place-temple) { --place-art: url("img/places/temple.webp"); }
body:has(.event-screen.place-dream) { --place-art: url("img/places/dream.webp"); }
body:has(.event-screen.place-sect) { --place-art: url("img/places/sect.webp"); }

/* 기연: 장소의 바탕은 그대로, 위에서 금빛이 내린다 */
body:has(.event-screen.is-fortune) {
  --place-glow: rgba(227, 194, 124, 0.26);
}

/* 장소 표시: 날짜 앞의 작은 꼬리표 낙관 */
.event-when {
  display: flex;
  align-items: center;
  gap: 10px;
}

.event-place {
  padding: 1px 8px;
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.event-screen.is-fortune .panel.story {
  border-left-color: #f0d99a;
  box-shadow: none;
}

.fortune-flash {
  background: rgba(8, 18, 17, 0.9);
}

.fortune-flash-text {
  color: #f0d99a;
}

/* ---------- PC: 족자 3 : 글 7 ---------- */
@media (min-width: 960px) {
  .app:has(.event-screen),
  .app:has(.child-screen) {
    max-width: 1100px;
  }

  .event-screen,
  .child-screen {
    display: grid;
    grid-template-columns: minmax(240px, 3fr) minmax(0, 7fr);
    column-gap: 40px;
  gap: 16px; /* 17번: 다른 화면과 같은 칸 사이 */
    align-items: start;
    align-content: start;
  }

  .event-screen > *,
  .child-screen > * {
    grid-column: 2;
  }

  /* 왼쪽: 인물 족자 (사건) */
  .event-screen > .figure.portrait-lg {
    grid-column: 1;
    grid-row: 1 / span 8;
    position: sticky;
    top: 24px;
    width: 100%;
    max-width: 300px;
    margin: 8px 0 0;
  }

  /* 왼쪽: 나이 패 (유년·생업) */
  .child-screen > .child-head {
    grid-column: 1;
    grid-row: 1 / span 8;
    position: sticky;
    top: 24px;
  }

  .child-screen .child-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .event-screen > .fortune-flash {
    grid-column: 1 / -1;
  }

  .event-title {
    font-size: 1.7rem; /* 17번: 다른 화면 제목(.heading)과 같은 크기 */
  }
}

@media (prefers-reduced-motion: reduce) {
  .event-screen .panel .list li,
  .child-gain,
  .choice-btn {
    animation: none !important;
    transition: none !important;
  }
}

/* 출신은 늘 다음 줄에 (줄 첫머리에 "·"가 오지 않게) */
.status-tag.tag-origin {
  flex-basis: 100%;
}

.status-tag.tag-origin::before {
  content: none;
}

/* 막대: 얇은 검날. 빈 자리도 길이가 보이게 밝은 홈과 눈금(10칸) */
.bar-row {
  grid-template-columns: 2.6em 1fr auto;
  gap: 10px;
}

.bar-label {
  color: var(--gold);
  letter-spacing: 0.15em;
  font-size: 0.8rem;
}

.bar {
  position: relative;
  height: 7px;
  border-radius: 0;
  background: #3a3027;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 164, 92, 0.28);
  clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
}

.bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(10, 8, 6, 0.75) calc(10% - 1px) 10%);
  pointer-events: none;
}

.bar-fill {
  border-radius: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.bar-hp { background: linear-gradient(180deg, #a5cc68, #6f9a38); }
.bar-mp { background: linear-gradient(180deg, #84b0e6, #4a78b8); }
.bar-fatigue { background: linear-gradient(180deg, #a08360, #75603f); }
.bar-fatigue.is-danger { background: linear-gradient(180deg, #e56a50, #a82c1c); }

.bar-row.is-danger .bar-label,
.bar-row.is-danger .bar-value {
  color: var(--danger);
}

.bar-value {
  min-width: 4.6em;
  color: var(--text);
  font-size: 0.82rem;
}

/* ---------- PC 왼쪽 칸: 호패 ---------- */
@media (min-width: 960px) {
  .daily .status-bar {
    padding-top: 30px;
    border-radius: 18px 18px 4px 4px;
    border: 1px solid color-mix(in srgb, var(--sect, var(--gold)) 55%, transparent);
    border-bottom: 6px solid #120d09;
    background:
      radial-gradient(circle at 50% 14px, #0e0b08 0 5px, transparent 6px),
      linear-gradient(180deg, #2a2119, #1b1510 60%, #17120d);
    box-shadow:
      inset 0 0 0 4px #1b1510,
      inset 0 0 0 5px rgba(201, 164, 92, 0.3),
      0 14px 30px rgba(0, 0, 0, 0.55);
    overflow: visible;
  }

  /* 끈 구멍에 걸린 매듭 끈 */
  .daily .status-bar::before {
    content: "";
    position: absolute;
    top: -22px;
    left: 50%;
    width: 2px;
    height: 32px;
    translate: -50% 0;
    background: linear-gradient(180deg, transparent, var(--sect, var(--accent)) 40%);
  }

  /* 바탕에 옅은 문파 문양 한 글자 */
  .daily .status-bar::after {
    content: var(--sect-mark, "무림");
    position: absolute;
    right: 10px;
    bottom: 40px;
    font-size: 9rem;
    line-height: 1;
    font-weight: 700;
    color: var(--sect, var(--gold));
    opacity: 0.05;
    pointer-events: none;
  }

  .daily .status-top,
  .daily .bar-row,
  .daily .side-figure {
    position: relative;
    z-index: 1;
  }

  .daily .status-name {
    font-size: 1.45rem;
    letter-spacing: 0.08em;
  }

  .daily .avatar {
    width: 52px;
    height: 52px;
  }

  .side-figure {
    gap: 4px;
  }

  /* 초상 족자: 문파 색 테 */
  .side-figure .figure {
    box-shadow: 0 0 0 3px #17130f, 0 0 0 4px var(--sect, var(--gold-dim)), 0 8px 18px rgba(0, 0, 0, 0.55);
  }

  /* 경지 이름: 크게, 양옆에 금선 */
  .side-figure-realm {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    font-size: 1.55rem;
    color: #f3e8cf;
    letter-spacing: 0.4em;
    text-indent: 0.4em;
  }

  .side-figure-realm::before,
  .side-figure-realm::after {
    content: "";
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold));
  }

  .side-figure-realm::after {
    background: linear-gradient(90deg, var(--gold), transparent);
  }

  /* 경지 장식: 절정·초절정은 금테를 더하고, 화경부터는 덜어 낸다 */
  .realm-o4 .side-figure-realm,
  .realm-o5 .side-figure-realm {
    padding: 2px 6px;
    border-top: 1px solid rgba(201, 164, 92, 0.5);
    border-bottom: 1px solid rgba(201, 164, 92, 0.5);
  }

  .realm-o5 .side-figure-realm {
    color: #f0d99a;
    text-shadow: 0 0 12px rgba(227, 194, 124, 0.35);
  }

  .realm-o6 .side-figure-realm::before,
  .realm-o6 .side-figure-realm::after,
  .realm-o7 .side-figure-realm::before,
  .realm-o7 .side-figure-realm::after,
  .realm-o8 .side-figure-realm::before,
  .realm-o8 .side-figure-realm::after {
    display: none;
  }

  .realm-o6 .side-figure-realm,
  .realm-o7 .side-figure-realm,
  .realm-o8 .side-figure-realm {
    font-weight: 400;
    letter-spacing: 0.7em;
    text-indent: 0.7em;
    color: #fbf5e6;
  }

  .side-figure-ovr {
    font-variant-numeric: tabular-nums;
    color: var(--gold);
  }

  /* 수명: 타 들어가는 향 한 대 (남은 만큼 길다) */
  .side-figure-life {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
  }

  .side-figure-life::before {
    content: "";
    width: calc(70px * var(--life, 1));
    min-width: 4px;
    height: 2px;
    background: linear-gradient(90deg, #6b4f2c, #9b7a4a);
    box-shadow: 1px 0 0 0 #ff7a3a, 2px 0 4px 1px rgba(255, 120, 60, 0.6);
  }
}

/* ---------- 휴대폰 위 상태창 ---------- */
@media (max-width: 959px) {
  .daily .status-bar {
    border-bottom-color: color-mix(in srgb, var(--sect, var(--gold)) 70%, #000);
  }

  .daily .status-who {
    flex: 1 1 140px;
  }
}

/* ============================================================
   밝기 한 단계 올림 (2026-11-16, 사용자: "너무 어둡다")
   색 변수는 :root에서 밝혔고, 여기서는 따로 박아 둔 어두운 색들을 같은 만큼 밝힌다.
   ============================================================ */

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(200, 80, 45, 0.24), transparent 70%),
    radial-gradient(ellipse at 50% 120%, rgba(201, 164, 92, 0.12), transparent 60%),
    repeating-linear-gradient(92deg, rgba(255, 240, 210, 0.02) 0 2px, transparent 2px 7px);
}

/* 칸: 바탕과의 밝기 차이를 조금 더 */
.panel {
  background:
    linear-gradient(var(--corner), var(--corner)) top left / 16px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top left / 1px 16px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top right / 16px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) top right / 1px 16px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom left / 16px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom left / 1px 16px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom right / 16px 1px no-repeat,
    linear-gradient(var(--corner), var(--corner)) bottom right / 1px 16px no-repeat,
    linear-gradient(180deg, rgba(255, 240, 210, 0.07), rgba(255, 240, 210, 0.03));
}

/* 현판(나무 단추) */
.action-btn {
  background:
    linear-gradient(180deg, rgba(255, 235, 200, 0.09), transparent 38%),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.14) 0 1px, transparent 1px 9px, rgba(255, 220, 170, 0.03) 9px 10px, transparent 10px 17px),
    linear-gradient(180deg, #503b28, #3a2a1c);
}

.action-btn:hover:not(:disabled) {
  background:
    linear-gradient(180deg, rgba(255, 235, 200, 0.14), transparent 42%),
    repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.14) 0 1px, transparent 1px 9px, rgba(255, 220, 170, 0.03) 9px 10px, transparent 10px 17px),
    linear-gradient(180deg, #5a4430, #42301f);
}

.action-seal {
  background: radial-gradient(circle at 50% 38%, #3d2e22, #20170f 72%);
}

/* 상태창·탭·유년 패 */
.status-bar,
.tab-bar,
.child-head {
  background: linear-gradient(180deg, #3d3025, #2e241b);
}

@media (min-width: 960px) {
  .daily .status-bar {
    background:
      radial-gradient(circle at 50% 14px, #1a130d 0 5px, transparent 6px),
      linear-gradient(180deg, #43352a, #33281e 60%, #2d231a);
  }
}

.tab-btn.is-main {
  background: #3d3025;
}

.btn {
  background: linear-gradient(180deg, #46382b, #382c21);
}

.text-input {
  background: #2a2119;
}

.bar {
  background: #4f4134;
}

.codex-sheet {
  background-color: #2f251d;
}

/* 장소별 바탕도 같은 만큼 밝힘 */
body:has(.event-screen) { --place-bg: var(--bg); }
body:has(.event-screen.place-inn) { --place-bg: #2e2216; }
body:has(.event-screen.place-road) { --place-bg: #2a241d; }
body:has(.event-screen.place-market) { --place-bg: #2f2116; }
body:has(.event-screen.place-mountain) { --place-bg: #202a24; }
body:has(.event-screen.place-water) { --place-bg: #1b2631; }
body:has(.event-screen.place-temple) { --place-bg: #2a261d; }
body:has(.event-screen.place-dream) { --place-bg: #221e33; }

/* 장소 그림: 바탕이 밝아진 만큼 조금 더 보이게 */
body:has(.event-screen)::before {
  opacity: 0.24;
}

/* ============================================================
   7. 싸움 화면 (DESIGN-UI.md 7번)
   걸어 둔 족자 무대 · 무대 아래 이름패 · 접는 전투 기록 · 붓으로 긋는 승패 띠
   ============================================================ */

/* 족자: 비단 표구(하늘 칸이 땅 칸보다 넓게) + 위 막대·걸이 끈 + 아래 굴대·금박 꼭지 */
.arena-scroll {
  position: relative;
  margin: 34px 6px 14px;
  padding: 22px 12px 14px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 240, 200, 0.035) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #5b4630, #4a3826);
  border-left: 1px solid #6e573a;
  border-right: 1px solid #6e573a;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
  transform-origin: 50% -30px;
  animation: scroll-sway 7s ease-in-out infinite;
}

@keyframes scroll-sway {
  0%, 100% { rotate: -0.18deg; }
  50% { rotate: 0.18deg; }
}

.arena-scroll .arena {
  border: 0;
  border-top: 1px solid #b9a77f;
  border-bottom: 1px solid #b9a77f;
  box-shadow: none;
}

/* 종이 가장자리의 바랜 기운: 인물 칸에 가리지 않게 맨 위 겹으로 */
.arena-scroll .arena::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(42, 37, 31, 0.25), inset 0 0 40px rgba(120, 95, 50, 0.2);
  pointer-events: none;
}

.scroll-rod {
  position: absolute;
  left: -10px;
  right: -10px;
  border-radius: 6px;
  pointer-events: none;
}

/* 위 막대 */
.scroll-top {
  top: -7px;
  height: 12px;
  background: linear-gradient(180deg, #8a6a43 0%, #5a4027 55%, #3a2a1a 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 걸이 끈: 막대 양쪽에서 올라가 위에서 만나는 세모 */
.scroll-top::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 160px;
  height: 30px;
  translate: -50% 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 30'%3E%3Cpolyline points='4,30 80,3 156,30' fill='none' stroke='%23c9a45c' stroke-width='1.6'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* 끈 꼭대기의 걸이 못 */
.scroll-top::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -27px;
  width: 7px;
  height: 7px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0d99a, #8a7243);
}

/* 아래 굴대: 더 굵고, 양 끝에 금박 꼭지 */
.scroll-bottom {
  bottom: -9px;
  height: 16px;
  left: -4px;
  right: -4px;
  border-radius: 8px;
  background: linear-gradient(180deg, #6b4f33 0%, #3d2b1b 60%, #2a1d12 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.55);
}

.scroll-bottom::before,
.scroll-bottom::after {
  content: "";
  position: absolute;
  top: -2px;
  width: 14px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(90deg, #8a7243, #f0d99a 45%, #a88a50);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}

.scroll-bottom::before { left: -12px; }
.scroll-bottom::after { right: -12px; }

/* ---- 이름패 ---- */
.fighters {
  margin-top: 4px;
}

.fighter.panel {
  gap: 8px;
  padding: 14px 16px 12px;
}

.fighter-head {
  flex-wrap: nowrap;
  gap: 10px;
}

.fighter-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--gold);
  border-radius: 3px;
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.fighter-enemy .fighter-mark {
  border-color: var(--accent);
  color: #fff3e6;
  background: var(--accent);
}

.fighter-name {
  font-size: 1.12rem;
  letter-spacing: 0.04em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fighter-enemy .fighter-name {
  color: #e27a6a;
}

/* 먼저 움직이는 쪽: 붉은 동그라미 낙관 "先" */
.fighter-first {
  flex: none;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff3e6;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(194, 58, 43, 0.25);
  cursor: help;
}

.fighter.is-first {
  border-top-color: var(--gold);
}

.fighter .bar {
  height: 12px;
}

/* 걸린 상태 이상: 막대 아래 네모 낙관 */
.fighter .badges {
  gap: 6px;
  margin-top: 2px;
}

.fighter .badge {
  padding: 2px 8px;
  border-radius: 2px;
  border-width: 1px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.fighter .badge-bleed { color: #e8705e; }
.fighter .badge-poison { color: #9cc866; }
.fighter .badge-blind { color: #c7b9a0; }
.fighter .badge-stun { color: #e8b25a; }
.fighter .badge-shield { color: #86b2e6; }

.versus {
  color: var(--gold);
  font-size: 1.4rem;
  font-weight: 700;
}

/* ---- 전투 기록: 이번 합은 크게, 지난 합은 죽간처럼 접기 ---- */
.combat-log .log-now li {
  color: var(--text);
  font-size: 1.02rem;
}

.combat-log .log-now li:first-child {
  font-weight: 700;
}

.log-earlier {
  margin-top: 10px;
  border-top: 1px dashed rgba(201, 164, 92, 0.3);
  padding-top: 8px;
}

.log-earlier > summary {
  display: inline-block;
  padding: 4px 14px;
  cursor: pointer;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, #6b5536, #4f3d27);
  list-style: none;
}

.log-earlier > summary::-webkit-details-marker { display: none; }
.log-earlier > summary::before { content: "▸ "; }
.log-earlier[open] > summary::before { content: "▾ "; }

.log-earlier .log li:first-child {
  color: var(--muted);
}

.log-earlier .log-round {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

/* ---- 승패 띠: 붓으로 한 번에 그은 먹 띠 ---- */
.result-band {
  position: relative;
  padding: 16px 10px;
  border: 0;
  border-radius: 0;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 5px),
    var(--band, #8a2418);
  clip-path: polygon(2% 12%, 30% 0, 70% 6%, 99% 0, 97% 50%, 100% 92%, 66% 100%, 34% 94%, 0 100%, 3% 55%);
  animation: band-stroke 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transform-origin: left center;
}

.result-band.result-win { --band: linear-gradient(90deg, #9a2418, #c23a2b 55%, #9a2418); }
.result-band.result-lose { --band: linear-gradient(90deg, #1d1712, #3a2e24 55%, #1d1712); }
.result-band.result-draw { --band: linear-gradient(90deg, #4a4034, #6b5d4a 55%, #4a4034); }

.result-band-text {
  display: block;
  color: #fff3e6;
  font-size: 1.9rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  animation: band-text 0.4s ease-out 0.35s both;
}

.result-band.result-lose .result-band-text { color: #e27a6a; }

@keyframes band-stroke {
  from { scale: 0 1; opacity: 0.4; }
  to { scale: 1 1; opacity: 1; }
}

@keyframes band-text {
  from { opacity: 0; scale: 1.3; }
  to { opacity: 1; scale: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .arena-scroll,
  .result-band,
  .result-band-text {
    animation: none;
  }
}

@media (max-width: 600px) {
  .arena-scroll {
    margin: 30px 8px 12px;
    padding: 16px 8px 10px;
  }
  .scroll-top::before { width: 120px; }
}

/* ============================================================
   8. 저자 탭 (DESIGN-UI.md 8번)
   대장간은 벽 걸이, 약방은 약장 서랍, 행낭은 펼친 보따리.
   장비 등급은 선의 수로: 범품 흐린 한 줄 / 양품 금 한 줄 / 명품 금 두 줄 / 신병 금 두 줄 + 꺾쇠.
   ============================================================ */

/* 등급 글자 (어두운 바탕에 맞춘 색) */
.gear-name.tier-common .gear-tier { color: #b8aa90; }
.gear-name.tier-fine .gear-tier { color: #86b2e6; }
.gear-name.tier-master .gear-tier { color: #e8c070; }
.gear-name.tier-divine .gear-tier { color: #fff3e6; background: var(--accent); border-color: var(--accent); }

/* 장비 칸·가진 장비: 왼쪽 선의 수로 등급 */
.inv-item.tier-common,
.inv-item.tier-fine,
.inv-item.tier-master,
.inv-item.tier-divine {
  padding-left: 10px;
}
.inv-item.tier-common { border-left: 1px solid rgba(201, 164, 92, 0.35); }
.inv-item.tier-fine { border-left: 2px solid var(--gold); }
.inv-item.tier-master { border-left: 5px double var(--gold); }
.inv-item.tier-divine { border-left: 5px double #f0d99a; box-shadow: -6px 0 12px -6px rgba(194, 58, 43, 0.7); }

/* 견주기: 오르면 금색 ▲, 내리면 흐린 ▽ */
.gear-compare {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
}
.gear-compare .is-up { color: var(--gold); font-weight: 700; }
.gear-compare .is-down { color: var(--muted); opacity: 0.75; }

/* 값 꼬리표: 은전 한 닢 + 값 */
.price-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
}
.price-coin {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4f1ea, #b9b4a8 60%, #85806f);
  color: #3a352c;
  font-size: 0.62rem;
  font-weight: 700;
}
.price-was {
  color: var(--muted);
  font-size: 0.78rem;
}

/* 살 수 없는 것: 흐리게, 까닭은 붉게 */
.ware.is-locked,
.drawer.is-locked {
  opacity: 0.6;
  filter: saturate(0.5);
}
.ware.is-locked .ware-buy,
.drawer.is-locked .drawer-buy {
  color: #e8705e;
  opacity: 1;
}
.ware.is-owned {
  opacity: 0.55;
}

/* ---- 대장간: 벽 걸이 ---- */
.rack {
  position: relative;
  margin-top: 14px;
  padding: 32px 10px 10px;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #3e3023, #33271c);
  border: 1px solid #2a1f15;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}
/* 걸이 막대와 놋쇠 못 */
.rack::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 18px;
  height: 5px;
  border-radius: 3px;
  background:
    radial-gradient(circle, #f0d99a 0 2px, transparent 2.5px) 0 50% / 40px 5px repeat-x,
    linear-gradient(180deg, #7a5b39, #4a3522);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}
.rack-name {
  position: absolute;
  top: -10px;
  left: 12px;
  margin: 0;
  padding: 1px 10px;
  background: #1f1912;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.15em;
}
.list.rack-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}
.ware {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 10px;
  background: linear-gradient(180deg, rgba(40, 31, 23, 0.95), rgba(30, 23, 17, 0.95));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}
/* 걸이 끈: 막대에서 내려온 짧은 줄 */
.ware::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -12px;
  width: 1px;
  height: 12px;
  background: var(--gold-dim);
}
.ware.tier-common { border: 1px solid rgba(201, 164, 92, 0.3); }
.ware.tier-fine { border: 1px solid var(--gold); }
.ware.tier-master { border: 4px double var(--gold); }
.ware.tier-divine {
  border: 4px double #f0d99a;
  box-shadow: 0 0 14px rgba(194, 58, 43, 0.45), 0 4px 10px rgba(0, 0, 0, 0.45);
}
.ware.tier-divine::after {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  background:
    linear-gradient(#f0d99a, #f0d99a) 0 0 / 10px 2px no-repeat,
    linear-gradient(#f0d99a, #f0d99a) 0 0 / 2px 10px no-repeat,
    linear-gradient(#f0d99a, #f0d99a) 100% 100% / 10px 2px no-repeat,
    linear-gradient(#f0d99a, #f0d99a) 100% 100% / 2px 10px no-repeat;
}
.ware-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.ware-head {
  flex-wrap: wrap;
}
.ware-head .gear-name {
  min-width: 0;
  word-break: keep-all;
}
.ware-head .price-tag {
  margin-left: auto;
}
.ware-buy,
.drawer-buy {
  margin-top: 4px;
  align-self: stretch;
}

/* ---- 약방: 약장 서랍 ---- */
.list.drawers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  margin-top: 12px;
  padding: 8px;
  background: #2a1d12;
  border: 1px solid #1a120b;
  box-shadow: inset 0 0 0 3px #3a2918;
}
.drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 10px 10px;
  background: linear-gradient(180deg, #5b412a, #47321f);
  border: 1px solid #1f160d;
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.12), inset 0 -2px 4px rgba(0, 0, 0, 0.35);
}
/* 놋쇠 손잡이 */
.drawer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  width: 18px;
  height: 8px;
  translate: -50% 0;
  border: 2px solid #c9a45c;
  border-top: 0;
  border-radius: 0 0 10px 10px;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
/* 서랍의 종이 이름표 */
.drawer-label {
  padding: 1px 8px;
  background: #e9dcbc;
  color: #2a251f;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.drawer .skill-meta {
  color: #d8c9aa;
}
.drawer-have {
  font-size: 0.78rem;
  color: var(--gold);
}

/* ---- 행낭: 펼친 보따리 ---- */
.list.bundle {
  margin-top: 10px;
  padding: 12px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 12px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 12px),
    radial-gradient(ellipse at 50% 40%, #3b4458, #262c3a 80%);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.5);
}
.bundle .inv-item + .inv-item {
  border-top-color: rgba(255, 255, 255, 0.08);
}
.bundle .skill-meta {
  color: #c9c3b4;
}
.item-count {
  color: var(--gold);
  font-weight: 400;
}

/* ============================================================
   9. 비무 탭 (DESIGN-UI.md 9번)
   연무장: 나와 이번 상대를 크게 마주 세운다 · 승급 조건은 등롱 · 다 켜지면 "昇" 낙관
   ============================================================ */

/* ---- 마주 서기 ---- */
.spar-faceoff {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 8px;
  margin-top: 6px;
}
.faceoff-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.faceoff-fig {
  width: min(100%, 150px);
  aspect-ratio: 2 / 3;
}
.faceoff-fig img,
.faceoff-fig svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.faceoff-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  word-break: keep-all;
  text-align: center;
}
.faceoff-side.is-foe .faceoff-name {
  color: #e27a6a;
}
.faceoff-name .fighter-first {
  margin-left: 0;
  width: 22px;
  height: 22px;
  font-size: 0.75rem;
}
.faceoff-vs {
  align-self: center;
  padding-bottom: 30px;
  color: var(--gold);
  font-size: 1.9rem;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(201, 164, 92, 0.35);
}

/* 견주는 줄: 내 수 · 이름 · 상대 수 */
.faceoff-stats {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  padding: 8px 10px;
  border-top: 1px solid rgba(201, 164, 92, 0.25);
  border-bottom: 1px solid rgba(201, 164, 92, 0.25);
}
.faceoff-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 12px;
}
.faceoff-row .faceoff-num:first-child { text-align: right; }
.faceoff-label {
  min-width: 3.5em;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
}
.faceoff-num {
  color: var(--text);
  font-size: 1.05rem;
}
.faceoff-num.is-higher {
  color: var(--gold);
  font-weight: 700;
}
.faceoff-note {
  margin: 8px 0 4px;
  text-align: center;
}

/* ---- 다음 경지: 구름무늬 ---- */
.advance-panel {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cg fill='none' stroke='%23c9a45c' stroke-width='1.4' stroke-linecap='round' opacity='0.22'%3E%3Cpath d='M8 44 q0-14 14-14 q2-12 16-10 q8-12 22-4 q14-6 20 8 q14 0 14 14'/%3E%3Cpath d='M30 30 q6 0 6 6 q0 5-5 5'/%3E%3Cpath d='M58 20 q8 0 8 8 q0 6-6 6'/%3E%3Cpath d='M86 32 q5 1 4 6'/%3E%3Cpath d='M4 52 h110'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px top 40px;
  background-size: 120px 60px;
}

/* ---- 승급 조건 등롱 ---- */
.adv-lanterns {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 4px 0 0;
  padding: 18px 0 0;
  list-style: none;
}
.adv-lantern {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 92px;
}
/* 매단 줄 */
.adv-lantern::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  width: 1px;
  height: 14px;
  background: var(--gold-dim);
}
.lantern-body {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 48px;
  border-radius: 46% / 40%;
  border: 1px solid #6b5a41;
  background: linear-gradient(90deg, #2e231a, #45362a 50%, #2e231a);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.15);
}
/* 위아래 나무 테 */
.lantern-body::before,
.lantern-body::after {
  content: "";
  position: absolute;
  left: 50%;
  translate: -50% 0;
  width: 22px;
  height: 5px;
  border-radius: 1px;
  background: #241a12;
  border: 1px solid #6b5a41;
}
.lantern-body::before { top: -4px; }
.lantern-body::after { bottom: -4px; }
.lantern-mark {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}
.adv-lantern.is-lit .lantern-body {
  border-color: #f0b060;
  background: radial-gradient(circle at 50% 45%, #ffe6a8 0%, #f2a24a 45%, #b23a1e 100%);
  box-shadow: 0 0 18px rgba(255, 170, 80, 0.55), 0 0 40px rgba(255, 120, 40, 0.2);
  animation: lantern-flicker 3.2s ease-in-out infinite;
}
.adv-lantern.is-lit .lantern-mark {
  color: #7a1d10;
}
@keyframes lantern-flicker {
  0%, 100% { filter: brightness(1); }
  45% { filter: brightness(1.08); }
  60% { filter: brightness(0.95); }
}
.lantern-label {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.lantern-value {
  font-size: 0.95rem;
  color: var(--text);
}
.adv-lantern.is-lit .lantern-value {
  color: var(--gold);
}
.lantern-bar {
  display: block;
  width: 80px;
  height: 4px;
  background: var(--bar-track);
  border-radius: 2px;
  overflow: hidden;
}
.lantern-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transform-origin: left center;
  scale: var(--fill, 0) 1;
}

/* ---- 다 켜지면 승급 단추에 붉은 낙관 ---- */
.btn-advance {
  position: relative;
}
.btn-advance:has(.advance-stamp) {
  padding-right: 64px;
  padding-left: 64px;
}
.advance-stamp {
  position: absolute;
  right: 12px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  translate: 0 -50%;
  rotate: -8deg;
  border: 2px solid #fff3e6;
  border-radius: 4px;
  background: #8a1f14;
  color: #fff3e6;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  animation: advance-stamp 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) 0.2s both;
}
@keyframes advance-stamp {
  from { scale: 1.8; opacity: 0; }
  to { scale: 1; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .adv-lantern.is-lit .lantern-body,
  .advance-stamp {
    animation: none;
  }
}

@media (max-width: 600px) {
  .faceoff-fig { width: min(100%, 120px); }
  .faceoff-vs { font-size: 1.5rem; }
  .adv-lanterns { gap: 18px; }
}

/* ============================================================
   10. 인연 탭과 숙적 (DESIGN-UI.md 10번)
   초상 족자 + 세로 이름패 · 인연은 붉은 실(친밀도가 오르면 굵어진다) · 숙적은 검붉은 기운과 팽팽한 실
   ============================================================ */

.npc-card,
.rival-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}
.npc-card {
  padding: 12px;
  border: 1px solid rgba(201, 164, 92, 0.22);
  border-left: 3px solid rgba(201, 164, 92, 0.35);
  border-radius: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.04));
}
.npc-card.is-ready {
  border-color: rgba(194, 58, 43, 0.6);
  border-left-color: var(--accent);
  box-shadow: 0 0 16px rgba(194, 58, 43, 0.12);
}
.npc-portrait,
.rival-portrait {
  width: 84px;
  aspect-ratio: 2 / 3;
  align-self: center;
}

/* 세로 이름패: 검은 옻칠 판에 금 글자 */
.npc-plate {
  align-self: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  padding: 10px 4px;
  min-height: 84px;
  background: linear-gradient(90deg, #1b1510, #2a2018 50%, #1b1510);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.npc-body,
.rival-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
.npc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.npc-title {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}
.npc-tier {
  border-color: rgba(226, 122, 106, 0.7);
  color: #e88e7e;
  border-radius: 2px;
}
.npc-skill { color: var(--text); }
.npc-skill.is-taught { color: var(--gold); }

/* ---- 인연의 붉은 실 ---- */
.bond {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.bond-label {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.bond-thread {
  position: relative;
  height: 12px;
}
/* 아직 닿지 않은 쪽: 흐린 점선 */
.bond-thread::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed rgba(226, 122, 106, 0.3);
}
/* 이어진 쪽: 붉은 실. 친밀도에 따라 길이와 굵기가 함께 는다 */
.bond-thread i {
  position: absolute;
  left: 0;
  top: 50%;
  width: calc(var(--aff, 0) * 100%);
  height: calc(1.5px + var(--aff, 0) * 3.5px);
  translate: 0 -50%;
  border-radius: 3px;
  background: linear-gradient(90deg, #8a1f14, #d2402c);
  box-shadow: 0 0 6px rgba(210, 64, 44, calc(0.2 + var(--aff, 0) * 0.4));
}
/* 실 끝의 매듭 */
.bond-thread i::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  translate: 0 -50%;
  rotate: 45deg;
  background: #d2402c;
}
.bond-value {
  color: var(--text);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ---- 숙적 ---- */
.rival-panel.is-met {
  border-color: rgba(138, 31, 20, 0.7);
  background:
    radial-gradient(ellipse at 15% 50%, rgba(138, 31, 20, 0.28), transparent 60%),
    var(--panel);
}
.rival-panel .rival-portrait {
  width: 96px;
}
.rival-panel.is-met .rival-portrait {
  box-shadow: 0 0 0 1px #8a1f14, 0 0 22px rgba(194, 58, 43, 0.55);
}
/* 아직 못 만났으면 그림자만 */
.rival-panel:not(.is-met) .rival-portrait img,
.rival-panel:not(.is-met) .rival-portrait svg {
  filter: brightness(0) opacity(0.45);
}
.rival-plate {
  border-color: #8a1f14;
  color: #e8705e;
  background: linear-gradient(90deg, #1a0d0a, #2e1410 50%, #1a0d0a);
}
.rival-panel.is-met .npc-name {
  color: #e8705e;
}
/* 팽팽한 검붉은 실: 끝에서 끝까지 곧게 */
.rival-thread {
  display: block;
  height: 3px;
  margin: 4px 0;
  background: linear-gradient(90deg, #3a0c08, #a32a1c 50%, #3a0c08);
  box-shadow: 0 0 8px rgba(163, 42, 28, 0.6);
}
.rival-panel:not(.is-met) .rival-thread {
  height: 1px;
  background: none;
  border-top: 1px dashed rgba(226, 122, 106, 0.35);
  box-shadow: none;
}
.rival-record {
  display: flex;
  gap: 8px;
}
.rival-seal {
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 0.85rem;
  font-weight: 700;
}
.rival-seal.is-win {
  background: var(--accent);
  color: #fff3e6;
}
.rival-seal.is-lose {
  border: 1px solid rgba(201, 164, 92, 0.5);
  color: var(--muted);
}

@media (max-width: 600px) {
  .npc-portrait { width: 70px; }
  .rival-panel .rival-portrait { width: 80px; }
}

/* ============================================================
   11. 강호 탭 (DESIGN-UI.md 11번)
   의뢰는 나무 게시판에 붙은 방(榜) · 급마다 도장 색 · 끝내면 붉은 "完"
   나의 이야기는 책장 · 강호 기록은 죽간
   ============================================================ */

/* ---- 게시판: 물결과 벼랑 무늬 머리띠 + 나무판 ---- */
.quest-panel .section-title {
  position: relative;
}
.quest-list {
  position: relative;
  gap: 16px;
  margin-top: 10px;
  padding: 26px 14px 16px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 14'%3E%3Cpath d='M0 10 q10-8 20 0 t20 0 t20 0 t20 0' fill='none' stroke='%23c9a45c' stroke-width='1.2' opacity='0.45'/%3E%3Cpath d='M0 13 q10-6 20 0 t20 0 t20 0 t20 0' fill='none' stroke='%23c9a45c' stroke-width='0.8' opacity='0.25'/%3E%3C/svg%3E") 0 4px / 80px 14px repeat-x,
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 64px),
    linear-gradient(180deg, #4a3826, #3b2c1d);
  border: 1px solid #241a11;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.45);
}
/* 벼랑: 머리띠 양 끝의 깎아지른 바위 */
.quest-list::before,
.quest-list::after {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 20px;
  background: #2a1f15;
  pointer-events: none;
}
.quest-list::before { left: 0; clip-path: polygon(0 0, 100% 0, 60% 40%, 75% 60%, 30% 100%, 0 100%); }
.quest-list::after { right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 70% 100%, 25% 60%, 40% 40%); }

/* ---- 방(榜): 종이에 먹 글씨, 위 두 귀를 못으로 박음 ---- */
.quest-card {
  --text: #2a251f;
  --accent-ink: #9e2b1e;
  --danger: #a3271a;
  --muted: #6f6556;
  --ink: #2a251f;
  position: relative;
  gap: 4px;
  padding: 16px 16px 12px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.35), transparent 55%),
    linear-gradient(180deg, #efe4c8, #e2d4b0);
  color: #2a251f;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(140, 110, 60, 0.18);
  rotate: -0.4deg;
}
.quest-card:nth-child(even) { rotate: 0.5deg; }
/* 못 두 개 */
.quest-card::before,
.quest-card::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c9b68a, #4a3a22);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}
.quest-card::before { left: 8px; }
.quest-card::after { right: 8px; }
.quest-card .skill-name { color: #1f1b16; font-size: 1.02rem; }
.quest-card .skill-desc { color: #3a3329; }
.quest-card .skill-meta { color: #6f6556; }
.quest-card .quest-reward { color: #7a1d10; }
.quest-head {
  padding-right: 54px;
}
.quest-type {
  border-color: #9e2b1e;
  color: #9e2b1e;
}
.quest-type.type-심부름 {
  border-color: #6f6556;
  color: #6f6556;
}
.quest-card .btn-small {
  background: #3a2c1f;
  color: #f0e7d3;
  border-color: #2a1f15;
}
.quest-card .btn-small:disabled {
  background: transparent;
  color: #6f6556;
  border-color: rgba(111, 101, 86, 0.5);
}

/* 급 낙관: 흰 바탕 색 글자(꼬리표). 급이 오를수록 도장 색이 짙어진다 */
.quest-seal {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--seal);
  border-radius: 3px;
  background: #fbf6ea;
  color: var(--seal);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  writing-mode: vertical-rl;
  rotate: 6deg;
}
.quest-card.g1 { --seal: #7a6a55; }
.quest-card.g2 { --seal: #a3271a; }
.quest-card.g3 { --seal: #2e5a8a; }
.quest-card.g4 { --seal: #6b2a7a; }
.quest-card.g5 { --seal: #9a7420; }
.quest-card.g5 .quest-seal {
  background: #2a1f15;
  color: #f0d99a;
  border-color: #f0d99a;
  box-shadow: 0 0 10px rgba(240, 217, 154, 0.5);
}

/* 끝낸 의뢰: 종이는 바래고 붉은 바탕 흰 글자 "完"(확정) */
.quest-card.is-done {
  opacity: 1;
  filter: saturate(0.6) brightness(0.85);
}
.quest-done-seal {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  translate: -50% -50%;
  rotate: -12deg;
  border-radius: 6px;
  background: rgba(163, 39, 26, 0.88);
  color: #fff3e6;
  font-size: 2rem;
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(163, 39, 26, 0.35);
  pointer-events: none;
}

/* ---- 나의 이야기: 펼친 책장 ---- */
.story-book .chapter-item {
  border-left: 0;
  padding: 12px 14px 12px 22px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 10px, rgba(201, 164, 92, 0.25) 10px 11px, transparent 11px),
    linear-gradient(180deg, rgba(240, 231, 211, 0.06), rgba(240, 231, 211, 0.02));
  border: 1px solid rgba(201, 164, 92, 0.2);
}
.story-book .chapter-item summary {
  color: var(--gold);
}
.story-book .chapter-item[open] .chapter-text {
  animation: page-turn 0.35s ease-out both;
  transform-origin: left center;
}
@keyframes page-turn {
  from { opacity: 0; transform: perspective(600px) rotateY(-18deg); }
  to { opacity: 1; transform: none; }
}

/* ---- 강호 기록: 죽간 ---- */
.list.bamboo {
  position: relative;
  margin-top: 8px;
  padding: 6px 0;
  list-style: none;
}
/* 대쪽을 엮은 두 줄 끈 */
.list.bamboo::before,
.list.bamboo::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(120, 70, 30, 0.75);
  z-index: 1;
  pointer-events: none;
}
.list.bamboo::before { left: 14px; }
.list.bamboo::after { right: 14px; }
.list.bamboo li {
  position: relative;
  margin: 0 0 3px;
  padding: 6px 26px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 40%, rgba(0, 0, 0, 0.08)),
    linear-gradient(90deg, #cdb98a, #dcc99a 50%, #c8b383);
  color: #2a251f;
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.list.bamboo li + li {
  border-top: 0;
  padding-top: 6px;
}
.list.bamboo li:first-child {
  font-weight: 700;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent 40%, rgba(0, 0, 0, 0.06)),
    linear-gradient(90deg, #dccaa0, #ead9ae 50%, #d6c294);
}

@media (prefers-reduced-motion: reduce) {
  .story-book .chapter-item[open] .chapter-text { animation: none; }
}

@media (max-width: 600px) {
  .quest-list { padding: 24px 8px 12px; }
  .quest-card, .quest-card:nth-child(even) { rotate: 0deg; }
}

/* 11번 손질: 급 낙관이 설명 글을 가리지 않게 · 긴 칸 제목 옆 한자가 세로로 깨지지 않게 */
.quest-card .skill-desc {
  padding-right: 46px;
}
.section-hanja {
  white-space: nowrap;
  flex: none;
}
@media (max-width: 600px) {
  .quest-panel .section-hanja { display: none; }
}

.quest-card .skill-name {
  word-break: keep-all;
}

/* ============================================================
   12. 강호 견문록 (DESIGN-UI.md 12번)
   실로 꿰맨 고서: 누런 종이에 먹 글씨, 갈래는 비단 책갈피, 항목은 칸 없이 여백과 금선 하나
   ============================================================ */

.codex-sheet {
  --text: #2a251f;
  --accent-ink: #9e2b1e;
  --danger: #a3271a;
  --muted: #6f6556;
  --border: rgba(111, 90, 60, 0.35);
  --ink: #2a251f;
  position: relative;
  color: #2a251f;
  background-color: #e9dcbc;
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.35), transparent 60%),
    radial-gradient(ellipse at 80% 90%, rgba(150, 110, 50, 0.18), transparent 55%),
    repeating-linear-gradient(0deg, rgba(120, 90, 50, 0.04) 0 1px, transparent 1px 4px);
  border-top: 4px solid #3a2a1c;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 60px rgba(140, 100, 40, 0.18);
}

/* 책등: 남색 표지 띠와 꿰맨 실 구멍 넷 (넓은 화면에서만) */
.codex-spine {
  display: none;
}
@media (min-width: 960px) {
  .codex-sheet {
    padding-left: 58px;
  }
  .codex-spine {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background:
      radial-gradient(circle, #e9dcbc 0 3px, transparent 3.5px) 50% 12% / 100% 25% repeat-y,
      linear-gradient(90deg, #1d2534, #2b3549 60%, #1d2534);
    border-right: 1px solid #10151f;
  }
  /* 실: 구멍에서 가장자리로 감긴 줄 */
  .codex-spine::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(180deg, transparent 0 calc(12.5% - 1px), rgba(233, 220, 188, 0.7) calc(12.5% - 1px) 12.5%, transparent 12.5% 25%);
    -webkit-mask: linear-gradient(90deg, transparent 50%, #000 50%);
    mask: linear-gradient(90deg, transparent 50%, #000 50%);
  }
}

/* 제목: 붙인 종이 이름표(題簽) */
.codex-title {
  flex: 0 1 auto;
  padding: 4px 14px;
  background: #f6efdc;
  border: 1px solid #8a7243;
  box-shadow: inset 0 0 0 3px #f6efdc, inset 0 0 0 4px rgba(138, 114, 67, 0.6);
}
.codex-head {
  justify-content: flex-start;
}
.codex-close {
  margin-left: auto;
  border-color: rgba(42, 37, 31, 0.4);
  color: #2a251f;
}
.codex-title-main { color: #1f1b16; }
.codex-title-sub { color: #6f6556; }
.codex-search {
  background: rgba(255, 252, 242, 0.65);
  border-color: rgba(111, 90, 60, 0.45);
  color: #2a251f;
}
.codex-search::placeholder { color: #8a7d68; }

/* ---- 갈래: 위에서 드리운 비단 책갈피 ---- */
.codex-tabs {
  gap: 4px;
  padding-top: 0;
  align-items: flex-start;
}
.codex-tab {
  flex-direction: column;
  gap: 2px;
  min-width: 58px;
  padding: 8px 8px 14px;
  border: 0;
  border-radius: 0;
  background: var(--silk, #7a2a20);
  color: #f6efdc;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 8px), 0 100%);
  opacity: 0.72;
  transition: padding 0.15s ease, opacity 0.15s ease;
}
.codex-tab:nth-child(7n+1) { --silk: #7a2a20; }
.codex-tab:nth-child(7n+2) { --silk: #2b4a6b; }
.codex-tab:nth-child(7n+3) { --silk: #3d5a3a; }
.codex-tab:nth-child(7n+4) { --silk: #6b4a1e; }
.codex-tab:nth-child(7n+5) { --silk: #4a2b5a; }
.codex-tab:nth-child(7n+6) { --silk: #2a4d4a; }
.codex-tab:nth-child(7n+7) { --silk: #5a2a3a; }
.codex-tab-hanja {
  font-size: 1.05rem;
}
.codex-tab:hover { opacity: 0.9; }
/* 지금 펼친 갈래: 책갈피가 길게 내려온다 */
.codex-tab.is-active {
  opacity: 1;
  padding-bottom: 24px;
  background: var(--silk, #7a2a20);
  color: #fff8e6;
  box-shadow: none;
}

/* ---- 항목: 칸 없이 여백과 금선 하나 ---- */
.codex-body {
  border-top: 1px solid rgba(138, 114, 67, 0.5);
}
.codex-list {
  gap: 0;
}
.codex-entry {
  gap: 6px;
  padding: 16px 6px 18px;
  border: 0;
  border-bottom: 1px solid rgba(160, 128, 64, 0.55);
  border-radius: 0;
  background: none;
}
.codex-term {
  border-bottom: 0;
  padding-bottom: 2px;
}
.codex-term-name {
  color: #1f1b16;
  font-size: 1.2rem;
}
.codex-term-name::first-letter {
  color: #7a1d10;
  font-size: 1.3em;
}
.codex-term-hanja { color: #8a7243; }
/* 붉은 주석(朱批)처럼 작은 붉은 글자, 칸 없이 */
.codex-label {
  border: 0;
  padding: 0;
  color: #9e2b1e;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: left;
  letter-spacing: 0.05em;
}
.codex-text { color: #2a251f; }

/* 마도·사도 낱말: 머리글자가 기울고 번진다 */
.codex-entry.is-dark .codex-term-name {
  display: inline-block;
  transform: skewX(-10deg);
  text-shadow: 0 0 3px rgba(122, 29, 16, 0.55), 1px 1px 6px rgba(42, 37, 31, 0.5);
}
.codex-entry.is-dark .codex-term-hanja {
  color: #7a1d10;
}

/* 넓은 화면 두 단: 가운데에 세로 금선 하나 */
@media (min-width: 960px) {
  .codex-list {
    column-gap: 28px;
    background: linear-gradient(rgba(160, 128, 64, 0.4), rgba(160, 128, 64, 0.4)) 50% 0 / 1px 100% no-repeat;
  }
}

/* ============================================================
   13. 장면·승급·끝 화면 (DESIGN-UI.md 13번): 큰 한자와 낙관으로 한 장의 그림처럼
   ============================================================ */

/* ---- 수련 장면: 걸린 족자 한 장. 종이에 먹 한자, 붉은 낙관 이름 ---- */
.scene-card {
  --text: #2a251f;
  --accent-ink: #9e2b1e;
  --danger: #a3271a;
  --muted: #6f6556;
  --accent: #9e2b1e;
  position: relative;
  padding: 30px 30px 24px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(180deg, #efe4c8, #e2d4b0);
  color: #2a251f;
  box-shadow: 0 0 0 10px #4a3826, 0 0 0 11px #2a1f15, 0 24px 50px rgba(0, 0, 0, 0.7);
}
/* 위 막대·아래 굴대 */
.scene-card::before,
.scene-card::after {
  content: "";
  position: absolute;
  left: -20px;
  right: -20px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(180deg, #8a6a43, #4a3522 60%, #2a1d12);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}
.scene-card::before { top: -16px; }
.scene-card::after { bottom: -16px; height: 15px; }
.scene-time { color: #6f6556; }
.scene-seal {
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: 5.2rem;
  color: #1f1b16;
  background: none;
  box-shadow: none;
  text-shadow: 2px 2px 0 rgba(31, 27, 22, 0.12);
}
/* 이름: 붉은 바탕 흰 글자 낙관 */
.scene-title {
  display: inline-block;
  padding: 3px 10px 3px 14px;
  background: #9e2b1e;
  color: #fff3e6;
  letter-spacing: 0.35em;
  rotate: -2deg;
}
.scene-line { color: #2a251f; }
.scene-gain { color: #7a1d10; }
.scene-extra { color: #6f6556; }
.scene-skip { color: #8a7d68; }

/* ---- 승급: 큰 경지 한자가 번지며 금테 안에 ---- */
.advance-screen {
  align-items: center;
  text-align: center;
}
.advance-screen > .panel,
.advance-screen > .btn {
  align-self: stretch;
  text-align: left;
}
.advance-reveal {
  --ink-fill: #1f1b16;
  position: relative;
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  margin: 10px auto 0;
}
.advance-hanja {
  position: relative;
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: 4.2rem;
  line-height: 1.05;
  color: #f0e7d3;
  width: 1.05em;
  text-align: center;
  word-break: break-all;
  animation: ink-bloom 0.9s ease-out 0.5s both;
}
.advance-frame {
  position: absolute;
  inset: -10px;
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 4px transparent, inset 0 0 0 5px rgba(201, 164, 92, 0.6);
  animation: frame-in 0.6s ease-out 1.1s both;
  pointer-events: none;
}
@keyframes frame-in {
  from { opacity: 0; scale: 1.15; }
  to { opacity: 1; scale: 1; }
}
/* 화경부터: 금테가 한 귀퉁이부터 스르르 풀려 사라진다 */
.advance-screen.is-transcend .advance-frame {
  animation: frame-in 0.6s ease-out 1.1s both, frame-unravel 1.6s ease-in 2.2s forwards;
}
@keyframes frame-unravel {
  0% { clip-path: inset(0 0 0 0); opacity: 1; }
  100% { clip-path: inset(0 0 0 100%); opacity: 0; }
}
.advance-screen.is-transcend .advance-hanja {
  text-shadow: 0 0 18px rgba(240, 217, 154, 0.55);
}

/* ---- 끝 화면: 한 장의 그림 ---- */
.ending {
  align-items: center;
}
.ending > .panel,
.ending > .btn,
.ending > .notice {
  align-self: stretch;
}
.end-picture {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 22px;
  padding: 22px 26px;
  background: linear-gradient(180deg, #efe4c8, #e2d4b0);
  box-shadow: 0 0 0 8px #3a2a1c, 0 0 0 9px var(--gold-dim), 0 18px 40px rgba(0, 0, 0, 0.6);
}
.end-picture .portrait-lg {
  width: 180px;
  position: relative;
  overflow: hidden;
}
/* 세로쓰기 한 줄 평: 오른쪽부터 읽는다 */
.epitaph-vertical {
  display: flex;
  flex-direction: row-reverse;
  gap: 10px;
  align-self: center;
  max-height: 340px;
}
.epitaph-col {
  writing-mode: vertical-rl;
  color: #2a251f;
  font-size: 1.05rem;
  line-height: 1.5;
  letter-spacing: 0.12em;
  animation: brush-down 0.9s ease-out calc(0.3s + var(--i, 0) * 0.45s) both;
}
.epitaph-col:first-child { font-weight: 700; }
@keyframes brush-down {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* 죽음: 그림이 아래에서부터 먹에 잠긴다 (태어남의 번짐을 거꾸로) */
.death .end-picture .portrait-lg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #14100c 0%, #14100c 55%, rgba(20, 16, 12, 0.6) 75%, transparent 100%);
  translate: 0 100%;
  animation: ink-sink 2.6s cubic-bezier(0.4, 0, 0.2, 1) 0.6s forwards;
  pointer-events: none;
}
.death.is-demon .end-picture .portrait-lg::after {
  background: linear-gradient(0deg, #2a0805 0%, #14100c 50%, rgba(74, 15, 10, 0.6) 75%, transparent 100%);
}
@keyframes ink-sink {
  to { translate: 0 62%; }
}
.death.is-age .end-picture .portrait-lg img {
  filter: grayscale(1) contrast(0.9);
}

/* 낙관 셋: 이름(흰 바탕 붉은 글자) → 한 줄 평 두 글자(붉은 바탕 흰 글자) → 문파(둥근 도장) */
.end-seals {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 6px 0 4px;
}
.end-seal {
  display: grid;
  place-items: center;
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-weight: 700;
  line-height: 1;
  animation: seal-thud 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) var(--d, 0s) both;
}
.seal-name {
  min-width: 52px;
  min-height: 64px;
  padding: 6px;
  writing-mode: vertical-rl;
  border: 3px solid #b3301f;
  border-radius: 3px;
  background: #fbf3e6;
  color: #b3301f;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  rotate: -4deg;
}
.seal-verdict {
  min-width: 64px;
  min-height: 64px;
  padding: 6px;
  writing-mode: vertical-rl;
  border-radius: 4px;
  background: #b3301f;
  color: #fff3e6;
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  box-shadow: inset 0 0 0 2px rgba(255, 243, 230, 0.35);
}
.seal-sect {
  width: 54px;
  height: 54px;
  border: 3px double #b3301f;
  border-radius: 50%;
  color: #e8705e;
  font-size: 1.6rem;
  rotate: 6deg;
}
@keyframes seal-thud {
  0% { scale: 2; opacity: 0; }
  60% { scale: 0.92; opacity: 1; }
  100% { scale: 1; opacity: 1; }
}

/* ---- 출신이 주는 것: 한 줄씩 붓으로 써 내려가듯 ---- */
.origin-screen .origin-base li {
  animation: brush-right 0.6s ease-out both;
}
.origin-screen .origin-base li:nth-child(1) { animation-delay: 1.1s; }
.origin-screen .origin-base li:nth-child(2) { animation-delay: 1.5s; }
.origin-screen .origin-base li:nth-child(3) { animation-delay: 1.9s; }
.origin-screen .origin-base li:nth-child(n+4) { animation-delay: 2.3s; }
@keyframes brush-right {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  .advance-hanja,
  .advance-frame,
  .epitaph-col,
  .end-seal,
  .origin-screen .origin-base li {
    animation: none !important;
  }
  .death .end-picture .portrait-lg::after {
    animation: none;
    translate: 0 62%;
  }
  .advance-screen.is-transcend .advance-frame { opacity: 0; }
}

@media (max-width: 600px) {
  .end-picture { gap: 14px; padding: 16px; }
  .end-picture .portrait-lg { width: 130px; }
  .epitaph-col { font-size: 0.92rem; }
  .epitaph-vertical { max-height: 280px; }
  .advance-hanja { font-size: 3.4rem; }
}

/* 끝 그림 안에서는 쓰러뜨리지 않고 서 있는 채로 먹에 잠긴다 */
.end-picture .figure.is-fallen svg,
.end-picture .figure.is-fallen img {
  transform: none;
  opacity: 1;
}

/* 수련 장면 족자 안의 먹색 (얻은 것 글자가 종이 위에서 흐려지지 않게) */
.scene-card {
  --ink: #2a251f;
}
.scene-card .scene-gain.is-good {
  color: #7a1d10;
}

/* ===== 14. 문파 대문과 특성 부적 (DESIGN-UI.md 14번) ===== */
/* 깃발 색: 바꾸려면 여기만 고친다 */
.gate-card { --flag: #9e2b1e; }
.gate-card[data-sect="hwasan"] { --flag: #b8404c; }
.gate-card[data-sect="namgung"] { --flag: #3f6f9e; }
.gate-card[data-sect="shaolin"] { --flag: #c98b26; }
.gate-card[data-sect="wudang"] { --flag: #4c8173; }
.gate-card[data-sect="cheonma"] { --flag: #7d1414; }

.gate-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 12px 0 18px;
}

.gate-card {
  --gw: 176px;
  position: relative;
  display: grid;
  grid-template-columns: var(--gw) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  width: 100%;
  padding: 16px 20px 16px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--flag);
  border-radius: 3px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--flag) 16%, transparent), transparent 46%),
    var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, translate 0.1s ease;
  animation: gate-rise 0.5s ease both;
  animation-delay: calc(var(--i, 0) * 0.08s);
}

@keyframes gate-rise {
  from { opacity: 0; translate: 0 10px; }
}

.gate-card:hover:not(:disabled),
.gate-card:focus-visible {
  border-color: var(--gold);
  border-left-color: var(--flag);
}

.gate-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.gate-card:active:not(:disabled) { translate: 0 2px; }

/* --- 대문 --- */
.gate {
  position: relative;
  display: block;
  width: var(--gw);
  height: calc(var(--gw) * 1.3);
  margin: 0 auto;
}

.gate-roof {
  position: absolute;
  inset: 4% -6% auto;
  height: 15%;
  background: linear-gradient(180deg, #2b2621, #15120f);
  clip-path: polygon(0 100%, 7% 30%, 22% 0, 78% 0, 93% 30%, 100% 100%, 88% 82%, 12% 82%);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.4));
}

.gate-plaque {
  position: absolute;
  z-index: 3;
  top: 15%;
  left: 50%;
  translate: -50% 0;
  display: grid;
  place-items: center;
  width: 30%;
  aspect-ratio: 1;
  border: 2px solid var(--gold);
  border-radius: 2px;
  background: linear-gradient(160deg, #3a1a12, #1c0d09);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), inset 0 0 0 2px #1c0d09, inset 0 0 0 3px var(--gold-dim);
  color: #e9c977;
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: calc(var(--gw) * 0.16);
  line-height: 1;
}

.gate-opening {
  --text: #2a251f;
  --accent-ink: #9e2b1e;
  --danger: #a3271a;
  --muted: #6f6556;
  --ink: #2a251f;
  position: absolute;
  inset: 22% 10% 7%;
  overflow: hidden;
  border: 5px solid #5a1c12;
  border-top-width: 7px;
  border-bottom: 0;
  background:
    radial-gradient(ellipse at 50% 85%, color-mix(in srgb, var(--flag) 18%, transparent), transparent 70%),
    var(--paper);
  box-shadow: inset 0 0 18px rgba(60, 40, 20, 0.35);
  perspective: 420px;
}

.gate-figure {
  position: absolute;
  inset: 12% 8% 0;
}

.gate-figure img,
.gate-figure svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
}

.gate-door {
  --door: #3a2216;
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, #c9a45c 0 1.4px, transparent 1.8px) 0 0 / 25% 16%,
    linear-gradient(90deg, rgba(0, 0, 0, 0.25), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.25)),
    var(--door);
  color: color-mix(in srgb, var(--gold) 80%, var(--flag));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
  transition: rotate 0.7s cubic-bezier(0.3, 0.7, 0.2, 1);
  backface-visibility: hidden;
}

.gate-door svg {
  width: 70%;
  height: auto;
  padding: 3px;
  border-radius: 50%;
  background: var(--door);
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.6));
}

.gate-door.is-left { left: 0; transform-origin: 0 50%; rotate: y -74deg; }
.gate-door.is-right { right: 0; transform-origin: 100% 50%; rotate: y 74deg; }

/* 화면이 열리면 문이 천천히 열린다 */
.gate-card:not(.is-locked) .gate-door { animation: gate-open 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) both; animation-delay: calc(0.25s + var(--i, 0) * 0.1s); }
@keyframes gate-open { from { rotate: y 0deg; } }

.gate-card:hover:not(:disabled) .gate-door.is-left,
.gate-card:focus-visible .gate-door.is-left { rotate: y -84deg; }
.gate-card:hover:not(:disabled) .gate-door.is-right,
.gate-card:focus-visible .gate-door.is-right { rotate: y 84deg; }

.gate-step {
  position: absolute;
  inset: auto 2% 2%;
  height: 6%;
  background: linear-gradient(180deg, #6b5a41, #3c3125);
  clip-path: polygon(4% 0, 96% 0, 100% 100%, 0 100%);
}

/* 깃발: 대문 오른쪽 장대에 달린 삼각기 */
.gate-flag {
  position: absolute;
  z-index: 4;
  top: -6%;
  right: 12%;
  width: 3px;
  height: 24%;
  background: #4a3a2a;
}

.gate-flag::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 3px;
  width: calc(var(--gw) * 0.2);
  height: calc(var(--gw) * 0.15);
  background: var(--flag);
  clip-path: polygon(0 0, 100% 18%, 78% 50%, 100% 82%, 0 100%);
  transform-origin: 0 50%;
  animation: flag-wave 2.6s ease-in-out infinite alternate;
}

@keyframes flag-wave {
  from { scale: 1 1; skew: 0 -3deg; }
  to { scale: 0.86 1; skew: 0 4deg; }
}

/* 닫힌 문: 문짝이 닫히고 빗장이 걸린다 */
.gate-card.is-locked {
  cursor: not-allowed;
  background: var(--panel);
  border-left-color: color-mix(in srgb, var(--flag) 45%, #3a332b);
}

.gate-card.is-locked .gate-door { rotate: y 0deg; }
.gate-card.is-locked .gate-flag::after {
  animation: none;
  filter: saturate(0.35) brightness(0.8);
  clip-path: polygon(0 0, 70% 40%, 50% 70%, 40% 100%, 0 100%);
}

.gate-bar {
  position: absolute;
  z-index: 3;
  top: 46%;
  left: -6%;
  right: -6%;
  height: 9%;
  border-radius: 2px;
  background: linear-gradient(180deg, #8a6440, #5a3d22 60%, #3a2614);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.5);
  rotate: -4deg;
}

.gate-bar::after {
  /* 빗장에 걸린 쪽지 */
  content: "닫힘";
  position: absolute;
  top: 90%;
  left: 50%;
  translate: -50% 0;
  padding: 3px 4px 6px;
  background: var(--paper);
  color: #8f2217;
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: calc(var(--gw) * 0.09);
  line-height: 1;
  rotate: 6deg;
  transform-origin: 50% 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* --- 글 --- */
.gate-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.gate-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}
.gate-desc {
  color: var(--text);
  line-height: 1.55;
  word-break: keep-all;
}

.gate-row {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: keep-all;
}

.gate-row b {
  flex: none;
  min-width: 4.6em;
  color: var(--gold);
  font-weight: 600;
}

.gate-ok {
  color: #9cc26a;
  font-size: 0.86rem;
  word-break: keep-all;
}

.gate-card.is-locked .gate-name,
.gate-card.is-locked .gate-desc { color: var(--muted); }

/* 빗장에 걸린 까닭: 종이 쪽지 */
.gate-tag {
  --text: #2a251f;
  --accent-ink: #9e2b1e;
  --danger: #a3271a;
  --muted: #6f6556;
  position: relative;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
  margin-top: 6px;
  padding: 8px 12px 9px 14px;
  border-left: 3px solid #8f2217;
  background: var(--paper);
  color: var(--text);
  rotate: -0.8deg;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.gate-tag-title { color: #8f2217; font-weight: 700; letter-spacing: 0.06em; }
.gate-tag-reason { font-size: 0.9rem; word-break: keep-all; }
.gate-tag-rule { font-size: 0.82rem; color: var(--muted); word-break: keep-all; }

@media (max-width: 560px) {
  .gate-card {
    --gw: 112px;
    gap: 14px;
    padding: 12px 12px 12px 10px;
    align-items: start;
  }
  .gate-name { font-size: 1.12rem; }
  .gate-row { flex-direction: column; gap: 0; }
  .gate-tag { rotate: 0deg; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-card, .gate-door, .gate-flag::after { animation: none !important; }
}

/* --- 특성: 노란 부적 --- */
.trait-grid { gap: 12px; }

.trait-card {
  --text: #2a251f;
  --accent-ink: #9e2b1e;
  --danger: #a3271a;
  position: relative;
  gap: 4px;
  padding: 14px 10px 12px;
  border: 0;
  border-radius: 1px;
  background:
    linear-gradient(180deg, rgba(143, 34, 23, 0.9) 0 4px, transparent 4px calc(100% - 4px), rgba(143, 34, 23, 0.9) calc(100% - 4px)),
    linear-gradient(170deg, #eadbaa, #d4bf80);
  color: #2a251f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: translate 0.12s ease, rotate 0.2s ease, box-shadow 0.2s ease;
}

.trait-card:nth-child(odd) { rotate: -0.6deg; }
.trait-card:nth-child(even) { rotate: 0.5deg; }

.trait-card:hover:not(:disabled),
.trait-card:focus-visible {
  rotate: 0deg;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55), 0 0 0 2px var(--gold);
}

.trait-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.trait-hanja {
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: 1.9rem;
  line-height: 1.1;
  letter-spacing: 0.06em;
  color: #9e1f12;
}

.trait-name { color: #2a251f; }
.trait-text { color: #4a3f31; opacity: 1; font-size: 0.8rem; word-break: keep-all; }

.trait-card:disabled { opacity: 0.55; filter: saturate(0.4); }

.trait-card.is-picked {
  border: 0;
  background:
    linear-gradient(180deg, rgba(143, 34, 23, 0.9) 0 4px, transparent 4px calc(100% - 4px), rgba(143, 34, 23, 0.9) calc(100% - 4px)),
    linear-gradient(170deg, #f6e2a0, #e6c86c);
  color: #2a251f;
  rotate: 0deg;
  box-shadow: 0 0 0 2px #8f2217, 0 0 16px rgba(226, 85, 63, 0.45);
}

.trait-card.is-picked .trait-hanja { color: #9e1f12; }

.trait-card.is-picked::after {
  /* 고른 부적에는 붉은 도장 */
  content: "택";
  position: absolute;
  top: -9px;
  right: -7px;
  background: #f3ead4;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid #b0281a;
  border-radius: 3px;
  color: #b0281a;
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: 1rem;
  rotate: 8deg;
  animation: seal-thud 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@media (max-width: 560px) {
  .trait-hanja { font-size: 1.55rem; }
}

/* ===== 15. 자잘한 상태 (DESIGN-UI.md 15번) ===== */
/* 키보드 초점: 모든 단추·입력에 금색 두 줄 */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(201, 164, 92, 0.28);
}

/* 누름: 모든 단추가 80ms 동안 0.96배로 */
/* 다른 규칙이 transition을 정했으면 그것을 따른다 (:where로 우선순위 0) */
:where(button:not(:disabled)) {
  transition: scale 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
}
:where(button:not(:disabled)):active {
  scale: 0.96;
}

/* 못 누름: 흐리게 + 금지 표시 (따로 정한 곳은 그대로) */
:where(button):disabled {
  cursor: not-allowed;
}

/* 마우스 올림: 테두리가 금빛으로 */
@media (hover: hover) {
  :where(.btn, .tab-btn, .sound-toggle):hover:not(:disabled) {
    border-color: var(--gold);
  }
}

/* 효과음 스위치: 꺼지면 흐리게 */
.sound-toggle[aria-checked="false"] { opacity: 0.6; }

/* 탭 지름길 숫자: 마우스가 있는 화면에서만 */
.tab-key { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 700px) {
  .tab-btn { position: relative; }
  .tab-key {
    display: block;
    position: absolute;
    top: 7px;
    left: 9px;
    font-size: 0.66rem;
    line-height: 1;
    color: var(--muted);
    opacity: 0.8;
  }
  .tab-btn.is-active .tab-key { color: var(--accent-text); }
}

/* 스크롤 막대: 어두운 나무에 금빛 손잡이 */
html {
  scrollbar-color: var(--gold-dim) #1d1712;
  scrollbar-width: thin;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #1d1712; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8a7243, #6b5a41);
  border: 2px solid #1d1712;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  :where(button:not(:disabled)):active { scale: 1; }
}

/* ===== 18~20. 키우기의 손맛: 상태 패의 OVR·다음 경지 띠·변화 숫자 (DESIGN-UI.md) ===== */
.status-goal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-top: 7px;
  border-top: 1px dashed rgba(201, 164, 92, 0.3);
}

.goal-ovr {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 50px;
  line-height: 1;
}

.goal-ovr-label {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.goal-ovr-value {
  margin-top: 2px;
  font-size: 1.55rem;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

.goal-next {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.goal-next-text {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 10px;
  font-size: 0.78rem;
  line-height: 1.3;
}

.goal-next-head { color: var(--text); font-weight: 600; letter-spacing: 0.04em; }
.goal-next-parts { color: var(--muted); font-variant-numeric: tabular-nums; }

.goal-track {
  display: block;
  height: 7px;
  border-radius: 4px;
  background: var(--bar-track);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.goal-fill {
  display: block;
  height: 100%;
  width: 100%;
  position: relative;
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
  background: linear-gradient(90deg, #8a7243, var(--gold));
  transition: transform 0.9s cubic-bezier(0.23, 1, 0.32, 1);
}

.status-goal.is-ready .goal-next-head { color: var(--gold); }
.status-goal.is-ready .goal-fill {
  background: linear-gradient(90deg, var(--gold), #f0d99a);
}
/* 승급 준비: 빛이 숨 쉬듯. box-shadow(매번 다시 칠함) 대신 위에 얹은 밝은 층의 opacity만 움직인다 */
.status-goal.is-ready .goal-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff3c8;
  opacity: 0;
  animation: goal-ready 1.8s ease-in-out infinite;
}
@keyframes goal-ready {
  50% { opacity: 0.45; }
}
.status-goal.is-peak .goal-track { display: none; }

/* --- 변화 숫자 (알림 1단계) --- */
.status-bar .bar-row { position: relative; }
.status-bar .bar-fill { transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1); }

.status-bar .bar-value { position: relative; }
/* 숫자 바로 왼쪽(막대 끝 위)에 떠오른다: 값 글자를 가리지 않게 */
.gain-float {
  position: absolute;
  right: calc(100% + 4px);
  top: 50%;
  margin-top: -0.65em;
  z-index: 2;
  border-radius: 3px;
  background: rgba(20, 15, 11, 0.85);
  padding: 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  animation: gain-float 1.8s ease-out both;
}
.gain-float.is-good { color: #b6db7e; }
.gain-float.is-bad { color: #f28c70; }
@keyframes gain-float {
  0% { opacity: 0; translate: 8px 0; }
  15% { opacity: 1; translate: 0 0; }
  80% { opacity: 1; translate: 0 -2px; }
  100% { opacity: 0; translate: 0 -6px; }
}
/* 다음 경지 띠의 깨달음 +1: 글줄 안에 */
.gain-float.is-inline {
  position: static;
  margin: 0 0 0 6px;
  padding: 0 4px;
}

.bar-row.is-flash .bar { animation: bar-flash 0.9s ease-out; }
.bar-row.is-flash.is-up .bar { --flash: rgba(182, 219, 126, 0.65); }
.bar-row.is-flash.is-down .bar { --flash: rgba(242, 140, 112, 0.6); }
.goal-next.is-flash .goal-track { --flash: rgba(240, 217, 154, 0.75); animation: bar-flash 1s ease-out; }
@keyframes bar-flash {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45); }
  30% { box-shadow: 0 0 0 1px var(--flash), 0 0 10px var(--flash); }
}

/* 19번: OVR ▲ */
.ovr-delta {
  position: absolute;
  top: -15px;
  left: 50%;
  margin-left: -0.9em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #b6db7e;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  animation: ovr-delta 2.2s ease-out both;
}
.goal-ovr.is-down .ovr-delta { color: #f28c70; }
.goal-ovr.is-flash.is-up .goal-ovr-value { animation: ovr-glow 1.2s ease-out; }
@keyframes ovr-delta {
  0% { opacity: 0; scale: 0.6; }
  15% { opacity: 1; scale: 1.15; }
  25% { scale: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; translate: 0 -6px; }
}
@keyframes ovr-glow {
  30% { color: #f6e2a0; text-shadow: 0 0 12px rgba(240, 217, 154, 0.9); scale: 1.12; }
}

/* --- 한 줄 띠 (알림 2단계): 상태 패 바로 아래에 잠깐 --- */
.gain-band {
  position: absolute;
  left: var(--gap);
  right: var(--gap);
  top: calc(100% + 6px);
  z-index: 16;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 7px 12px;
  border: 1px solid rgba(201, 164, 92, 0.55);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  background: rgba(27, 21, 16, 0.94);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  font-size: 0.85rem;
  animation: band-in 0.3s cubic-bezier(0.23, 1, 0.32, 1) both;
}
/* 사라질 때 ease-in(처음이 느림)은 굼뜨다 → 짧은 강한 ease-out (2026-11-23 애니메이션 점검 4번) */
.gain-band.is-leaving { animation: band-out 0.2s cubic-bezier(0.23, 1, 0.32, 1) both; }
@keyframes band-in { from { opacity: 0; translate: 0 -6px; } }
@keyframes band-out { to { opacity: 0; translate: 0 -6px; } }

.gain-band-seal {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.75rem;
}
.gain-band-name { color: var(--text); letter-spacing: 0.04em; }
.gain-chip { font-variant-numeric: tabular-nums; }
.gain-chip.is-good { color: #b6db7e; }
.gain-chip.is-note { color: var(--muted); }

@media (min-width: 960px) {
  .daily .status-bar .gain-band { left: 0; right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .gain-float, .ovr-delta, .gain-band, .bar-row.is-flash .bar, .goal-next.is-flash .goal-track, .goal-ovr .goal-ovr-value, .status-goal.is-ready .goal-fill::after { animation: none !important; }
  .goal-fill, .status-bar .bar-fill { transition: none; }
}

/* ===== 21~23. 지금 → 다음 · 한 달 결산 · 깨달음 막대 ===== */
/* 21번: 수련 현판의 미리보기 */
.action-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.pv { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pv-label { color: var(--muted); }
.pv-from { color: var(--muted); }
.pv-arrow { color: var(--gold-dim); font-size: 0.85em; }
.pv-to { color: #b6db7e; font-weight: 700; }
.pv.is-ovr .pv-label { letter-spacing: 0.08em; }
.pv.is-ovr .pv-to { color: var(--gold); }
.pv.is-cost .pv-to { color: #f2a07f; font-weight: 600; }
.pv.is-relief .pv-to { color: #9cc9e6; }
.action-btn.is-locked .pv-to { color: inherit; }

/* 23번: 깨달음 막대 */
.bar-insight { background: linear-gradient(90deg, #7d5f99, var(--bar-insight)); }

/* 22번: 한 달 결산 쪽지 (종이 구역) */
.month-note {
  --text: #2a251f;
  --muted: #6f6556;
  --accent-ink: #9e2b1e;
  position: relative;
  padding: 12px 16px 12px;
  border-left: 4px solid #8f2217;
  background: linear-gradient(180deg, #f3ead4, #e8dcbc);
  color: var(--text);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  animation: month-in 0.5s cubic-bezier(0.3, 0.7, 0.2, 1) both;
}
@keyframes month-in { from { opacity: 0; translate: 0 -10px; } }
.month-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.month-seal {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 3px;
  background: #8f2217;
  color: #fbf1dc;
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: 0.95rem;
}
.month-title { font-size: 1.05rem; letter-spacing: 0.06em; }
.month-realm { padding: 1px 8px; border: 1px solid #8f2217; color: #8f2217; font-weight: 700; font-size: 0.85rem; }
.month-close { margin-left: auto; min-height: 30px; padding: 2px 12px; background: transparent; color: #2a251f; border-color: rgba(42, 37, 31, 0.4); }
.month-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 16px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.month-row { display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.month-label { min-width: 4.4em; color: var(--muted); }
.month-from { color: var(--muted); }
.month-arrow { color: #8a7243; font-size: 0.85em; }
.month-to { color: #2a251f; }
.month-diff { margin-left: 2px; font-size: 0.8rem; font-weight: 700; }
.month-diff.is-up { color: #3f6b1f; }
.month-diff.is-down { color: #9e2b1e; }
.month-row.is-ovr .month-to { color: #7a5a14; font-size: 1.05rem; }
@media (prefers-reduced-motion: reduce) { .month-note { animation: none; } }

/* 23번: 석 자 이름(깨달음)이 꺾이지 않게 이름 칸을 조금 넓히고 자간을 줄인다 */
.status-bar .bar-row { grid-template-columns: 3.3em 1fr auto; }
.status-bar .bar-row-insight .bar-label { letter-spacing: 0.02em; white-space: nowrap; }
.pv-arrow { color: var(--muted); font-size: 0.9em; margin: 0 1px; }

/* 22번: 넓은 화면의 두 칸 짜임에서도 결산 쪽지는 한 줄을 다 쓴다 */
.daily .tab-body > .month-note { column-span: all; } /* 넓은 화면의 두 단(columns) 짜임 */

/* ============================================================
   인스타 레퍼런스 적용 (2026-11-20, 옵시디언 "13 인스타 레퍼런스 적용")
   카메라 무빙을 큰 장면에만, transform·opacity로만. 움직임 줄이기면 모두 끈다.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  /* 시작 화면: 마우스를 따라 층마다 다르게 밀린다(가까운 산이 가장 많이, 달은 반대로 조금). 제목·단추는 고정 */
  .cover { --mx: 0; --my: 0; }
  .cover-mountains,
  .cover-sky,
  .cover::before {
    transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .cover-mountains { transform: translate3d(calc(var(--mx) * -10px), calc(var(--my) * -3px), 0); }
  .cover-sky { transform: translate3d(calc(var(--mx) * -4px), calc(var(--my) * -2px), 0); }
  .cover::before { transform: translate3d(calc(var(--mx) * 4px), calc(var(--my) * 3px), 0); }

  /* 승급: Push In. 경지 한자 쪽으로 천천히 다가간다(깨달음의 순간) */
  .advance-reveal { animation: cam-push-in 3.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.3s both; }
  @keyframes cam-push-in {
    from { transform: scale(0.94); }
    to { transform: scale(1.04); }
  }

  /* 죽음: Pull Out. 그림이 먹에 잠기는 동안 카메라가 뒤로 빠진다(장면 마무리, 고독) */
  .death .end-picture { animation: cam-pull-out 3.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both; }
  @keyframes cam-pull-out {
    from { transform: scale(1.07); }
    to { transform: scale(1); }
  }

  /* 생사경 엔딩: Crane Down. 하늘에서 내려와 그림에 닿는다 */
  .is-summit .end-picture { animation: cam-crane-down 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes cam-crane-down {
    from { opacity: 0; transform: translate3d(0, -36px, 0) scale(1.03); }
    to { opacity: 1; transform: none; }
  }
}

/* ---- 한 생 되감기 (DESIGN-UI.md 26번, 2026-11-20): 끝 화면의 단추와 큰 일이 한 장씩 지나가는 창 ---- */
.btn-reel {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-reel .action-hint { margin-left: auto; }
.reel-btn-seal {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: "Noto Serif KR", "Batang", serif;
  font-size: 0.9em;
}
.reel-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px 16px;
  background: rgba(14, 12, 10, 0.95);
  cursor: pointer;
  outline: none;
  animation: scene-in 0.25s ease both;
}
.reel-overlay.is-leaving { animation: scene-out 0.18s ease both; }
.reel-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  width: min(100%, 380px);
  color: var(--gold);
  border-bottom: 1px solid rgba(201, 164, 92, 0.35);
  padding-bottom: 6px;
}
.reel-title { font-size: 1.08rem; letter-spacing: 0.2em; }
.reel-count { margin-left: auto; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.reel-card {
  position: relative;
  width: min(100%, 380px);
  min-height: 300px;
  padding: 26px 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(180deg, #efe4c8, #e2d4b0);
  color: #2a251f;
  box-shadow: 0 0 0 10px #4a3826, 0 0 0 11px #2a1f15, 0 24px 50px rgba(0, 0, 0, 0.7);
}
.reel-date { color: #6f6556; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.reel-hanja {
  align-self: center;
  margin: 10px 0 8px;
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-size: 5.6rem;
  line-height: 1;
  color: #1f1b16;
  text-shadow: 2px 2px 0 rgba(31, 27, 22, 0.12);
}
/* 꼬리표 낙관: 흰 바탕 붉은 글자. 승급과 끝 장면만 붉은 바탕 흰 글자(확정) */
.reel-label {
  display: inline-block;
  padding: 2px 9px;
  border: 1.5px solid #9e2b1e;
  color: #9e2b1e;
  font-size: 0.82rem;
  letter-spacing: 0.25em;
  rotate: -2deg;
}
.reel-card.is-realm .reel-label,
.reel-card.is-end .reel-label { background: #9e2b1e; color: #fff3e6; }
.reel-text {
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
  word-break: keep-all;
}
.reel-card.is-end { box-shadow: 0 0 0 10px #3a2a1c, 0 0 0 11px var(--gold-dim), 0 24px 50px rgba(0, 0, 0, 0.7); }
.reel-card.is-end .reel-hanja { color: #7a1d10; }
.reel-track {
  display: flex;
  gap: 4px;
  width: min(100%, 380px);
}
.reel-mark {
  flex: 1;
  height: 3px;
  background: rgba(201, 164, 92, 0.2);
}
.reel-mark.is-big { height: 5px; }
.reel-mark.is-on { background: var(--gold); }
.reel-tail { visibility: hidden; }
.reel-tail.is-shown { visibility: visible; }
.reel-skip { margin: 0; color: var(--muted); font-size: 0.8rem; }
@media (prefers-reduced-motion: no-preference) {
  .reel-card.is-in { animation: reel-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .reel-card.is-in .reel-hanja { animation: ink-bloom 0.7s ease-out 0.1s both; }
  .reel-card.is-in .reel-text { animation: reel-text 0.5s ease-out 0.25s both; }
  .reel-mark { transition: background 0.3s ease; }
  @keyframes reel-in {
    from { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.98); }
    to { opacity: 1; transform: none; }
  }
  @keyframes reel-text {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}
.reel-overlay { overflow-y: auto; }
.reel-tail.buttons { display: flex; flex-direction: row; gap: 10px; width: min(100%, 380px); margin: 0; }
.reel-tail.buttons .btn { flex: 1; margin: 0; }
.reel-overlay:has(.reel-tail.is-shown) .reel-skip { visibility: hidden; }
@media (max-width: 480px) {
  .reel-card { width: calc(100% - 20px); min-height: 260px; padding: 22px 20px 20px; }
  .reel-hanja { font-size: 4.6rem; }
}

/* ---- 강호 지도 (DESIGN-UI.md 27번, 2026-11-20): 먹빛 바탕에 금빛 가는 선. 장소는 둥근 낙관 단추 ---- */
.gmap {
  position: relative;
  aspect-ratio: 600 / 360;
  margin: 6px 0 12px;
  background:
    radial-gradient(ellipse at 88% 13%, rgba(233, 222, 196, 0.08), transparent 35%),
    linear-gradient(180deg, #17130f, #1d1813);
  box-shadow: inset 0 0 0 1px rgba(201, 164, 92, 0.28), inset 0 0 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.gmap > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.gmap .gm-far { stroke: rgba(201, 164, 92, 0.12); stroke-width: 1.2; }
.gmap .gm-ridge { stroke: rgba(201, 164, 92, 0.38); stroke-width: 1.6; }
.gmap .gm-river { stroke: rgba(143, 171, 166, 0.45); stroke-width: 2.2; }
.gmap .gm-river.is-thin { stroke-width: 1; stroke: rgba(143, 171, 166, 0.25); }
.gmap .gm-road { stroke: rgba(201, 164, 92, 0.32); stroke-width: 1.3; stroke-dasharray: 2 6; }
.gmap .gm-moon { stroke: rgba(233, 222, 196, 0.35); stroke-width: 1; fill: rgba(233, 222, 196, 0.05); }
.gmap-spot {
  position: absolute;
  translate: -50% -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.gmap-seal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 3px #1a1511, inset 0 0 0 4px rgba(201, 164, 92, 0.5);
  background: #1a1511;
  color: #f0e7d3;
  font-family: "Noto Serif KR", "Batang", serif;
  font-size: 1.05rem;
  transition: background 0.2s ease, color 0.2s ease, scale 0.2s ease;
}
.gmap-name {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000, 0 0 6px #000;
}
.gmap-count {
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px #000;
}
/* 아직 아무것도 겪지 않은 곳은 흐린 테 (빈 곳이 아니라 모르는 곳) */
.gmap-spot.is-unknown .gmap-seal { border-style: dashed; border-color: var(--gold-dim); color: var(--muted); }
.gmap-spot:hover .gmap-seal,
.gmap-spot:focus-visible .gmap-seal { scale: 1.08; border-color: #e3c47e; }
.gmap-spot:focus-visible { outline: none; }
.gmap-spot:focus-visible .gmap-seal { box-shadow: inset 0 0 0 3px #1a1511, inset 0 0 0 4px rgba(201, 164, 92, 0.5), 0 0 0 2px var(--gold), 0 0 0 4px #1a1511, 0 0 0 5px var(--gold); }
/* 고른 곳: 붉은 바탕 흰 글자 낙관(확정) */
.gmap-spot.is-active .gmap-seal { background: #9e2b1e; border: 1px solid #c94a37; color: #fff3e6; box-shadow: none; }
.gmap-spot.is-active .gmap-name { color: var(--gold); }
.gmap-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(201, 164, 92, 0.25);
}
.gmap-head-seal { color: var(--gold); font-size: 1.3rem; }
.gmap-head-name { font-size: 1.08rem; }
.gmap-head-meta { color: var(--muted); font-size: 0.85rem; word-break: keep-all; }
.gmap-events { margin: 8px 0 0; }
.gmap-event summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  cursor: pointer;
  list-style: none;
}
.gmap-event summary::-webkit-details-marker { display: none; }
.gmap-event summary::before { content: "▸"; color: var(--gold-dim); font-size: 0.8em; }
.gmap-event[open] summary::before { content: "▾"; }
.gmap-kind {
  flex: none;
  padding: 0 6px;
  border: 1px solid #c94a37;
  color: #e9a094;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
}
.gmap-event.is-fortune .gmap-kind { border-color: var(--gold); color: var(--gold); }
.gmap-title { word-break: keep-all; }
.gmap-who { margin-left: auto; color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.gmap-text { margin: 0 0 8px 18px; color: var(--muted); font-size: 0.92rem; line-height: 1.65; word-break: keep-all; }
.gmap-events li + li { border-top: 1px solid rgba(201, 164, 92, 0.12); }
@media (max-width: 520px) {
  .gmap-name { display: none; }
  .gmap-seal { width: 30px; height: 30px; font-size: 0.95rem; }
}
@media (prefers-reduced-motion: reduce) {
  .gmap-seal { transition: none; }
  .gmap-spot:hover .gmap-seal, .gmap-spot:focus-visible .gmap-seal { scale: 1; }
}
/* 강호 지도는 넓은 화면의 두 단을 가로질러 한 장으로 */
.daily .tab-body > .gmap-panel { column-span: all; }
/* 자리 점에 낙관 한가운데가 오게 (이름·수는 그 아래로) */
.gmap-spot { translate: -50% -19px; }
@media (max-width: 520px) { .gmap-spot { translate: -50% -17px; } }

/* ============================================================
   싸움 몸짓 2 (2026-11-20, 사용자: "제자리에서 검이나 주먹을 내지르고, 이펙트는 상대에게")
   달려가지 않는다. 뒤로 당겼다가 한 발 디디며 내지르고 돌아온다.
   side-enemy는 부모(stage)가 뒤집혀 있어 같은 keyframes로 반대 방향(상대 쪽)을 향한다.
   손속(ui.js strikeStyle): blade 검·도·봉 / fist 맨손·권갑 / claw 발톱·짐승
   ============================================================ */

/* 보통 공격 0.55초, 맞는 순간 36% */
@keyframes strike-blade {
  0% { translate: 0 0; rotate: 0deg; transform: skewX(0deg); }
  14% { translate: -10px 2px; rotate: -7deg; transform: skewX(3deg); animation-timing-function: cubic-bezier(0.7, 0, 0.9, 0.4); }
  32% { translate: calc(var(--fw) * 0.3) 0; rotate: 9deg; transform: skewX(-9deg); }
  44% { translate: calc(var(--fw) * 0.28) 0; rotate: 5deg; transform: skewX(-4deg); animation-timing-function: ease-out; }
  100% { translate: 0 0; rotate: 0deg; transform: skewX(0deg); }
}

@keyframes strike-fist {
  0% { translate: 0 0; rotate: 0deg; scale: 1; }
  16% { translate: -12px 0; rotate: -4deg; scale: 0.95 1.03; animation-timing-function: cubic-bezier(0.7, 0, 0.9, 0.4); }
  31% { translate: calc(var(--fw) * 0.38) -2px; rotate: 5deg; scale: 1.06 0.97; }
  44% { translate: calc(var(--fw) * 0.35) 0; rotate: 2deg; scale: 1; animation-timing-function: ease-out; }
  100% { translate: 0 0; rotate: 0deg; scale: 1; }
}

@keyframes strike-claw {
  0% { translate: 0 0; rotate: 0deg; scale: 1; }
  16% { translate: -8px 4px; rotate: -3deg; scale: 1.05 0.92; animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5); }
  32% { translate: calc(var(--fw) * 0.42) -16px; rotate: 11deg; scale: 1; }
  44% { translate: calc(var(--fw) * 0.4) 0; rotate: 4deg; animation-timing-function: ease-out; }
  100% { translate: 0 0; rotate: 0deg; scale: 1; }
}

/* 무공 0.95초, 맞는 순간 53%: 기를 모으며(붉은 기운) 웅크렸다가 크게 내지른다 */
@keyframes strike-blade-skill {
  0% { translate: 0 0; rotate: 0deg; scale: 1; transform: skewX(0deg); filter: none; }
  34% { translate: -14px 0; rotate: -9deg; scale: 1.06; transform: skewX(4deg); filter: drop-shadow(0 0 10px rgba(143, 34, 23, 0.6)); animation-timing-function: cubic-bezier(0.7, 0, 0.9, 0.4); }
  50% { translate: calc(var(--fw) * 0.42) -4px; rotate: 11deg; scale: 1.02; transform: skewX(-11deg); filter: drop-shadow(0 0 6px rgba(143, 34, 23, 0.45)); }
  64% { translate: calc(var(--fw) * 0.38) 0; rotate: 6deg; scale: 1; transform: skewX(-4deg); filter: none; animation-timing-function: ease-out; }
  100% { translate: 0 0; rotate: 0deg; scale: 1; transform: skewX(0deg); filter: none; }
}

@keyframes strike-fist-skill {
  0% { translate: 0 0; rotate: 0deg; scale: 1; filter: none; }
  34% { translate: -16px 2px; rotate: -6deg; scale: 0.94 1.05; filter: drop-shadow(0 0 10px rgba(143, 34, 23, 0.6)); animation-timing-function: cubic-bezier(0.7, 0, 0.9, 0.4); }
  50% { translate: calc(var(--fw) * 0.48) -3px; rotate: 6deg; scale: 1.08 0.96; filter: drop-shadow(0 0 6px rgba(143, 34, 23, 0.45)); }
  64% { translate: calc(var(--fw) * 0.44) 0; rotate: 2deg; scale: 1; filter: none; animation-timing-function: ease-out; }
  100% { translate: 0 0; rotate: 0deg; scale: 1; filter: none; }
}

@keyframes strike-claw-skill {
  0% { translate: 0 0; rotate: 0deg; scale: 1; filter: none; }
  34% { translate: -10px 6px; rotate: -4deg; scale: 1.08 0.88; filter: drop-shadow(0 0 10px rgba(143, 34, 23, 0.6)); animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5); }
  50% { translate: calc(var(--fw) * 0.5) -24px; rotate: 14deg; scale: 1; filter: drop-shadow(0 0 6px rgba(143, 34, 23, 0.45)); }
  64% { translate: calc(var(--fw) * 0.46) 0; rotate: 5deg; filter: none; animation-timing-function: ease-out; }
  100% { translate: 0 0; rotate: 0deg; scale: 1; filter: none; }
}

/* 내지를 때 디딘 자리에 남는 잔상 */
@keyframes ghost-strike {
  0%, 18% { opacity: 0; translate: 0 0; }
  26% { opacity: 0.45; translate: calc(var(--fw) * 0.1) 0; }
  40%, 100% { opacity: 0; translate: calc(var(--fw) * 0.22) 0; }
}

@keyframes ghost-strike-skill {
  0%, 38% { opacity: 0; translate: 0 0; }
  45% { opacity: 0.55; translate: calc(var(--fw) * 0.14) 0; }
  58%, 100% { opacity: 0; translate: calc(var(--fw) * 0.3) 0; }
}

/* ---------- 내지른 자국: 쓴 사람 앞에서 상대 앞까지 ---------- */
.thrust {
  position: absolute;
  top: 50%;
  left: 24%;
  width: 52%;
  height: 64px;
  translate: 0 -50%;
  pointer-events: none;
}
.thrust.from-enemy { scale: -1 1; }
.thrust::before,
.thrust::after {
  content: "";
  position: absolute;
  opacity: 0;
}

/* 검: 앞에서 휘두른 초승달 + 상대까지 뻗는 가는 검기 */
.thrust-blade::before {
  left: -4%;
  top: -30%;
  width: 46%;
  height: 160%;
  border-radius: 50%;
  border-right: 5px solid var(--ink);
  rotate: -30deg;
  animation: thrust-arc 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) var(--d, 0s) both;
}
.thrust-blade::after {
  left: 18%;
  right: 4%;
  top: calc(50% - 1.5px);
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(31, 27, 22, 0.85) 30%, rgba(31, 27, 22, 0.3) 85%, transparent);
  transform-origin: left center;
  animation: thrust-streak 0.28s ease-out var(--d, 0s) both;
}
.thrust-blade.is-big::before { border-right-width: 8px; }
.thrust-blade.is-big::after { height: 5px; background: linear-gradient(90deg, transparent, rgba(143, 34, 23, 0.9) 25%, rgba(31, 27, 22, 0.5) 85%, transparent); }

/* 주먹: 앞으로 뻗는 권풍(가로 속도선 셋) + 주먹 끝의 기운 덩이 */
.thrust-fist::before {
  left: 14%;
  right: 6%;
  top: 22%;
  bottom: 22%;
  background:
    linear-gradient(90deg, transparent, rgba(31, 27, 22, 0.75) 40%, transparent) 0 0 / 100% 3px no-repeat,
    linear-gradient(90deg, transparent, rgba(31, 27, 22, 0.9) 30%, transparent) 0 50% / 100% 4px no-repeat,
    linear-gradient(90deg, transparent, rgba(31, 27, 22, 0.75) 40%, transparent) 0 100% / 100% 3px no-repeat;
  transform-origin: left center;
  animation: thrust-streak 0.26s ease-out var(--d, 0s) both;
}
.thrust-fist::after {
  left: 62%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 27, 22, 0.55), transparent 65%);
  animation: thrust-ball 0.3s ease-out var(--d, 0s) both;
}
.thrust-fist.is-big::before { top: 10%; bottom: 10%; }
.thrust-fist.is-big::after { width: 70px; height: 70px; margin: -35px 0 0 -35px; background: radial-gradient(circle, rgba(143, 34, 23, 0.6), transparent 65%); }

/* 발톱: 덮치는 길의 굵은 먹선 두 줄 */
.thrust-claw::before {
  left: 20%;
  right: 10%;
  top: 30%;
  bottom: 30%;
  background:
    linear-gradient(90deg, transparent, rgba(31, 27, 22, 0.8), transparent) 0 0 / 100% 4px no-repeat,
    linear-gradient(90deg, transparent, rgba(31, 27, 22, 0.8), transparent) 0 100% / 100% 4px no-repeat;
  rotate: 8deg;
  transform-origin: left center;
  animation: thrust-streak 0.28s ease-out var(--d, 0s) both;
}

@keyframes thrust-arc {
  0% { opacity: 0; rotate: -70deg; scale: 0.8; }
  30% { opacity: 1; }
  100% { opacity: 0; rotate: 20deg; scale: 1.05; }
}
@keyframes thrust-streak {
  0% { opacity: 0; scale: 0 1; }
  30% { opacity: 1; scale: 1 1; }
  100% { opacity: 0; scale: 1 1; translate: 8% 0; }
}
@keyframes thrust-ball {
  0% { opacity: 0; translate: -120px 0; scale: 0.5; }
  55% { opacity: 1; translate: 0 0; scale: 1; }
  100% { opacity: 0; translate: 10px 0; scale: 1.5; }
}

/* ---------- 맞는 자리(상대 몸)의 이펙트: 손속마다 ---------- */
/* 검: 몸을 비스듬히 가르는 먹선이 그어지고, 붉은 먹이 튄다 */
.impact-blade::before {
  inset: calc(50% - 3px) -45%;
  height: 6px;
  border-radius: 3px;
  box-shadow: none;
  background: linear-gradient(90deg, transparent, var(--ink) 18%, #120d09 50%, var(--ink) 82%, transparent);
  rotate: -32deg;
  transform-origin: left center;
  animation: cut-draw 0.42s cubic-bezier(0.2, 0.8, 0.3, 1) var(--d, 0s) both;
}
.impact-skill.impact-blade::before { height: 9px; inset: calc(50% - 4.5px) -55%; background: linear-gradient(90deg, transparent, #5c120b 15%, #120d09 50%, #5c120b 85%, transparent); }
.impact-blade::after,
.impact-claw::after {
  background: repeating-conic-gradient(#8f2217 0 4deg, transparent 4deg 31deg);
}
@keyframes cut-draw {
  0% { opacity: 0; scale: 0 1; }
  15% { opacity: 1; }
  45% { opacity: 1; scale: 1 1; }
  100% { opacity: 0; scale: 1 0.3; }
}

/* 주먹: 맞은 자리에서 퍼지는 충격 고리 두 겹 + 먹 튐 */
.impact-fist::before {
  inset: 12%;
  border-radius: 50%;
  border: 5px solid var(--ink);
  box-shadow: 0 0 0 8px rgba(31, 27, 22, 0.15);
  animation: shock-ring 0.42s ease-out var(--d, 0s) both;
}
.impact-skill.impact-fist::before { border-width: 7px; border-color: #5c120b; }
@keyframes shock-ring {
  0% { opacity: 0; scale: 0.15; }
  20% { opacity: 1; }
  100% { opacity: 0; scale: 1.7; }
}

/* 발톱: 몸에 세 줄이 위에서 아래로 그어진다 */
.impact-claw::before {
  inset: 0 10%;
  border-radius: 0;
  box-shadow: none;
  background: repeating-linear-gradient(90deg, transparent 0 16%, #2a1210 16% 23%, transparent 23% 38%);
  -webkit-mask: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
  mask: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
  rotate: 22deg;
  animation: claw-draw 0.42s ease-out var(--d, 0s) both;
}
@keyframes claw-draw {
  0% { opacity: 0; clip-path: inset(0 0 100% 0); }
  20% { opacity: 1; }
  45% { opacity: 1; clip-path: inset(0 0 0 0); }
  100% { opacity: 0; clip-path: inset(0 0 0 0); }
}

/* 무공을 펼칠 때 발밑에 기가 모이는 소용돌이 */
.charge {
  position: absolute;
  bottom: 2px;
  width: 110px;
  height: 26px;
  translate: -50% 0;
  border-radius: 50%;
  border: 2px dashed rgba(143, 34, 23, 0.7);
  box-shadow: 0 0 14px rgba(143, 34, 23, 0.35), inset 0 0 10px rgba(143, 34, 23, 0.3);
  opacity: 0;
  animation: charge-swirl 0.5s ease-in var(--d, 0s) both;
}
.charge.at-player { left: 22%; }
.charge.at-enemy { left: 78%; }
@keyframes charge-swirl {
  0% { opacity: 0; scale: 1.6 1.4; rotate: 0deg; }
  60% { opacity: 1; }
  100% { opacity: 0; scale: 0.6 0.6; rotate: 140deg; }
}

/* 무공 이펙트는 무대 전체가 아니라 맞는 쪽(상대) 둘레에 모인다 */
.arena-skill.from-player .fx { left: 46%; right: -4%; }
.arena-skill.from-enemy .fx { left: -4%; right: 46%; }

@media (prefers-reduced-motion: reduce) {
  .thrust, .charge { display: none; }
}

/* 상대가 달려와 서지 않으니, 맞는 자리 이펙트는 상대 몸 한가운데에 (무대 너비로 계산) */
.arena-overlay { --fw: min(36cqw, 150px); }
@media (min-width: 960px) { .arena-overlay { --fw: min(30cqw, 190px); } }
.impact.at-enemy { left: calc(94% - var(--fw) / 2); }
.impact.at-player { left: calc(6% + var(--fw) / 2); }
.charge.at-enemy, .dust.at-enemy { left: calc(94% - var(--fw) / 2); }
.charge.at-player, .dust.at-player { left: calc(6% + var(--fw) / 2); }

/* 주먹: 먹 튐 대신 늦게 따라 퍼지는 둘째 고리 (시계처럼 보이지 않게) */
.impact-fist::after {
  inset: 24%;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: none;
  -webkit-mask: none;
  mask: none;
  animation: shock-ring 0.5s ease-out calc(var(--d, 0s) + 0.08s) both;
}
.impact-skill.impact-fist::after { border-color: #8f2217; border-width: 4px; }

/* 맞아서 어두워진 몸 위에서도 먹 이펙트가 보이게: 한지 빛 테두리 */
.impact-blade::before, .impact-fist::before, .impact-fist::after, .impact-claw::before {
  filter: drop-shadow(0 0 1.5px rgba(243, 234, 212, 0.95)) drop-shadow(0 0 3px rgba(243, 234, 212, 0.6));
}

/* ============================================================
   무림다움 점검 28~31번 (2026-11-20, 옵시디언 "14 무림다움 점검")
   ============================================================ */

/* ---- 28. 이름을 호패에 새긴다 ---- */
.name-screen {
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: min(78vh, 720px);
  text-align: center;
}
.name-ask {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.18em;
  word-break: keep-all;
}
.hopae {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 132px;
  min-height: 320px;
  margin-top: 30px;
  padding: 50px 0 64px;
  border-radius: 64px 64px 6px 6px;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #8d6c46, #6e5133 60%, #5c432a);
  box-shadow:
    inset 0 0 0 4px rgba(40, 26, 14, 0.55),
    inset 0 0 0 5px rgba(233, 201, 119, 0.35),
    0 14px 30px rgba(0, 0, 0, 0.6);
}
.hopae-hole {
  position: absolute;
  top: 18px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #1a120b;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 230, 180, 0.25);
}
/* 구멍에서 위로 올라간 붉은 끈 */
.hopae-cord {
  position: absolute;
  top: -30px;
  width: 3px;
  height: 52px;
  background: linear-gradient(180deg, transparent, #9e2b1e 35%, #7a1d10);
  border-radius: 2px;
}
.hopae-kicker {
  margin-bottom: 14px;
  color: rgba(30, 20, 12, 0.6);
  font-size: 0.78rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
}
/* 새긴 글자: 나무 속으로 파인 어두운 글자, 아래 밝은 그림자 */
.hopae-name {
  writing-mode: vertical-rl;
  color: #21160d;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(255, 228, 176, 0.28), -1px -1px 0 rgba(0, 0, 0, 0.25);
}
.hopae-name.is-empty { opacity: 0.32; }
.hopae-seal {
  position: absolute;
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: #9e2b1e;
  color: #fff3e6;
  font-size: 1rem;
  rotate: -4deg;
  opacity: 0;
}
.hopae.is-carved .hopae-seal { opacity: 1; }
.name-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(100%, 320px);
  text-align: left;
}
.name-field .text-input { text-align: center; font-size: 1.1rem; letter-spacing: 0.1em; }
.name-screen > .buttons { width: min(100%, 320px); }

/* ---- 29. 입문: 산문 앞에 선다 ---- */
.intro-screen {
  align-items: center;
  text-align: center;
  --flag: #9e2b1e;
}
.intro-screen[data-sect="hwasan"] { --flag: #b8404c; }
.intro-screen[data-sect="namgung"] { --flag: #3f6f9e; }
.intro-screen[data-sect="shaolin"] { --flag: #c98b26; }
.intro-screen[data-sect="wudang"] { --flag: #4c8173; }
.intro-screen[data-sect="cheonma"] { --flag: #7d1414; }
.intro-kicker {
  margin: 4px 0 0;
  color: var(--gold-dim);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  font-size: 0.85rem;
}
.intro-stage {
  --gw: min(64vw, 270px);
  margin: 26px auto 6px;
}
.intro-screen .gate-door.is-left { rotate: y -86deg; }
.intro-screen .gate-door.is-right { rotate: y 86deg; }
.intro-title { justify-content: center; }
.intro-screen > .panel,
.intro-screen > .btn {
  align-self: center;
  width: min(100%, 640px);
  text-align: left;
}
.intro-screen > .btn { text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .hopae.is-carved .hopae-name { animation: hopae-carve 0.45s ease-out both; }
  .hopae.is-carved .hopae-seal { animation: hopae-stamp 0.26s cubic-bezier(0.3, 1.4, 0.5, 1) 0.35s both; }
  @keyframes hopae-carve {
    0% { opacity: 0.45; transform: scale(1.06); }
    100% { opacity: 1; transform: none; }
  }
  @keyframes hopae-stamp {
    from { opacity: 0; transform: scale(1.7); }
    to { opacity: 1; transform: none; }
  }
  /* 위에서 내려와 산문에 닿고(Crane Down), 그다음 문이 열린다 */
  .intro-stage { animation: intro-crane 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .intro-screen .gate-door { animation: gate-open 1.2s cubic-bezier(0.3, 0.7, 0.2, 1) 1.05s both; }
  .intro-screen .intro-title,
  .intro-screen > .panel,
  .intro-screen > .btn { animation: intro-rise 0.6s ease-out 1.7s both; }
  @keyframes intro-crane {
    from { opacity: 0; transform: translate3d(0, -48px, 0) scale(1.08); }
    to { opacity: 1; transform: none; }
  }
  @keyframes intro-rise {
    from { opacity: 0; transform: translate3d(0, 10px, 0); }
    to { opacity: 1; transform: none; }
  }
}

/* ---- 30·31. 넓은 화면 왼쪽 칸: 그림은 전신 족자 하나, 경지가 그 족자에 기운으로 ---- */
@media (min-width: 960px) {
  /* 31. 호패 머리의 작은 얼굴 대신 문파 낙관 (얼굴은 아래 족자에 이미 있다) */
  .daily .avatar-clip { display: none; }
  .daily .avatar-seal {
    position: static;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 0;
    box-shadow: inset 0 0 0 2px rgba(20, 15, 11, 0.55), 0 0 0 1.5px var(--panel);
  }
  .daily .avatar-seal::before {
    content: var(--sect-mark, "무림");
    font-size: 1.45rem;
    line-height: 1;
  }

  /* 30. 경지별 기운. 삼류·이류는 아무것도 없다 */
  .side-figure .figure { position: relative; overflow: hidden; }
  /* 일류: 족자 안쪽에 금빛이 옅게 돈다(검기) */
  .realm-o3 .side-figure .figure,
  .realm-o4 .side-figure .figure {
    box-shadow: 0 0 0 3px #17130f, 0 0 0 4px var(--sect, var(--gold-dim)), 0 8px 18px rgba(0, 0, 0, 0.55),
      inset 0 0 22px rgba(214, 170, 82, 0.28);
  }
  /* 절정: 옷자락 높이에 바람이 지나간다 */
  .realm-o4 .side-figure .figure::before {
    content: "";
    position: absolute;
    inset: 48% -30% 14%;
    background: linear-gradient(180deg,
      transparent 18%, rgba(42, 37, 31, 0.26) 18% 19.5%, transparent 19.5% 58%,
      rgba(42, 37, 31, 0.18) 58% 59%, transparent 59%);
    pointer-events: none;
    opacity: 0.8;
  }
  /* 초절정: 몸 둘레에 금테(검강) */
  .realm-o5 .side-figure .figure {
    box-shadow: 0 0 0 3px #17130f, 0 0 0 4px var(--sect, var(--gold-dim)), 0 0 0 6px rgba(227, 194, 124, 0.55),
      0 0 26px rgba(227, 194, 124, 0.35), 0 8px 18px rgba(0, 0, 0, 0.55), inset 0 0 30px rgba(214, 170, 82, 0.4);
  }
  /* 화경·현경·생사경: 모두 걷어 낸다(반박귀진). 그림만 또렷하게 */
  .realm-o6 .side-figure .figure img,
  .realm-o7 .side-figure .figure img,
  .realm-o8 .side-figure .figure img { filter: contrast(1.08); }
}
@media (min-width: 960px) and (prefers-reduced-motion: no-preference) {
  .realm-o4 .side-figure .figure::before { animation: aura-wind 3.4s linear infinite; }
  @keyframes aura-wind {
    0% { opacity: 0; transform: translate3d(-18%, 0, 0); }
    30%, 70% { opacity: 0.8; }
    100% { opacity: 0; transform: translate3d(18%, 0, 0); }
  }
}
/* 28~30 손질 (찍어 보고): 이름 화면 세로 가운데, 호패 조금 크게, 일류 기운 또렷이, 절정 바람은 번진 먹 자국으로 */
.name-screen { display: flex; flex-direction: column; }
@media (min-width: 960px) { .hopae { width: 150px; min-height: 360px; } }
@media (min-width: 960px) {
  .realm-o3 .side-figure .figure,
  .realm-o4 .side-figure .figure {
    box-shadow: 0 0 0 3px #17130f, 0 0 0 4px var(--sect, var(--gold-dim)), 0 8px 18px rgba(0, 0, 0, 0.55),
      inset 0 0 26px rgba(214, 170, 82, 0.5);
  }
  .realm-o4 .side-figure .figure::before {
    inset: 40% -10% 8%;
    background:
      radial-gradient(ellipse 38% 2.6% at 28% 22%, rgba(42, 37, 31, 0.26), transparent 72%),
      radial-gradient(ellipse 30% 2% at 64% 48%, rgba(42, 37, 31, 0.2), transparent 72%),
      radial-gradient(ellipse 34% 2.2% at 40% 78%, rgba(42, 37, 31, 0.18), transparent 72%);
  }
}
/* 30 손질: 안쪽 금빛은 그림 위에 얹어야 보인다 (그림이 족자 안을 다 덮으므로) */
@media (min-width: 960px) {
  .realm-o3 .side-figure .figure::after,
  .realm-o4 .side-figure .figure::after,
  .realm-o5 .side-figure .figure::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 22px rgba(214, 170, 82, 0.42);
  }
  .realm-o5 .side-figure .figure::after { box-shadow: inset 0 0 0 1px rgba(227, 194, 124, 0.7), inset 0 0 30px rgba(214, 170, 82, 0.55); }
}

/* ============================================================
   32~34 (2026-11-20, 옵시디언 "14 무림다움 점검" G·L·B)
   ============================================================ */

/* 32. 넓은 화면 글자: 1024px에서 12.5px보다 작던 꼬리표·보조 글자를 한 단계 올린다.
   잰 칸: 미리보기 수치, 혈도 이름, OVR 칸, 목표 쪽지, 병기 품급, 지도 이름 (휴대폰은 그대로) */
@media (min-width: 960px) {
  .daily .pv,
  .daily .action-hint,
  .daily .mer-channel-name,
  .daily .mer-req-state,
  .daily .goal-next-head,
  .daily .goal-next-parts,
  .daily .hint-who,
  .daily .speech-who,
  .daily .fighter-first,
  .daily .drawer-have,
  .daily .rack-name,
  .daily .gear-slot-name,
  .daily .gmap-name { font-size: 0.84rem; }
  .daily .pv-arrow { font-size: 1em; }
  .daily .mer-name,
  .daily .ovr-label,
  .daily .ovr-title,
  .daily .ovr-cell-label,
  .daily .ovr-cell-sub,
  .daily .gear-tier,
  .daily .gmap-count { font-size: 0.8rem; }
  .daily .goal-ovr-label { font-size: 0.72rem; letter-spacing: 0.18em; }
  .daily .tab-key { font-size: 0.74rem; }
  .daily .small { font-size: 0.9rem; }
}

/* 33. 지도에서 장소 그림 펼치기: 누른 장소의 산수화가 족자처럼 위에서 내려 펼쳐지고, 그 아래 겪은 일 */
.gmap-art {
  position: relative;
  margin: 2px 0 12px;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  box-shadow: 0 0 0 3px #17130f, 0 0 0 4px rgba(201, 164, 92, 0.3), 0 10px 22px rgba(0, 0, 0, 0.5);
  background: #d9cfb8;
}
.gmap-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  filter: sepia(0.35) contrast(1.05) brightness(0.9);
}
/* 가장자리를 먹빛으로 눌러 화면과 잇는다 */
.gmap-art::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 40px rgba(23, 19, 15, 0.55);
}
/* 아직 아무것도 겪지 않은 곳: 안개에 가린 듯 */
.gmap-art.is-unknown img { filter: sepia(0.35) blur(3px) brightness(0.75); opacity: 0.55; }
@media (prefers-reduced-motion: no-preference) {
  .gmap-art.is-new { transform-origin: 50% 0; animation: gmap-unroll 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes gmap-unroll {
    from { transform: scaleY(0.04); opacity: 0.2; }
    to { transform: none; opacity: 1; }
  }
}

/* 34. 유년 화면 무대: 자란 곳의 산수화를 바탕에(어른 사건 화면과 같은 방식), 화면 세로 가운데 */
body:has(.child-screen)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--place-art, none) center 35% / cover no-repeat;
  filter: invert(1) grayscale(1) contrast(1.15);
  opacity: 0.2;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 95%);
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 95%);
  pointer-events: none;
}
body:has(.child-screen.child-bg-inn) { --place-art: url("img/places/inn.webp"); }
body:has(.child-screen.child-bg-sect) { --place-art: url("img/places/sect.webp"); }
body:has(.child-screen.child-bg-market) { --place-art: url("img/places/market.webp"); }
body:has(.child-screen.child-bg-mountain) { --place-art: url("img/places/mountain.webp"); }
body:has(.child-screen.child-bg-road) { --place-art: url("img/places/road.webp"); }
.child-screen { margin-block: auto; }

/* PC: 나이 패와 글·선택지를 '패 한 장'으로 묶는다. 위에 나이, 가운데 글, 아래 선택 */
@media (min-width: 960px) {
  .app:has(.child-screen) { max-width: 820px; }
  .child-screen {
    display: flex;
    flex-direction: column;
    align-items: stretch; /* 원래 격자 짜임의 align-items: start가 남아 칸이 왼쪽으로 줄어든다 */
    gap: 16px;
    position: relative;
    padding: 30px 44px 32px;
    background:
      repeating-linear-gradient(90deg, rgba(255, 240, 200, 0.018) 0 2px, transparent 2px 7px),
      linear-gradient(180deg, rgba(46, 37, 28, 0.95), rgba(31, 25, 19, 0.96));
    border: 1px solid var(--gold-dim);
    border-radius: 6px;
    box-shadow: 0 0 0 4px #17130f, 0 0 0 5px rgba(201, 164, 92, 0.35), 0 22px 48px rgba(0, 0, 0, 0.6);
  }
  /* 패를 매단 끈 구멍 */
  .child-screen::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: #120e0a;
    box-shadow: inset 0 1px 2px #000, 0 0 0 1px rgba(201, 164, 92, 0.35);
  }
  .child-screen > * { grid-column: auto; }
  .child-screen > .child-head {
    position: static;
    padding: 6px 0 16px;
    background: none;
    border: 0;
    border-bottom: 1px solid rgba(201, 164, 92, 0.3);
    gap: 12px;
  }
  .child-screen .child-age { font-size: 2.1rem; line-height: 1.1; }
  .child-screen .origin-seal { width: 52px; height: 52px; line-height: 52px; font-size: 1.6rem; }
  .child-screen .child-chips { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .child-screen .child-chip-label { font-size: 0.8rem; }
  .child-screen .child-title { margin-top: 4px; }
}

/* ============================================================
   35~37 (2026-11-20, 옵시디언 "14 무림다움 점검" E·I·F)
   ============================================================ */

/* 35. 계절 한 겹: 봄 꽃잎 · 여름 빗줄기 · 가을 낙엽 · 겨울 눈. 아주 옅게, 느리게. 움직임 줄이기면 멈춘다.
   상·중·하순은 위쪽 빛(붉은 아침 → 흰 낮 → 푸른 밤)으로. 움직이는 것은 입자 한 겹뿐 */
.season-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.season-layer::before {
  content: "";
  position: absolute;
  inset: -320px 0 0;
  background-size: 260px 320px;
  opacity: 0;
}
.season-spring .season-layer::before {
  opacity: 0.32;
  background-image:
    radial-gradient(ellipse 4px 2.5px at 30px 40px, #f0b9c2 60%, transparent 100%),
    radial-gradient(ellipse 3px 2px at 150px 110px, #e8a7b3 60%, transparent 100%),
    radial-gradient(ellipse 4px 2.5px at 210px 230px, #f3c6cd 60%, transparent 100%),
    radial-gradient(ellipse 3px 2px at 80px 270px, #e8a7b3 60%, transparent 100%);
}
.season-summer .season-layer::before {
  opacity: 0.16;
  background-image:
    linear-gradient(180deg, transparent, #b9cbe0) 20px 10px / 1px 30px no-repeat,
    linear-gradient(180deg, transparent, #b9cbe0) 90px 130px / 1px 26px no-repeat,
    linear-gradient(180deg, transparent, #b9cbe0) 170px 40px / 1px 32px no-repeat,
    linear-gradient(180deg, transparent, #b9cbe0) 230px 210px / 1px 28px no-repeat,
    linear-gradient(180deg, transparent, #b9cbe0) 130px 260px / 1px 24px no-repeat;
  rotate: 8deg;
  scale: 1.2;
}
.season-autumn .season-layer::before {
  opacity: 0.3;
  background-image:
    radial-gradient(ellipse 5px 3px at 40px 60px, #c4733a 60%, transparent 100%),
    radial-gradient(ellipse 4px 3px at 190px 140px, #a8562c 60%, transparent 100%),
    radial-gradient(ellipse 5px 3px at 110px 250px, #c98a3e 60%, transparent 100%);
}
.season-winter .season-layer::before {
  opacity: 0.34;
  background-image:
    radial-gradient(circle 2px at 30px 30px, #f4f1ea 60%, transparent 100%),
    radial-gradient(circle 1.5px at 120px 90px, #f4f1ea 60%, transparent 100%),
    radial-gradient(circle 2.5px at 200px 170px, #f4f1ea 60%, transparent 100%),
    radial-gradient(circle 1.5px at 70px 220px, #f4f1ea 60%, transparent 100%),
    radial-gradient(circle 2px at 170px 290px, #f4f1ea 60%, transparent 100%);
}
@media (prefers-reduced-motion: no-preference) {
  .season-layer::before { animation: season-fall 40s linear infinite; }
  .season-summer .season-layer::before { animation-duration: 2.6s; }
  .season-autumn .season-layer::before { animation-duration: 48s; }
  .season-winter .season-layer::before { animation-duration: 32s; }
  @keyframes season-fall {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(0, 320px, 0); }
  }
}
/* 상·하순 빛: 위쪽에서 내려오는 옅은 빛 (움직이지 않는다). slot-2는 예전 세 칸 때의 것 */
.season-layer::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 46vh;
  background: radial-gradient(ellipse 70% 100% at 50% 0, var(--slot-light, transparent), transparent 75%);
}
.daily.slot-0 { --slot-light: rgba(214, 120, 90, 0.16); }
.daily.slot-1 { --slot-light: rgba(90, 120, 180, 0.16); } /* 2026-11-26 두 칸: 상순 붉은 아침빛, 하순 푸른 저녁빛 */
.daily.slot-2 { --slot-light: rgba(90, 120, 180, 0.16); }
/* 날짜 앞의 계절 한 글자 */
.day-season {
  margin-right: 6px;
  color: var(--gold);
  font-weight: 700;
}
/* 결산 쪽지의 절기 */
.month-terms {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

/* 36. 휴대폰: 상태창이 위로 지나가면 한 줄 호패. 누르면 맨 위로 (넓은 화면에는 없음) */
.status-mini { display: none; }
@media (max-width: 959px) {
  .status-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 0;
    left: 50%;
    z-index: 40;
    width: min(560px, 100%);
    padding: max(8px, env(safe-area-inset-top)) 14px 8px;
    translate: -50% -110%;
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(180deg, #3d3025, #2e241b);
    border: 0;
    border-bottom: 1px solid var(--gold);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: translate 0.22s ease, opacity 0.22s ease;
  }
  .daily.is-scrolled .status-mini { translate: -50% 0; opacity: 1; pointer-events: auto; }
  /* 붙어 있던 상태창을 놓아 주어 위로 흘러가게 한다 */
  .daily.is-scrolled > .status-bar { position: relative; }
  .mini-name { font-weight: 700; color: #f1e6cd; white-space: nowrap; }
  .mini-realm { color: var(--gold); font-size: 0.85rem; white-space: nowrap; }
  .mini-day { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
  .mini-bars { flex: 1; display: grid; gap: 2px; min-width: 60px; }
  .mini-bar { position: relative; display: block; height: 3px; border-radius: 2px; background: var(--bar-track); overflow: hidden; }
  .mini-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    transform-origin: 0 50%;
    transform: scaleX(var(--fill, 0));
    background: var(--bar-color);
  }
  .mini-bar.is-hp { --bar-color: var(--bar-hp); }
  .mini-bar.is-mp { --bar-color: var(--bar-mp); }
  .mini-bar.is-fatigue { --bar-color: var(--bar-fatigue); }
  .mini-bar.is-insight { --bar-color: var(--bar-insight); }
}
@media (max-width: 959px) and (prefers-reduced-motion: reduce) {
  .status-mini { transition: none; }
}

/* 37. 저자 진열: 약장 서랍 · 병기 걸이 · 보따리 */
/* 약장: 작은 서랍 넷이 한 줄, 서랍마다 한자 종이 이름표. 누른 서랍은 앞으로 빠져나온다 */
.shop-panel .cabinet {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
  padding: 8px;
  background: #2a1d12;
  border: 1px solid #1a120b;
  box-shadow: inset 0 0 0 3px #3a2918, 0 6px 14px rgba(0, 0, 0, 0.4);
}
.cabinet .drawer {
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-height: 96px;
  padding: 20px 4px 8px;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cabinet .drawer-hanja {
  padding: 3px 6px;
  background: #e9dcbc;
  color: #2a251f;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.cabinet .drawer-label {
  padding: 0;
  background: none;
  box-shadow: none;
  color: #d8c9aa;
  font-size: 0.82rem;
  font-weight: 400;
}
.cabinet .drawer-have {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.78rem;
}
.cabinet .drawer:hover,
.cabinet .drawer:focus-visible { box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.2), 0 0 0 1px var(--gold-dim); }
.cabinet .drawer.is-open {
  z-index: 1;
  transform: translateY(5px) scale(1.05);
  box-shadow: 0 0 0 1px #f0d99a, 0 10px 16px rgba(0, 0, 0, 0.6);
}
/* 빼낸 서랍의 쪽지 */
.drawer-open { margin-top: 10px; }
.drawer-hint { margin: 0; }
.drawer-slip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #4a3624, #3a2a1b);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}
.drawer-slip .skill-meta { margin: 0; color: #d8c9aa; }
.drawer-slip-hanja { color: var(--gold); font-weight: 700; letter-spacing: 0.08em; }
.drawer-slip-name { flex: 1; color: #f1e6cd; }
.drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawer-count { color: var(--gold); font-size: 0.85rem; }
.drawer-foot .drawer-buy { margin: 0; align-self: auto; min-width: 96px; }

/* 병기 걸이: 막대에 세로 패가 걸려 있다. 패 머리의 선 수가 품급(범품 하나 … 신병 넷) */
.rack .rack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 10px;
  padding: 0 4px;
}
.rack .ware {
  align-items: center;
  gap: 6px;
  width: 54px;
  min-height: 150px;
  padding: 10px 4px 8px;
  border-radius: 3px 3px 12px 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transform-origin: 50% -12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.rack .ware-lines { display: flex; flex-direction: column; gap: 2px; }
.rack .ware-lines i { display: block; width: 18px; height: 2px; background: var(--gold); }
.rack .ware.tier-divine .ware-lines i { background: #e8705e; }
.rack .ware-name {
  flex: 1;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.04em;
  font-weight: 700;
  font-size: 0.92rem;
  color: #f1e6cd;
}
.rack .ware-price { font-size: 0.78rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.rack .ware.is-owned .ware-price { color: var(--muted); }
.rack .ware:hover,
.rack .ware:focus-visible { rotate: -2deg; }
.rack .ware.is-open {
  transform: translateY(6px);
  box-shadow: 0 0 0 1px #f0d99a, 0 0 14px rgba(227, 194, 124, 0.35), 0 8px 14px rgba(0, 0, 0, 0.5);
  opacity: 1;
  filter: none;
}
.ware-open:empty { display: none; }
.ware-slip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(40, 31, 23, 0.97), rgba(30, 23, 17, 0.97));
  border: 1px solid var(--gold-dim);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}
@media (prefers-reduced-motion: no-preference) {
  .drawer-slip.is-new,
  .ware-slip.is-new { animation: slip-out 0.24s ease-out both; }
  @keyframes slip-out {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .cabinet .drawer,
  .rack .ware { transition: none; }
  .rack .ware:hover,
  .rack .ware:focus-visible { rotate: none; }
}

/* 보따리: 조각보를 펼치고 그 위에 종이로 싼 약봉지·물건을 놓는다. 두 귀에 매듭 */
.bundle-cloth {
  position: relative;
  margin-top: 12px;
  padding: 20px 16px;
  border-radius: 4px;
  background:
    conic-gradient(from 45deg, #6a2f27 0 25%, #2f4058 0 50%, #7a6a3a 0 75%, #3d5a46 0) 0 0 / 72px 72px;
  box-shadow: inset 0 0 0 999px rgba(22, 17, 12, 0.5), inset 0 0 26px rgba(0, 0, 0, 0.6), 0 6px 14px rgba(0, 0, 0, 0.4);
}
.bundle-cloth::before,
.bundle-cloth::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 40% 60% 50% 50%;
  background: radial-gradient(circle at 40% 35%, #8a4a3a, #5a2a20);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.bundle-cloth::before { top: -8px; left: -8px; rotate: -20deg; }
.bundle-cloth::after { right: -8px; bottom: -8px; rotate: 160deg; }
.bundle-cloth .list.bundle {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  background: none;
  box-shadow: none;
}
.bundle-cloth .inv-item {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  padding: 10px 10px 8px;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, #efe4c8, #ddd0b0);
  color: #2a251f;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}
.bundle-cloth .inv-item:nth-child(odd) { rotate: -1.2deg; }
.bundle-cloth .inv-item:nth-child(even) { rotate: 1deg; }
.bundle-cloth .skill-name { color: #2a251f; }
.bundle-cloth .skill-meta { color: #4a4035; }
.bundle-cloth .item-count { color: #8a5a10; font-weight: 700; }
/* 36: 스크롤을 지켜보는 점. 흐름 밖에 두어 칸 사이·격자 칸을 차지하지 않는다 */
.status-sentinel { position: absolute; top: 0; left: 0; width: 1px; height: 1px; pointer-events: none; }
/* 37: 휴대폰에서는 보따리 위 물건을 두 줄로 */
@media (max-width: 520px) {
  .bundle-cloth { padding: 16px 10px; }
  .bundle-cloth .list.bundle { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bundle-cloth .inv-item { padding: 8px 8px 6px; }
}
/* 37 손질: 가진 수가 놋쇠 손잡이와 겹쳐 왼쪽 위 귀퉁이로 */
.cabinet .drawer-have { left: 5px; right: auto; top: 3px; font-size: 0.74rem; }

/* ---- 붓글씨 제목 (2026-11-20, 글꼴 받은 뒤) ----
   동해독도는 획이 가늘고 글자가 작게 보여 본문 제목보다 1.3배쯤 키운다. 굵기는 400(가짜 굵게 금지).
   한자는 이 글꼴에 없어 바탕 글꼴로 나온다. */
.heading,
.event-title,
.crossroad-title,
.result-banner,
.result-band-text {
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-weight: 400;
}
.heading { font-size: 2.4rem; line-height: 1.15; letter-spacing: 0.1em; }
.event-title { font-size: 2.2rem; line-height: 1.15; }
.crossroad-title { font-size: 1.6rem; }
.result-banner { font-size: 2.2rem; letter-spacing: 0.3em; }
.result-band-text { font-size: 2.6rem; }

/* 현판: 입문·경지 돌파·생의 끝 제목은 검은 옻칠 판에 금 글씨 */
.heading.ending-title,
.heading.advance-title,
.heading.intro-title {
  align-self: center;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  padding: 10px 30px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
    #1d0f0b;
  border: 2px solid #8a6a2e;
  box-shadow: inset 0 0 0 4px #1d0f0b, inset 0 0 0 5px rgba(201, 164, 92, 0.55), 0 6px 14px rgba(0, 0, 0, 0.5);
  color: #e9c977;
  font-size: 3rem;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
  word-break: keep-all;
}
.heading.ending-title::before,
.heading.advance-title::before,
.heading.intro-title::before,
.heading.ending-title::after,
.heading.advance-title::after,
.heading.intro-title::after { content: none; }
.death .heading.ending-title { color: #e27a6a; border-color: #7d1a11; }
@media (max-width: 520px) {
  .heading { font-size: 1.9rem; }
  .event-title { font-size: 1.9rem; }
  .heading.ending-title,
  .heading.advance-title,
  .heading.intro-title { padding: 8px 18px 10px; font-size: 2.4rem; letter-spacing: 0.14em; text-indent: 0.14em; }
}

/* ============================================================
   39. 문파별 바탕 실루엣 (2026-11-20, src/scenery.js)
   일과 화면 맨 아래에 먹 그림자 한 장. 계절 한 겹(35번)보다 뒤, 글보다 훨씬 옅게. 움직이지 않는다.
   ============================================================ */
.sect-scenery {
  position: fixed;
  inset: auto 0 0;
  height: min(46vh, 420px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  --scn-far: #1a110c;
  --scn-near: #0b0705;
  --scn-gap: #2a1f18;
  --scn-bloom: #7e3238;
  --scn-mist: #d9ccb4;
  --scn-moon: #5e1a12;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%);
  mask-image: linear-gradient(180deg, transparent, #000 30%);
}
.sect-scenery svg { display: block; width: 100%; height: 100%; }
.sect-wudang .sect-scenery { --scn-mist: rgba(217, 204, 180, 0.22); }
.sect-cheonma .sect-scenery { -webkit-mask-image: none; mask-image: none; height: min(52vh, 470px); }
/* 휴대폰: 아래 탭 막대에 가리지 않게 조금 올리고 낮게 */
@media (max-width: 959px) {
  .sect-scenery { height: min(38vh, 320px); bottom: 56px; opacity: 0.42; }
  .sect-cheonma .sect-scenery { height: min(44vh, 360px); }
}

/* ============================================================
   싸움 그림 (2026-11-20, 사용자: "higgsfield ai의 도움을 받아 퀄리티를 올리자")
   Higgsfield(GPT Image 2.6)로 그린 수묵 그림을 CSS로 그리던 이펙트 자리에 끼운다.
   움직임·시각은 "싸움 몸짓 2"를 그대로 쓴다. 그림: img/fx, img/stages, img/characters/<id>_atk.webp
   ============================================================ */

/* ---- 싸움터 배경: 비무장 / 산길 / 심마(꿈속) ---- */
.arena.stage-yard,
.arena.stage-road,
.arena.stage-dream {
  background-position: center 72%;
  background-size: cover;
  background-repeat: no-repeat;
}
.arena.stage-yard {
  background-image: linear-gradient(180deg, rgba(246, 238, 218, 0.1), rgba(246, 238, 218, 0.3) 70%, rgba(234, 223, 196, 0.6)), url("img/stages/yard.webp");
}
.arena.stage-road {
  background-image: linear-gradient(180deg, rgba(246, 238, 218, 0.1), rgba(246, 238, 218, 0.3) 70%, rgba(234, 223, 196, 0.6)), url("img/stages/road.webp");
}
.arena.stage-dream {
  background-image: linear-gradient(180deg, rgba(246, 238, 218, 0.35), rgba(234, 223, 196, 0.55)), url("img/places/dream.webp");
}

/* ---- 공격 자세: 내지르는 동안만 <id>_atk.png로 바뀐다 (ui.js withAttackPose) ---- */
@property --atk {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
.figure.has-atk { position: relative; }
.figure.has-atk > .figure-img:not(.figure-atk) { opacity: calc(1 - var(--atk)); }
.figure-atk {
  position: absolute;
  left: 0;
  bottom: 0;
  opacity: var(--atk);
  pointer-events: none;
}
@keyframes pose-strike {
  0%, 18% { --atk: 0; }
  24%, 58% { --atk: 1; }
  72%, 100% { --atk: 0; }
}
@keyframes pose-strike-skill {
  0%, 38% { --atk: 0; }
  44%, 74% { --atk: 1; }
  86%, 100% { --atk: 0; }
}

/* ---- 맞는 자리의 그림 이펙트 ---- */
.impact-blade:not(.impact-block),
.impact-fist:not(.impact-block),
.impact-claw:not(.impact-block) {
  width: calc(var(--fw) * 0.95);
  height: calc(var(--fw) * 0.95);
}
.impact-skill.impact-blade,
.impact-skill.impact-fist,
.impact-skill.impact-claw {
  width: calc(var(--fw) * 1.25);
  height: calc(var(--fw) * 1.25);
}
.impact-blade::before,
.impact-fist::before,
.impact-claw::before {
  inset: 0;
  height: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  rotate: 0deg;
  -webkit-mask: none;
  mask: none;
  background: center / contain no-repeat;
}
.impact-blade::before { background-image: url("img/fx/fx_cut.webp"); animation: fx-wipe 0.42s cubic-bezier(0.2, 0.8, 0.3, 1) var(--d, 0s) both; }
.impact-claw::before { background-image: url("img/fx/fx_claw.webp"); animation: fx-wipe 0.42s ease-out var(--d, 0s) both; }
.impact-fist::before { background-image: url("img/fx/fx_burst.webp"); animation: fx-pop 0.45s ease-out var(--d, 0s) both; }
.impact-skill.impact-blade::before { background-image: url("img/fx/fx_skill_blade.webp"); animation: fx-pop-spin 0.6s ease-out var(--d, 0s) both; }
.impact-skill.impact-fist::before { background-image: url("img/fx/fx_skill_fist.webp"); animation: fx-pop 0.6s ease-out var(--d, 0s) both; }
/* 그림에 먹 튐까지 들어 있으니 CSS로 그리던 둘째 조각은 끈다 */
.impact-blade::after,
.impact-fist::after,
.impact-claw::after { display: none; }

/* 위 오른쪽에서 아래 왼쪽으로 그어진다 */
@keyframes fx-wipe {
  0% { opacity: 0; clip-path: inset(0 0 100% 100%); scale: 0.9; }
  12% { opacity: 1; }
  40% { opacity: 1; clip-path: inset(0 0 0 0); scale: 1; }
  100% { opacity: 0; clip-path: inset(0 0 0 0); scale: 1.06; }
}
@keyframes fx-pop {
  0% { opacity: 0; scale: 0.35; }
  18% { opacity: 1; scale: 0.92; }
  55% { opacity: 1; }
  100% { opacity: 0; scale: 1.25; }
}
@keyframes fx-pop-spin {
  0% { opacity: 0; scale: 0.4; rotate: -25deg; }
  20% { opacity: 1; scale: 0.95; }
  60% { opacity: 1; }
  100% { opacity: 0; scale: 1.2; rotate: 8deg; }
}

/* ---- 내지른 자국: 검은 초승달 궤적, 주먹은 권풍 ---- */
.thrust-blade::before {
  left: 0;
  top: -55%;
  width: 62%;
  height: 210%;
  border: 0;
  border-radius: 0;
  rotate: 0deg;
  background: url("img/fx/fx_arc.webp") center / contain no-repeat;
  transform-origin: left center;
  animation: fx-sweep 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) var(--d, 0s) both;
}
.thrust-blade.is-big::before { width: 78%; top: -80%; height: 260%; }
.thrust-blade::after { display: none; }
.thrust-fist::before {
  left: 8%;
  right: 4%;
  top: -70%;
  bottom: -70%;
  background: url("img/fx/fx_wind.webp") center / contain no-repeat;
}
.thrust-fist.is-big::before { top: -110%; bottom: -110%; }
.thrust-fist::after { display: none; }
@keyframes fx-sweep {
  0% { opacity: 0; scale: 0.4 0.9; }
  30% { opacity: 1; }
  100% { opacity: 0; scale: 1.05 1; translate: 6% 0; }
}

/* ---- 무공: 발밑에 모이는 기 소용돌이 그림 ---- */
.charge {
  width: calc(var(--fw) * 1.1);
  height: calc(var(--fw) * 0.34);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: url("img/fx/fx_charge.webp") center / 100% 100% no-repeat;
  animation: fx-charge 0.5s ease-in var(--d, 0s) both;
}
@keyframes fx-charge {
  0% { opacity: 0; scale: 1.5; }
  55% { opacity: 1; }
  100% { opacity: 0; scale: 0.6; }
}

/* 공격 자세 그림은 몸을 펼친 만큼 틀 안에서 작게 그려져 있어, 발을 기준으로 조금 키운다 */
.figure-atk { scale: 1.12; transform-origin: 35% bottom; }
/* 맞아서 어두워진 몸 위에서도 먹 그림 이펙트가 보이게: 한지 빛 테두리를 두껍게 */
.impact-blade::before, .impact-fist::before, .impact-claw::before {
  filter: drop-shadow(0 0 2px rgba(246, 238, 218, 1)) drop-shadow(0 0 7px rgba(246, 238, 218, 0.85));
}
/* 예전 무공 검선(높이 9px 띠) 규칙이 그림 칸을 덮지 않게 */
.impact-skill.impact-blade::before,
.impact-skill.impact-fist::before,
.impact-skill.impact-claw::before { inset: 0; height: auto; border: 0; }

/* ============================================================
   수련 족자 카드 (2026-11-20, 사용자가 시안 A "족자 카드"를 고름)
   수련 단추를 위아래 나무 축이 달린 세로 족자로 건다. 족자마다 큰 한자, 문파·수련별 수묵화
   (Higgsfield GPT Image 2.6, img/train/<문파>_<행동>.webp), 이름·부제·미리보기 수치, 아래에 붉은 술.
   .scroll-card 가 붙은 단추(수련 탭 다섯, 비무 탭 하나)에만 적용한다. 대회·혈도 단추는 그대로.
   ============================================================ */
.actions.scroll-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 16px;
  padding: 16px 4px 52px;
}
.actions.actions-one.scroll-row {
  grid-template-columns: minmax(0, 240px) !important;
  justify-content: center;
}
.daily .tab-body > .actions-board:has(.scroll-row) { column-span: all; }

.action-btn.scroll-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  min-height: 0;
  padding: 16px 10px 18px;
  text-align: center;
  border: 0;
  border-radius: 1px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 252, 240, 0.55), transparent 70%),
    linear-gradient(180deg, #f3ead4, #e8dab8);
  box-shadow:
    inset 0 0 0 1px rgba(90, 70, 40, 0.35),
    inset 0 0 26px rgba(120, 90, 40, 0.28),
    0 12px 22px rgba(0, 0, 0, 0.55);
  color: #2a251f;
  --text: #2a251f;
  --muted: #6f6556;
  transition: translate 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.action-btn.scroll-card::after { display: none; }
.action-btn.scroll-card:hover:not(:disabled) {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 252, 240, 0.7), transparent 70%),
    linear-gradient(180deg, #f6eed9, #ebdebe);
  translate: 0 -6px;
  box-shadow:
    inset 0 0 0 1px rgba(201, 164, 92, 0.8),
    inset 0 0 26px rgba(120, 90, 40, 0.22),
    0 0 0 2px rgba(227, 194, 124, 0.55),
    0 0 26px rgba(227, 194, 124, 0.35),
    0 18px 26px rgba(0, 0, 0, 0.55);
}
.action-btn.scroll-card:active:not(:disabled),
.action-btn.scroll-card.is-stamped { translate: 0 1px; }

/* 위아래 나무 축과 술 (그림: img/ui) */
.scroll-rod {
  position: absolute;
  left: -9px;
  right: -9px;
  height: 16px;
  background: url("img/ui/scroll_rod.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}
.scroll-rod.is-top { top: -10px; }
.scroll-rod.is-bottom { bottom: -10px; }
.scroll-tassel {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  width: 14px;
  height: 74px;
  margin-left: -7px;
  background: url("img/ui/scroll_tassel.webp") center top / contain no-repeat;
  transform-origin: 50% 0;
  pointer-events: none;
}
.action-btn.scroll-card:hover:not(:disabled) .scroll-tassel { animation: tassel-sway 1.6s ease-in-out infinite; }
@keyframes tassel-sway {
  0%, 100% { rotate: 0deg; }
  30% { rotate: 7deg; }
  70% { rotate: -6deg; }
}

/* 큰 한자 (붓글씨 글꼴에 한자가 없어 굵은 명조) */
.scroll-card .action-seal {
  order: -1;
  width: auto;
  height: auto;
  margin: 2px 0 0;
  background: none;
  box-shadow: none;
  border-radius: 4px;
  color: #17110b;
  font-family: "Noto Serif KR", "Batang", serif;
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255, 250, 235, 0.6);
}
.scroll-card.is-stamped .action-seal { padding: 0 6px; }
/* 오른쪽 위 작은 붉은 낙관 */
.scroll-stamp {
  position: absolute;
  top: 14px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 2px;
  background: #a3271a;
  color: #fbe9d0;
  font-family: "Noto Serif KR", "Batang", serif;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 18px;
  opacity: 0.85;
  rotate: 4deg;
}
/* 수묵화: 그림 가장자리가 한지로 번져 있어 곱하기로 종이에 스민다 */
.scroll-art {
  width: calc(100% + 8px);
  margin: 0 -4px;
  aspect-ratio: 4 / 5;
  background: var(--art) center 42% / cover no-repeat;
  mix-blend-mode: multiply;
  -webkit-mask: radial-gradient(ellipse 70% 72% at 50% 50%, #000 62%, transparent 100%);
  mask: radial-gradient(ellipse 70% 72% at 50% 50%, #000 62%, transparent 100%);
  transition: scale 0.25s ease;
}
.action-btn.scroll-card:hover:not(:disabled) .scroll-art { scale: 1.03; }
.scroll-card .action-name {
  margin-top: 4px;
  color: #1f1a14;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  line-height: 1.2;
}
.scroll-card .action-tagline {
  color: #8f2a1c;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
}
.scroll-card .action-hint {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(90, 70, 40, 0.25);
  width: 100%;
  color: #5c5244;
  font-size: 0.74rem;
  line-height: 1.45;
}
.scroll-card .action-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1px 8px;
}
.scroll-card .pv-label, .scroll-card .pv-from { color: #6f6556; }
.scroll-card .pv-arrow { color: #a08356; }
.scroll-card .pv-to { color: #2f6b22; }
.scroll-card .pv.is-ovr .pv-to { color: #8a6416; }
.scroll-card .pv.is-cost .pv-to { color: #a3271a; }
.scroll-card .pv.is-relief .pv-to { color: #23608a; }
.action-btn.scroll-card.is-locked .action-hint { color: #a3271a; }

/* 추천: 금빛 숨결은 그대로, 댕기는 족자 오른쪽 위 축 아래로 */
.action-btn.scroll-card.is-recommended { animation: scroll-glow 2.2s ease-in-out infinite; }
.action-btn.scroll-card.is-recommended::before { top: 6px; right: auto; left: 8px; z-index: 1; }
@keyframes scroll-glow {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(90, 70, 40, 0.35), inset 0 0 26px rgba(120, 90, 40, 0.28), 0 12px 22px rgba(0, 0, 0, 0.55), 0 0 0 rgba(227, 194, 124, 0); }
  50% { box-shadow: inset 0 0 0 1px rgba(201, 164, 92, 0.9), inset 0 0 26px rgba(120, 90, 40, 0.22), 0 12px 22px rgba(0, 0, 0, 0.55), 0 0 22px rgba(227, 194, 124, 0.55); }
}
.action-btn.scroll-card:disabled { opacity: 0.55; filter: grayscale(0.7) brightness(0.85); }

/* 중간 폭: 세 장씩 */
@media (max-width: 959px) {
  .actions.scroll-row { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; row-gap: 64px; }
}
/* 휴대폰: 옆으로 넘겨 보는 족자 줄 */
@media (max-width: 699px) {
  .actions.scroll-row:not(.actions-one) {
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: 58%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    padding: 16px 14px 56px;
    margin: 0 -14px;
  }
  .actions.scroll-row .scroll-card { scroll-snap-align: center; }
  .scroll-card .action-seal { font-size: 2.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .action-btn.scroll-card.is-recommended,
  .action-btn.scroll-card:hover .scroll-tassel { animation: none !important; }
  .action-btn.scroll-card, .scroll-art { transition: none; }
}
/* 예전 현판(격자) 규칙의 align-self: end/start 가 세로 족자에서 글을 오른쪽으로 미는 것을 막는다 */
.scroll-card .action-seal,
.scroll-card .action-name,
.scroll-card .action-tagline,
.scroll-card .action-hint { align-self: center; justify-self: center; text-align: center; }
@media (max-width: 699px) {
  .actions.scroll-row:not(.actions-one) { scrollbar-width: none; }
  .actions.scroll-row:not(.actions-one)::-webkit-scrollbar { display: none; }
  .scroll-art { aspect-ratio: 1 / 1; }
}
/* 비무 탭의 比 족자 하나: 연무장 아래에서 길게 늘어지지 않게 그림을 가로로 낮춘다 */
.actions.actions-one.scroll-row { grid-template-columns: minmax(0, 320px) !important; padding-bottom: 60px; }
.actions-one .scroll-card .scroll-art { aspect-ratio: 16 / 8; background-position: center 55%; }
.actions-one .scroll-card .action-seal { font-size: 2.2rem; }

/* ============================================================
   다른 화면도 Higgsfield 그림으로 (2026-11-21, 사용자: "다른 화면도 Higgsfield로 바꿔줘")
   시작 화면 산수화(img/ui/cover.webp), 출신 그림(img/ui/origin_<id>.webp),
   물건 그림 26장(img/items/<id>.webp: 병기·옷·장신구·약), 수련 장면 창에 족자 그림(img/train) 다시 쓰기.
   ============================================================ */

/* ---- 시작 화면: 수묵 산수화를 맨 뒤에 깔고, 마우스 깊이를 조금 받는다 ---- */
.cover { isolation: isolate; }
.cover-painting {
  position: absolute;
  inset: -32px calc(var(--gap) * -1) 0;
  z-index: -1;
  background: url("img/ui/cover.webp") center 35% / cover no-repeat;
  opacity: 0.78;
  -webkit-mask: linear-gradient(180deg, #000 55%, transparent 100%), linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-composite: source-in;
  mask: linear-gradient(180deg, #000 55%, transparent 100%), linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-composite: intersect;
  translate: calc(var(--mx, 0) * -8px) calc(var(--my, 0) * -5px);
  scale: 1.03;
  transition: translate 0.4s ease-out;
  animation: cover-fade 1.8s ease-out both;
  pointer-events: none;
}
/* 그림 안에 달이 있으니 CSS로 그리던 달은 끈다 */
.cover:has(.cover-painting)::before { display: none; }
/* 제목·글이 그림 위에서 읽히게 가운데를 살짝 어둡게 */
.cover-stage, .cover-sub, .cover-ask { position: relative; }
.cover-ask::before {
  content: "";
  position: absolute;
  inset: -18px -40px;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 50%, rgba(14, 11, 8, 0.72), transparent 72%);
  pointer-events: none;
}
.cover-sub { text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }

/* ---- 출신: 태어난 자리의 수묵화 위에 출신 한 글자가 찍힌다 ---- */
.origin-art {
  display: block;
  width: min(100%, 560px);
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center 45%;
  -webkit-mask: radial-gradient(ellipse 72% 70% at 50% 46%, #000 58%, transparent 100%);
  mask: radial-gradient(ellipse 72% 70% at 50% 46%, #000 58%, transparent 100%);
  opacity: 0.92;
  animation: cover-fade 1.2s ease-out 0.1s both;
}
.origin-art + .origin-reveal { margin-top: -96px; }

/* ---- 수련 장면 창: 위에 족자 그림 ---- */
.scene-art {
  display: block;
  width: calc(100% + 60px);
  margin: -30px -30px 4px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center 42%;
  mix-blend-mode: multiply;
  -webkit-mask: linear-gradient(180deg, #000 70%, transparent);
  mask: linear-gradient(180deg, #000 70%, transparent);
  animation: cover-fade 0.5s ease-out both;
}
.scene-art ~ .scene-seal { position: relative; }

/* ---- 물건 그림: 먹 그림이라 어두운 칸 위에서는 한지 원판에 올려 둔다 ---- */
.item-art {
  flex: none;
  display: block;
  object-fit: contain;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #f4ecd8 0 56%, #ddd0ad 72%, rgba(221, 208, 173, 0) 73%);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}
.gear-art { width: 46px; height: 46px; padding: 4px; }
.bundle-art { width: 54px; height: 54px; padding: 5px; }
.gear-slot, .bundle-item, .gear-panel .inv-item { gap: 10px; }
.ware-art { width: 44px; height: 44px; padding: 4px; align-self: center; margin: 2px 0; }
.ware.is-open .ware-art { background: radial-gradient(circle at 50% 42%, #fff6dd 0 56%, #e6d6ad 72%, rgba(230, 214, 173, 0) 73%); }
.slip-art {
  float: left;
  width: 84px;
  height: 84px;
  padding: 6px;
  margin: 0 12px 6px 0;
}
.ware-slip::after, .drawer-slip::after { content: ""; display: block; clear: both; }
@media (prefers-reduced-motion: reduce) {
  .cover-painting, .origin-art, .scene-art { animation: none; transition: none; }
}

/* ---- 강호 지도: 굵은 먹으로 그린 지도 그림 (Higgsfield, img/ui/gangho_map.webp, 사용자 요청 2026-11-21) ----
   금빛 가는 선(SVG)을 걷고 한지 위 수묵 지도를 깐다. 장소 표시는 먹 위에서 읽히게 한지 원판 + 붉은 테 */
.gmap {
  aspect-ratio: 16 / 9;
  background: url("img/ui/gangho_map.webp") center / 100% 100% no-repeat, #efe6cf;
  box-shadow: inset 0 0 0 1px rgba(90, 70, 40, 0.5), inset 0 0 50px rgba(110, 80, 40, 0.35), 0 8px 18px rgba(0, 0, 0, 0.45);
}
.gmap > svg { display: none; }
.gmap .gmap-seal {
  border: 1.5px solid #8f2a1c;
  background: radial-gradient(circle at 50% 40%, #fbf5e6, #ecdfc0);
  box-shadow: 0 0 0 3px rgba(251, 245, 230, 0.7), 0 2px 6px rgba(40, 25, 10, 0.45);
  color: #2a1d12;
  font-weight: 700;
}
.gmap .gmap-name {
  color: #1f1710;
  font-weight: 700;
  text-shadow: 0 0 3px #f6eedb, 0 0 6px #f6eedb, 0 0 10px #f6eedb;
}
.gmap .gmap-count {
  color: #6b5b45;
  text-shadow: 0 0 3px #f6eedb, 0 0 6px #f6eedb;
}
.gmap .gmap-spot.is-unknown .gmap-seal { border-style: dashed; border-color: #8a7a62; color: #7a6a52; background: rgba(246, 238, 219, 0.85); }
.gmap .gmap-spot:hover .gmap-seal,
.gmap .gmap-spot:focus-visible .gmap-seal { border-color: #b5372a; }
.gmap .gmap-spot:focus-visible .gmap-seal { box-shadow: 0 0 0 3px #fbf5e6, 0 0 0 5px #b5372a; }
.gmap .gmap-spot.is-active .gmap-seal { background: #a3271a; border-color: #5c120b; color: #fff1d6; }
/* 시작 화면 그림은 가운데 칸이 아니라 창 전체에 (고정). 그림이 있으면 화면 흔들림·CSS 산은 끈다 */
.cover:has(.cover-painting) { animation: none; }
.cover:has(.cover-painting) .cover-mountains { display: none; }
.cover-painting {
  position: fixed;
  inset: 0;
  opacity: 0.88;
  -webkit-mask: linear-gradient(180deg, #000 70%, transparent 100%);
  -webkit-mask-composite: source-over;
  mask: linear-gradient(180deg, #000 70%, transparent 100%);
  mask-composite: add;
  background-position: center 40%;
}
/* 그림이 밝은 곳에서도 제목과 단추가 읽히게, 가운데 기둥만 살짝 어둡게 */
.cover:has(.cover-painting)::after {
  inset: 0 calc(var(--gap) * -1);
  height: auto;
  bottom: 0;
  background: radial-gradient(ellipse 60% 70% at 50% 45%, rgba(12, 9, 7, 0.55), transparent 75%);
  filter: none;
  animation: none;
  z-index: -1;
}

/* ============================================================
   사건·기연 장면 그림 (2026-11-21, 사용자: "사건·기연 장면")
   Higgsfield로 사건마다 그린 수묵 장면(img/events/<id>.webp, 55장)을 제목 아래에 넓게 건다.
   그림이 뜨면(has-art) 인물 초상은 숨긴다. 결과 화면은 같은 그림을 낮게.
   ============================================================ */
.event-art {
  position: relative;
  margin: 0;
  align-self: stretch;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #efe6cf;
  box-shadow: 0 0 0 1px rgba(201, 164, 92, 0.45), 0 0 0 5px #2a2018, 0 0 0 6px rgba(201, 164, 92, 0.35), 0 14px 30px rgba(0, 0, 0, 0.55);
  animation: event-art-in 0.7s ease-out both;
}
.event-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 가장자리의 바랜 기운 */
.event-art::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 40px rgba(110, 80, 40, 0.35);
  pointer-events: none;
}
.event-screen.is-fortune .event-art {
  box-shadow: 0 0 0 1px rgba(227, 194, 124, 0.8), 0 0 0 5px #2a2018, 0 0 0 6px rgba(227, 194, 124, 0.6), 0 0 34px rgba(227, 194, 124, 0.25), 0 14px 30px rgba(0, 0, 0, 0.55);
}
.event-screen.is-result .event-art { aspect-ratio: 16 / 6; }
.event-screen.is-result .event-art img { object-position: center 45%; }
.event-screen.has-art > .figure.portrait-lg { display: none; }
@keyframes event-art-in {
  from { opacity: 0; clip-path: inset(0 0 100% 0); }
  to { opacity: 1; clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
  .event-art { animation: none; }
}

/* ---- 버그 고침 (2026-11-21, 사용자: "수련 버튼을 누르면 화면이 위아래로 조금씩 움직여") ----
   누르면 화면을 새로 그리면서 마우스 아래 족자가 내려앉았다가(새 카드) 다시 떠오르며(hover -6px) 출렁였다.
   족자는 움직이지 않고 금빛 테·빛만 바뀐다. 누를 때 눌림도 위치 대신 밝기로. */
.action-btn.scroll-card:hover:not(:disabled),
.action-btn.scroll-card:active:not(:disabled),
.action-btn.scroll-card.is-stamped { translate: none; }
.action-btn.scroll-card:active:not(:disabled) { filter: brightness(0.96); }
.action-btn.scroll-card { transition: box-shadow 0.18s ease, filter 0.12s ease; }

/* ---- 사건 화면: 그림은 그대로, 선택지를 낮게 줄여 스크롤 없이 (사용자 요청 2026-11-21) ----
   넓은 화면에서 선택지를 두 줄 격자로 놓고 칸 높이·번호 원·글 사이를 줄인다. */
@media (min-width: 960px) {
  .event-screen { gap: 12px; }
  .event-screen .buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .event-screen .choice-btn {
    min-height: 44px;
    padding: 7px 12px 7px 9px;
    column-gap: 10px;
    grid-template-columns: 24px 1fr;
  }
  .event-screen .choice-btn::before {
    width: 24px;
    height: 24px;
    line-height: 22px;
    font-size: 0.78rem;
  }
  .event-screen .choice-btn .action-hint { margin-top: 2px; font-size: 0.7rem; }
  .event-screen .panel.story { padding-top: 6px; padding-bottom: 6px; line-height: 1.75; }
  .event-screen .event-when { margin: 0; }
  /* 선택지가 하나뿐이면 한 줄을 다 쓴다 */
  .event-screen .buttons > .choice-btn:only-child { grid-column: 1 / -1; }
}

/* ============================================================
   문파 산문·입문 장면 그림 (2026-11-21, 사용자: "문파 대문 입문 화면도 부탁해")
   고르기 카드: 왼쪽 대문 자리에 문파 산문 그림(img/sects/gate_<id>.webp, 3:4), 귀퉁이에 문파 한 글자.
   막힌 문파는 그림이 잿빛이 되고 빗장이 질린다. 입문: 주인공이 열린 산문 앞에 선 그림(intro_<id>.jpg)이
   문짝처럼 가운데부터 좌우로 열리며 드러난다. 그림을 못 읽으면 CSS 대문(29번)이 그대로.
   ============================================================ */
.gate-pic { position: relative; display: block; }
.gate-art, .intro-art { display: none; }
.gate-pic.has-art .gate, .intro-stage.has-art .gate { display: none; }
.gate-pic-seal { display: none; }
.gate-pic.has-art .gate-art {
  display: block;
  width: var(--gw);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(201, 164, 92, 0.5), 0 0 0 4px #1c1611, 0 0 0 5px color-mix(in srgb, var(--flag) 70%, transparent), 0 10px 22px rgba(0, 0, 0, 0.55);
  transition: filter 0.25s ease, scale 0.25s ease;
}
.gate-pic.has-art .gate-pic-seal {
  display: grid;
  place-items: center;
  position: absolute;
  top: 8px;
  left: 8px;
  width: 34px;
  height: 34px;
  border-radius: 3px;
  background: var(--flag);
  color: #fbecd2;
  font-family: "Noto Serif KR", "Batang", serif;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  rotate: -4deg;
}
.gate-card:not(:disabled):hover .gate-pic.has-art .gate-art { filter: brightness(1.06) saturate(1.1); }
/* 받아 주지 않는 문: 잿빛 + 엇갈린 빗장 */
.gate-card.is-locked .gate-pic.has-art .gate-art { filter: grayscale(1) brightness(0.62); }
.gate-card.is-locked .gate-pic.has-art::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: 50%;
  height: 14px;
  translate: 0 -50%;
  rotate: -8deg;
  background: linear-gradient(180deg, #6a4a2c, #3d2817);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 220, 170, 0.25);
}

/* 입문: 큰 그림이 가운데부터 문짝처럼 열린다 */
.intro-stage.has-art { width: min(100%, 880px); margin: 18px auto 4px; }
.intro-stage.has-art .intro-art {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(201, 164, 92, 0.55), 0 0 0 5px #1c1611, 0 0 0 6px rgba(201, 164, 92, 0.4), 0 18px 40px rgba(0, 0, 0, 0.6);
  animation: intro-doors 1.6s cubic-bezier(0.6, 0, 0.2, 1) 0.35s both, intro-push 6s ease-out 0.35s both;
}
@keyframes intro-doors {
  0% { clip-path: inset(0 50% 0 50%); filter: brightness(0.5); }
  100% { clip-path: inset(0 0 0 0); filter: brightness(1); }
}
@keyframes intro-push {
  from { scale: 1.06; }
  to { scale: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .intro-stage.has-art .intro-art { animation: none; }
}

/* ============================================================
   인연 그림 (2026-11-21, 사용자: "인연화면도 힉스필드로 바꿔")
   고수 다섯마다 그 사람이 있는 자리의 수묵화(img/bonds/npc_<id>.webp), 숙적은 모를 때 안개 속 그림자
   (rival_unknown) / 만난 뒤 달밤 절벽(rival_known). 인연 카드·숙적 칸 위에 띠 그림, 찾아간 화면에 큰 그림.
   ============================================================ */
.npc-card { flex-wrap: wrap; }
.npc-art,
.rival-art {
  display: block;
  flex: 1 0 100%;
  width: calc(100% + 24px);
  margin: -12px -12px 2px;
  aspect-ratio: 16 / 6;
  object-fit: cover;
  object-position: center 45%;
  -webkit-mask: linear-gradient(180deg, #000 62%, transparent);
  mask: linear-gradient(180deg, #000 62%, transparent);
  opacity: 0.92;
}
.npc-card.is-ready .npc-art { opacity: 1; }
.npc-card:not(.is-ready) .npc-art { filter: saturate(0.75) brightness(0.9); }
.rival-art {
  width: 100%;
  margin: 2px 0 10px;
  aspect-ratio: 16 / 7;
  -webkit-mask: linear-gradient(180deg, #000 70%, transparent);
  mask: linear-gradient(180deg, #000 70%, transparent);
}
/* 찾아간 화면: 큰 그림, 그림이 뜨면 전신 초상은 숨긴다 */
.npc-visit-art { display: contents; }
.npc-visit-art:not(.has-art) > .event-art { display: none; }
.npc-visit-art.has-art > .portrait-lg { display: none; }
/* 인연 카드는 격자(초상 · 이름패 · 글)라 띠 그림이 한 칸을 차지했다: 첫 줄 전체를 가로지르게 */
.npc-card > .npc-art { grid-column: 1 / -1; width: calc(100% + 24px); }

/* ============================================================
   강호 탭 그림 (2026-11-21, 사용자: "강호 화면도 부탁해")
   의뢰 방마다 먹 그림(img/quests/<id>.webp, 18장: 토벌은 현상수배 초상, 호위·심부름은 장면)을 종이에 스미게,
   나의 이야기(列傳) 머리에 문파 입문 그림(img/sects/intro_<문파>.webp)을 다시 쓴다.
   ============================================================ */
.quest-art {
  display: block;
  width: calc(100% - 40px);
  margin: 6px 0 4px;
  aspect-ratio: 16 / 6;
  object-fit: cover;
  object-position: center 30%;
  mix-blend-mode: multiply;
  -webkit-mask: radial-gradient(ellipse 62% 75% at 50% 50%, #000 55%, transparent 100%);
  mask: radial-gradient(ellipse 62% 75% at 50% 50%, #000 55%, transparent 100%);
}
.quest-card.type-토벌 .quest-art,
.quest-card:has(.type-토벌) .quest-art { object-position: center 22%; }
.quest-card.is-done .quest-art { filter: grayscale(0.6); opacity: 0.7; }
.story-art {
  display: block;
  width: 100%;
  margin: 4px 0 10px;
  aspect-ratio: 16 / 6;
  object-fit: cover;
  object-position: center 55%;
  -webkit-mask: linear-gradient(180deg, #000 65%, transparent);
  mask: linear-gradient(180deg, #000 65%, transparent);
  opacity: 0.9;
}

/* ---- 삶의 큰 장면 그림 (2026-11-22): 폐관·비무대회·경지 돌파·죽음 둘·생사경 (img/life) ----
   사건 그림(.event-art) 틀을 그대로 쓰고, 화면마다 높이만 조금 낮춘다. */
.life-art { align-self: stretch; aspect-ratio: 16 / 7; }
.life-art img { object-position: center 45%; }
.ending .life-art, .advance-screen .life-art { aspect-ratio: 16 / 6; }
.seclusion .life-art img { object-position: center 30%; }

/* ---- 버그 고침 2 (2026-11-22, 사용자: "수련 단추 출렁임 안 고쳐졌어") ----
   진짜 마우스로 재 보니 누르는 순간 족자 위 끝이 8px 내려갔다 0.1초 뒤 돌아왔다(tools/shots/jitter.mjs).
   모든 단추 공통의 "누르면 0.96배"(:where(button):active)가 키 큰 족자에서는 출렁임으로 보였다. 족자만 끈다. */
.action-btn.scroll-card:active:not(:disabled),
.action-btn.scroll-card.is-stamped { scale: none; }
/* 사건 그림: 펼쳐지는 연출은 그림이 다 읽힌 뒤에(is-loaded). 읽는 동안은 한지 빛 빈 틀 */
.event-art:not(.life-art) { animation: none; }
.event-art.is-loaded:not(.life-art) { animation: event-art-in 0.7s ease-out both; }
.event-art img { opacity: 0; transition: opacity 0.25s ease; }
.event-art.is-loaded img, .life-art img { opacity: 1; }
.npc-visit-art .event-art img { opacity: 1; }
.npc-visit-art .event-art { animation: event-art-in 0.7s ease-out both; }

/* ---- 버그 고침 3 (2026-11-22, 사용자 영상): 수련을 누를 때마다 출렁인 진짜 까닭 ----
   달이 바뀌면 결산 쪽지가 일과 맨 위에 끼어 아래를 밀어내고, 다음 수련 때 사라지며 다시 끌어올렸다(약 40px).
   쪽지를 흐름에서 빼서 오른쪽 아래에 뜬 쪽지로. 나타나고 사라져도 아무것도 밀리지 않는다. */
.daily .tab-body > .month-note,
.month-note {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: min(440px, calc(100vw - 32px));
  max-height: 46vh;
  overflow: auto;
  column-span: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(143, 34, 23, 0.4);
  animation: month-pop 0.45s cubic-bezier(0.3, 0.7, 0.2, 1) both;
}
@keyframes month-pop { from { opacity: 0; translate: 0 14px; } }
@media (max-width: 959px) {
  .daily .tab-body > .month-note,
  .month-note { right: 16px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* 사건 그림: 위에서 닦이며 펼쳐지는 연출이 장소 배경·글과 엇갈려 보였다 → 짧게 스미기만 */
.event-art.is-loaded:not(.life-art),
.npc-visit-art .event-art { animation: event-art-fade 0.22s ease-out both; }
@keyframes event-art-fade { from { opacity: 0; } }
.event-art img { transition: none; }

/* ============================================================
   애니메이션 점검 (2026-11-23, Emil Kowalski 기준 3번)
   휴대폰은 탭하면 :hover가 남는다. 떠오르거나 비키는 올림 효과가 굳어 "떠 있는 단추"가 되지 않게
   마우스가 없는 화면에서는 움직임만 걷는다(색·테두리 변화는 그대로). 누름(:active)과 낙관 찍힘은 건드리지 않는다.
   ============================================================ */
@media (hover: none), (pointer: coarse) {
  .action-btn:hover:not(:disabled):not(:active):not(.is-stamped),
  .choice-btn:not(:disabled):hover:not(:active),
  .cover .btn:not(.btn-primary):not(:disabled):hover:not(:active),
  .cover .btn-primary:not(:disabled):hover:not(:active) {
    translate: none;
  }
  .action-btn.scroll-card:hover:not(:disabled) .scroll-art { scale: 1; }
  .gate-card:hover:not(:disabled):not(:focus-visible) .gate-door.is-left,
  .gate-card:hover:not(:disabled):not(:focus-visible) .gate-door.is-right { rotate: none; }
  .gmap-spot:hover:not(:focus-visible) .gmap-seal { scale: 1; }
  .rack .ware:hover:not(:focus-visible) { rotate: none; }
}

/* ---- 배경 음악 단추 (2026-11-23, src/bgm.js) ---- */
/* 시작 화면: 견문록 단추 왼쪽 */
.cover .cover-music {
  position: absolute;
  top: 2px;
  right: 104px;
  z-index: 2;
  background: rgba(29, 25, 21, 0.8);
  border-color: rgba(201, 164, 92, 0.5);
  color: var(--gold);
  animation: cover-fade 0.8s ease-out 1.6s both;
}
.cover .cover-music.is-off { color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .cover .cover-music { animation: none; }
}

/* ==========================================================================
   41. 한자 걷어내기와 무림 낱말 말풍선 (2026-11-23)
   화면의 한자를 모두 한글로 바꿨다. 무림 맛은 붓글씨체·먹·붉은 도장 모양으로 낸다.
   ========================================================================== */

/* 도장 안의 한글: 한 글자 칸에 맞춘 도장이라 글자가 많으면 도장 글자 크기를 기준으로 줄인다 */
.ko-fit {
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.04em;
}
.ko-2 { font-size: 0.6em; }
.ko-3 { font-size: 0.46em; }
.ko-4 { font-size: 0.38em; }
.ko-5 { font-size: 0.3em; }

/* 세로 현판(문파 대문)은 세로로 쓰니 줄이지 않아도 들어간다 */
.gate-plaque .ko-fit { font-size: 0.78em; letter-spacing: 0; }

/* 바탕의 옅은 문파 문양: 두 글자라 세로로 세운다 */
@media (min-width: 960px) {
  .daily .status-bar::after {
    writing-mode: vertical-rl;
    font-size: 5.4rem;
    letter-spacing: -0.06em;
  }
  .daily .avatar-seal::before { font-size: 0.8rem; letter-spacing: -0.05em; }
}

/* 아래 탭: 한자 대신 먹 그림 */
.tab-icon {
  display: grid;
  place-items: center;
  height: 1.2em;
}
.tab-icon svg {
  width: 1.05em;
  height: 1.05em;
}
.tab-btn.is-main .tab-icon svg { width: 1.15em; height: 1.15em; }

/* 오른쪽 위 단추: 동그란 한자 대신 한글 이름표(붉은 테 낙관 모양은 그대로) */
.sound-toggle {
  width: auto;
  min-width: 30px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.sound-toggle.is-off { text-decoration: line-through; text-decoration-thickness: 1px; }
.codex-btn { padding: 0 11px; }

/* 무림 낱말: 점선 밑줄, 마우스를 올리면 한지 말풍선 */
.has-tip {
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
  text-underline-offset: 3px;
  cursor: help;
}

.term-tip {
  position: fixed;
  z-index: 60;
  max-width: min(300px, calc(100vw - 16px));
  padding: 10px 13px 9px;
  border: 1px solid #b9a27a;
  border-radius: 3px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.5), transparent 60%),
    #f1e6cc;
  color: #2a231b;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 3px rgba(241, 230, 204, 1), inset 0 0 0 4px rgba(143, 34, 23, 0.35);
  pointer-events: none;
  animation: term-tip-in 0.14s ease-out both;
}
.term-tip-name {
  display: block;
  margin-bottom: 4px;
  color: #8f2217;
  font-size: 0.95rem;
}
.term-tip p { margin: 0; font-size: 0.84rem; line-height: 1.5; }
.term-tip-how { margin-top: 4px !important; color: #5b4c3a; }
@keyframes term-tip-in {
  from { opacity: 0; translate: 0 4px; }
  to { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .term-tip { animation: none; }
}
/* 오른쪽 위 단추 묶음: 휴대폰은 이름 줄 끝에, PC 호패에서는 맨 위 한 줄(이름을 가리지 않게) */
.status-tools {
  flex: none;
  display: flex;
  gap: 5px;
}
.daily .status-top { flex-wrap: wrap; }
.daily .status-tools {
  order: -1;
  flex: 1 0 100%;
  justify-content: flex-end;
}
.daily .status-tools .sound-toggle { height: 28px; }
/* 족자 모서리 붉은 도장: 한글 두 글자가 읽히게 조금 넓힌다 */
.scroll-stamp {
  width: auto;
  height: auto;
  padding: 3px 4px;
  line-height: 1;
}
.scroll-stamp .ko-fit { font-size: 0.68rem; }

/* PC 호패의 둥근 문파 낙관: 두 글자를 가운데에 */
@media (min-width: 960px) {
  .daily .avatar-seal { display: flex; align-items: center; justify-content: center; }
  .daily .avatar-seal::before { display: block; width: 100%; }
}
/* 효과음·음악 단추: 글 대신 먹 선 그림 (동그라미) */
.sound-toggle:not(.codex-btn) {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  padding: 0;
  text-decoration: none;
}
.sound-toggle:not(.codex-btn) svg { width: 17px; height: 17px; }
.daily .status-tools .sound-toggle:not(.codex-btn) { width: 28px; min-width: 28px; }
/* 아래 탭: 그림을 뺀 뒤(2026-11-23, 사용자: "무게감이 없어 그림을 없애줘") 이름만 굵고 크게, 칸 가운데에 */
.tab-btn { justify-content: center; }
.tab-label {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.tab-btn.is-main .tab-label { font-size: 1.12rem; }
@media (min-width: 960px) {
  .daily .tab-label { font-size: 1.12rem; letter-spacing: 0.18em; }
  .daily .tab-btn.is-main .tab-label { font-size: 1.2rem; }
}
/* 의뢰 급 낙관: 한자 한 글자(下·中·上·特·天)를 크게 */
.quest-seal { font-size: 1.45rem; line-height: 1; letter-spacing: 0; }
/* 족자 모서리 도장: 한자 한 글자 (이름이 두 번 나오지 않게, 2026-11-23) */
.scroll-stamp {
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 0.86rem;
  line-height: 1;
}
/* 족자 큰 이름(내공·외공 …): 반듯한 바탕체 대신 붓글씨, 먹이 살짝 번진 듯 (2026-11-23, 사용자: "정자라 딱딱하다") */
.action-btn.scroll-card .action-seal {
  font-family: "Murim Brush", "Noto Serif KR", "Batang", serif;
  font-weight: 400;
  color: #1b1610;
  text-shadow: 0 0 1px rgba(27, 22, 16, 0.55), 0.5px 1px 2px rgba(27, 22, 16, 0.18);
}
.action-btn.scroll-card .action-seal .ko-fit {
  font-size: 1.08em;
  letter-spacing: 0.02em;
  rotate: -2deg;
}
/* 달 결산 쪽지: "다시 안 보기"는 접기 옆에 흐리게 */
.month-never { opacity: 0.75; margin-left: auto; }
.month-never + .month-close { margin-left: 6px; }
.codex-month-back { margin: 8px 0 0 auto; display: block; }.month-note .month-never {
  opacity: 1;
  background: transparent;
  color: #6b5a45;
  border: 1px solid rgba(107, 90, 69, 0.35);
  box-shadow: none;
  font-size: 0.8rem;
}
.month-note .month-never:hover { color: #2a231b; border-color: rgba(107, 90, 69, 0.7); }
/* 표지 아래 안내 링크 (소개·가이드·공략·패치노트·방침·문의, 2026-11-24) */
.cover-links {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin: 18px auto 6px;
  padding: 0 16px;
  font-size: 0.8rem;
}
.cover-links a {
  color: rgba(240, 231, 211, 0.62);
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.cover-links a:hover { color: #f0e7d3; text-decoration: underline; }
/* 후원 링크 (인터넷 3단계, 2026-11-24): 배포본에서 site.config.json의 donateUrl이 있을 때만 */
.cover .cover-donate {
  position: absolute;
  top: 2px;
  left: 0;
  z-index: 2;
  padding: 5px 12px;
  border: 1px solid rgba(201, 164, 92, 0.5);
  border-radius: 999px;
  background: rgba(29, 25, 21, 0.8);
  color: var(--gold);
  font-size: 0.82rem;
  text-decoration: none;
  animation: cover-fade 0.8s ease-out 1.6s both;
}
.cover .cover-donate:hover { color: #f0d99a; border-color: var(--gold); }
.donate-note {
  margin: 10px 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.donate-note .donate-link { color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .cover .cover-donate { animation: none; } }
/* 생업의 길 열쇠 (2026-11-26, DESIGN.md 6.41): 갈림길의 생업 단추 아래 결제 칸 */
.choice-btn.is-locked { opacity: 0.55; }
.civil-lock {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(201, 164, 92, 0.45);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  background: rgba(20, 15, 11, 0.55);
}
.civil-lock-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.civil-lock-seal {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 3px;
  background: var(--accent); color: #fbe9d0; font-weight: 700; font-size: 1rem; rotate: -4deg;
}
.civil-test { padding: 1px 8px; border: 1px dashed var(--gold); border-radius: 999px; color: var(--gold); font-size: 0.75rem; }
.civil-buy { width: 100%; margin: 8px 0 4px; }
.civil-has-code { margin-top: 6px; font-size: 0.9rem; }
.civil-has-code summary { cursor: pointer; color: var(--muted); }
.civil-code-row { display: flex; gap: 8px; margin-top: 8px; }
.civil-code-row .civil-code { flex: 1; min-width: 0; letter-spacing: 0.08em; text-transform: uppercase; }
.civil-status { min-height: 1.2em; margin: 8px 0 0; color: var(--gold); }
.civil-status.is-bad { color: var(--accent-ink); }
.civil-fine { margin: 6px 0 0; }
.civil-fine a { color: var(--gold); }