/*
 * 장면 진행기 DOM 창 (js/ui/stage-*.js, dialog.js, item-*.js, rulecard.js, marker.js)
 * - 토큰은 css/base.css(--ink --paper --hanji --seal --fiction --variant --interp --font-ui --font-yet --fs)
 * - 글자 크기 3단계: --fs (진행기가 설정에 맞춰 html 에 둔다). 교사 모드 크게 보기: html[data-nm-teacher="1"] → --st-big
 * - 방점: 음절 왼쪽의 점(.nm-bj). html[data-nm-bangjeom="off"] 이면 숨김. 움직임 줄이기: html[data-nm-motion="reduce"]
 * - 색만으로 나누지 않는다: 상태·정답·표지마다 기호나 글자 이름표가 함께 있다.
 */
:root {
  --st-big: 1;
  --st-line: rgba(43, 36, 32, .22);
  --st-shade: rgba(43, 36, 32, .07);
  --st-focus: #d08a12;
  --st-know: #4f6b3a;
}
/* 교사 모드 크게 보기: U1 이 있으면 U1 이 --fs 로 키운다(html.nm-teacher). 진행기 혼자일 때만 여기서 키운다. */
html[data-nm-teacher="1"]:not(.nm-teacher) { --st-big: 1.35; }

/* ── 창 ── */
#ui-layer > .nm-overlay-host > .nm-st-win {
  position: absolute; inset: 0; margin: auto;
  width: min(760px, calc(100% - 24px)); height: fit-content; max-height: calc(100% - 24px);
  box-sizing: border-box; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--paper, #f6efe2); color: var(--ink, #2b2420);
  border: 2px solid var(--ink, #2b2420); border-radius: 14px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, .25), 0 18px 40px rgba(0, 0, 0, .35);
  font: 400 calc(17px * var(--fs, 1) * var(--st-big, 1)) / 1.6 var(--font-ui, system-ui, sans-serif);
  word-break: keep-all; overflow-wrap: anywhere;
}
.nm-st-win[inert] { filter: brightness(.86); }
.nm-st-win:focus { outline: none; }
.nm-st-head {
  display: flex; align-items: center; gap: .5em; padding: .7em 3.2em .5em 1.1em;
  border-bottom: 1px solid var(--st-line); background: var(--hanji, #efe4cf); border-radius: 12px 12px 0 0;
  flex: 0 0 auto; position: relative; z-index: 1;
}
.nm-st-title { margin: 0; font-size: 1.05em; font-weight: 700; letter-spacing: .02em; }
.nm-st-title:focus { outline: none; }
.nm-st-title:focus-visible { outline: 3px solid var(--st-focus); outline-offset: 2px; }
/* 머리글(제목·×)과 아래 단추 줄은 제자리에 두고 본문만 스크롤한다(긴 창·글자 크기 3에서도 ×가 화면 밖으로 밀려나지 않게). */
.nm-st-body {
  padding: .9em 1.1em; display: flex; flex-direction: column; gap: .8em;
  flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain;
}
.nm-st-body > * { flex-shrink: 0; }
.nm-st-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6em; padding: .6em 1.1em 1em; flex: 0 0 auto; border-top: 1px solid var(--st-line); }
.nm-st-foot:empty { display: none; }
.nm-st-close {
  position: absolute; top: .35em; right: .45em; z-index: 2;
  width: 2.2em; height: 2.2em; min-width: 44px; min-height: 44px; border-radius: 50%;
  border: 2px solid transparent; background: transparent; color: var(--ink, #2b2420);
  font: 700 1.3em/1 var(--font-ui, system-ui, sans-serif); cursor: pointer;
}
.nm-st-close:hover { background: var(--st-shade); }
/* 낮은 화면(가로로 든 휴대 전화): 머리글·아래 단추 줄을 얇게 해서 본문 자리를 늘린다 */
@media (max-height: 520px) {
  .nm-st-head { padding-top: .4em; padding-bottom: .3em; }
  .nm-st-close { top: .15em; }
  .nm-st-foot { padding-top: .35em; padding-bottom: .45em; }
  .nm-st-foot .nm-st-btn { min-height: 44px; padding-top: .2em; padding-bottom: .2em; }
}

/* ── 단추 ── */
.nm-st-btn {
  min-height: 48px; padding: .45em 1.1em; border-radius: 10px; cursor: pointer;
  border: 2px solid var(--ink, #2b2420); background: #fffaf0; color: var(--ink, #2b2420);
  font: 600 1em/1.3 var(--font-ui, system-ui, sans-serif);
}
.nm-st-btn:hover:not(:disabled) { background: var(--hanji, #efe4cf); }
.nm-st-primary { background: var(--seal, #b8322a); border-color: var(--seal, #b8322a); color: #fff; }
.nm-st-primary:hover:not(:disabled) { background: #9c2820; }
.nm-st-btn:disabled { opacity: .45; cursor: not-allowed; }
.nm-st-btn[hidden] { display: none; }
.nm-st-win button:focus-visible, .nm-st-hud button:focus-visible, .nm-st-win textarea:focus-visible {
  outline: 3px solid var(--st-focus); outline-offset: 2px;
}

/* ── 옛한글·원문 ── */
.nm-yet { font-family: var(--font-yet, 'NMYet', 'NMSans', serif); font-feature-settings: 'ljmo', 'vjmo', 'tjmo'; }
.nm-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* 방점: 음절 왼쪽에 점(거성 1점, 상성 위아래 2점).
   점은 제 음절 쪽에 바짝 붙인다(앞 음절과의 틈 .09em > 제 음절과의 틈 .02em) — 가운데에 두면 앞 음절의 점이나 가운뎃점처럼 읽힌다. */
.nm-bj-syl { position: relative; padding-left: .26em; }
.nm-bj {
  position: absolute; left: .09em; top: 50%; width: .15em; height: .15em; margin-top: -.075em;
  border-radius: 50%; background: currentColor;
}
.nm-bj-syl[data-bj="2"] > .nm-bj { margin-top: -.25em; box-shadow: 0 .34em 0 currentColor; }
/* 루비(한자 읽기) — js/ui/stage-yet.js build 와 js/core/yet.js buildDom 이 <ruby>바탕<rp>(</rp><rt>읽기</rt><rp>)</rp></ruby> 로 만든다.
   읽기 글자는 옛한글(받침 ㆁ 등)이 들어 있어 기본 50% 로는 뭉개진다 → 조금 키우고, 굵기·자간은 바탕을 따르지 않는다.
   줄 높이를 1 로 두어 읽기 줄이 위(또는 아래) 줄 글자에 닿지 않게 줄 상자를 덜 키운다. */
rt { font-size: .58em; line-height: 1; font-weight: 400; letter-spacing: 0; }
html[data-nm-bangjeom="off"] .nm-bj { display: none; }
html[data-nm-bangjeom="off"] .nm-bj-syl { padding-left: 0; }

.nm-orig {
  position: relative; padding: .8em 1em .7em; border-radius: 10px;
  background: #fbf6ea; border: 1px solid var(--st-line); box-shadow: inset 0 0 0 4px #fbf6ea, inset 0 0 0 5px rgba(184, 50, 42, .25);
}
.nm-orig-head { display: flex; align-items: center; gap: .6em; margin-bottom: .35em; }
.nm-orig-title { font-weight: 600; font-size: .92em; }
.nm-orig-line { margin: .15em 0; font-size: 1.35em; line-height: 1.75; letter-spacing: .04em; }
.nm-solved { background: linear-gradient(transparent 62%, rgba(208, 138, 18, .28) 62%); border-radius: 2px; }
.nm-gloss {
  display: inline-block; margin: 0 .25em; padding: 0 .35em; border-radius: 6px;
  font: 600 .62em/1.5 var(--font-ui, system-ui, sans-serif); letter-spacing: 0;
  color: var(--ink, #2b2420); background: #fff3d6; border: 1px solid rgba(208, 138, 18, .55); vertical-align: middle;
}
.nm-gloss::before { content: '\2192\00a0'; }

/* ── 표지 ── */
.nm-mark {
  display: inline-flex; align-items: center; padding: .05em .55em; border-radius: 4px;
  font: 700 .8em/1.5 var(--font-ui, system-ui, sans-serif); letter-spacing: .03em; white-space: nowrap;
  border: 1.5px solid currentColor;
}
.nm-mark-orig { color: #fff; background: var(--seal, #b8322a); border-color: var(--seal, #b8322a); border-radius: 3px; transform: rotate(-2deg); font-family: var(--font-yet, serif); }
.nm-mark-explain { color: var(--ink, #2b2420); }
.nm-mark-know { color: var(--st-know); }
.nm-mark-fiction { color: var(--fiction, #2f8a86); }
.nm-mark-variant { color: var(--variant, #a87c3a); }
.nm-mark-interp { color: var(--interp, #34508a); }
.nm-mark-unknown { color: var(--ink, #2b2420); border-style: dashed; }
.nm-card {
  padding: .6em .85em; border-radius: 10px; background: #fffaf0; border: 1px solid var(--st-line);
  border-left: 6px solid var(--ink, #2b2420);
}
.nm-card-know { border-left-color: var(--st-know); }
.nm-card-fiction { border-left-color: var(--fiction, #2f8a86); background: #f1f8f6; }
.nm-card-variant { border-left-color: var(--variant, #a87c3a); }
.nm-card-interp { border-left-color: var(--interp, #34508a); }
.nm-card-unknown { border-left-style: dashed; background: #f7f2e6; }
.nm-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5em; }
.nm-card-title { font-weight: 700; }
.nm-card-note { font-size: .8em; opacity: .8; }
.nm-card-text, .nm-card-real, .nm-card-src { margin: .35em 0 0; }
.nm-card-real-label { font-weight: 700; color: var(--fiction, #2f8a86); }
.nm-card-src { font-size: .82em; opacity: .85; }
.nm-orig-note { margin: .35em 0 0; font-size: .8em; opacity: .85; font-style: italic; }
.nm-card-src-label { font-weight: 700; }

/* ── 대사 ── */
.nm-dlg-extras { display: flex; flex-direction: column; gap: .7em; }
.nm-dlg-stage { min-height: 3.4em; }
.nm-dlg-line { display: flex; gap: .75em; align-items: flex-start; }
.nm-dlg-line.is-narration { font-style: italic; opacity: .9; }
.nm-dlg-line.is-card { display: block; }
.nm-dlg-portrait {
  flex: none; width: 3.2em; height: 3.2em; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--ink, #2b2420); background: var(--hanji, #efe4cf);
  display: inline-flex; align-items: center; justify-content: center;
}
.nm-dlg-portrait img { width: 100%; height: 100%; object-fit: cover; }
.nm-dlg-portrait.is-mono { font-weight: 700; font-size: 1.15em; }
.nm-dlg-main { min-width: 0; flex: 1; }
.nm-dlg-who { display: inline-flex; flex-wrap: wrap; gap: .35em; align-items: center; font-weight: 700; font-size: .9em; color: var(--seal, #b8322a); }
.nm-dlg-text { margin: .1em 0 0; font-size: 1.05em; }
.nm-dlg-note { margin: 0; padding: .45em .7em; border-radius: 8px; background: #fde9e6; border: 1px dashed var(--seal, #b8322a); }
.nm-st-dialog .nm-st-body { gap: .9em; }
.nm-ctx-lines { display: flex; flex-direction: column; gap: .6em; }

/* ── 맥락의 항목 단추·HUD 상태 ── */
.nm-ctx-items { display: flex; flex-direction: column; gap: .45em; }
.nm-ctx-items-label { margin: 0; font-weight: 700; font-size: .9em; }
.nm-st-ctx-item { display: flex; align-items: center; gap: .6em; text-align: left; width: 100%; }
.nm-st-ctx-name { flex: 1; font-size: 1.1em; }
.nm-st-ctx-state { font-size: .82em; font-weight: 500; opacity: .85; }
.nm-st-sym { display: inline-block; min-width: 1.2em; text-align: center; font-weight: 700; }
[data-state="confirmed"] > .nm-st-sym, [data-state="confirmedByHelp"] > .nm-st-sym,
[data-state="done"] > .nm-st-sym, [data-state="doneByHelp"] > .nm-st-sym { color: #2c7a3a; }
[data-state="misread"] > .nm-st-sym { color: var(--seal, #b8322a); }

/* ── 해독 항목 ── */
.nm-st-item-label { font-size: 2em; line-height: 1.4; font-weight: 700; text-align: center; letter-spacing: .05em; }
.nm-st-prompt { display: block; text-align: center; font-weight: 600; }
.nm-st-seenbox { padding: .5em .8em; border-radius: 10px; background: var(--st-shade); }
.nm-st-seenbox p { margin: .1em 0; }
.nm-st-seen { font-weight: 700; }
.nm-st-seen-list, .nm-st-status { font-size: .9em; }
.nm-st-note { margin: 0; font-size: .88em; opacity: .85; }
.nm-st-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12em), 1fr)); gap: .55em; }
.nm-st-card {
  position: relative; display: flex; align-items: center; gap: .55em; min-height: 56px; padding: .55em .8em;
  text-align: left; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--st-line); background: #fffdf7; color: var(--ink, #2b2420);
  font: 500 1.05em/1.4 var(--font-ui, system-ui, sans-serif);
  box-shadow: 0 3px 0 rgba(43, 36, 32, .12);
}
.nm-st-card:hover:not(:disabled) { border-color: var(--ink, #2b2420); }
.nm-st-card.is-selected { border-color: var(--ink, #2b2420); background: var(--hanji, #efe4cf); box-shadow: inset 0 0 0 2px var(--ink, #2b2420); }
.nm-st-card-mark { flex: none; width: 1.3em; height: 1.3em; border-radius: 50%; border: 2px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-size: .85em; font-weight: 800; }
.nm-st-card.is-selected:not(.is-correct) .nm-st-card-mark::before { content: '\25CF'; font-size: .8em; }
.nm-st-card.is-correct { border-color: #2c7a3a; background: #eef7ec; }
.nm-st-card.is-correct .nm-st-card-mark { color: #fff; background: #2c7a3a; border-color: #2c7a3a; }
.nm-st-card-tag { margin-left: auto; font-size: .78em; font-weight: 700; color: #2c7a3a; }
.nm-st-card:disabled { cursor: default; opacity: 1; }
.nm-st-card:disabled:not(.is-correct):not(.is-selected) { opacity: .7; }

/* 규칙 카드 문장 완성 */
.nm-rulecard { display: flex; flex-direction: column; gap: .7em; }
.nm-rulecard-sentence {
  margin: 0; padding: .7em .9em; border-radius: 10px; font-size: 1.1em; line-height: 1.9;
  background: #fffaf0; border: 1px solid var(--st-line); border-left: 6px solid var(--ink, #2b2420);
}
.nm-rulecard-blank {
  display: inline-block; min-width: 5em; margin: 0 .2em; padding: 0 .5em; text-align: center;
  border-bottom: 3px solid var(--ink, #2b2420); background: rgba(208, 138, 18, .12); border-radius: 4px 4px 0 0;
}
.nm-rulecard-blank.is-filled { font-weight: 700; background: rgba(208, 138, 18, .24); }
.nm-rulecard-placeholder { opacity: .55; font-size: .85em; }

/* 도움·결과 */
.nm-st-why, .nm-st-help, .nm-st-result, .nm-st-teacher-view, .nm-st-taskstatus {
  padding: .6em .85em; border-radius: 10px; display: flex; flex-direction: column; gap: .45em;
}
.nm-st-why { background: #fdf0ee; border: 1px dashed var(--seal, #b8322a); display: block; }
.nm-st-why-label, .nm-st-hint-label, .nm-st-answer-label { font-weight: 700; }
.nm-st-why-label::before { content: '\00D7\00a0'; }
.nm-st-help { background: #f3f0fa; border: 1px solid rgba(52, 80, 138, .35); }
.nm-st-help[hidden] { display: none; }
.nm-st-help p { margin: 0; }
.nm-st-hint-label::before { content: '\2605\00a0'; }
.nm-st-glow::before, .nm-st-fix::before { content: '\2605\00a0'; }
.nm-st-answer { font-weight: 600; }
.nm-st-result { background: #eef7ec; border: 1px solid rgba(44, 122, 58, .45); }
.nm-st-result[data-result="help"] { background: #f3f0fa; border-color: rgba(52, 80, 138, .35); }
.nm-st-result-text { margin: 0; font-weight: 700; }
.nm-st-result[data-result="correct"] .nm-st-result-text::before { content: '\25CB\00a0'; }
.nm-st-rule-added { padding: .5em .7em; border-radius: 8px; background: #fffaf0; border: 2px solid var(--ink, #2b2420); }
.nm-st-rule-added p { margin: .1em 0; }
.nm-st-rule-added-text { font-weight: 700; }
.nm-st-rule-added-text::before { content: '\25A0\00a0'; color: var(--seal, #b8322a); }
.nm-st-rule-name { font-weight: 700; }
.nm-st-teacher-view { background: #fff6dd; border: 2px dashed var(--st-focus); }
.nm-st-teacher-answer { border-style: dashed; }

/* 기믹 과제 */
.nm-st-gimmick { min-height: 4em; }
.nm-st-taskstatus { margin: 0; display: block; font-weight: 700; }
.nm-st-taskstatus[hidden] { display: none; }
.nm-st-taskstatus[data-result="wrong"] { background: #fdf0ee; border: 1px dashed var(--seal, #b8322a); }
.nm-st-taskstatus[data-result="wrong"]::before { content: '\25B3\00a0'; }
.nm-st-taskstatus[data-result="correct"] { background: #eef7ec; }
.nm-st-taskstatus[data-result="correct"]::before, .nm-st-taskstatus[data-result="help"]::before { content: '\25CB\00a0'; }
.nm-st-taskstatus[data-result="help"] { background: #f3f0fa; }

/* 장면 끝 */
.nm-st-plate {
  align-self: center; width: 6.5em; height: 8em; display: flex; align-items: center; justify-content: center;
  border-radius: 1.2em 1.2em 1.6em 1.6em; background: linear-gradient(160deg, #c9a46a, #a37a42);
  border: 3px solid #6d4c22; box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .18), 0 6px 0 rgba(0, 0, 0, .25);
}
.nm-st-glyph { font-size: 3.6em; line-height: 1; color: #3d2a12; text-shadow: 0 2px 0 rgba(255, 255, 255, .35); animation: nm-st-carve .9s ease-out both; }
.nm-st-plate.is-still .nm-st-glyph { animation: none; }
@keyframes nm-st-carve { from { opacity: 0; transform: scale(1.6); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.nm-st-end-text { margin: 0; text-align: center; font-weight: 600; }
.nm-st-reflect-input {
  width: 100%; box-sizing: border-box; min-height: 4em; padding: .6em .7em; border-radius: 10px; resize: vertical;
  border: 2px solid var(--st-line); background: #fffdf7; color: var(--ink, #2b2420);
  font: 400 1em/1.5 var(--font-ui, system-ui, sans-serif);
}

/* ── HUD ── */
#ui-layer > .nm-st-hud {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top));
  width: min(300px, calc(100% - 24px)); max-height: calc(100% - 120px); overflow: auto; box-sizing: border-box;
  padding: .6em .7em; border-radius: 12px; z-index: 5;
  background: rgba(246, 239, 226, .94); color: var(--ink, #2b2420); border: 2px solid var(--ink, #2b2420);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
  font: 400 calc(14px * var(--fs, 1) * var(--st-big, 1)) / 1.45 var(--font-ui, system-ui, sans-serif);
}
#ui-layer > .nm-st-hud[hidden] { display: none; }
.nm-st-hud-head {
  width: 100%; display: flex; flex-wrap: wrap; gap: .1em .45em; align-items: baseline; align-content: center; text-align: left;
  min-height: 40px; padding: .1em .2em; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.nm-st-hud-head:hover { background: var(--st-shade); }
.nm-st-hud-count { margin-left: auto; font-weight: 700; font-size: .9em; }
.nm-st-hud-chev { font-size: .9em; }
.nm-st-hud-title { font-weight: 700; font-size: 1.1em; }
.nm-st-hud-era { font-size: .85em; opacity: .8; }
.nm-st-hud-sub, .nm-st-hud-goal { margin: .3em 0; font-size: .85em; font-weight: 600; }
.nm-st-hud-goal { color: var(--seal, #b8322a); }
.nm-st-hud-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3em; }
.nm-st-hud-item {
  width: 100%; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: .1em .45em; text-align: left;
  padding: .3em .5em; border-radius: 8px; border: 1.5px solid var(--st-line); background: #fffdf7; color: inherit;
  font: inherit; cursor: pointer;
}
.nm-st-hud-item:disabled { cursor: default; opacity: .7; }
.nm-st-hud-name { flex: 1 1 6em; font-weight: 600; }
.nm-st-hud-state { font-size: .8em; opacity: .85; }
.nm-st-hud-actions { display: flex; flex-wrap: wrap; gap: .4em; margin-top: .5em; }
.nm-st-hud-actions .nm-st-btn { min-height: 40px; padding: .25em .8em; font-size: .9em; }

@media (max-width: 520px) {
  #ui-layer > .nm-overlay-host > .nm-st-win { width: calc(100% - 16px); max-height: calc(100% - 16px); border-radius: 12px; }
  .nm-st-body { padding: .75em .8em; }
  .nm-st-foot { padding: .5em .8em .8em; }
  .nm-st-foot .nm-st-btn { flex: 1 1 auto; }
  .nm-orig-line { font-size: 1.2em; }
}
/* 좁은·낮은 화면의 HUD: 작게, 도구 막대(오른쪽 위 한 줄) 왼쪽에. 옆자리가 좁으면(html.nm-tb-crowded) 도구 막대 아래로.
   아래쪽은 살피기 단추 자리(약 100px)를 비운다. --nm-tb-w·--nm-tb-b 는 js/ui/app.js measureToolbar 가 둔다. */
@media (max-width: 520px), (max-height: 520px) {
  #ui-layer > .nm-st-hud {
    --hud-top: max(6px, env(safe-area-inset-top));
    top: var(--hud-top); left: max(6px, env(safe-area-inset-left));
    width: min(300px, calc(100% - 12px - var(--nm-tb-w, 0px) - 8px));
    max-height: calc(100% - var(--hud-top) - 104px);
    padding: .35em .5em; border-radius: 10px;
    font-size: calc(13px * var(--fs, 1) * var(--st-big, 1));
  }
  html.nm-tb-crowded #ui-layer > .nm-st-hud {
    --hud-top: calc(var(--nm-tb-b, 0px) + 6px);
    width: min(360px, calc(100% - 12px));
  }
  .nm-st-hud-head { min-height: 44px; }
  .nm-st-hud-title { font-size: 1.05em; }
  .nm-st-hud-goal, .nm-st-hud-sub { margin: .2em 0; }
}

/* 움직임 줄이기 */
html[data-nm-motion="reduce"] .nm-st-glyph, html.nm-reduced-motion .nm-st-glyph { animation: none; }
@media (prefers-reduced-motion: reduce) { .nm-st-glyph { animation: none; } }

/* 대사 위 장면 그림(줄의 cg 키) */
.nm-dlg-line.has-cg { flex-wrap: wrap; }
.nm-dlg-cg { flex: 1 0 100%; margin: 0 0 .5em; }
.nm-dlg-cg img { display: block; width: 100%; max-height: 42vh; object-fit: contain; border-radius: 8px; background: var(--hanji); }

/* 原文 현대어 풀이 — <html data-nm-modern="tap|always|off">(설정 '현대어 풀이') */
.nm-orig-modern { margin: .5em 0 0; }
.nm-orig-modern-btn {
  font: inherit; font-size: .85em; padding: .3em .8em; min-height: 2.2em; cursor: pointer;
  border: 1.5px solid currentColor; border-radius: 999px; background: transparent; color: inherit; opacity: .85;
}
.nm-orig-modern-text { display: none; margin: .45em 0 0; padding: .5em .75em; border-left: 3px solid #b5651d; background: rgba(181, 101, 29, .08); border-radius: 4px; }
.nm-orig-modern.is-open .nm-orig-modern-text { display: block; }
.nm-orig-modern-label { display: block; font-size: .78em; font-weight: 700; opacity: .8; margin-bottom: .15em; }
.nm-orig-modern-line { margin: .1em 0; line-height: 1.6; }
html[data-nm-modern="always"] .nm-orig-modern-btn { display: none; }
html[data-nm-modern="always"] .nm-orig-modern-text { display: block; }
html[data-nm-modern="off"] .nm-orig-modern { display: none; }

/* 한자 음 — 모든 루비 읽기는 글자 아래. 맨 한자에 단 오늘날 음(.nm-eum-rt)은 연한 색·본문 글꼴로 原文 읽기와 구별,
   설정 '한자 음 달기'가 끔이면 <html data-nm-eum="off"> 로 숨긴다 */
ruby { ruby-position: under; }
rt.nm-eum-rt { font-family: var(--font-ui); color: #8a6d4b; font-size: .62em; }
.nm-gbs-eum { display: block; font-family: var(--font-ui); color: #8a6d4b; font-size: .8em; line-height: 1.1; text-align: center; }
html[data-nm-eum="off"] .nm-eum-rt { display: none; }

/* 현대어 풀이 잠김 표지(B02) — 그 原文으로 푸는 말을 해독하기 전. 설정 '끔'이면 위의 .nm-orig-modern 규칙으로 숨는다.
   자물쇠는 글꼴 글자 대신 테두리로 그린다(글꼴 범위 밖 그림 문자를 쓰지 않음). */
.nm-orig-modern-lock {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .1em .4em; margin: 0; padding: .4em .7em;
  font-size: .85em; line-height: 1.5; border: 1.5px dashed rgba(181, 101, 29, .55); border-radius: 6px; background: rgba(181, 101, 29, .05);
}
.nm-orig-modern-lock-icon {
  position: relative; display: inline-block; flex: none; width: .7em; height: .55em; margin: 0 .1em 0 .05em;
  border-radius: 2px; background: #b5651d; align-self: center; transform: translateY(.15em);
}
.nm-orig-modern-lock-icon::before {
  content: ''; position: absolute; left: .12em; right: .12em; bottom: 100%; height: .38em;
  border: .1em solid #b5651d; border-bottom: 0; border-radius: .3em .3em 0 0;
}
.nm-orig-modern-lock-label { font-weight: 700; color: #8a4b12; }
.nm-orig-modern-lock-text { opacity: .9; }

/* 실마리 더 보기(S03) — 확정 단추보다 덜 눈에 띄게 */
.nm-st-morehelp { opacity: .92; }

/* 창 제목: 작은 윗글(갈래 — 해독·과제·조사) + 지금 할 일(항목 이름·장소 이름) */
.nm-st-title.has-eyebrow { display: flex; flex-direction: column; gap: 0; line-height: 1.3; }
.nm-st-eyebrow { font-size: .72em; font-weight: 700; letter-spacing: .08em; opacity: .7; }
.nm-st-title-main { min-width: 0; }
.nm-st-itemwin .nm-st-title-main, .nm-st-taskwin .nm-st-title-main { font-size: 1.22em; letter-spacing: .03em; }

/* 虛 한 줄 표지(compact) — 이야기 앞에 크게 늘어놓지 않는다. '실제 역사 보기'를 누르면 설정 설명과 "실제로는 →" */
.nm-card-fiction.is-compact { padding: .3em .6em; font-size: .9em; border-left-width: 4px; }
.nm-card-fiction.is-compact .nm-card-head { gap: .25em .5em; }
.nm-card-fiction.is-compact .nm-mark { font-size: .82em; }
.nm-card-fname { flex: 1 1 4em; min-width: 0; font-weight: 600; }
.nm-card-toggle {
  margin-left: auto; min-height: 2.2em; padding: .15em .75em; cursor: pointer;
  font: 600 .85em/1.3 var(--font-ui, system-ui, sans-serif); color: var(--fiction, #2f8a86);
  border: 1.5px solid currentColor; border-radius: 999px; background: #fffdf7;
}
.nm-card-toggle:hover { background: #e3f1ee; }
.nm-card-toggle::after { content: '\00a0\25BE'; }
.nm-card-fiction.is-open .nm-card-toggle::after { content: '\00a0\25B4'; }
.nm-card-more { padding: .1em 0 .2em; }
.nm-card-more[hidden] { display: none; }
.nm-dlg-extras:has(> .nm-card-fiction.is-compact) { gap: .35em; }

/* 해독 창의 '살핀 곳' 칩 — 펼치면 그 맥락의 원문 카드·대사를 창 안에서 작게 다시 본다 */
.nm-st-clues { display: flex; flex-direction: column; gap: .35em; margin-top: .35em; }
.nm-st-seenbox p.nm-st-clues-label { margin: 0; font-size: .85em; font-weight: 600; opacity: .85; }
.nm-st-clue { border-radius: 10px; }
.nm-st-clue-btn {
  display: flex; align-items: center; gap: .45em; width: 100%; min-height: 44px; padding: .3em .75em; text-align: left; cursor: pointer;
  border: 1.5px solid var(--st-line); border-radius: 10px; background: #fffdf7; color: var(--ink, #2b2420);
  font: 600 .92em/1.35 var(--font-ui, system-ui, sans-serif);
}
.nm-st-clue-btn:hover { border-color: var(--ink, #2b2420); }
.nm-st-clue-sym::before { content: '\25B8'; display: inline-block; width: 1em; text-align: center; }
.nm-st-clue.is-open .nm-st-clue-sym::before { content: '\25BE'; }
.nm-st-clue.is-open .nm-st-clue-btn { border-color: var(--ink, #2b2420); border-radius: 10px 10px 0 0; background: var(--hanji, #efe4cf); }
.nm-st-clue-body { padding: .55em .65em; border: 1.5px solid var(--ink, #2b2420); border-top: 0; border-radius: 0 0 10px 10px; background: var(--paper, #f6efe2); font-size: .9em; }
.nm-st-clue-body[hidden] { display: none; }
.nm-st-clue-view { display: flex; flex-direction: column; gap: .55em; }
.nm-st-clue-view .nm-orig { padding: .55em .7em .5em; }
.nm-st-clue-view .nm-orig-line { font-size: 1.2em; }
.nm-st-clue-view .nm-dlg-cg { display: none; }
.nm-st-clue-view .nm-dlg-line.has-cg { flex-wrap: nowrap; }
.nm-st-clue-view .nm-dlg-portrait { width: 2.3em; height: 2.3em; }
.nm-st-clue-view .nm-dlg-text { font-size: 1em; }
.nm-st-clue-view .nm-ctx-lines { gap: .4em; }
@media (pointer: coarse) { .nm-card-toggle { min-height: 44px; } }

/* 통역할 인물이 맵에 없는 장면: 통역 창을 닫은 뒤 HUD 에서 다시 시작 */
.nm-st-hud-go { display: block; width: 100%; margin: .35em 0 0; padding: .45em .8em; font-weight: 700; background: #b8322a; color: #fff; border: 2px solid #2b2420; border-radius: 10px; cursor: pointer; }

/* 추측해 두었다는 잠깐 안내(해독 창의 '추측하기' 뒤) */
.nm-st-toast { position: absolute; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  max-width: min(92vw, 520px); padding: .7em 1.1em; border-radius: 12px; background: rgba(29, 26, 23, .92); color: #fff8ea;
  font-size: calc(15px * var(--fs, 1)); line-height: 1.5; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.35); pointer-events: none;
  animation: nm-toast-in .25s ease-out; }
@keyframes nm-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
html.nm-reduced-motion .nm-st-toast { animation: none; }
