/* 혈의 약 — 한지·먹·단청 느낌의 UI */
:root {
  --ink: #241a12; --ink2: #4a3a2a; --paper: #e9dcc0; --paper2: #d8c7a3; --red: #8e2a22; --blue: #2c3f73; --gold: #c9a24f;
  --dc-red: #b33a2a; --dc-green: #2e7a62; --dc-blue: #2b4f8a; --dc-yellow: #d8a83a;
  --font: 'Gowun Batang', 'Nanum Myeongjo', serif; --title: 'Song Myung', 'Gowun Batang', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050608; color: var(--paper); font-family: var(--font); overflow: hidden; user-select: none; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Cpath d='M2 2 L17 8 L10 10 L8 18 Z' fill='%23e3d3a8' stroke='%23201810' stroke-width='1.5'/%3E%3C/svg%3E") 2 2, default; }
.hidden { display: none !important; }
button { font-family: var(--font); cursor: pointer; }
input, select { font-family: var(--font); }

/* 한지 종이 */
.paper {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.27 0 0 0 0 0.16 0 0 0 0.22 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 30% 20%, #efe4cb 0%, #e3d3b0 55%, #cdb88f 100%);
  color: var(--ink);
  border: 1px solid #6d5636;
  box-shadow: 0 0 0 3px #2a1f15, 0 0 0 4px var(--gold), 0 0 0 7px #2a1f15, 0 10px 40px rgba(0,0,0,0.7);
}
.paper h2, .paper h3 { font-family: var(--title); font-weight: 400; margin: 0 0 6px; color: var(--red); letter-spacing: 2px; }
.note { color: var(--ink2); margin: 4px 0; }
.small { font-size: 12px; }
.key { font-family: var(--font); font-size: 11px; color: #fff; background: var(--ink2); padding: 0 5px; border-radius: 2px; vertical-align: middle; }
.link { background: none; border: none; color: var(--ink2); text-decoration: underline; }

/* 첫 화면 */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; }
#title { background: radial-gradient(ellipse at 50% 40%, rgba(40,20,14,0.5), rgba(0,0,0,0.92) 70%); }
.title-box { text-align: center; max-width: 560px; padding: 24px; }
.hanja { font-family: var(--title); font-size: 22px; color: #7c2018; letter-spacing: 10px; opacity: 0.85; }
.title-box h1 { font-family: var(--title); font-weight: 400; font-size: 92px; margin: 0; color: #c63a2a; text-shadow: 0 0 30px rgba(200,40,20,0.45), 2px 2px 0 #1a0805; letter-spacing: 12px; }
.title-box .sub { font-family: var(--title); font-size: 22px; color: #d9c79e; letter-spacing: 6px; margin-bottom: 18px; }
.lead { color: #bfae8a; line-height: 1.8; }
#login-area { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#devlogin input, #char-new input { padding: 8px 10px; border: 1px solid #6d5636; background: #f4ead4; width: 200px; }
/* 종이 위 입력 칸은 먹 글씨로 — 글자 색을 정하지 않아 어두운 화면 설정(사파리 등)에서 흰 글씨가 한지 위에 떠 안 보였다 */
#devlogin input, #char-new input, #pty-inv input { color: #241a12; -webkit-text-fill-color: #241a12; caret-color: #8e2a22; color-scheme: light; }
#devlogin input::placeholder, #char-new input::placeholder, #pty-inv input::placeholder { color: #8a7458; -webkit-text-fill-color: #8a7458; opacity: 1; }
#devlogin button, #char-new button, #revive { padding: 8px 14px; background: var(--red); color: #f4e6c8; border: 1px solid #3a120c; }
.msg { color: #e5a37a; min-height: 1.2em; }

/* 캐릭터 고르기 */
.chars-box { width: 440px; padding: 22px 26px; }
#char-list { list-style: none; padding: 0; margin: 12px 0; }
#char-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; margin: 6px 0; border: 1px solid #8a7048; background: rgba(255,250,235,0.45); cursor: pointer; }
#char-list li:hover { background: rgba(255,240,200,0.8); border-color: var(--red); }
#char-list .nm { font-family: var(--title); font-size: 20px; color: var(--ink); }
#char-list .meta { color: var(--ink2); font-size: 13px; }
#char-list .del { background: none; border: none; color: #9a3a2a; font-size: 12px; }
#char-list .acts { display: flex; align-items: center; gap: 6px; }
#char-list .go { display: none; font-family: var(--title); font-size: 15px; letter-spacing: 2px; padding: 5px 14px; color: #f3e6c4; background: linear-gradient(#8a2418, #6a1810); border: 1px solid #4a100a; box-shadow: inset 0 1px 0 rgba(255,220,180,0.25); cursor: pointer; }
#char-list li.sel { background: rgba(255,236,190,0.9); border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
#char-list li.sel .go { display: inline-block; }
#char-new { display: flex; gap: 8px; margin: 10px 0; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#zone-name { position: absolute; top: 12px; left: 16px; font-family: var(--title); font-size: 20px; color: #e4d2a2; text-shadow: 1px 1px 2px #000; pointer-events: none !important; }
#sysbox { position: absolute; top: 44px; left: 16px; width: 520px; pointer-events: none !important; }
#sysbox div { font-size: 14px; text-shadow: 1px 1px 2px #000, 0 0 6px #000; margin: 2px 0; transition: opacity 1s; }
#chatbox { position: absolute; left: 14px; bottom: max(250px, 30vh); width: 420px; }
#chat-log { max-height: 190px; overflow-y: auto; font-size: 14px; padding: 4px 6px; text-shadow: 1px 1px 2px #000; scrollbar-width: thin; }
#chat-log .c { margin: 1px 0; }
#chat-log .from { color: #e6d29a; }
#chat-log .w .from { color: #9ec6ff; }
#chat-log .whisper { color: #e8a8ff; }
#chat-log .sys { color: #9a8f78; font-style: italic; }
#chat-log .c.npc .from { color: #e8a878; }            /* 인연 스승 등 NPC 한마디 (lib/mentor.js) */
#chat-log .c.npc { color: #efe2c4; }
#chat-form { display: flex; opacity: 0.35; transition: opacity 0.2s; }
#chat-form:focus-within { opacity: 1; }
#chat-ch { background: #1a140e; color: #e4d2a2; border: 1px solid #5a4630; }
#chat-in { flex: 1 1 auto; min-width: 0; width: 0; background: rgba(20,15,10,0.85); color: #f0e4c8; border: 1px solid #5a4630; padding: 5px 8px; }
#toast { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); font-family: var(--title); font-size: 26px; text-shadow: 0 0 10px #000, 2px 2px 0 #000; pointer-events: none !important; text-align: center; }

/* 창 */
.panel { position: absolute; padding: 14px 16px; max-height: 80vh; overflow: auto; }
#panel-inv { right: 18px; top: 60px; width: 470px; }
#panel-stats { left: 18px; top: 60px; width: 330px; }
#panel-skills { left: 18px; top: 60px; width: 360px; }
#panel-chron { left: 50%; top: 70px; transform: translateX(-50%); width: 480px; }
#panel-npc { left: 18px; top: 60px; width: 440px; }
#panel-mentor { left: 50%; top: 22%; transform: translateX(-50%); width: 480px; }
.line { font-size: 16px; line-height: 1.7; border-left: 3px solid var(--red); padding-left: 10px; margin: 8px 0 12px; }

/* 행낭 */
#doll { position: relative; height: 296px; margin: 4px 0 10px; background: radial-gradient(ellipse at 50% 45%, rgba(120,90,50,0.18), transparent 70%); }
.slot { position: absolute; border: 1px solid #6d5636; background: rgba(40,28,18,0.82); box-shadow: inset 0 0 8px #000; display: flex; align-items: center; justify-content: center; }
.slot .lab { position: absolute; bottom: 1px; width: 100%; text-align: center; font-size: 10px; color: #8d7a5a; pointer-events: none; }
.slot img, .cell-item img { max-width: 100%; max-height: 100%; image-rendering: auto; pointer-events: none; }
#grid { position: relative; width: 438px; height: 176px; background-size: 44px 44px; background-image: linear-gradient(#5a4630 1px, transparent 1px), linear-gradient(90deg, #5a4630 1px, transparent 1px); background-color: rgba(40,28,18,0.82); border: 1px solid #6d5636; }
.cell-item { position: absolute; display: flex; align-items: center; justify-content: center; }
.cell-item.g-sang, .slot.g-sang { background: rgba(40,60,140,0.35); }
.cell-item.g-jin, .slot.g-jin { background: rgba(150,130,30,0.35); }
.cell-item.g-myeong, .slot.g-myeong { background: rgba(150,90,20,0.45); }
.cell-item.g-beol, .slot.g-beol { background: rgba(40,130,50,0.38); }
.cell-item.bad { background: rgba(160,20,20,0.35); }
.gold { margin-top: 8px; text-align: right; color: var(--ink2); }
.gold b { color: #8a5a10; }

/* 능력치 */
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 2px; border-bottom: 1px dotted #a08a62; }
.stat-row button { width: 24px; height: 22px; background: var(--red); color: #f4e6c8; border: 1px solid #3a120c; padding: 0; }
.stat-row .v { font-weight: 700; }
.sub-title { font-family: var(--title); color: var(--blue); margin: 10px 0 2px; }
.skill { padding: 8px; margin: 6px 0; border: 1px solid #a08a62; background: rgba(255,250,235,0.35); }
.skill.locked { opacity: 0.45; }
.skill .nm { font-family: var(--title); font-size: 17px; color: var(--ink); }
.skill .kk { float: right; font-size: 12px; }

/* 상점 */
.shop-item { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid #a08a62; margin: 4px 0; background: rgba(255,250,235,0.3); cursor: pointer; }
.shop-item:hover { background: rgba(255,240,200,0.75); }
.shop-item .ic { width: 44px; height: 44px; background: rgba(40,28,18,0.85); display: flex; align-items: center; justify-content: center; }
.shop-item .ic img { max-width: 44px; max-height: 44px; }
.shop-item .nm { flex: 1; }
.shop-item .pr { color: #8a5a10; }
.shop-item.on { background: rgba(255,236,190,0.85); border-color: #8a2a18; box-shadow: inset 3px 0 0 #9a2018, 0 0 0 1px rgba(154,32,24,0.35); }   /* 터치: 고른 물건 — 붉은 인주 띠 */
.shop-item.on { position: relative; }
.shop-item.on .pr::after { content: '한 번 더 누르면 산다'; position: absolute; right: 7px; bottom: 1px; color: #9a2018; font-size: 10.5px; letter-spacing: 0.5px; }   /* 이름을 밀어내지 않게 오른쪽 아래 귀퉁이에 */
html.lang-en .shop-item.on .pr::after { content: 'Tap again to buy'; letter-spacing: 0; }
#tip .tip-acts .lq-btn.buy { min-width: 140px; gap: 6px; }
#tip .tip-acts .lq-btn.buy b { font-weight: normal; color: inherit; opacity: 0.9; }

/* 인연 */
.mentor { padding: 10px; margin: 8px 0; border: 1px solid var(--red); background: rgba(255,245,220,0.5); }
.mentor .who { font-family: var(--title); font-size: 20px; color: var(--red); }
.mentor button { margin-top: 8px; padding: 6px 12px; background: var(--red); color: #f4e6c8; border: 1px solid #3a120c; }
.mentor .why { margin-left: 8px; font-family: inherit; font-size: 11px; color: #6b4a2a; letter-spacing: 0.05em; vertical-align: middle; }
.mentor.rumor { border-style: dashed; background: rgba(255,245,220,0.32); }
/* 잠룡 창 숨은 기운: 한지 위 먹선 막대, 끝 = 인연(100), 눈금 = 소문 */
.aff-row { align-items: center; }
.aff-row > span:first-child { white-space: nowrap; min-width: 4.6em; }
.aff-bar { position: relative; display: inline-block; flex: 1; min-width: 50px; margin: 0 8px; height: 8px; background: #b8a27a; box-shadow: inset 0 1px 0 rgba(58,18,12,0.25); }
.aff-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #8e2a22; transition: width .4s; }
.aff-bar b { position: absolute; top: -2px; bottom: -2px; width: 1px; background: #3a120c; opacity: 0.55; }
.aff-tag { min-width: 64px; white-space: nowrap; text-align: right; font-size: 11px; color: #7a6040; }
.aff-row.fate .aff-tag, .aff-row.rumor .aff-tag { color: var(--red); font-weight: bold; }
.aff-row.fate .aff-bar i { background: linear-gradient(90deg, #8e2a22, #c0392b); box-shadow: 0 0 6px rgba(192,57,43,0.5); }
.aff-note { margin: 6px 0 0; font-size: 11px; line-height: 1.5; color: #6b5536; }

/* 실록 */
#chron-list { list-style: none; padding: 0; margin: 6px 0; }
#chron-list li { padding: 5px 0; border-bottom: 1px dotted #a08a62; font-size: 14px; }
#chron-list .when { color: #8d7a5a; font-size: 11px; margin-right: 6px; }

/* 죽음 */
#dead { position: absolute; inset: 0; z-index: 55; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(30,0,0,0.45); }
.dead-title { font-family: var(--title); font-size: 72px; color: #b4251a; text-shadow: 0 0 20px #000; letter-spacing: 16px; }
#dead-msg { color: #e4d2a2; margin: 10px 0 20px; text-shadow: 1px 1px 2px #000; }

/* 설명 창 */
#tip { position: fixed; z-index: 50; max-width: 320px; padding: 10px 12px; background: rgba(14,10,8,0.95); border: 1px solid #6d5636; box-shadow: 0 0 0 1px #000, 0 6px 20px #000; color: #d8ccb0; font-size: 14px; line-height: 1.55; pointer-events: none; text-align: center; }
#tip .tn { font-family: var(--title); font-size: 18px; }
#tip .tsub { color: #a49678; font-size: 12px; }
#tip .ts { color: #8fa8ff; }
#tip .tr { color: #e05a4a; }
#tip .tl { color: #b8a27a; font-style: italic; margin-top: 6px; }
#drag { position: fixed; z-index: 60; pointer-events: none; opacity: 0.85; }

/* ── 렌더한 재질 (tools/blender/ui_art.py) ── 그림이 있으면 덮어쓴다 */
.paper {
  border: 30px solid transparent;
  border-image: url("../ui/frame_najeon.png") 58 stretch;
  background: url("../ui/tex_hanji.png") center / 340px;
  background-clip: padding-box;
  box-shadow: 0 14px 50px rgba(0,0,0,0.75);
}
#panel-inv {
  border-image: url("../ui/frame_bandaji.png") 58 stretch;
  background: url("../ui/tex_bandaji.png") center / 300px;
  background-clip: padding-box;
  color: #ecdcb6;
  width: 520px;
}
#panel-inv h3 { color: #f0c870; text-shadow: 1px 1px 0 #000; }
#panel-inv .note { color: #c8b48a; }
#panel-inv .gold { color: #d8c290; }
#panel-inv .gold b { color: #ffd77a; }
#doll { background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0.25), transparent 70%); }
.slot { border: 1px solid #b08a48; background: rgba(16,10,6,0.88); box-shadow: inset 0 0 10px #000, 0 0 0 2px rgba(0,0,0,0.6); }
#grid { border: 2px solid #b08a48; background-color: rgba(16,10,6,0.9); background-image: linear-gradient(rgba(176,138,72,0.35) 1px, transparent 1px), linear-gradient(90deg, rgba(176,138,72,0.35) 1px, transparent 1px); box-shadow: inset 0 0 18px #000; }
.panel { padding: 6px 10px; }
.paper h2, .paper h3 { font-size: 22px; border-bottom: 1px solid rgba(110,80,40,0.45); padding-bottom: 4px; }
#tip {
  border: 18px solid transparent;
  border-image: url("../ui/frame_najeon.png") 58 stretch;
  background: rgba(10,6,5,0.96);
  background-clip: padding-box;
  padding: 4px 6px;
  box-shadow: 0 8px 30px #000;
}
.sk-ic { float: left; width: 64px; height: 64px; margin: 0 10px 4px 0; background-image: url("../ui/skills.png"); background-size: 512px auto; box-shadow: 0 0 0 2px #2a1a10, 0 0 0 3px #b08a48; }
.skill.locked .sk-ic { filter: grayscale(1) brightness(0.5); }
.skill { overflow: hidden; }
.stat-row button, #devlogin button, #char-new button, #revive, .mentor button {
  background: linear-gradient(#7a1a12, #4a0c08); border: 1px solid #c9a24f; color: #f6e2b0; box-shadow: inset 0 1px 0 rgba(255,220,160,0.3), 0 1px 2px #000;
}

/* ── 터치 조작 ── */
#touch { display: none; }
body.touch #touch { display: block; }
#joy { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: 26px; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(20,14,10,0.35) 55%, rgba(201,162,79,0.25) 56%, rgba(20,14,10,0.5) 70%);
  border: 2px solid rgba(201,162,79,0.7); box-shadow: 0 0 0 3px rgba(0,0,0,0.5), inset 0 0 20px #000; touch-action: none; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e8c470, #8a6420 60%, #3a2a10); border: 2px solid #2a1a10; box-shadow: 0 2px 8px #000; pointer-events: none; }
#tbtns { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 22px; width: 250px; height: 250px; touch-action: none; }
.tb { position: absolute; border-radius: 50%; border: 2px solid #c9a24f; color: #f2dfae; font-family: var(--title); box-shadow: 0 0 0 3px #1a120a, 0 4px 12px rgba(0,0,0,0.7);
  background: radial-gradient(circle at 40% 35%, #6a1a12, #2a0806); background-repeat: no-repeat; touch-action: none; }
.tb.down { filter: brightness(1.5); transform: scale(0.94); }
.tb.big { right: 6px; bottom: 6px; width: 104px; height: 104px; font-size: 22px; }
.tb.sk { width: 66px; height: 66px; background-color: #1a120a; }
.tb.sk.locked { filter: grayscale(1) brightness(0.45); }
.tb.sk[data-s="0"] { right: 124px; bottom: 6px; }
.tb.sk[data-s="1"] { right: 112px; bottom: 82px; }
.tb.sk[data-s="2"] { right: 58px; bottom: 132px; }
.tb.sk[data-s="3"] { right: 0; bottom: 148px; display: none; }
.tb.sm { width: 54px; height: 54px; font-size: 12px; line-height: 1.1; background: radial-gradient(circle at 40% 35%, #3a2c1e, #120c08); }
.tb.sm[data-a="interact"] { right: 190px; bottom: 120px; }
.tb.sm[data-a="target"] { right: 128px; bottom: 170px; }
#tmenu { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); display: flex; gap: 6px; }
#tmenu button { min-width: 44px; height: 40px; padding: 0 8px; font-family: var(--title); font-size: 14px; color: #f2dfae; border: 1px solid #c9a24f;
  background: linear-gradient(#3a1a12, #1a0806); box-shadow: 0 2px 6px #000; }
@media (min-height: 700px) { .tb.sk[data-s="3"] { display: block; } }
@media (max-height: 699px) { .tb.sk[data-s="3"] { display: block; right: 10px; bottom: 120px; } .tb.sm[data-a="target"] { right: 190px; bottom: 60px; } }

/* 터치 화면에서는 창을 크게, 채팅은 위로 */
body.touch .panel { left: 50% !important; top: 52px !important; transform: translateX(-50%) !important; max-width: calc(100vw - 16px); max-height: calc(100vh - 64px); }
body.touch #chatbox { top: auto; bottom: 6px; left: 50%; transform: translateX(-50%); width: min(360px, 40vw); }
body.touch #chat-log { max-height: 84px; font-size: 12px; }
body.touch #chat-form { opacity: 0.85; }
body.touch #sysbox { top: 96px; }
body.touch #zone-name { font-size: 16px; }
@media (max-width: 560px) {
  /* 행낭은 통째로 줄이지 않는다 — ui.js fitInv 가 칸 배율(--ik)로 맞춘다 */
  .title-box h1 { font-size: 64px; }
}

/* ── 첫 화면 ── */
#backdrop { position: fixed; inset: 0; z-index: 1; overflow: hidden; background: #050304; }
#backdrop.hidden { display: none; }
#bd-img { position: absolute; inset: -3%; background: url("../ui/title_bg.png") 62% 60% / cover no-repeat; animation: bdzoom 40s ease-in-out infinite alternate; }
@keyframes bdzoom { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.06) translate(-1%, -0.5%); } }
#bd-moon { position: absolute; left: 76%; top: 50%; width: 70vmin; height: 70vmin; transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(circle, rgba(255,120,90,0.32) 0%, rgba(200,50,40,0.16) 30%, rgba(120,20,20,0.06) 55%, transparent 72%); mix-blend-mode: screen; animation: moonpulse 7s ease-in-out infinite; }
@keyframes moonpulse { 50% { opacity: 0.75; } }
#bd-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bd-shade { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, transparent 30%, rgba(0,0,0,0.55) 100%), linear-gradient(transparent 60%, rgba(0,0,0,0.7)); pointer-events: none; }
#title { background: none; z-index: 10; align-items: flex-start; }
.title-box { margin-top: 6vh; max-width: 760px; }
.title-head { display: flex; align-items: center; justify-content: center; gap: 18px; }
.title-box h1 { font-family: 'Song Myung', serif; font-size: clamp(64px, 12vw, 148px); letter-spacing: 0.08em; margin: 0; line-height: 1;
  color: #c92a18; text-shadow: 0 0 28px rgba(230,50,25,0.55), 0 0 2px rgba(255,140,100,0.6), 3px 4px 0 #120303; }
.title-box h1 span { display: inline-block; opacity: 0; transform: translateY(14px); animation: inkin 1.4s forwards; }
.title-box h1 .t2 { font-size: 0.55em; animation-delay: 0.35s; margin: 0 0.04em; }
.title-box h1 .t3 { animation-delay: 0.7s; }
@keyframes inkin { to { opacity: 1; transform: none; } }
.seal { width: clamp(48px, 7vw, 76px); height: clamp(48px, 7vw, 76px); background: #a8150e; border-radius: 6px; display: grid; grid-template-columns: 1fr; place-items: center;
  color: #f6e2c8; font-family: 'Noto Serif KR', 'Song Myung', serif; font-weight: 700; font-size: clamp(18px, 2.6vw, 28px); line-height: 1; padding: 4px;
  box-shadow: inset 0 0 0 3px #f6e2c8, inset 0 0 0 5px #a8150e, 0 0 18px rgba(200,30,20,0.4); transform: rotate(-4deg); opacity: 0; animation: inkin 1s 1.2s forwards; }
.title-box .sub { font-family: 'Song Myung', serif; font-size: clamp(18px, 2.4vw, 28px); color: #e6d2a4; letter-spacing: 0.5em; margin: 14px 0 8px; text-shadow: 0 0 12px #000, 0 2px 0 #000;
  opacity: 0; animation: inkin 1.2s 1.4s forwards; }
.title-box .sub::before, .title-box .sub::after { content: '—'; color: #8a2a1c; margin: 0 0.6em; letter-spacing: 0; }
.lead { color: #cdbb94; line-height: 1.9; text-shadow: 0 1px 4px #000, 0 0 12px #000; opacity: 0; animation: inkin 1.2s 1.8s forwards; }
.lacquer { margin: 22px auto 0; padding: 16px 22px; max-width: 360px; border: 18px solid transparent; border-image: url("../ui/frame_najeon.png") 58 stretch;
  background: rgba(12,7,6,0.88); background-clip: padding-box; opacity: 0; animation: inkin 1s 2.2s forwards; }
#devlogin { display: flex; gap: 8px; } #devlogin button { white-space: nowrap; }
/* 명부 */
.chars-box { width: min(640px, calc(100vw - 24px)); }
.chars-grid { display: grid; grid-template-columns: 1fr 260px; gap: 14px; align-items: start; }
#char-preview { width: 260px; height: 320px; background: radial-gradient(ellipse at 50% 70%, rgba(120,30,20,0.35), rgba(10,6,5,0.85) 70%); border: 1px solid #8a7048; }
#char-new { flex-wrap: wrap; }
.sex { display: flex; gap: 0; }
.sex button { padding: 8px 12px; background: #e9dcc0; border: 1px solid #6d5636; color: #4a3a2a; }
.sex button.on { background: #7a1a12; color: #f6e2b0; }
/* 누리 (lib/realm.js): 명부 카드의 작은 이름표 · 철이 열렸을 때만 보이는 고르는 줄 */
#char-list .realm-tag { margin-left: 8px; padding-left: 8px; border-left: 1px solid rgba(110,80,40,0.35); font-size: 11.5px; letter-spacing: 1px; color: rgba(74,58,42,0.7); }
#char-list .realm-tag.season { color: #7a1a12; }
#char-new .realm { display: flex; gap: 0; }
#char-new .realm button { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px 6px 6px; background: #e9dcc0; border: 1px solid #6d5636; color: #4a3a2a; }
#char-new .realm button i { font-style: normal; font-family: var(--title); width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 50%; font-size: 12px; }
#char-new .realm button.on { background: #2a2018; color: #f6e2b0; }
@media (max-width: 640px) { .chars-grid { grid-template-columns: 1fr; } #char-preview { width: 100%; height: 220px; } }

/* ── 「구룸 소긔 수믄 룡」 첫 화면: 제첨(고서 표제 쪽지) ── */
#title { align-items: flex-end; justify-content: center; padding-bottom: 5vh; }
#title .title-box { margin: 0; max-width: 560px; background: rgba(236,228,208,0.0); }
#title .lead { color: #c8bfae; text-shadow: 0 1px 6px #000; }
#title .lead b { color: #e0b860; }
#title .lacquer { border: 18px solid transparent; border-image: url("../ui/frame_najeon.png") 58 stretch; background: rgba(10,8,8,0.82); background-clip: padding-box; color: #e0d4b8; box-shadow: none; }
#title .msg { color: #8e1e14; }
@media (max-width: 700px) { #title { padding-bottom: 2vh; } }

/* ── 메뉴 아이콘 (ui/menu.png: 160px 10칸) ── */
.mi { background-image: url("../ui/menu.png") !important; background-repeat: no-repeat !important; border: none !important; box-shadow: 0 3px 8px rgba(0,0,0,0.6) !important;
  border-radius: 50% !important; padding: 0 !important; color: transparent !important; cursor: pointer; }
.mi-inv { --i: 0; } .mi-stats { --i: 1; } .mi-skills { --i: 2; } .mi-chron { --i: 3; } .mi-map { --i: 4; } .mi-chat { --i: 5; } .mi-walk { --i: 6; }
.mi-attack { --i: 7; } .mi-target { --i: 8; } .mi-interact { --i: 9; }
.minimenu button { width: 46px; height: 46px; min-width: 0 !important; background-size: 460px 46px !important; background-position: calc(var(--i) * -46px) 0 !important; transition: transform 0.12s, filter 0.12s; }
.minimenu button:hover { transform: translateY(-2px) scale(1.06); filter: brightness(1.2); }
.minimenu button.on { filter: brightness(1.35) drop-shadow(0 0 6px #ffcf7a); }
#mini { position: absolute; left: 50%; bottom: 17vh; transform: translateX(-50%); display: flex; gap: 6px; --ms: 46px; }
body.touch #mini { display: none; }
#tmenu { gap: 8px; }
#tmenu button { width: 46px; height: 46px; }
.tb.mi { background-size: auto 100% !important; }
.tb.big.mi { width: 104px; height: 104px; background-size: 1040px 104px !important; background-position: calc(var(--i) * -104px) 0 !important; }
.tb.sm.mi { width: 58px; height: 58px; background-size: 580px 58px !important; background-position: calc(var(--i) * -58px) 0 !important; }
.tb.sm.mi[data-a="interact"] { right: 188px; bottom: 118px; } .tb.sm.mi[data-a="target"] { right: 126px; bottom: 168px; }

/* ── 이야기: 대화창 · 추적 창 · 두 개의 실록 · 판소리 서막 ── */
#tracker { position: absolute; right: 16px; top: 64px; width: 300px; pointer-events: none !important; }
#tracker .tq { background: linear-gradient(90deg, rgba(10,6,4,0), rgba(10,6,4,0.78) 18%); padding: 8px 12px 10px 34px; margin-bottom: 6px; text-align: right; border-right: 3px solid #a8150e; }
#tracker .tq-n { font-family: var(--title); font-size: 17px; color: #ffd27a; text-shadow: 0 1px 2px #000; }
#tracker .tq-t { font-size: 14px; color: #f0e4c8; text-shadow: 0 1px 2px #000; margin-top: 2px; }
#tracker .tq-p { color: #ffcf7a; font-weight: 700; }
#tracker .tq-h { font-size: 12px; color: #b8a27a; margin-top: 3px; text-shadow: 0 1px 2px #000; }
body.touch #tracker { top: 62px; right: 8px; width: 240px; }
#dialog { position: absolute; left: 50%; bottom: 20vh; transform: translateX(-50%); width: min(720px, calc(100vw - 24px)); min-height: 120px; padding: 18px 26px 26px;
  border: 22px solid transparent; border-image: url("../ui/frame_najeon.png") 58 stretch; background: rgba(12,8,6,0.94); background-clip: padding-box; cursor: pointer; z-index: 40; }
.dlg-who { font-family: var(--title); font-size: 20px; color: #ffcf7a; margin-bottom: 8px; min-height: 1em; }
.dlg-text { font-size: 18px; line-height: 1.8; color: #f2e6cc; white-space: pre-line; }
.dlg-text.narr { color: #cdbb94; font-style: italic; text-align: center; }
.dlg-next { position: absolute; right: 10px; bottom: 4px; font-size: 12px; color: #b8a27a; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
#records { position: absolute; inset: 0; background: rgba(0,0,0,0.65); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 45; }
.rec-title { font-family: var(--title); font-size: 28px; color: #ffd27a; margin-bottom: 14px; text-shadow: 0 2px 4px #000; }
.rec-pair { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.rec { width: min(340px, 44vw); min-height: 220px; padding: 20px 22px; color: #1e140c; background: url("../ui/tex_hanji.png") center / 300px; position: relative;
  box-shadow: 0 0 0 6px #5a3e22, 0 0 0 8px #2a1a10, 0 10px 30px #000; }
.rec::before, .rec::after { content: ''; position: absolute; left: -10px; right: -10px; height: 14px; background: linear-gradient(#6a4a2a, #3a2414); border-radius: 7px; }
.rec::before { top: -14px; } .rec::after { bottom: -14px; }
.rec-h { font-family: var(--title); font-size: 22px; color: #6a1810; border-bottom: 1px solid #8a6a4a; padding-bottom: 6px; margin-bottom: 10px; }
.rec-h span { display: block; font-family: var(--font); font-size: 12px; color: #6a5a40; }
.rec.official .rec-h { color: #1a2a5a; }
.rec-b { font-size: 16px; line-height: 1.9; }
.rec.official .rec-b { font-family: 'Noto Serif KR', serif; }
.rec-ok { margin-top: 26px; padding: 10px 28px; font-family: var(--title); font-size: 18px; background: linear-gradient(#7a1a12, #4a0c08); color: #f6e2b0; border: 1px solid #c9a24f; }
#intro { position: fixed; inset: 0; z-index: 60; background: transparent; }
#intro-cv { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro-text { position: absolute; left: 50%; bottom: 12vh; transform: translateX(-50%); width: min(820px, calc(100vw - 32px)); text-align: center;
  font-family: 'Song Myung', serif; font-size: clamp(18px, 2.6vh, 28px); line-height: 1.9; color: #e8dfcc; white-space: pre-line;
  text-shadow: 0 0 14px #000, 0 0 4px #000; }
.intro-text span { opacity: 0; transition: opacity 0.6s; }
.intro-text span.on { opacity: 1; }
.intro-skip { position: absolute; right: 22px; bottom: 22px; padding: 8px 16px; font-family: var(--title); background: rgba(30,20,14,0.75); color: #f0e0bc; border: 1px solid #8a6a4a; }

/* ── 기기별 배치: body.pc / body.tablet / body.phone (+ portrait, short) ── */
.lay { width: 46px; height: 46px; border-radius: 50%; border: 2px solid #8a6a34; background: radial-gradient(circle at 40% 35%, #3a2c1e, #120c08); box-shadow: 0 3px 8px rgba(0,0,0,0.6);
  color: #f0dfae; font-size: 20px; cursor: pointer; padding: 0; }
.lay::before { content: '✋'; }
.lay.kb::before { content: '⌨'; }
.lay[hidden] { display: none; }

/* 태블릿 + 키보드: PC 판을 쓰고 조이스틱·큰 버튼은 치운다. 메뉴는 오른쪽 위 (손이 닿게) */
body.tablet #touch { display: none; }
body.tablet #mini { display: flex; position: absolute; right: max(10px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); bottom: auto; }
body.tablet #mini button { width: 50px; height: 50px; background-size: 500px 50px !important; background-position: calc(var(--i) * -50px) 0 !important; }
body.tablet #mini .lay { background-size: auto !important; }
body.tablet #tracker { top: 72px; right: 10px; width: 280px; }
body.tablet #chatbox { left: 14px; bottom: max(200px, 26vh); width: 360px; transform: none; }
body.tablet .panel { top: 70px !important; }

/* 휴대폰 */
body.phone #mini { display: none; }
body.phone #tracker { top: 140px; right: auto; left: 10px; width: 230px; }
body.phone #tracker .tq { text-align: left; border-right: none; border-left: 3px solid #a8150e; padding: 6px 12px 7px 10px;
  background: linear-gradient(270deg, rgba(10,6,4,0), rgba(10,6,4,0.78) 22%); }
body.phone #tracker .tq-n { font-size: 14px; } body.phone #tracker .tq-t { font-size: 12px; } body.phone #tracker .tq-h { font-size: 11px; }
body.phone #sysbox { top: 140px; left: auto; right: 10px; width: min(300px, 45vw); text-align: right; }
body.phone #sysbox div { font-size: 12px; }
body.phone #chatbox { bottom: max(6px, env(safe-area-inset-bottom)); width: min(320px, 36vw); }
body.phone #chat-log { max-height: 64px; }
body.phone #zone-name { top: 8px; }
body.phone .lay { width: 46px; height: 46px; }
body.phone.panel-open #tracker, body.phone.panel-open #joy, body.phone.panel-open #tbtns, body.phone.panel-open #chatbox { display: none; }
body.phone #dialog { bottom: 8px; width: calc(100vw - 16px); min-height: 0; padding: 10px 14px 14px; border-width: 14px; }
body.phone .dlg-who { font-size: 16px; margin-bottom: 4px; }
body.phone .dlg-text { font-size: 15px; }

/* 휴대폰 세로: 메뉴를 오른쪽 세로줄로, 추적 창은 구슬 아래, 채팅은 조이스틱 위 */
body.phone.portrait #tmenu { flex-direction: column; top: max(10px, env(safe-area-inset-top)); }
body.phone.portrait #tmenu button { width: 42px; height: 42px; background-size: 420px 42px !important; background-position: calc(var(--i) * -42px) 0 !important; }
body.phone.portrait #tmenu .lay { background-size: auto !important; }
body.phone.portrait #tracker { top: 190px; width: calc(100vw - 80px); max-width: 300px; }
body.phone.portrait #sysbox { top: auto; bottom: 330px; left: 10px; right: auto; text-align: left; width: calc(100vw - 80px); }
body.phone.portrait #chatbox { left: 10px; transform: none; bottom: 200px; width: calc(100vw - 20px); }
body.phone.portrait #chat-log { max-height: 54px; }
body.phone.portrait #joy { width: 136px; height: 136px; bottom: max(30px, env(safe-area-inset-bottom)); }
body.phone.portrait #tbtns { bottom: max(26px, env(safe-area-inset-bottom)); }
body.phone.portrait #dialog { bottom: 180px; }

/* 높이가 낮은 화면 (가로 휴대폰): 버튼을 줄여 화면을 넓게 */
body.phone.short #joy { width: 118px; height: 118px; bottom: 14px; }
body.phone.short #joy-knob { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
body.phone.short #tbtns { transform: scale(0.8); transform-origin: right bottom; bottom: 10px; }
body.phone.short #tmenu button { width: 40px; height: 40px; background-size: 400px 40px !important; background-position: calc(var(--i) * -40px) 0 !important; }
body.phone.short #tmenu .lay { background-size: auto !important; }
body.phone.short #tracker { top: 122px; width: 210px; }
body.phone.short #tracker .tq-h { display: none; }
body.phone.short #sysbox { top: 58px; right: 10px; }
body.phone.short #chatbox { width: min(300px, 34vw); }
body.phone.short #dialog { bottom: 4px; width: min(640px, calc(100vw - 300px)); }
body.phone.short #zone-name { display: none; }
body.phone.portrait #zone-name { left: 50%; transform: translateX(-50%); top: 6px; font-size: 14px; white-space: nowrap; }
body.phone.portrait #tbtns { transform: scale(0.78); transform-origin: right bottom; }
body.phone.portrait #joy { left: 14px; width: 128px; height: 128px; }
body.phone.portrait #chatbox { bottom: 236px; }
body.phone.portrait #tracker { top: 160px; }   /* 허리띠가 아래(이동 막대 위)로 내려가 구슬 밑이 비었다 */
@media (max-width: 360px) { body.phone.portrait #tbtns { transform: scale(0.7); } }

/* ── 제첨 다시: 찢긴 한지, 스며든 먹, 찍히는 낙관, 뒤에서 타오르는 도깨비불 ── */

/* 능력치 설명 */
.stat-k .stat-what { font-size: 12px; color: #6d5636; margin-left: 4px; }
.stat-per { font-size: 12px; color: #8a4a20; margin: -2px 0 6px 10px; }
.stat-tip { font-size: 12px; color: #4a3a2a; background: rgba(120,90,50,0.12); border-left: 3px solid #8e2a22; padding: 6px 8px; margin: 6px 0 2px; line-height: 1.6; }

/* ── 길잡이 ── */
.helpb { width: 46px; height: 46px; border-radius: 50%; border: 2px solid #b08a48; padding: 0; cursor: pointer;
  background: radial-gradient(circle at 40% 32%, #5a2018, #2a0a06 70%); box-shadow: 0 3px 8px rgba(0,0,0,0.6), inset 0 0 0 3px rgba(0,0,0,0.35);
  color: #f0d488; font-family: 'Noto Serif KR', serif; font-weight: 700; font-size: 20px; line-height: 1; text-shadow: 0 1px 2px #000; }
.helpb:hover { filter: brightness(1.2); }
body.phone.portrait #tmenu .helpb, body.phone.short #tmenu .helpb { width: 40px; height: 40px; font-size: 17px; }
body.tablet #mini .helpb { width: 50px; height: 50px; }
#panel-help { width: min(560px, calc(100vw - 16px)); max-height: min(78vh, 640px); overflow: auto; left: 50%; top: 10vh; transform: translateX(-50%); }
.help-tabs { display: flex; gap: 6px; margin: 4px 0 10px; }
.help-tabs button { padding: 6px 14px; background: #e4d6b4; border: 1px solid #8a6a3a; color: #4a3a2a; font-family: var(--title); font-size: 15px; cursor: pointer; }
.help-tabs button.on { background: #7a1a12; color: #f6e2b0; }
.help-dev-now { font-size: 13px; color: #6d5636; margin-bottom: 6px; }
.help-keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.help-keys th { text-align: left; white-space: nowrap; padding: 6px 10px 6px 0; color: #7a1a12; font-family: var(--title); font-weight: 400; vertical-align: top; width: 1%; }
.help-keys td { padding: 6px 0; color: #2a2018; border-bottom: 1px dashed rgba(120,90,50,0.35); line-height: 1.5; }
.help-other { margin-top: 10px; font-size: 12px; color: #6d5636; }
.help-dev { margin: 4px 4px 0 0; padding: 3px 8px; font-size: 12px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; cursor: pointer; }
.help-topic { border-bottom: 1px dashed rgba(120,90,50,0.35); padding: 6px 0; }
.help-topic summary { cursor: pointer; font-family: var(--title); font-size: 16px; color: #5a1a10; }
.help-topic div { font-size: 14px; color: #2a2018; line-height: 1.75; padding: 6px 4px 2px; }
.help-topic b, #gtip b { color: #8e1e14; }
.help-reset { margin-top: 12px; padding: 5px 10px; font-size: 12px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; cursor: pointer; }
#gtip { position: absolute; left: 50%; bottom: 22vh; transform: translateX(-50%); width: min(440px, calc(100vw - 24px)); z-index: 45;
  border: 18px solid transparent; border-image: url("../ui/frame_najeon.png") 58 stretch; background: rgba(12,8,6,0.95); background-clip: padding-box; padding: 10px 16px 12px;
  animation: gtin 0.35s ease-out; }
@keyframes gtin { from { opacity: 0; transform: translate(-50%, 12px); } }
.gt-title { font-family: var(--title); font-size: 19px; color: #ffcf7a; margin-bottom: 6px; }
.gt-body { font-size: 14px; color: #efe2c4; line-height: 1.75; }
#gtip b { color: #ffd27a; }
.gt-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.gt-btns button { padding: 6px 12px; font-size: 13px; background: #3a1a12; color: #f2dfae; border: 1px solid #a8803e; cursor: pointer; }
.gt-btns .gt-ok { background: #7a1a12; }
body.phone #gtip { bottom: auto; top: 30vh; }
body.phone.short #gtip { top: 12px; }
body.phone .gt-all { display: none; }

/* PC 메뉴 줄: 크기는 ui.js placeMini 가 판 너비에 맞춰 --ms 로 준다 */
body.pc #mini button { width: var(--ms); height: var(--ms); }
body.pc #mini button.mi { background-size: calc(var(--ms) * 10) var(--ms) !important; background-position: calc(var(--i) * var(--ms) * -1) 0 !important; }
body.pc #mini .helpb { font-size: calc(var(--ms) * 0.42); }

/* 기술 창 — 점수·단계·수치 (lib/skills.js) */
.sk-pts { font-family: var(--title); color: var(--blue); margin: 2px 0 6px; }
.sk-pts b { color: var(--red); font-size: 18px; }
.skill { cursor: pointer; }
.skill.sk-right { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: rgba(255,240,200,0.55); }
.skill .sk-up { width: 22px; height: 20px; margin-left: 4px; padding: 0; background: var(--red); color: #f4e6c8; border: 1px solid #3a120c; font-weight: 700; }
.skill .sk-up:hover { background: #a8352b; }
.sk-bonus { color: var(--dc-blue); }
.sk-tag { font-family: var(--font); font-size: 11px; color: var(--dc-green); border: 1px solid currentColor; padding: 0 4px; margin-left: 4px; vertical-align: middle; }
.sk-tag.sk-lock { color: var(--dc-red); }
.sk-num { font-size: 12px; color: var(--ink); margin-top: 4px; border-top: 1px dotted #a08a62; padding-top: 3px; }
.sk-next { color: var(--ink2); border-top: none; padding-top: 0; margin-top: 1px; }

/* ───────── 세계: 역참 장부 · 궤짝 · 종묘지기 (public/js/world.js) ───────── */
.w-hanja { font-family: var(--title); font-size: 13px; color: var(--ink2); letter-spacing: 3px; margin-left: 6px; }
.wpanel h3 .close, .w-ledger h3 .close, .w-gwe h3 .close { float: right; background: none; border: none; color: var(--ink2); font-size: 16px; }
/* 역참 장부: 괘선 친 장부 한 장. 등록한 역참엔 붉은 驛 도장 */
#panel-wp { left: 50%; top: 70px; transform: translateX(-50%); width: 430px; }
#wp-list { list-style: none; margin: 8px 0 4px; padding: 0; border-top: 2px solid #6d5636; border-bottom: 2px solid #6d5636;
  background: repeating-linear-gradient(90deg, transparent 0 46px, rgba(120,40,30,0.18) 46px 47px); }
.wp-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-bottom: 1px dotted rgba(90,60,30,0.55); }
.wp-row:last-child { border-bottom: none; }
.wp-seal { width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center; font-family: var(--title); font-size: 18px; }
.wp-row.known .wp-seal { color: #f3d9c0; background: #9a2a20; border: 2px solid #6a160f; box-shadow: inset 0 0 0 2px rgba(255,210,180,0.35); transform: rotate(-4deg); }
.wp-row.unknown .wp-seal { border: 1px dashed rgba(90,60,30,0.5); border-radius: 2px; }
.wp-nm { flex: 1; font-size: 15px; color: var(--ink); }
.wp-nm small { display: block; font-size: 11px; color: var(--ink2); }
.wp-row.unknown .wp-nm { color: rgba(60,45,30,0.45); }
.wp-st { font-family: var(--title); font-size: 14px; color: var(--blue); min-width: 42px; text-align: right; }
.wp-row.unknown .wp-st { color: rgba(60,45,30,0.4); font-family: var(--font); font-size: 12px; }
.wp-row.here { background: rgba(201,162,79,0.18); }
.wp-row.here .wp-st { color: var(--ink2); }
.wp-row.known:not(.here) { cursor: pointer; }
.wp-row.known:not(.here):hover { background: rgba(142,42,34,0.12); }
.wp-row.known:not(.here):hover .wp-st { color: var(--red); }
.wp-row.portal .wp-seal { background: #3a3a44; border-color: #222; }
.w-foot { margin-top: 6px; }
/* 궤짝: 행낭과 같은 반닫이 재질 */
#panel-stash { left: 18px; top: 60px; width: 760px; max-width: calc(100vw - 24px);
  border-image: url("../ui/frame_bandaji.png") 58 stretch; background: url("../ui/tex_bandaji.png") center / 300px; background-clip: padding-box; color: #ecdcb6; }
#panel-stash h3 { color: #f0c870; text-shadow: 1px 1px 0 #000; }
#panel-stash h3 .w-hanja, #panel-stash .note { color: #c8b48a; }
#panel-stash .close { color: #c8b48a; }
.st-wrap { display: flex; gap: 16px; flex-wrap: wrap; }
.st-h { font-family: var(--title); color: #e8c27a; margin: 4px 0; letter-spacing: 2px; }
.st-grid { position: relative; border: 2px solid #b08a48; background-color: rgba(16,10,6,0.9);
  background-image: linear-gradient(rgba(176,138,72,0.3) 1px, transparent 1px), linear-gradient(90deg, rgba(176,138,72,0.3) 1px, transparent 1px); background-size: 34px 34px; box-shadow: inset 0 0 18px #000; }
.st-it { position: absolute; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.st-it img { max-width: 100%; max-height: 100%; }
.st-it:hover { background: rgba(255,210,120,0.16); }
.st-it.g-sang { background: rgba(80,100,200,0.16); } .st-it.g-jin { background: rgba(220,190,60,0.14); }
.st-it.g-myeong { background: rgba(200,130,50,0.2); } .st-it.g-beol { background: rgba(80,190,90,0.16); }
.st-it.unid img { filter: sepia(0.6) brightness(0.8); }
.st-gold { margin-top: 10px; font-size: 13px; color: #d8c290; line-height: 1.6; }
.st-gold b { color: #ffd77a; }
.st-gb { margin-top: 4px; display: flex; gap: 6px; }
.st-gb button, .sg-btns button { padding: 5px 10px; font-size: 13px; background: linear-gradient(#7a1a12, #4a0c08); border: 1px solid #c9a24f; color: #f6e2b0; box-shadow: inset 0 1px 0 rgba(255,220,160,0.3), 0 1px 2px #000; }
.st-hover { min-height: 18px; margin-top: 8px; font-size: 13px; width: 0; min-width: 100%; overflow-wrap: anywhere; }   /* 칸 위에 마우스를 대면 뜨는 설명: 열 폭을 늘리지 않고 그 안에서 줄을 바꾼다 (긴 재료 설명이 행낭 열을 넓혀 아래로 밀어내던 것 — 사파리) */
/* 종묘지기: 먹빛 혼, 옛이야기는 한지에 쓴 인용 */
#panel-sage { left: 18px; top: 60px; width: 440px; }
#panel-sage h3 { color: #3a4a6a; }
.sg-btns { display: flex; gap: 8px; margin: 8px 0; }
.sg-btns button:disabled { filter: grayscale(0.8) brightness(0.8); cursor: default; }
#sg-lore-t { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--red); background: rgba(255,250,235,0.35); font-size: 14px; line-height: 1.6; color: var(--ink); }
body.touch #panel-stash .st-grid { transform-origin: 0 0; }
body.panel-open #tracker { display: none; }
#devlogin { flex-wrap: wrap; justify-content: center; }
#devlogin #devkey { width: 120px; }

/* ───────── 기술 나무 (ui.js renderSkills) · 단축 칸 고르기 · 터치 기술 넘기기 ─────────
   한지 위에 먹선으로 이은 나무. 쓰는 기술은 금테 네모, 숙련(늘 붙음)은 엽전처럼 둥근 테.
   갈래 책갈피는 붉은 옻칠 + 금박 글씨, 고른 기술 풀이는 오른쪽(휴대폰은 아래) 한지 쪽지. */
#panel-skills { width: 660px; max-width: calc(100vw - 24px); }
body.pc #panel-skills, body.tablet #panel-skills { max-height: calc(100vh - 250px); }   /* 아래 판·메뉴 줄을 가리지 않게 */
.skt-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.skt-head .sk-pts { margin: 0; }
.skt-forget { margin-left: auto; padding: 3px 10px; font-size: 13px; background: linear-gradient(#3a2a4a, #1c1226); color: #e8dcff; border: 1px solid #9a86c8;
  box-shadow: inset 0 1px 0 rgba(220,200,255,0.25), 0 1px 2px #000; }
.skt-forget i { font-style: normal; color: #c8b4ff; font-size: 11px; margin-left: 4px; }
.skt-tabs { display: flex; gap: 4px; margin: 0 0 -1px; position: relative; z-index: 1; }
.skt-tab { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 6px 4px 5px; border: 1px solid #5a2a18; border-bottom: none;
  background: linear-gradient(#5a1a12, #3a0e0a); color: #d8b88a; font-family: var(--title); font-size: 17px; letter-spacing: 2px; border-radius: 6px 6px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,200,140,0.18); opacity: 0.78; }
.skt-tab i { font-style: normal; font-size: 12px; color: #c9a24f; letter-spacing: 1px; }
.skt-tab em { font-style: normal; font-family: var(--font); font-size: 11px; color: #ffd77a; min-width: 1em; }
.skt-tab.on { opacity: 1; background: linear-gradient(#9a2a1e, #6a160e); color: #ffe8b8; border-color: #c9a24f; box-shadow: inset 0 1px 0 rgba(255,220,160,0.35), 0 -2px 8px rgba(0,0,0,0.3); }
.skt-tab:hover { opacity: 1; }
.skt-main { display: flex; gap: 12px; align-items: flex-start; }
.skt-board { flex: 0 0 300px; border: 1px solid #8a6a34; border-top: 2px solid #c9a24f; padding: 6px 4px 10px;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,250,232,0.55), rgba(205,184,143,0.25) 70%), url("../ui/tex_hanji.png") center / 260px;
  box-shadow: inset 0 0 22px rgba(80,50,20,0.35); }
.skt-tdesc { font-size: 12px; color: var(--ink2); text-align: center; margin: 0 6px 4px; line-height: 1.4; }
.skt-tree { position: relative; width: 100%; height: calc(var(--rows) * 92px); }
.skt-lines { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.skt-lines line { stroke: rgba(42,28,16,0.55); stroke-width: 3px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-dasharray: 2 5; }
.skt-lines line.half { stroke: #8e2a22; stroke-dasharray: none; stroke-width: 3px; opacity: 0.75; }
.skt-lines line.both { stroke: #b8862a; stroke-dasharray: none; stroke-width: 4px; filter: drop-shadow(0 0 2px rgba(255,200,90,0.6)); }
.skt-lv { position: absolute; left: 2px; transform: translateY(-50%); font-family: var(--title); font-size: 13px; color: rgba(74,58,42,0.45); width: 20px; text-align: center; }
.skt-lv.open { color: #8e2a22; }
.skt-lv::after { content: ''; display: block; margin: 1px auto 0; width: 10px; border-top: 1px solid currentColor; opacity: 0.6; }
.skt-node { position: absolute; width: 60px; height: 60px; transform: translate(-50%, -50%); cursor: pointer; }
body.pc .skt-node { touch-action: none; }
.skt-ic { position: absolute; inset: 0; background-color: #1a120a; background-repeat: no-repeat;
  box-shadow: 0 0 0 2px #2a1a10, 0 0 0 3px #b08a48, 0 0 0 5px #2a1a10, 0 3px 8px rgba(0,0,0,0.5); }
.skt-node.passive .skt-ic { border-radius: 50%; box-shadow: 0 0 0 2px #2a1a10, 0 0 0 4px #c9a24f, 0 0 0 6px #2a1a10, 0 3px 8px rgba(0,0,0,0.5); }
.skt-node.locked .skt-ic { filter: grayscale(1) brightness(0.55) contrast(0.9); }
.skt-node:not(.learned):not(.locked) .skt-ic { filter: saturate(0.55) brightness(0.8); }
.skt-node.can .skt-ic { filter: none; animation: sktcan 2.4s ease-in-out infinite; }
@keyframes sktcan { 50% { box-shadow: 0 0 0 2px #2a1a10, 0 0 0 3px #ffd77a, 0 0 0 5px #2a1a10, 0 0 14px rgba(255,200,90,0.75); } }
.skt-node.passive.can .skt-ic { animation: none; }
.skt-node.sel .skt-ic, .skt-node:hover .skt-ic { box-shadow: 0 0 0 2px #2a1a10, 0 0 0 3px #ffe08a, 0 0 0 5px #8e2a22, 0 0 16px rgba(255,190,90,0.7); }
.skt-node.passive.sel .skt-ic, .skt-node.passive:hover .skt-ic { box-shadow: 0 0 0 2px #2a1a10, 0 0 0 4px #ffe08a, 0 0 0 6px #8e2a22, 0 0 16px rgba(255,190,90,0.7); }
.skt-node.lit .skt-ic { box-shadow: 0 0 0 2px #2a1a10, 0 0 0 3px #ffd77a, 0 0 0 5px #2a1a10, 0 0 18px rgba(255,210,110,0.9); }
.skt-pt { position: absolute; right: -8px; bottom: -8px; min-width: 22px; height: 20px; padding: 0 4px; font: 700 13px/20px var(--font); text-align: center;
  color: #ffe08a; background: linear-gradient(#2a1810, #0e0806); border: 1px solid #c9a24f; border-radius: 3px; box-shadow: 0 1px 3px #000; }
.skt-pt i { font-style: normal; color: #9ec0ff; font-size: 10px; margin-left: 1px; }
.skt-slk { position: absolute; left: -7px; top: -8px; padding: 0 3px; font: 700 10px/15px var(--font); color: #1a120a; background: #e8d6a6; border: 1px solid #6d5636; border-radius: 2px; letter-spacing: 1px; }
.skt-up { position: absolute; right: -11px; top: -11px; width: 24px; height: 24px; padding: 0; border-radius: 50%; font: 700 17px/20px var(--font);
  color: #ffeec8; background: radial-gradient(circle at 40% 35%, #c84432, #7a160e); border: 1px solid #ffd77a; box-shadow: 0 1px 4px #000; z-index: 2; }
.skt-up:hover { filter: brightness(1.25); }
.skt-nm { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 6px; white-space: nowrap; font-size: 11px; color: var(--ink); text-shadow: 0 0 3px rgba(255,248,230,0.9), 0 0 2px rgba(255,248,230,0.9); pointer-events: none; }
.skt-node.locked .skt-nm { color: rgba(74,58,42,0.6); }
.skt-info { flex: 1; min-width: 0; min-height: 320px; padding: 8px 10px 10px; border-left: 3px solid var(--red); background: rgba(255,250,235,0.38); font-size: 13px; line-height: 1.55; }
.skt-empty { color: var(--ink2); font-size: 13px; padding: 30px 6px; text-align: center; }
.skt-i-nm { font-family: var(--title); font-size: 22px; color: var(--red); letter-spacing: 2px; }
.skt-i-ty { font-size: 12px; color: var(--ink2); margin-bottom: 4px; }
.skt-i-lv b { font-size: 17px; color: var(--ink); }
.skt-i-need { font-size: 12px; } .skt-i-need .ok { color: var(--dc-green); } .skt-info .no { color: var(--dc-red); }
.skt-i-desc { margin: 6px 0; color: var(--ink); }
.skt-i-cost { font-size: 12px; color: var(--blue); }
.skt-info .sk-num b { font-family: var(--title); font-weight: 400; color: var(--red); margin-right: 4px; }
.skt-syn { margin-top: 5px; font-size: 12px; color: #6a4a1a; } .skt-syn i { font-style: normal; color: var(--ink2); } .skt-syn b { color: var(--dc-green); }
.skt-put { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; padding-top: 8px; border-top: 1px dotted #a08a62; }
.skt-put .small { width: 100%; color: var(--ink2); }
.skt-key { min-width: 30px; height: 30px; padding: 0 6px; font: 700 13px var(--font); color: #e8d6a6; background: linear-gradient(#3a2a1c, #1a120a); border: 1px solid #8a6a34; box-shadow: 0 1px 2px #000; }
.skt-key:last-child { min-width: 46px; }
.skt-key.on { color: #2a1406; background: linear-gradient(#ffe6a0, #c9a24f); border-color: #fff0c8; }
.skt-key:hover { filter: brightness(1.25); }
.skt-hint { margin: 8px 2px 0; }
.skt-ghost { position: fixed; width: 52px; height: 52px; z-index: 70; pointer-events: none; opacity: 0.9; box-shadow: 0 0 0 2px #c9a24f, 0 6px 18px #000; }
/* 아래 판의 칸을 누르면 뜨는 기술 고르기 */
#sk-pick { position: fixed; z-index: 45; max-width: min(460px, calc(100vw - 12px)); padding: 6px 8px 8px; border: 18px solid transparent;
  border-image: url("../ui/frame_najeon.png") 58 stretch; background: rgba(12,8,6,0.95); background-clip: padding-box; color: #e8d6a6; box-shadow: 0 10px 30px #000; }
.skp-h { font-family: var(--title); color: #f0c870; font-size: 15px; letter-spacing: 2px; margin-bottom: 4px; }
.skp-list { display: flex; flex-wrap: wrap; gap: 5px; }
.skp-sk { width: 50px; height: 50px; padding: 2px; background: #1a120a; border: 1px solid #6d5636; }
.skp-sk span { display: block; width: 46px; height: 46px; background-repeat: no-repeat; }
.skp-sk.on { border-color: #ffd77a; box-shadow: 0 0 8px rgba(255,210,110,0.8); }
.skp-sk.dim span { filter: grayscale(1) brightness(0.5); }
.skp-sk:hover { border-color: #ffe08a; }
.skp-clear { margin-top: 6px; padding: 2px 10px; font-size: 12px; background: #2a1a10; color: #c8b48a; border: 1px solid #6d5636; }
/* 터치: 기술 단추 둘째 장 (A S D 우클릭) */
.tb.sk { background-repeat: no-repeat; }
.tb.sk::after { content: attr(data-k); position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%); font: 700 10px/1 var(--font); color: #f2dfae; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.tb.sk.empty { background: radial-gradient(circle at 40% 35%, #2a1e14, #0e0906) !important; filter: none; opacity: 0.7; }
/* 기술 단추의 재사용 대기: 시곗바늘처럼 걷히는 먹빛(.cdw) + 남은 초(.cdt). 기력 모자람은 쪽빛, 다 차면 잠깐 금빛 (touch.js skillIcons) */
.tb.sk .cdw { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.tb.sk .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
  font: 400 21px/1 var(--title); color: #fff1cc; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 2px #000; }
.tb.sk.nomp { box-shadow: inset 0 0 0 99px rgba(20,30,90,0.45), 0 0 0 3px #1a120a, 0 4px 12px rgba(0,0,0,0.7); }
.tb.sk.nomp .cdt:empty::before { content: '기력'; font: 400 11px/1 var(--font); color: #b8ccff; margin-top: 30px; }
html.lang-en .tb.sk.nomp .cdt:empty::before { content: 'Ki'; }
.tb.sk.ready { animation: sk-ready 0.42s ease-out; }
@keyframes sk-ready { from { box-shadow: 0 0 0 3px #1a120a, 0 0 18px 6px rgba(255,210,120,0.95), inset 0 0 0 99px rgba(255,226,150,0.35); border-color: #ffe6a0; } to { box-shadow: 0 0 0 3px #1a120a, 0 4px 12px rgba(0,0,0,0.7); } }
.tb.sm.sk-page { width: 40px; height: 40px; right: 70px; bottom: 214px; font-size: 18px; color: #ffe0a0; background: radial-gradient(circle at 40% 35%, #6a1a12, #2a0806); }
.tb.sm.sk-page.on { background: radial-gradient(circle at 40% 35%, #2c3f73, #0c1430); }
@media (max-height: 699px) { .tb.sm.sk-page { right: 64px; bottom: 196px; } }
/* 휴대폰·좁은 화면: 나무 위, 풀이 아래. 손가락 크기 */
@media (max-width: 720px) {
  .skt-main { flex-direction: column; align-items: stretch; }
  .skt-board { flex: none; }
  .skt-info { min-height: 0; border-left: none; border-top: 3px solid var(--red); }
  .skt-tab { font-size: 15px; letter-spacing: 1px; } .skt-tab i { display: none; }
}
body.touch .skt-up { width: 30px; height: 30px; right: -13px; top: -13px; font-size: 20px; line-height: 26px; }
body.touch .skt-key { min-width: 36px; height: 36px; }
body.phone #panel-skills { width: calc(100vw - 12px); }

/* ── 두루마리 그림 위의 제첨: 그림 속 제목 쪽지 자리에 딱 맞춘다 (title.js placePlaque) ── */

/* 낮은 가로 화면(휴대폰 가로): 소개글·로그인 상자를 작게, 제첨과 겹치지 않게 왼쪽 가운데로 */
@media (orientation: landscape) and (max-height: 560px) {
  #title { align-items: center; justify-content: flex-start; padding: 0 0 0 4vw; }
  #title .title-box { max-width: min(440px, 58vw); }
  #title .lead { font-size: 12px; line-height: 1.55; margin: 0 0 6px; }
  #title .lacquer { margin-top: 6px; padding: 8px 12px; border-width: 12px; }
  #devlogin input { width: 150px; padding: 6px 8px; }
  #devlogin #devkey { width: 96px; }
}
@media (orientation: portrait) and (max-width: 520px) {
  #title .lead { font-size: 13px; line-height: 1.6; }
}

/* ── 터치 단추 배치 (모든 화면 공통, 겹침 없음) ──
   큰 공격 단추를 중심으로 반지름 112px 호 위에 기술 4개 (0·35·70·105°, 이웃 간격 ≥ 7px),
   그 바깥에 줍기·표적, 위에 기술 넘기기. 작은 화면은 #tbtns 전체를 줄일 뿐 서로 위치는 같다. */
body.touch #tbtns { width: 270px; height: 250px; }
body.touch #tbtns .tb.big { right: 6px; bottom: 6px; width: 104px; height: 104px; }
body.touch #tbtns .tb.sk { width: 60px; height: 60px; display: block; }
body.touch #tbtns .tb.sk[data-s="0"] { right: 140px; bottom: 28px; }
body.touch #tbtns .tb.sk[data-s="1"] { right: 120px; bottom: 92px; }
body.touch #tbtns .tb.sk[data-s="2"] { right: 66px; bottom: 133px; }
body.touch #tbtns .tb.sk[data-s="3"] { right: 0; bottom: 136px; }
body.touch #tbtns .tb.sm.mi { width: 50px; height: 50px; background-size: 500px 50px !important; background-position: calc(var(--i) * -50px) 0 !important; }
body.touch #tbtns .tb.sm[data-a="interact"] { right: 211px; bottom: 15px; }
body.touch #tbtns .tb.sm[data-a="target"] { right: 203px; bottom: 95px; }
body.touch #tbtns .tb.sm.sk-page { right: 40px; bottom: 202px; width: 40px; height: 40px; }
body.phone.short #tbtns { transform: scale(0.74); }
.skt-i-spd { font-size: 12px; color: #6a4a1a; }
/* 대화 잠금 중(첫 장 0.8초): 넘기기 안내를 흐리게 */
#dialog .dlg-next { transition: opacity 0.25s; }
#dialog.locked .dlg-next { opacity: 0.15; }

/* ── 잠룡 명부: 화면 안에 들어오게 하고, 명부(목록)만 따로 스크롤 ── */
#chars { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); box-sizing: border-box; }
#chars .chars-box { max-height: 100%; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; }
#chars .chars-box > h2, #chars .chars-box > .note { flex: none; }
#chars .chars-grid { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
#chars .chars-grid > div:first-child { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
#char-list { flex: 1 1 auto; min-height: 60px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding-right: 4px; }
#char-list::-webkit-scrollbar { width: 6px; } #char-list::-webkit-scrollbar-thumb { background: rgba(110,80,40,0.5); border-radius: 3px; }
#char-new, #chars .chars-grid .note, #logout { flex: none; }
/* 휴대폰 세로: 미리보기는 위에 작게, 아래로 명부·새 잠룡 */
@media (max-width: 640px) {
  #chars .chars-box { width: 100%; padding: 14px 14px 10px; }
  #chars .chars-grid { display: flex; flex-direction: column; gap: 8px; }
  #char-preview { order: -1; flex: none; width: 100%; height: min(26vh, 200px); }
  #char-list li { padding: 8px 10px; margin: 4px 0; }
  #char-list .nm { font-size: 17px; }
}
/* 휴대폰 가로: 좌우 두 칸, 줄 간격을 줄여 한 화면에 */
@media (orientation: landscape) and (max-height: 560px) {
  #chars .chars-box { width: min(860px, 100%); padding: 10px 16px 8px; }
  #chars .chars-box > h2 { font-size: 18px; margin: 0; padding-bottom: 2px; }
  #chars .chars-box > .note { margin: 2px 0 4px; font-size: 12px; }
  #chars .chars-grid { grid-template-columns: 1fr 210px; gap: 12px; }
  #char-preview { width: 210px; height: 100%; max-height: calc(100vh - 90px); }
  #char-list { margin: 4px 0; }
  #char-list li { padding: 5px 10px; margin: 3px 0; }
  #char-list .nm { font-size: 16px; }
  #char-list .meta { font-size: 12px; }
  #char-new { margin: 6px 0 2px; gap: 6px; }
  #char-new input { padding: 6px 8px; width: 150px; }
  #char-new button, .sex button { padding: 6px 10px; }
  #chars .chars-grid .note { margin: 2px 0; font-size: 11px; }
}
body.shop-open #tmenu, body.shop-open #tracker, body.shop-open #mini { display: none !important; }

/* 휴대폰: 꾹 누르기 메뉴·글자 고르기·그림 끌기·두 번 톡 확대 막기 (입력 칸은 예외) */
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
* { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
img, canvas { -webkit-user-drag: none; user-drag: none; }
input, textarea, [contenteditable="true"] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
/* 아이폰은 16px 보다 작은 입력 칸을 누르면 화면을 확대한다 → 터치 기기에서는 16px */
body.touch input, body.touch textarea, body.touch select { font-size: 16px !important; }

/* ───────── 끝판: 세공방 · 혼 도감 · 혼각 책 · 꿈길 방목 · 장쇠 · 세상(난이도) · 궤짝 칸 · 꿈길 두루마리 (public/js/endgame.js) ─────────
   한지 위 먹선·붉은 인장. 혼은 넋불 속 한 글자, 보석은 옥벽·산호 가지. 꿈길 시계는 타들어 가는 향 한 대. */
.eg-seal { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none; font-family: var(--title); font-size: 18px; color: #f6e4cc;
  background: var(--c, #8e2a22); border: 2px solid rgba(0,0,0,0.35); box-shadow: inset 0 0 0 2px rgba(255,225,190,0.35), 0 1px 2px rgba(0,0,0,0.4); transform: rotate(-4deg); border-radius: 3px; }
.eg-seal.sm { width: 20px; height: 20px; font-size: 12px; border-width: 1px; }
.eg-seal.big { width: 120px; height: 120px; font-size: 76px; border-width: 5px; box-shadow: inset 0 0 0 6px rgba(255,225,190,0.3), 0 10px 40px rgba(0,0,0,0.7); }
.eg-ic { vertical-align: middle; }
/* 행낭 칸: 묶음 수 · 홈 */
.cell-item .eg-cnt { position: absolute; right: 2px; bottom: 0; font: 700 12px var(--font); color: #ffe8b0; text-shadow: 0 0 2px #000, 1px 1px 0 #000; pointer-events: none; }
.cell-item .eg-sk { position: absolute; left: 2px; top: 0; font-style: normal; font-size: 8px; letter-spacing: -1px; color: #ffcf7a; text-shadow: 0 0 2px #000; pointer-events: none; }
.cell-item.g-gak, .slot.g-gak { background: rgba(170,130,60,0.38); box-shadow: inset 0 0 10px rgba(255,200,110,0.35); }
.cell-item.g-hon { background: radial-gradient(circle, rgba(255,120,40,0.28), transparent 70%); }
.cell-item.g-gem { background: radial-gradient(circle, rgba(120,210,220,0.2), transparent 70%); }
.st-it.g-gak { background: rgba(170,130,60,0.3); } .st-it.g-hon { background: rgba(255,120,40,0.2); }
/* 설명창 덧붙임 */
#tip .eg-tcat { color: #c8a870; font-size: 11px; margin-top: 4px; letter-spacing: 1px; }
#tip .eg-tr { color: #e8a060; }
#tip .eg-bt { font-family: var(--title); } #tip .eg-bt.bt1 { color: #9ad0ff; } #tip .eg-bt.bt2 { color: #ffb060; }
#tip .eg-socks { margin: 4px 0; color: #b8a27a; font-size: 12px; }
#tip .eg-gakline { color: #e8c070; font-family: var(--title); margin-top: 4px; }
#tip .eg-aura { color: #ffd77a; margin-top: 3px; font-size: 12.5px; line-height: 1.45; padding-left: 8px; border-left: 2px solid rgba(232,192,112,0.7); }   /* 혼각 오라 (lib/gakaura.js) */
#tip .eg-aura b { font-family: var(--title); font-weight: 400; color: #ffe6a0; }
#tip .eg-proc { color: #d8b8ff; margin-top: 2px; font-size: 12px; padding-left: 8px; border-left: 2px solid rgba(176,112,224,0.6); }   /* 혼각 발동 */
#tip .eg-hint { color: #a8c890; margin-top: 2px; font-size: 11.5px; font-style: italic; }
.eg-rec .eg-aura { font-size: 12px; color: #7a4a10; margin-top: 3px; }
.eg-rec .eg-proc { font-size: 12px; color: #5a2a7e; }
.eg-rec .eg-hint { font-size: 11.5px; color: #3a6a2a; font-style: italic; }
.eg-chip { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin: 0 1px; border-radius: 50%; font-family: var(--title); font-size: 12px; vertical-align: middle;
  background: radial-gradient(circle at 40% 35%, #ffc890, #c0501a 60%, #4a1406); color: #2a0e04; box-shadow: 0 0 6px rgba(255,140,60,0.6); }
.eg-chip.gem { background: radial-gradient(circle at 40% 35%, #e8fbff, #5ab0c0 60%, #10343a); color: #08262a; box-shadow: 0 0 6px rgba(120,220,230,0.5); }
.eg-chip.empty { background: radial-gradient(circle, #050302 50%, #3a2a18); box-shadow: inset 0 1px 3px #000, 0 0 0 1px #6d5636; }
.eg-chip.unseen { filter: grayscale(1) brightness(0.6); box-shadow: none; }
#tip .eg-cmp { margin-top: 8px; padding-top: 5px; border-top: 1px dashed rgba(176,138,72,0.5); font-size: 12px; text-align: left; }
#tip .eg-cmph { color: #a49678; text-align: center; margin-bottom: 2px; }
#tip .eg-cmp .up { color: #8fd88a; } #tip .eg-cmp .dn { color: #e07a6a; } #tip .eg-cmp .more { color: #a49678; }
/* 세공방 */
#panel-eg { left: 50%; top: 56px; transform: translateX(-50%); width: 720px; max-width: calc(100vw - 20px); }
#panel-eg h3 .close { float: right; background: none; border: none; color: var(--ink2); font-size: 16px; }
.eg-tabs { display: flex; gap: 4px; margin: 2px 0 0; }
.eg-tabs button { flex: 1; padding: 6px 4px 5px; border: 1px solid #5a2a18; border-bottom: none; border-radius: 6px 6px 0 0; background: linear-gradient(#5a1a12, #3a0e0a); color: #d8b88a;
  font-family: var(--title); font-size: 16px; letter-spacing: 2px; opacity: 0.78; box-shadow: inset 0 1px 0 rgba(255,200,140,0.18); }
.eg-tabs button i { font-style: normal; font-size: 11px; color: #c9a24f; margin-left: 4px; letter-spacing: 1px; }
.eg-tabs button.on { opacity: 1; background: linear-gradient(#9a2a1e, #6a160e); color: #ffe8b8; border-color: #c9a24f; }
.eg-tabs button:hover { opacity: 1; }
.eg-body { border: 1px solid #8a6a34; border-top: 2px solid #c9a24f; padding: 8px 10px; min-height: 260px; max-height: calc(80vh - 140px); overflow: auto;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,250,232,0.5), rgba(205,184,143,0.2) 70%); box-shadow: inset 0 0 22px rgba(80,50,20,0.3); }
.eg-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 13px; color: var(--ink2); }
.eg-body button:not(.eg-hc):not(.link), .eg-world button { font-family: var(--font); }
.eg-body li button, .eg-big, .eg-step button { padding: 4px 12px; font-size: 13px; background: linear-gradient(#7a1a12, #4a0c08); border: 1px solid #c9a24f; color: #f6e2b0;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.3), 0 1px 2px #000; }
.eg-body button:disabled { filter: grayscale(0.85) brightness(0.8); cursor: default; }
/* 세공: 장부 줄 */
.eg-cube { list-style: none; margin: 6px 0; padding: 0; border-top: 2px solid #6d5636; border-bottom: 2px solid #6d5636; }
.eg-cube li { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-bottom: 1px dotted rgba(90,60,30,0.5); color: var(--ink); }
.eg-cube li:last-child { border-bottom: none; }
.eg-cube li.can { background: rgba(201,162,79,0.14); }
.eg-cin, .eg-cout { display: flex; align-items: center; gap: 4px; }
.eg-cin b { font-size: 12px; color: var(--blue); } .eg-cin b.short { color: #9a3a2a; } .eg-cin em { font-style: normal; color: var(--ink2); }
.eg-cout { flex: 1; } .eg-cout span { font-size: 14px; }
.eg-arrow { font-family: var(--title); color: var(--red); font-size: 18px; }
.eg-cost { font-size: 12px; color: var(--ink2); white-space: nowrap; }
/* 혼 도감: 여섯 줄 인장 돌 */
.eg-codex { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.eg-hc { position: relative; height: 66px; padding: 2px 0 0; border: 1px solid #6d5636; background: radial-gradient(circle at 50% 40%, #2a1a10, #0c0705 75%); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; box-shadow: inset 0 0 8px #000; }
.eg-hc small { font-size: 10px; color: #c8a870; white-space: nowrap; }
.eg-hc:not(.seen) { background: rgba(255,250,235,0.25); box-shadow: inset 0 0 6px rgba(80,50,20,0.25); border-style: dashed; }
.eg-hc:not(.seen) small { color: rgba(60,45,30,0.6); }
.eg-hq { font-family: var(--title); font-size: 30px; line-height: 44px; color: rgba(60,45,30,0.22); }
.eg-hc.sel { outline: 2px solid #b8862a; outline-offset: 1px; }
.eg-count { text-align: right; font-size: 12px; color: var(--ink2); margin: 4px 0; }
.eg-hdet { display: flex; gap: 12px; margin-top: 6px; padding: 8px; border-left: 3px solid var(--red); background: rgba(255,250,235,0.4); color: var(--ink); }
.eg-hdet b { font-family: var(--title); font-size: 18px; color: var(--red); }
.eg-hst { font-size: 13px; margin-top: 3px; } .eg-hst span { display: inline-block; min-width: 86px; color: var(--ink2); font-size: 12px; }
.eg-hdet blockquote { margin: 6px 0; font-style: italic; color: #5a4028; font-size: 13px; }
/* 혼각 책: 족보처럼 붉은 괘선 */
.eg-chk { font-size: 13px; color: var(--ink2); }
.eg-book { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.eg-rec { padding: 6px 8px 6px 12px; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(142,42,34,0.07) 22px 23px), rgba(255,250,235,0.35); border: 1px solid rgba(110,80,40,0.4); border-left: 3px solid #8e2a22; color: var(--ink); }
.eg-rec.far { opacity: 0.62; }
.eg-rec header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.eg-rec header b { font-family: var(--title); font-size: 17px; color: #6a1810; }
.eg-rmeta { font-size: 11px; color: var(--ink2); width: 100%; }
.eg-seq { display: flex; align-items: center; gap: 2px; margin: 5px 0; flex-wrap: wrap; }
.eg-seq small { font-size: 11px; color: var(--ink2); margin-right: 2px; } .eg-seq i { font-style: normal; color: var(--red); margin: 0 2px; }
.eg-rst { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: #2c3f73; }
.eg-rec p { margin: 4px 0 0; font-size: 12px; font-style: italic; color: #6a5038; }
/* 꿈길 · 방목 */
.eg-dream { display: flex; gap: 14px; }
.eg-dl { flex: 1; color: var(--ink); } .eg-dr { flex: 1.1; }
.eg-dstat { margin: 8px 0; font-size: 14px; } .eg-dstat b { color: var(--red); font-size: 16px; }
.eg-step { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0; }
.eg-tier { min-width: 90px; text-align: center; font-family: var(--title); font-size: 18px; color: var(--ink); }
.eg-tier b { font-size: 34px; color: #5a2a8a; }
.eg-big { display: block; width: 100%; padding: 8px !important; font-family: var(--title) !important; font-size: 17px !important; letter-spacing: 2px; background: linear-gradient(#4a2a6a, #24102e) !important; border-color: #b8a0ff !important; }
.eg-dr h4, .eg-smith h4 { margin: 0 0 4px; font-family: var(--title); font-weight: 400; color: var(--red); font-size: 17px; letter-spacing: 2px; }
.eg-lb { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--ink); border-top: 2px solid #6d5636; border-bottom: 2px solid #6d5636;
  background: repeating-linear-gradient(90deg, transparent 0 46px, rgba(120,40,30,0.12) 46px 47px); }
.eg-lb th { font-weight: 400; font-size: 11px; color: var(--ink2); border-bottom: 1px solid rgba(110,80,40,0.45); padding: 2px 4px; }
.eg-lb td { padding: 3px 4px; border-bottom: 1px dotted rgba(90,60,30,0.4); }
.eg-lb td:first-child { font-family: var(--title); color: var(--red); text-align: center; width: 26px; }
.eg-lb td.t { font-family: var(--title); color: #5a2a8a; }
.eg-lb tr.me { background: rgba(184,160,255,0.2); }
/* 장쇠 */
.eg-smith { display: flex; gap: 12px; } .eg-smith > div { flex: 1; }
.eg-smith ul { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; border-top: 2px solid #6d5636; }
.eg-smith li { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-bottom: 1px dotted rgba(90,60,30,0.45); font-size: 13px; }
.eg-smith li span:nth-of-type(1) { flex: 1; text-shadow: 0 0 1px rgba(0,0,0,0.6); }
.eg-smith li img { background: #1a120a; box-shadow: 0 0 0 1px #6d5636; }
/* 역참 장부: 세상 고르기 */
.eg-world { margin: 6px 0 8px; padding: 6px; border: 1px solid rgba(110,80,40,0.45); background: rgba(255,250,235,0.3); }
.eg-wh { font-family: var(--title); color: var(--red); font-size: 16px; letter-spacing: 2px; }
.eg-wrow { display: flex; gap: 6px; margin: 4px 0; }
.eg-wt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; background: rgba(255,250,235,0.4); border: 1px solid rgba(110,80,40,0.5); cursor: pointer; color: var(--ink); }
.eg-wt b { font-family: var(--title); font-weight: 400; font-size: 15px; } .eg-wt small { font-size: 10px; color: var(--ink2); }
.eg-wt.on { background: rgba(201,162,79,0.3); border-color: #b8862a; cursor: default; }
.eg-wt.lock { opacity: 0.45; cursor: default; } .eg-wt.lock .eg-seal { background: #6a6258; }
.eg-wt:not(.on):not(.lock):hover { background: rgba(142,42,34,0.12); }
/* 궤짝 칸: 놋쇠 이름판 */
.eg-stabs { display: flex; align-items: center; gap: 6px; margin: 2px 0 6px; flex-wrap: wrap; }
.eg-stabs button { padding: 3px 12px; font-family: var(--title); font-size: 14px; color: #3a2408; border: 1px solid #6a4a18; border-radius: 3px;
  background: linear-gradient(#e8c870, #a8802a); box-shadow: inset 0 1px 0 rgba(255,245,200,0.6), 0 1px 2px #000; opacity: 0.7; }
.eg-stabs button.on { opacity: 1; box-shadow: inset 0 1px 0 rgba(255,245,200,0.6), 0 0 8px rgba(255,210,120,0.6); }
.eg-stabs .note { color: #c8b48a; }
/* 지역 이름 옆 세상·꿈 표시 */
.eg-zt { font-family: var(--title); margin-left: 6px; }
/* 메뉴 단추 */
.eg-mb { background: radial-gradient(circle at 40% 32%, #4a2a6a, #1a0a24 70%) !important; color: #ffcf8a !important; }
/* 꿈길 두루마리 */
#eg-dream { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 340px; z-index: 6; pointer-events: auto; filter: drop-shadow(0 6px 14px rgba(0,0,0,0.6)); }
.eg-dh-rod { height: 9px; margin: 0 -10px; border-radius: 5px; background: linear-gradient(#7a5232, #3a2414 60%, #2a180c); box-shadow: 0 2px 3px rgba(0,0,0,0.5); position: relative; }
.eg-dh-rod::before, .eg-dh-rod::after { content: ''; position: absolute; top: -2px; width: 14px; height: 13px; border-radius: 4px; background: radial-gradient(circle at 40% 35%, #e8c870, #8a6420); }
.eg-dh-rod::before { left: -6px; } .eg-dh-rod::after { right: -6px; }
.eg-dh-paper { padding: 6px 12px 4px; background: url("../ui/tex_hanji.png") center / 300px, #e3d3b0; color: var(--ink); }
.eg-dh-t { text-align: center; font-family: var(--title); font-size: 16px; color: #4a2a6a; letter-spacing: 1px; }
.eg-dh-row { display: flex; align-items: center; gap: 6px; margin: 4px 0; font-size: 12px; }
.eg-dh-l { font-family: var(--title); color: var(--red); width: 14px; }
.eg-dh-row > span:last-child { width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.eg-incense { flex: 1; position: relative; height: 10px; }
.eg-incense .stick { position: absolute; left: 0; top: 4px; height: 3px; background: linear-gradient(90deg, #6a3a1e, #9a5a2a); border-radius: 2px; transition: width 0.25s linear; }
.eg-incense::before { content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 1px; background: rgba(60,40,20,0.2); }
.eg-incense .ember { position: absolute; top: 2px; width: 6px; height: 7px; margin-right: -3px; border-radius: 50%; background: radial-gradient(circle, #fff2b0, #ff6a1a 55%, rgba(255,60,0,0)); box-shadow: 0 0 6px #ff7a2a; animation: egEmber 1.4s ease-in-out infinite; }
.eg-incense .ember::after { content: ''; position: absolute; left: 1px; bottom: 6px; width: 4px; height: 16px; border-radius: 50%; background: linear-gradient(rgba(120,110,100,0), rgba(120,110,100,0.4)); animation: egSmoke 2.6s ease-out infinite; }
@keyframes egEmber { 50% { box-shadow: 0 0 10px #ffa04a; } }
@keyframes egSmoke { 0% { transform: translate(0, 0) scaleY(0.6); opacity: 0.7; } 100% { transform: translate(-4px, -10px) scaleY(1.4); opacity: 0; } }
.eg-ink { flex: 1; height: 8px; border: 1px solid rgba(60,40,20,0.4); background: rgba(255,255,255,0.2); }
.eg-ink > div { height: 100%; background: linear-gradient(90deg, rgba(40,20,60,0.85), rgba(90,50,140,0.75)); box-shadow: 2px 0 4px rgba(60,30,90,0.5); transition: width 0.4s; }
.eg-dh-st { text-align: center; font-size: 12px; color: #4a3a2a; min-height: 16px; }
#eg-dream .link { display: block; margin: 0 auto; font-size: 11px; }
#eg-dream.late .eg-dh-t { color: #8e2a22; } #eg-dream.done .eg-dh-st { color: #5a2a8a; font-weight: 700; }
body.phone #eg-dream { top: 54px; width: 260px; }
/* 큰 도장 */
.eg-stamp { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 80; text-align: center; pointer-events: none; animation: egStamp 0.5s cubic-bezier(.2,1.6,.4,1) both; transition: opacity 1s; }
.eg-stamp.out { opacity: 0; }
.eg-st-t { margin-top: 12px; font-family: var(--title); font-size: 28px; color: #f0d488; text-shadow: 0 2px 6px #000; letter-spacing: 3px; }
.eg-st-l { margin-top: 4px; font-size: 15px; color: #e8dcc0; text-shadow: 0 1px 4px #000; max-width: 520px; }
@keyframes egStamp { 0% { transform: translate(-50%, -50%) scale(2.4) rotate(-12deg); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; } }
body.touch #panel-eg { width: calc(100vw - 16px); }
body.phone .eg-codex { grid-template-columns: repeat(6, 1fr); }
body.phone .eg-book, body.phone .eg-dream, body.phone .eg-smith { grid-template-columns: 1fr; flex-direction: column; }
.eg-wt .eg-seal, .eg-seal.sm { writing-mode: vertical-rl; line-height: 1; letter-spacing: -1px; }
.eg-wt .eg-seal { width: 40px; height: 40px; font-size: 16px; }
.eg-seal.sm { width: 22px; height: 26px; font-size: 10px; }

/* ───────── 사귐: 동행(同行) 패 · 청 알림 · 차림표 · 동행 창 · 흥정 문서 (public/js/social.js) ───────── */
/* 동행 패: 왼쪽에 세로로. 도장 = 직업 한자, 首 = 행수. 잎빛 왼쪽 선 = 곁(경험치·물건 복을 함께 받는 거리) */
#pty-frames { position: absolute; left: 16px; top: 44px; width: 200px; display: flex; flex-direction: column; gap: 4px; }
.pf { display: flex; align-items: center; gap: 8px; padding: 4px 10px 5px 5px; cursor: pointer; border-left: 2px solid #8a6a34;
  background: linear-gradient(90deg, rgba(14,9,6,0.9), rgba(14,9,6,0.62) 80%, rgba(14,9,6,0)); text-shadow: 0 1px 2px #000; }
.pf:hover { background: linear-gradient(90deg, rgba(60,30,18,0.95), rgba(30,16,10,0.7) 80%, rgba(14,9,6,0)); }
.pf.near { border-left-color: #7cd08a; }
.pf.far { border-left-color: #5a6a9a; }
.pf-seal { position: relative; flex: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-family: var(--title); font-size: 19px;
  color: #f3d9c0; background: #9a2a20; border: 2px solid #6a160f; box-shadow: inset 0 0 0 2px rgba(255,210,180,0.3), 0 2px 4px rgba(0,0,0,0.6); transform: rotate(-3deg); }
.pf-seal i { font-style: normal; }
.pf-seal em { position: absolute; top: -7px; right: -9px; width: 16px; height: 16px; border-radius: 50%; font: 400 10px/16px var(--title); text-align: center; font-style: normal;
  color: #2a1406; background: radial-gradient(circle at 35% 30%, #ffe6a0, #c9a24f); border: 1px solid #fff0c8; transform: rotate(3deg); }
.pf-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pf-nm { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; overflow: hidden; }
.pf-nm b { font-family: var(--title); font-weight: 400; font-size: 15px; color: #f0e0b8; overflow: hidden; text-overflow: ellipsis; }
.pf-nm small { font-size: 11px; color: #c8b48a; }
.pf-bar { display: block; height: 6px; margin-top: 2px; background: #1a0d0a; border: 1px solid #3e2c1a; box-shadow: inset 0 1px 2px #000; }
.pf-bar.mp { height: 4px; margin-top: 1px; }
.pf-bar i { display: block; height: 100%; transition: width 0.4s; }
.pf-bar.hp i { background: linear-gradient(#ff6a4a, #a3170c 60%, #6a0a05); }
.pf-bar.mp i { background: linear-gradient(#7ab8ff, #1d40b8); }
.pf-where { font-size: 11px; color: #b8a27a; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-where:empty { display: none; }
.pf.off { opacity: 0.55; } .pf.off .pf-seal { background: #4a4440; border-color: #2a2420; color: #c8c0b0; }
.pf.dead .pf-seal { background: #2a2626; border-color: #111; color: #8a8278; }
.pf.dead .pf-nm b { color: #9a8f78; text-decoration: line-through rgba(160,40,30,0.7); }
body.has-party.pc #sysbox, body.has-party.tablet #sysbox { left: 232px; width: min(520px, calc(100vw - 560px)); }
/* 휴대폰: 구슬·허리띠 아래, 퀘스트 추적 창은 그만큼 내린다 */
body.phone #pty-frames { left: 10px; top: 156px; width: 172px; gap: 3px; }
body.phone.portrait #pty-frames { top: 160px; }
body.phone.short #pty-frames { top: 158px; width: 160px; }
body.phone.short .pf-seal { width: 20px; height: 20px; font-size: 12px; }
body.phone.short .pf-bar.mp { display: none; }
body.phone.short .pf-where { font-size: 9px; }
body.phone #tracker { margin-top: var(--pty-h, 0px); }
body.phone .pf { padding: 2px 8px 3px 3px; gap: 6px; }
body.phone .pf-seal { width: 24px; height: 24px; font-size: 14px; border-width: 1.5px; }
body.phone .pf-seal em { width: 13px; height: 13px; font-size: 8px; line-height: 13px; top: -5px; right: -7px; }
body.phone .pf-nm b { font-size: 12px; } body.phone .pf-nm small { font-size: 10px; }
body.phone .pf-bar { height: 4px; } body.phone .pf-bar.mp { height: 2px; }
body.phone .pf-where { font-size: 10px; }
body.phone.panel-open #pty-frames { display: none; }

/* 청(請) 알림: 향 한 대가 다 타기 전에 */
#soc-ask { position: absolute; left: 50%; top: 16vh; transform: translateX(-50%); width: min(460px, calc(100vw - 20px)); z-index: 46; display: flex; align-items: center; gap: 12px;
  border: 18px solid transparent; border-image: url("../ui/frame_najeon.png") 58 stretch; background: rgba(12,8,6,0.96); background-clip: padding-box; padding: 6px 10px; animation: gtin 0.3s ease-out; }
.ask-seal { flex: none; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; font-family: var(--title); font-size: 30px; color: #f3d9c0;
  background: #9a2a20; border: 2px solid #6a160f; box-shadow: inset 0 0 0 3px rgba(255,210,180,0.3); transform: rotate(-5deg); }
.ask-body { flex: 1; min-width: 0; }
.ask-t { font-family: var(--title); font-size: 18px; color: #ffcf7a; }
.ask-s { font-size: 13px; color: #efe2c4; margin: 2px 0 7px; }
.ask-incense { height: 3px; background: rgba(255,230,190,0.08); }
.ask-incense i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #3a1a0a, #8a4a1a 85%, #ffb060); box-shadow: 0 0 6px #ff9040; }
.ask-btns { display: flex; flex-direction: column; gap: 6px; }
.ask-btns button { min-height: 38px; padding: 4px 14px; font-family: var(--title); font-size: 15px; letter-spacing: 1px; color: #f2dfae; background: #3a1a12; border: 1px solid #a8803e; }
.ask-btns .ask-yes { background: #7a1a12; color: #ffe6a0; }
.ask-btns button:hover { filter: brightness(1.25); }
body.phone #soc-ask { top: 6px; }

/* 차림표: 다른 잠룡을 눌렀을 때 */
#soc-menu { position: fixed; z-index: 48; min-width: 176px; max-width: 240px; border: 14px solid transparent; border-image: url("../ui/frame_najeon.png") 58 stretch;
  background: rgba(12,8,6,0.97); background-clip: padding-box; padding: 2px 4px 4px; box-shadow: 0 10px 30px #000; }
.sm-h { font-family: var(--title); font-size: 16px; color: #f0c870; padding: 2px 4px 5px; border-bottom: 1px solid rgba(201,162,79,0.45); margin-bottom: 2px; }
.sm-h small { font-family: var(--font); font-size: 11px; color: #a89070; margin-left: 4px; }
#soc-menu button { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px dotted rgba(200,160,90,0.22); color: #efe2c4; padding: 8px 6px; font-size: 14px; min-height: 36px; }
#soc-menu button:last-child { border-bottom: none; }
#soc-menu button:hover:not([disabled]) { background: rgba(142,42,34,0.4); color: #fff0d0; }
#soc-menu button small { display: block; font-size: 11px; color: #a89070; }
#soc-menu button[disabled] { opacity: 0.45; cursor: default; }

/* 메뉴 단추 伴 */
.minimenu .socb { font-family: var(--title); }

/* 동행 창 (伴 · P) */
#panel-pty { left: 50%; top: 70px; transform: translateX(-50%); width: 420px; }
#panel-pty h3 .close { float: right; background: none; border: none; color: var(--ink2); font-size: 16px; }
#pty-list { border-top: 2px solid #6d5636; border-bottom: 2px solid #6d5636; margin: 6px 0; }
.pty-row .wp-st button, .pty-nr button { padding: 2px 8px; font-size: 12px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; min-height: 28px; }
.pty-row .wp-st button:hover, .pty-nr button:hover:not([disabled]) { background: #8e2a22; color: #f4e6c8; border-color: #3a120c; }
.pty-lead { font-style: normal; font-family: var(--title); font-size: 12px; color: #9a2a20; margin-left: 4px; }
#pty-opts { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 2px; }
.pty-opt { display: flex; align-items: center; gap: 6px; }
.pty-opt > span { width: 38px; font-family: var(--title); color: var(--red); }
.pty-opt button { padding: 4px 10px; font-size: 13px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; min-height: 30px; }
.pty-opt button.on { background: #8e2a22; color: #f4e6c8; border-color: #3a120c; }
.pty-opt.dim button:not(.on) { opacity: 0.55; }
.pty-leave { align-self: flex-start; padding: 4px 12px; font-size: 13px; background: none; border: 1px solid #8e2a22; color: #8e2a22; min-height: 30px; }
.pty-sub { font-family: var(--title); font-size: 15px; color: var(--red); border-bottom: 1px solid rgba(110,80,40,0.45); margin: 10px 0 4px; }
.pty-nr { display: flex; align-items: center; gap: 6px; padding: 3px 2px; border-bottom: 1px dotted rgba(90,60,30,0.45); }
.pty-nr span { flex: 1; color: var(--ink); } .pty-nr small { color: var(--ink2); font-size: 11px; }
.pty-nr em { font-style: normal; font-size: 12px; color: #2e7a62; }
#pty-inv { display: flex; gap: 6px; margin: 8px 0 4px; }
#pty-inv input { flex: 1; padding: 6px 8px; border: 1px solid #6d5636; background: #f4ead4; }
#pty-inv button { padding: 6px 12px; background: var(--red); color: #f4e6c8; border: 1px solid #3a120c; }
.pty-eff { line-height: 1.6; }

/* 동행 말 */
#chat-log .c.p .from { color: #8fe8a0; }
#chat-log .c.p .from::before { content: '[동행] '; color: #6cc07a; }
html.lang-en #chat-log .c.p .from::before { content: '[Party] '; }

/* 흥정 문서: 괘선 친 계약 문서 두 장 + 내 행낭(반닫이). 확인 = 諾 도장, 성사 = 成 */
#panel-trade { left: 50%; top: 64px; transform: translateX(-50%); width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 80px); }
#panel-trade h3 .close { float: right; background: none; border: none; color: var(--ink2); font-size: 16px; }
.tr-cols { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; margin-top: 6px; }
.tr-col { position: relative; display: flex; flex-direction: column; padding: 4px 8px 6px; min-width: 0; border: 1px solid rgba(110,80,40,0.5);
  background: repeating-linear-gradient(0deg, transparent 0 27px, rgba(120,40,30,0.15) 27px 28px), rgba(255,250,235,0.25); transition: box-shadow 0.25s; }
.tr-col.locked { box-shadow: inset 0 0 0 2px rgba(154,42,32,0.55); }
.tr-h { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 30px; font-family: var(--title); color: var(--red); border-bottom: 2px solid #6d5636; padding-bottom: 3px; margin-bottom: 6px; }
.tr-h b { font-weight: 400; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-h small { font-family: var(--font); font-size: 11px; color: var(--ink2); }
.tr-seal { width: 38px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center; font-family: var(--title); font-size: 24px; opacity: 0; }
.tr-seal.on { opacity: 1; color: #f3d9c0; background: #9a2a20; border: 2px solid #6a160f; box-shadow: inset 0 0 0 2px rgba(255,210,180,0.35); transform: rotate(-9deg); }
.tr-seal.stamp { animation: trstamp 0.32s cubic-bezier(.2,1.6,.4,1); }
@keyframes trstamp { from { transform: rotate(-9deg) scale(2.3); opacity: 0; } to { transform: rotate(-9deg) scale(1); opacity: 1; } }
.tr-offer { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; min-height: 128px; padding: 4px 2px 10px; }
.tr-it { position: relative; width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; background: rgba(16,10,6,0.9); border: 1px solid #b08a48; box-shadow: inset 0 0 8px #000; }
.tr-it img { max-width: 48px; max-height: 48px; object-fit: contain; pointer-events: none; }
.tr-it.g-sang { background: rgba(40,60,140,0.55); } .tr-it.g-jin { background: rgba(150,130,30,0.5); } .tr-it.g-myeong { background: rgba(150,90,20,0.6); } .tr-it.g-beol { background: rgba(40,130,50,0.55); }
.tr-it .eg-cnt, .tr-bi .eg-cnt { position: absolute; right: 2px; bottom: 0; font: 700 12px var(--font); color: #ffe8b0; text-shadow: 0 0 2px #000, 1px 1px 0 #000; pointer-events: none; }
.tr-rm { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 10px; line-height: 18px; color: #f4e6c8; background: #7a1a12; border: 1px solid #f0c870; }
.tr-step { position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%); display: flex; gap: 2px; }
.tr-step button { width: 20px; height: 18px; padding: 0; font: 700 13px/16px var(--font); color: #f0c870; background: #2a1a10; border: 1px solid #8a6a34; }
.tr-empty { color: rgba(60,45,30,0.6); font-size: 12px; font-style: italic; padding: 8px 2px; }
.tr-gold { margin-top: auto; border-top: 1px dotted rgba(90,60,30,0.6); padding-top: 5px; font-size: 14px; color: var(--ink); }
.tr-gold b { color: #8e1e14; font-size: 16px; }
.tr-gold input { width: 110px; padding: 3px 6px; margin: 0 4px; font-size: 14px; background: #f4ead4; border: 1px solid #6d5636; color: var(--ink); }
.tr-gold small { color: var(--ink2); font-size: 11px; }
.tr-bag { padding: 4px 8px 8px; border: 1px solid #6d5636; background: url("../ui/tex_bandaji.png") center / 300px; color: #ecdcb6; }
.tr-bag .tr-h { color: #f0c870; border-bottom-color: #b08a48; } .tr-bag .tr-h small { color: #c8b48a; }
#tr-inv { position: relative; border: 2px solid #b08a48; background-color: rgba(16,10,6,0.9); box-shadow: inset 0 0 14px #000;
  background-image: linear-gradient(rgba(176,138,72,0.32) 1px, transparent 1px), linear-gradient(90deg, rgba(176,138,72,0.32) 1px, transparent 1px); touch-action: none; }
.tr-bi { position: absolute; display: flex; align-items: center; justify-content: center; cursor: grab; }
.tr-bi img { max-width: 100%; max-height: 100%; pointer-events: none; }
.tr-bi.g-sang { background: rgba(40,60,140,0.35); } .tr-bi.g-jin { background: rgba(150,130,30,0.35); } .tr-bi.g-myeong { background: rgba(150,90,20,0.45); } .tr-bi.g-beol { background: rgba(40,130,50,0.38); }
.tr-bi.used { opacity: 0.4; box-shadow: inset 0 0 0 2px #c9a24f; }
.tr-bi.bound { filter: grayscale(1) brightness(0.55); cursor: not-allowed; }
.tr-ghost { position: fixed; width: 44px; height: 44px; z-index: 80; pointer-events: none; opacity: 0.9; display: flex; align-items: center; justify-content: center; background: rgba(16,10,6,0.85); box-shadow: 0 0 0 2px #c9a24f, 0 6px 18px #000; }
.tr-ghost img { max-width: 100%; max-height: 100%; }
.tr-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.tr-note { flex: 1; min-width: 200px; margin: 0; font-size: 13px; color: var(--ink2); }
.tr-btns { display: flex; gap: 8px; }
.tr-btns button { min-height: 40px; padding: 6px 16px; font-family: var(--title); font-size: 16px; letter-spacing: 2px; background: #eadfc4; border: 1px solid #a88a5a; color: #4a3a2a; }
#tr-lock.on { background: #9a2a20; color: #f4e6c8; border-color: #3a120c; }
#tr-ok.ready { background: #7a1a12; color: #ffe6a0; border-color: #3a120c; animation: trready 1.4s ease-in-out infinite; }
@keyframes trready { 50% { box-shadow: 0 0 12px rgba(255,180,80,0.75); } }
#tr-ok:disabled { opacity: 0.45; cursor: default; }
#tr-x { background: none; border-color: transparent; text-decoration: underline; letter-spacing: 0; font-family: var(--font); font-size: 14px; }
/* 휴대폰: 가로는 세 칸 그대로 작게, 세로는 두 문서 아래에 행낭 */
body.phone #panel-trade { top: 6px !important; width: calc(100vw - 12px); max-height: calc(100vh - 12px); border-width: 16px; padding: 2px 6px; }
body.phone #panel-trade h3 { font-size: 17px; margin-bottom: 0; }
body.phone .tr-cols { gap: 6px; }
body.phone .tr-h { min-height: 24px; margin-bottom: 3px; } body.phone .tr-h b { font-size: 14px; }
body.phone .tr-seal { width: 28px; height: 28px; font-size: 18px; }
body.phone .tr-offer { min-height: 60px; gap: 6px; padding-bottom: 12px; }
body.phone .tr-it { width: 42px; height: 42px; } body.phone .tr-it img { max-width: 38px; max-height: 38px; }
body.phone .tr-gold { font-size: 12px; } body.phone .tr-gold input { width: 80px; font-size: 13px; }
body.phone .tr-foot { margin-top: 4px; } body.phone .tr-note { font-size: 11px; min-width: 120px; }
body.phone .tr-btns button { min-height: 36px; padding: 4px 12px; font-size: 14px; }
body.phone.portrait .tr-cols { grid-template-columns: 1fr 1fr; }
body.phone.portrait .tr-bag { grid-column: 1 / -1; justify-self: center; }
body.phone.short.has-party #tracker .tq-t { display: none; }   /* 낮은 가로 화면: 동행 패 아래로 내려간 추적 창은 퀘스트 이름만 (조이스틱을 덜 가린다) */
#hud.intro-on > :not(#intro) { visibility: hidden !important; }

/* ── 설정 (settings.js): 왼쪽 옻칠 현판 줄 · 오른쪽 한지 위 미닫이·낙관 ── */
#panel-set { left: 50%; top: 8vh; transform: translateX(-50%); width: 680px; max-width: calc(100vw - 16px); max-height: min(84vh, 620px); overflow: hidden; display: flex; flex-direction: column; }
#panel-set:not(.hidden) { display: flex; }
#panel-set h3 { flex: none; }
#panel-set h3 .close, #panel-help h3 .close { float: right; background: none; border: none; color: var(--ink2); font-size: 16px; cursor: pointer; }
.set-wrap { display: flex; gap: 14px; min-height: 0; flex: 1; }
.set-menu { flex: none; width: 168px; display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.set-plq { position: relative; display: block; text-align: left; padding: 9px 40px 9px 12px; min-height: 48px; cursor: pointer;
  background: linear-gradient(100deg, rgba(255,210,150,0.08), transparent 40%), linear-gradient(#3a120c, #1c0805);
  border: 1px solid #c9a24f; border-radius: 3px; color: #f4e2b4; box-shadow: 0 0 0 2px #1a0b06, 0 3px 8px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,220,160,0.18); }
.set-plq::before { content: ''; position: absolute; inset: 3px; border: 1px solid rgba(201,162,79,0.35); pointer-events: none; }
.set-plq b { display: block; font-family: var(--title); font-weight: 400; font-size: 17px; letter-spacing: 2px; }
.set-plq small { display: block; font-size: 11px; color: #c8a878; margin-top: 1px; }
.set-plq i { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font-style: normal; font-family: 'Noto Serif KR', serif; font-weight: 700; font-size: 12px; line-height: 1.05;
  writing-mode: vertical-rl; color: #f6e4cc; background: #8e2a22; padding: 4px 2px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(255,230,200,0.35); }
.set-plq:hover { filter: brightness(1.18); }
.set-plq:active { transform: translateY(1px); }
.set-plq.dim { background: linear-gradient(#2a2420, #14100c); border-color: #8a7450; }
.set-plq.dim i { background: #4a4238; }
.set-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.set-tabs { display: flex; gap: 4px; flex: none; }
.set-tabs button { flex: 1; padding: 6px 4px 5px; border: 1px solid #5a2a18; border-bottom: none; border-radius: 6px 6px 0 0; background: linear-gradient(#5a1a12, #3a0e0a); color: #d8b88a;
  font-family: var(--title); font-size: 16px; letter-spacing: 2px; opacity: 0.78; box-shadow: inset 0 1px 0 rgba(255,200,140,0.18); }
.set-tabs button i { font-style: normal; font-size: 11px; color: #c9a24f; margin-left: 4px; }
.set-tabs button.on { opacity: 1; background: linear-gradient(#9a2a1e, #6a160e); color: #ffe8b8; border-color: #c9a24f; }
.set-body { flex: 1; min-height: 0; overflow: auto; border: 1px solid #8a6a34; border-top: 2px solid #c9a24f; padding: 4px 12px 10px;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,250,232,0.5), rgba(205,184,143,0.2) 70%); box-shadow: inset 0 0 22px rgba(80,50,20,0.3); -webkit-overflow-scrolling: touch; }
.set-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed rgba(120,90,50,0.38); }
.set-row label { flex: 1; min-width: 0; font-family: var(--title); font-size: 16px; color: #4a1a10; }
.set-row label small { display: block; font-family: var(--font); font-size: 12px; color: #6d5636; margin-top: 1px; }
.set-ctl { flex: none; display: flex; align-items: center; gap: 8px; }
.set-note { font-size: 13px; color: #4a3a2a; line-height: 1.7; margin: 8px 0 2px; }
kbd { font-family: var(--font); font-size: 11px; color: #fff3d8; background: #4a3a2a; padding: 0 5px; border-radius: 2px; box-shadow: 0 1px 0 #1a120a; }
/* 미닫이: 먹 선 위에 스며드는 붉은 먹, 손잡이는 엽전 */
.set-sl { -webkit-appearance: none; appearance: none; width: 170px; height: 26px; background: transparent; cursor: pointer; --p: 50%; touch-action: pan-y; }
.set-sl::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, #8e2a22 0 var(--p), rgba(60,40,24,0.28) var(--p) 100%); box-shadow: inset 0 1px 2px rgba(0,0,0,0.4); }
.set-sl::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(60,40,24,0.28); }
.set-sl::-moz-range-progress { height: 6px; border-radius: 3px; background: #8e2a22; }
.set-sl::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; border: 1px solid #5a3a12;
  background: linear-gradient(#2a1a0c, #2a1a0c) center / 7px 7px no-repeat, radial-gradient(circle at 35% 30%, #fbe3a0, #c9a24f 55%, #7a5418); box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(255,240,200,0.35); }
.set-sl::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; border: 1px solid #5a3a12;
  background: linear-gradient(#2a1a0c, #2a1a0c) center / 7px 7px no-repeat, radial-gradient(circle at 35% 30%, #fbe3a0, #c9a24f 55%, #7a5418); }
.set-ctl output { width: 30px; text-align: right; font-family: var(--title); font-size: 15px; color: #6a1810; }
/* 켜고 끄기: 낙관 (켜면 붉은 도장이 찍힌다) */
.set-seal { min-width: 76px; padding: 5px 10px; font-family: var(--title); font-size: 15px; letter-spacing: 1px; color: #7a6a52; background: rgba(255,250,235,0.35);
  border: 1.5px dashed rgba(122,90,50,0.6); border-radius: 3px; transition: transform 0.12s; }
.set-seal.on { color: #fbeedd; background: radial-gradient(circle at 30% 25%, #b8402e, #8e2a22 60%, #6a1a12); border: 1.5px solid #5a120c; transform: rotate(-3deg);
  box-shadow: inset 0 0 0 2px rgba(255,220,200,0.28), 0 2px 4px rgba(60,10,6,0.35); }
.set-pick { display: inline-flex; border: 1px solid #8a6a3a; border-radius: 3px; overflow: hidden; }
.set-pick button { padding: 5px 11px; font-family: var(--title); font-size: 14px; color: #4a3a2a; background: rgba(255,250,235,0.45); border: none; border-left: 1px solid #b09a70; }
.set-pick button:first-child { border-left: none; }
.set-pick button.on { background: #7a1a12; color: #f6e2b0; }
.set-cyc { padding: 5px 12px; font-size: 14px; color: #f6e2b0; background: linear-gradient(#7a1a12, #4a0c08); border: 1px solid #c9a24f; border-radius: 2px; }
.set-confirm { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; text-align: center;
  background: rgba(16,8,5,0.9); color: #f0e0bc; font-size: 16px; line-height: 1.8; }
.set-confirm b { color: #ffd27a; font-weight: 400; font-family: var(--title); }
.set-confirm div { display: flex; gap: 10px; }
.set-confirm button { min-width: 110px; padding: 9px 16px; font-family: var(--title); font-size: 17px; border: 1px solid #c9a24f; color: #f6e2b0; background: linear-gradient(#3a2a1e, #1a120a); }
.set-confirm .yes { background: linear-gradient(#9a2a1e, #5a0e08); }
/* 메뉴 줄: 設 단추. 조작 방식 단추(.lay)는 설정 창으로 옮겼다 */
.minimenu .lay { display: none !important; }
.setb { font-size: 19px; }
body.phone.portrait #tmenu .setb, body.phone.short #tmenu .setb { width: 40px; height: 40px; font-size: 17px; }
body.tablet #mini .setb { width: 50px; height: 50px; }
body.pc #mini .setb { font-size: calc(var(--ms) * 0.42); }
#joy { transform: scale(var(--joy-k, 1)); transform-origin: left bottom; }
/* 초당 장면 · 지연 */
#perf { position: absolute; left: 50%; top: 0; transform: translateX(-50%); z-index: 30; pointer-events: none; padding: 1px 10px 2px; font-size: 11px; color: #d8c8a4;
  background: rgba(8,5,3,0.6); border-radius: 0 0 6px 6px; text-shadow: 0 1px 1px #000; white-space: nowrap; }
#perf b { color: #fff0c8; font-weight: 400; } #perf b.mid { color: #ffcf7a; } #perf b.bad { color: #ff7a60; }
/* 좁은 화면: 현판을 위 두 줄로 */
@media (max-width: 600px) {
  .set-wrap { flex-direction: column; gap: 8px; }
  .set-menu { width: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .set-plq { min-height: 40px; padding: 6px 34px 6px 10px; }
  .set-plq b { font-size: 15px; letter-spacing: 1px; } .set-plq small { display: none; }
  .set-sl { width: 120px; }
}
body.touch #panel-set { max-height: calc(100vh - 64px); }
body.phone.short #panel-set { top: 8px !important; max-height: calc(100vh - 16px); }
body.phone.short .set-plq { min-height: 40px; padding: 6px 38px 6px 10px; }
body.phone.short .set-row { padding: 6px 0; }
/* 창(.panel)은 메뉴 단추 줄(#mini·#tmenu)·동행 패·추적 창보다 위에 (메뉴 줄이 창 아래쪽을 덮던 것) */
#hud .panel { z-index: 20; }

/* ── 길잡이 안내서 (guide.js): 옻칠 탭 + 한지 위 장(章) ── */
#panel-help { width: min(760px, calc(100vw - 16px)); max-height: min(84vh, 700px); top: 7vh; overflow: hidden; flex-direction: column; }
#panel-help:not(.hidden) { display: flex; }
#panel-help h3 { flex: none; }
#panel-help .help-tabs { flex: none; display: flex; gap: 4px; margin: 2px 0 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#panel-help .help-tabs::-webkit-scrollbar { display: none; }
#panel-help .help-tabs button { flex: 1 0 auto; padding: 6px 10px 5px; border: 1px solid #5a2a18; border-bottom: none; border-radius: 6px 6px 0 0; background: linear-gradient(#5a1a12, #3a0e0a);
  color: #d8b88a; font-family: var(--title); font-size: 15px; letter-spacing: 1px; opacity: 0.8; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255,200,140,0.18); }
#panel-help .help-tabs button i { font-style: normal; font-size: 11px; color: #c9a24f; margin-left: 4px; }
#panel-help .help-tabs button.on { opacity: 1; background: linear-gradient(#9a2a1e, #6a160e); color: #ffe8b8; border-color: #c9a24f; }
#help-body { flex: 1; min-height: 0; overflow: auto; position: relative; border: 1px solid #8a6a34; border-top: 2px solid #c9a24f; padding: 8px 14px 14px;
  background: radial-gradient(ellipse at 50% 20%, rgba(255,250,232,0.55), rgba(205,184,143,0.2) 70%); box-shadow: inset 0 0 22px rgba(80,50,20,0.3); -webkit-overflow-scrolling: touch; }
.gd-toc { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 0 10px; border-bottom: 1px solid rgba(110,80,40,0.4); margin-bottom: 4px; }
.gd-toc button { padding: 3px 9px; font-size: 13px; color: #5a1a10; background: rgba(255,250,235,0.5); border: 1px solid #a88a5a; border-radius: 12px; }
.gd-toc button:hover { background: #7a1a12; color: #f6e2b0; }
.gd-sec { padding: 10px 0 6px; border-bottom: 1px dashed rgba(120,90,50,0.38); }
.gd-sec h4 { margin: 0 0 6px; font-family: var(--title); font-weight: 400; font-size: 18px; color: #6a1810; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.gd-sec h4::before { content: ''; flex: none; width: 9px; height: 9px; background: #8e2a22; transform: rotate(45deg); box-shadow: 0 0 0 2px rgba(142,42,34,0.25); }
.gd-b { font-size: 15px; color: #241a12; line-height: 1.8; }
.gd-b p { margin: 4px 0 8px; }
.gd-b ul { margin: 4px 0 8px; padding-left: 20px; } .gd-b li { margin: 2px 0; }
.gd-b b { color: #8e1e14; }
.gtab { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; background: rgba(255,250,235,0.35); }
.gtab th, .gtab td { padding: 5px 8px; border: 1px solid rgba(120,90,50,0.35); vertical-align: top; text-align: left; line-height: 1.55; }
.gtab th { font-family: var(--title); font-weight: 400; color: #6a1810; background: rgba(142,42,34,0.08); white-space: nowrap; }
.gc { padding: 0 5px; border-radius: 2px; background: #1e140c; font-family: var(--title); white-space: nowrap; }
.gc-bum { color: #d6d0c2; } .gc-sang { color: #8fa8ff; } .gc-jin { color: #ecd25a; } .gc-myeong { color: #e0a050; } .gc-beol { color: #6fd078; }
.gd-more { text-align: right; margin: 12px 0 0; font-size: 13px; color: #6d5636; }
.gd-go { padding: 4px 12px; font-family: var(--title); font-size: 15px; color: #f6e2b0; background: linear-gradient(#7a1a12, #4a0c08); border: 1px solid #c9a24f; margin-left: 4px; }
body.touch #panel-help { max-height: calc(100vh - 64px); }
body.phone.short #panel-help { top: 8px !important; max-height: calc(100vh - 16px); }
@media (max-width: 600px) { .gd-b { font-size: 15px; } .gtab { font-size: 13px; } .gtab th { white-space: normal; } #panel-help .help-tabs button { font-size: 14px; padding: 6px 8px 5px; } }
body.phone #perf { left: max(10px, env(safe-area-inset-left)); transform: none; top: 6px; border-radius: 4px; }
body.phone.portrait #tmenu { gap: 6px; }   /* 세로: 메뉴 세로줄이 말하기 칸에 닿지 않게 */
body.phone.portrait #panel-help, body.phone.portrait #panel-set { border-width: 18px; max-width: calc(100vw - 8px); width: calc(100vw - 8px); }
.gtab td, .gd-b { word-break: keep-all; overflow-wrap: anywhere; }
body.tablet #perf { left: 12px; top: 30px; transform: none; border-radius: 4px; }

/* ── 제첨: 그림에 붙은 낡은 한지 쪽지 — 글꼴이 아니라 그린 그림 세 장(종이·먹·인장)을 겹친다 (tools/blender/title_art.py).
   .jc-inner = 종이 자리(placePlaque 가 --jcw/--jch 로 맞춘다). 그림에는 해진 가장자리 여백이 있어 조금 밖으로 넘친다. SVG 필터 없음(iOS). ── */
.jecheom { position: fixed; z-index: 11; right: 9vw; top: 8vh; pointer-events: none; user-select: none; -webkit-user-select: none; }
.jecheom.on-scroll { right: auto; }
.jc-inner { position: relative; width: var(--jcw, 160px); height: var(--jch, 540px); isolation: isolate; }
.jc-inner img { position: absolute; left: -5.556%; top: -1.656%; width: 111.111%; height: 103.311%; display: block; -webkit-user-drag: none; }
.jc-paper { opacity: 0; animation: jcpaper 1.6s 0.15s ease-out forwards; }
/* 먹: 위에서 아래로 써 내려간다 (가림막을 밀어 내린다) */
.jc-ink { -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 44%, transparent 56%); mask-image: linear-gradient(to bottom, #000 0%, #000 44%, transparent 56%);
  -webkit-mask-size: 100% 300%; mask-size: 100% 300%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 0 100%; mask-position: 0 100%; animation: jcwrite 2.3s 0.8s cubic-bezier(.4,.1,.6,.95) forwards; }
.jc-seal { opacity: 0; transform-origin: 23% 89%; animation: jcstamp 0.32s 3.05s cubic-bezier(.2,.9,.3,1) forwards; }
/* 달빛 안개가 쪽지 아랫자락에도 얇게 낀다 — 그림 속에 함께 있게 */
.jc-inner::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 75% 32% at 50% 100%, rgba(16,14,12,0.2), rgba(16,14,12,0) 100%), radial-gradient(ellipse 60% 18% at 50% 100%, rgba(206,200,186,0.12), rgba(206,200,186,0) 100%); }
.jc-title { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@keyframes jcpaper { from { opacity: 0; } to { opacity: 1; } }
@keyframes jcwrite { to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes jcstamp { 0% { opacity: 0; transform: scale(1.06); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
#jc-fx, #jc-fx2 { position: absolute; pointer-events: none; left: calc(var(--jcw, 140px) * -0.9); top: calc(var(--jch, 500px) * -0.22);
  width: calc(100% + var(--jcw, 140px) * 1.8); height: calc(100% + var(--jch, 500px) * 0.34); }
#jc-fx { z-index: -1; }
#jc-fx2 { z-index: 2; }
.jecheom:not(.on-scroll) #jc-fx2 { display: none; }
@media (prefers-reduced-motion: reduce) { .jc-paper, .jc-ink, .jc-seal { animation-duration: 0.01s; animation-delay: 0s; } }

/* ── 행낭 정리·한꺼번에 팔기 (ui.js sellAllBox, world.js 궤짝) ── 붉은 옻칠에 금박 테, 한자는 낙관처럼 */
.lq-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 3px 12px 3px 14px; font-family: var(--title); font-size: 15px; letter-spacing: 2px; color: #f6e2b0;
  background: linear-gradient(#8a2216, #5a0f09 60%, #44090a); border: 1px solid #c9a24f; border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.35), inset 0 -2px 0 rgba(0,0,0,0.35), 0 0 0 1px #2a0806, 0 2px 4px rgba(0,0,0,0.7); text-shadow: 0 1px 0 #2a0806; touch-action: manipulation; }
.lq-btn i { font-style: normal; font-size: 11px; line-height: 1; letter-spacing: 0; padding: 2px 3px; color: #2a0806; background: #d8b45a; border-radius: 2px; box-shadow: inset 0 0 0 1px #8a6a20; }
.lq-btn:hover:not(:disabled) { filter: brightness(1.15); }
.lq-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 3px rgba(0,0,0,0.5), 0 0 0 1px #2a0806; }
.lq-btn:disabled { filter: grayscale(0.85) brightness(0.75); cursor: default; }
.lq-btn.sm { min-height: 24px; padding: 1px 8px 1px 10px; font-size: 13px; letter-spacing: 1px; }
.inv-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.inv-foot .gold { margin-top: 0; }
.st-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.sa-box { margin-top: 10px; padding: 8px 10px 6px; border-top: 3px double rgba(60,38,20,0.55); background: linear-gradient(rgba(255,248,228,0.28), rgba(200,170,120,0.12)); }
.sa-head { display: flex; align-items: baseline; gap: 8px; font-family: var(--title); color: var(--ink); font-size: 17px; letter-spacing: 2px; }
.sa-head i { font-style: normal; font-size: 12px; color: #f3d9c0; background: #9a2a20; padding: 1px 4px; border-radius: 2px; transform: rotate(-3deg); box-shadow: inset 0 0 0 1px rgba(255,210,180,0.35); }
.sa-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.sa-chip { position: relative; cursor: pointer; }
.sa-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sa-chip span { display: inline-block; min-height: 30px; padding: 5px 10px 4px 22px; font-size: 14px; color: var(--ink2); border: 1px solid #8a6a3a; background: rgba(255,250,235,0.55); position: relative; }
.sa-chip span::before { content: ''; position: absolute; left: 7px; top: 50%; width: 9px; height: 9px; margin-top: -5px; border: 1px solid #6d5636; background: transparent; transform: rotate(45deg); }
.sa-chip input:checked + span { color: #2a1a0e; background: rgba(255,236,190,0.9); border-color: #6a4a18; box-shadow: inset 0 0 0 1px rgba(201,162,79,0.7); }
.sa-chip input:checked + span::before { background: var(--red); border-color: #3a120c; }
.sa-chip input:focus-visible + span { outline: 2px solid #c9a24f; outline-offset: 1px; }
.sg-bum span::after, .sg-sang span::after, .sg-jin span::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0,0,0,0.5); }
.sg-bum span::after { background: #b8b0a0; } .sg-sang span::after { background: #5a7ae0; } .sg-jin span::after { background: #d8b830; }
.sa-rare span { color: #7a3a10; border-style: dashed; }
.sa-rare input:checked + span { color: #f6e2b0; background: #7a1a12; border-color: #c9a24f; border-style: solid; }
.sa-rare input:checked + span::before { background: #d8b45a; }
.sa-warn { margin: 2px 0 4px; font-size: 13px; color: #a01c10; font-weight: 700; }
.sa-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 2px; }
.sa-sum { font-size: 14px; color: var(--ink2); } .sa-sum b { color: #8a5a10; }
.sa-confirm { margin: 6px 0; padding: 8px 10px; background: rgba(20,12,8,0.92); border: 1px solid #c9a24f; color: #e8d6a6; box-shadow: inset 0 0 12px #000; }
.sa-cq { font-size: 15px; } .sa-cq b { color: #ffd77a; }
.sa-cw { margin-top: 4px; color: #ff9a7a; font-weight: 700; font-size: 13px; }
.sa-list { list-style: none; padding: 0; margin: 6px 0; max-height: 150px; overflow: auto; font-size: 13px; }
.sa-list li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px dotted rgba(201,162,79,0.3); }
.sa-list li em { font-style: normal; color: #d8c290; white-space: nowrap; } .sa-list li.more { color: #a49678; }
.sa-btns { display: flex; gap: 8px; justify-content: flex-end; }
.sa-no { min-height: 30px; padding: 3px 14px; font-family: var(--title); font-size: 15px; color: #f2dfae; background: #3a1a12; border: 1px solid #a8803e; }
.sa-note { margin: 4px 0 0; }
body.touch .lq-btn, body.touch .sa-no { min-height: 38px; }
body.touch .sa-chip span { min-height: 36px; padding-top: 8px; }

/* ───────── 걸린 기운 줄 (public/js/buffs.js) ─────────
   패 하나 = 기술 그림 + 해시계 그늘(지난 시간만큼 먹빛이 시계 방향으로 덮인다) + 남은 시간.
   테: 기운은 놋쇠, 약화는 인주(붉은), 켜 둔 오라·변신은 금빛이 번지고, 곁의 기운은 옥빛. PC·태블릿은 지역 이름 아래, 휴대폰은 구슬 위·옆 */
#buffs { position: absolute; left: 16px; top: 42px; display: flex; flex-wrap: wrap; gap: 6px 7px; max-width: 520px; max-height: 98px; overflow: hidden; padding: 2px 2px 16px; z-index: 6; }
#buffs.hidden { display: none; }
body.has-buffs:not(.phone) #sysbox { top: max(var(--bfb, 92px), 44px); }   /* 기운 줄 아래 (줄이 둘이면 더 내려간다, buffs.js) */
.bf { position: relative; width: 34px; height: 34px; flex: none; background: #120b07; cursor: help; touch-action: manipulation;
  box-shadow: 0 0 0 1px #0a0604, 0 0 0 2px #9a7a3c, 0 0 0 3px #2a1c0e, 0 3px 6px rgba(0,0,0,0.7); }
.bf::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255,230,170,0.18), inset 0 -8px 10px rgba(0,0,0,0.35); }
.bf-ic { position: absolute; inset: 0; width: 100%; height: 100%; background-repeat: no-repeat; font-style: normal; }
img.bf-ic { object-fit: contain; padding: 1px; box-sizing: border-box; background: radial-gradient(circle at 50% 40%, #3a2a1a, #120b07 70%); }
.bf-gl { display: grid; place-items: center; font-family: var(--title); font-size: 21px; line-height: 1; color: #2a1a10;
  background: url("../ui/tex_hanji.png") center / 120px, #e3d3b0; text-shadow: 0 0 1px rgba(36,26,18,0.5); }
.bf.c-d .bf-gl { color: #e0452c; background: radial-gradient(circle at 50% 45%, #3a0e08, #140504 75%); text-shadow: 0 0 4px rgba(255,80,40,0.45), 0 1px 1px #000; }
.bf-gl.gk { color: #ffe6a0; background: radial-gradient(circle at 50% 42%, #6a4a18, #2a1a08 78%); text-shadow: 0 0 5px rgba(255,200,90,0.55), 0 1px 1px #000; }   /* 혼각 오라·발동 (lib/gakaura.js) — 금빛 낙관 */
.bf-sw { position: absolute; inset: 0; pointer-events: none; --a: 0deg; background: conic-gradient(rgba(10,5,2,0.74) var(--a), rgba(0,0,0,0) 0); }
.bf-t { position: absolute; left: -6px; right: -6px; bottom: -16px; text-align: center; font: 700 12px/1 var(--font); color: #f2e2b4; letter-spacing: -0.3px;
  text-shadow: 0 0 2px #000, 0 1px 2px #000, 0 0 4px #000; pointer-events: none; white-space: nowrap; }
.bf.c-d { box-shadow: 0 0 0 1px #0a0604, 0 0 0 2px #b8301e, 0 0 0 3px #3a0a06, 0 0 8px rgba(210,50,25,0.55); }
.bf.c-d .bf-t { color: #ffb8a0; }
.bf.c-a, .bf.c-f { box-shadow: 0 0 0 1px #0a0604, 0 0 0 2px #e0b85a, 0 0 0 3px #3a2810, 0 0 9px rgba(255,200,90,0.6); }
.bf.c-n { box-shadow: 0 0 0 1px #0a0604, 0 0 0 2px #6e9c84, 0 0 0 3px #10241a, 0 3px 6px rgba(0,0,0,0.7); }
.bf.c-n .bf-ic { filter: saturate(0.8); }
.bf.end .bf-ic { animation: bfblink 0.5s steps(2, jump-none) infinite; }
@keyframes bfblink { from { opacity: 1; } to { opacity: 0.3; } }
#bf-tip { position: fixed; z-index: 52; min-width: 150px; max-width: min(300px, calc(100vw - 12px)); padding: 4px 8px 6px; border: 14px solid transparent;
  border-image: url("../ui/frame_najeon.png") 58 stretch; background: rgba(12,8,6,0.95); background-clip: padding-box; color: #e0d2b0; font-size: 13px; line-height: 1.5;
  pointer-events: none; text-align: left; box-shadow: 0 8px 22px rgba(0,0,0,0.7); }
#bf-tip.hidden { display: none; }
#bf-tip .bt-n { font-family: var(--title); font-size: 17px; color: #f0c870; letter-spacing: 1px; }
#bf-tip.c-d .bt-n { color: #ff8a6a; }
#bf-tip.c-n .bt-n { color: #a8dcc0; }
#bf-tip .bt-k { font-size: 11px; color: #a49678; margin: -2px 0 3px; }
#bf-tip .bt-e { color: #f0e4c8; }
#bf-tip .bt-t { margin-top: 3px; color: #d8c290; font-size: 12px; border-top: 1px solid rgba(201,162,79,0.3); padding-top: 3px; }
/* 휴대폰: 패를 줄이고 시간은 패 안 아래에. 가로는 구슬 위 (가운데 표적 창을 비킨다), 세로는 구슬 오른쪽 */
body.phone #buffs { top: 23px; left: max(14px, env(safe-area-inset-left)); gap: 5px; max-width: calc(50vw - 170px); max-height: 32px; padding: 2px; }
body.phone .bf { width: 28px; height: 28px; }
body.phone .bf-gl { font-size: 18px; }
body.phone .bf-t { bottom: 1px; font-size: 10px; }
body.phone.portrait #buffs { top: 68px; left: 180px; max-width: calc(100vw - 236px); max-height: 66px; }
body.phone.has-buffs #sysbox { top: 140px; }
body.phone.short.has-buffs #sysbox { top: 58px; }
body.phone.portrait.has-buffs #sysbox { top: auto; }

/* ───────── 물건 쓰기 단추 (터치 설명창) · 감정 부적 고르기 (ui.js itemActs / identBar) ───────── */
#tip.acts { pointer-events: auto; }
#tip .tip-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px -2px 2px; padding-top: 8px; border-top: 1px dashed rgba(176,138,72,0.55); }
#tip .tip-acts .lq-btn { min-height: 36px; padding: 2px 12px; font-size: 15px; }
#tip .tip-acts .lq-btn.warn { background: linear-gradient(#c23a1c, #7a120a); color: #fff2d0; box-shadow: 0 0 0 1px #2a0806, 0 0 10px rgba(255,120,60,0.55); }
#ident-bar { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; padding: 5px 8px; background: rgba(20,12,8,0.92); border: 1px solid #c9a24f; box-shadow: inset 0 0 12px #000; color: #e8d6a6; font-size: 14px; }
#ident-bar .ib-t { flex: 1; min-width: 0; }
#ident-bar .ib-t b { display: inline-block; margin-right: 6px; padding: 0 4px; font: 12px var(--title); color: #f3d9c0; background: #9a2a20; transform: rotate(-4deg); box-shadow: inset 0 0 0 1px rgba(255,210,180,0.35); }
#ident-bar small { display: block; color: #a49678; font-size: 11px; }
#panel-inv.identing #grid, #panel-inv.identing #doll { cursor: help; }
#panel-inv.identing .cell-item:not(.unid), #panel-inv.identing .slot:not(.unid) img { filter: grayscale(0.7) brightness(0.55); }
#panel-inv.identing .cell-item.unid, #panel-inv.identing .slot.unid { box-shadow: inset 0 0 0 2px #e05a4a, 0 0 10px rgba(224,90,74,0.6); animation: ident-pulse 1.2s ease-in-out infinite alternate; }
@keyframes ident-pulse { from { box-shadow: inset 0 0 0 2px #e05a4a, 0 0 4px rgba(224,90,74,0.4); } to { box-shadow: inset 0 0 0 2px #ffb070, 0 0 12px rgba(255,150,90,0.75); } }
.cell-item.unid img { filter: sepia(0.35) brightness(0.92); }

/* ───────── 설명창 크기: 화면 안에만, 길면 안에서 굴리고 단추는 늘 아래 (ui.js placeTip) ───────── */
#tip { display: flex; flex-direction: column; box-sizing: border-box; max-width: min(320px, calc(100vw - 16px)); }
#tip .tip-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #8a6a3a transparent; }
#tip .tip-body::-webkit-scrollbar { width: 4px; } #tip .tip-body::-webkit-scrollbar-thumb { background: #8a6a3a; }
#tip .tip-acts { flex: none; }
#tip.touchy { pointer-events: auto; touch-action: pan-y; }
#tip.scrolls .tip-body { -webkit-mask-image: linear-gradient(#000 calc(100% - 12px), transparent); mask-image: linear-gradient(#000 calc(100% - 12px), transparent); padding-bottom: 10px; }
#tip.two { max-width: min(660px, calc(100vw - 16px)); }
#tip.two .tip-body { column-count: 2; column-gap: 16px; column-rule: 1px dashed rgba(176,138,72,0.35); text-align: left; }
#tip.two .tip-body > * { break-inside: avoid; }
#tip.two .tip-body > .tn, #tip.two .tip-body > .tsub:nth-child(2) { column-span: all; text-align: center; }
body.short #tip { font-size: 12.5px; line-height: 1.35; border-width: 10px; }
body.short #tip .tn { font-size: 15px; }
body.short #tip .tsub, body.short #tip .eg-cmp { font-size: 11px; }
body.short #tip .tip-acts { margin-top: 5px; padding-top: 5px; gap: 5px; }
body.short #tip .tip-acts .lq-btn { min-height: 32px; font-size: 14px; padding: 1px 10px; }

/* ───────── 궤짝 재료 칸 (材料, public/js/world.js renderMats · lib/stashmats.js) ─────────
   약방 약장(藥欌)처럼: 먹빛 느티 서랍마다 놋 고리, 개수는 한지 쪽지에 먹으로. 빈 서랍은 그림만 흐릿하게 */
#panel-stash { --mc: 32px; width: 792px; }   /* 궤짝·행낭 340 칸 둘이 나란히 들어가게 (전엔 680 폭에 696 이 들어가 행낭이 아래로 밀렸다) */
.st-hb { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.eg-stabs button i { font-style: normal; font-size: 10px; margin-left: 4px; color: #6a1a10; letter-spacing: 0; }
.eg-stabs button.mats { background: linear-gradient(#d9b56a, #8e6a22); }
/* 냥으로 더 들이는 공동 칸: 아직 짜 넣지 않은 빈 서랍 자리 — 먹빛 느티에 놋 +, 값은 엽전 글씨. 두 번 눌러야 산다 */
.eg-stabs button.buy { display: inline-flex; align-items: center; gap: 5px; opacity: 1; color: #e8cf8a; background: rgba(36,22,10,0.85) url("../ui/tex_bandaji.png") center / 160px;
  border: 1px dashed #b08a48; box-shadow: inset 0 0 6px #000; }
.eg-stabs button.buy s { text-decoration: none; font-size: 15px; line-height: 1; color: #ffd77a; }
.eg-stabs button.buy em { font: 400 11px var(--font); font-style: normal; color: #c8b48a; letter-spacing: 0; }
.eg-stabs button.buy:hover { border-style: solid; color: #ffe2a0; }
.eg-stabs button.buy.poor { filter: grayscale(0.6); opacity: 0.6; }
.eg-stabs button.buy.armed { color: #fbe9cf; background: #8e2a22; border: 1px solid #3a120c; animation: mk-pulse 0.9s ease-in-out infinite; }
.mt-wrap { position: relative; width: calc(var(--mc) * 10 + 21px); max-width: 100%; padding: 4px 4px 6px; border: 2px solid #b08a48;
  background: rgba(16,10,6,0.9) url("../ui/tex_bandaji.png") center / 260px; background-blend-mode: multiply; box-shadow: inset 0 0 18px #000, 0 1px 0 rgba(255,220,160,0.15); }
.mt-h { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin: 4px 2px 3px; font-family: var(--title); color: #e8c27a; letter-spacing: 2px; font-size: 14px; }
.mt-h:first-child { margin-top: 0; }
.mt-h i { font-style: normal; font-size: 10px; color: #f3d9c0; background: #8e2a22; padding: 0 3px 1px; border-radius: 2px; letter-spacing: 0; box-shadow: inset 0 0 0 1px rgba(255,210,180,0.35); }
.mt-h small { font-family: var(--font); font-size: 11px; color: #b8a47a; letter-spacing: 0; }
.mt-g { display: grid; gap: 1px; }
.mt-hon { grid-template-columns: repeat(10, var(--mc)); }
.mt-gem { grid-template-columns: repeat(10, var(--mc)); }
.mt-gem .mt-c:nth-child(10n+6) { border-left: 2px solid #b08a48; }   /* 한 줄에 보석 두 가지 (1~5등급씩) */
.mt-etc { grid-template-columns: repeat(10, var(--mc)); }
.mt-c { position: relative; width: var(--mc); height: var(--mc); padding: 2px; border: 1px solid #6a4a22; border-radius: 1px;
  background: linear-gradient(#3a2416, #24160c); box-shadow: inset 0 1px 0 rgba(255,210,150,0.14), inset 0 -2px 3px rgba(0,0,0,0.6); cursor: pointer; touch-action: manipulation; }
.mt-c::before { content: ''; position: absolute; left: 50%; top: 1px; width: 8px; height: 3px; margin-left: -4px; border-radius: 0 0 3px 3px; background: #b8923e; box-shadow: 0 1px 1px #000; opacity: 0.8; }
.mt-c img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.mt-c.zero { cursor: default; background: linear-gradient(#24160c, #1a0f08); }
.mt-c.zero img { filter: grayscale(1) brightness(0.55); opacity: 0.28; }
.mt-c:not(.zero):hover { border-color: #e8c27a; box-shadow: 0 0 6px rgba(255,200,110,0.55), inset 0 1px 0 rgba(255,210,150,0.2); }
.mt-c:not(.zero):active { transform: translateY(1px); }
.mt-n { position: absolute; right: -1px; bottom: -1px; min-width: 14px; padding: 0 2px; font: 700 10px/12px var(--font); color: #241a12; text-align: center;
  background: #e9dcc0; border: 1px solid #6d5636; box-shadow: 0 1px 1px rgba(0,0,0,0.6); pointer-events: none; }
.mt-c.full .mt-n { color: #f3d9c0; background: #8e2a22; border-color: #4a0c08; }
.st-it .mt-n { right: 0; bottom: 0; }
/* 개수 고르기: 한지 쪽지 */
.mt-pick { position: absolute; z-index: 5; width: 200px; padding: 8px 10px; color: var(--ink); background: var(--paper) url("../ui/tex_hanji.png") center / 200px;
  border: 1px solid #6d5636; box-shadow: 0 4px 14px rgba(0,0,0,0.7), inset 0 0 0 3px rgba(255,250,235,0.35); }
.mt-pt { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mt-pt img { width: 28px; height: 28px; background: #24160c; border: 1px solid #6a4a22; }
.mt-pt small { margin-left: auto; color: var(--ink2); }
.mt-pr { display: flex; gap: 4px; margin: 6px 0; }
.mt-pr input { flex: 1; min-width: 0; text-align: center; font-size: 15px; border: 1px solid #8a6a3a; background: rgba(255,250,235,0.7); color: var(--ink); }
.mt-pr button, .mt-pb button { min-width: 32px; min-height: 30px; font-size: 13px; color: var(--ink); background: rgba(255,250,235,0.55); border: 1px solid #8a6a3a; }
.mt-pb { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.mt-pb button { flex: 1 1 auto; white-space: nowrap; }
.mt-pb button.go { color: #f6e2b0; background: linear-gradient(#7a1a12, #4a0c08); border-color: #c9a24f; }
body.touch #panel-stash { --mc: 32px; }
@media (max-width: 760px) { #panel-stash, body.touch #panel-stash { --mc: min(32px, calc((100vw - 84px) / 10.4)); } }
body.phone #panel-stash { width: calc(100vw - 12px); border-width: 16px; padding: 2px 6px; }
body.phone #panel-stash, body.phone.touch #panel-stash { --mc: min(32px, calc((100vw - 84px) / 10)); }
body.phone #panel-stash .st-h { flex-wrap: wrap; }
/* 목표 추적 창 접기 (story.js) — 접으면 「行」 인장 하나 */
#tracker .trk-btn { pointer-events: auto; display: block; margin: 0 0 4px auto; width: 28px; height: 28px; padding: 0; border: 1px solid #5a120c; border-radius: 3px;
  background: radial-gradient(circle at 40% 35%, #b8281c, #7a140c); color: #f6e2b0; font-family: var(--title); font-size: 16px; line-height: 26px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.6), inset 0 0 4px rgba(0,0,0,0.4); cursor: pointer; position: relative; opacity: 0.8; }
#tracker .trk-btn:hover { opacity: 1; }
#tracker .trk-btn b { position: absolute; right: -6px; bottom: -6px; min-width: 14px; height: 14px; border-radius: 7px; background: #1e1610; color: #ffd27a; font: 700 10px/14px 'Gowun Batang', serif; }
body.phone #tracker .trk-btn { margin: 0 auto 4px 0; }
/* 인장 곁 작은 글씨 「접기」·「펴기」 — 무엇을 하는 단추인지 (휴대폰은 오른쪽, PC 는 왼쪽) */
#tracker .trk-btn .trk-l { position: absolute; top: 50%; right: calc(100% + 6px); transform: translateY(-50%); font: 400 11px/1 var(--font); font-style: normal; color: #e8d4a8; white-space: nowrap;
  text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; }
body.phone #tracker .trk-btn .trk-l { right: auto; left: calc(100% + 10px); }
#tracker.fold .tq { display: none; }
#tracker.fold .trk-btn { opacity: 0.95; }
#tracker.ping .trk-btn { animation: trkping 0.9s ease-out 1; }
@keyframes trkping { 0% { box-shadow: 0 0 0 0 rgba(255,210,122,0.9); } 100% { box-shadow: 0 0 0 12px rgba(255,210,122,0); } }

/* 대화 고르기 (dlgchoice.js — 4막 모닥불): 대사 아래 한지 띠 셋, 앞머리에 붉은 인주 숫자 */
#dialog.choosing { cursor: default; }
#dialog.choosing .dlg-next { visibility: hidden; }
.dlg-ch { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.dlg-ch button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 9px 14px 9px 10px; border: 0; border-radius: 2px;
  color: var(--ink); font-size: 16px; line-height: 1.45;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.27 0 0 0 0 0.16 0 0 0 0.22 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ece0c4, #d9c8a2);
  box-shadow: inset 0 0 0 1px rgba(74,58,42,0.45), inset 0 -2px 6px rgba(74,58,42,0.18), 0 2px 5px rgba(0,0,0,0.55);
  transition: transform 0.12s, filter 0.12s, opacity 0.2s; }
.dlg-ch button:hover, .dlg-ch button:focus-visible { transform: translateX(4px); filter: brightness(1.06); outline: none; }
.dlg-ch-n { flex: none; width: 26px; height: 26px; display: grid; place-items: center; font-family: var(--title); font-size: 15px; color: #f3e2c6;
  background: var(--red); border-radius: 3px; box-shadow: inset 0 0 0 2px rgba(243,226,198,0.35); transform: rotate(-3deg); }
.dlg-ch-t { flex: 1; }
.dlg-ch.sent button { opacity: 0.35; pointer-events: none; }
.dlg-ch.sent button.on { opacity: 1; filter: brightness(1.08); }
body.phone .dlg-ch { gap: 5px; margin-top: 8px; }
body.phone .dlg-ch button { font-size: 14px; padding: 7px 10px 7px 8px; gap: 9px; }
body.phone .dlg-ch-n { width: 22px; height: 22px; font-size: 13px; }
.dlg-ch.many { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }   /* 고를 것이 많으면 두 줄 (주모의 첫 무기) */
.dlg-ch.many button { font-size: 14.5px; padding: 7px 10px 7px 8px; gap: 9px; }
.dlg-ch.many button:last-child:nth-child(odd) { grid-column: 1 / -1; }
body.phone .dlg-ch.many button { font-size: 12.5px; padding: 5px 8px 5px 6px; line-height: 1.3; }
body.phone.portrait .dlg-ch.many { grid-template-columns: 1fr; gap: 4px; }

/* 장쇠의 재련 (再鍊, public/js/refine.js) — 세공방 「장쇠」 칸 아래: 화덕 앞 장부. 고른 줄은 주사(朱砂) 붓 점, 전/후는 먹 줄 긋기와 금빛 새 줄 */
.rf-box { margin-top: 10px; padding-top: 6px; border-top: 3px double #6d5636; color: var(--ink); }
.rf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rf-head h4 { margin: 0; font-family: var(--title); font-weight: 400; color: var(--red); font-size: 17px; letter-spacing: 2px; }
.rf-head h4 i { font-style: normal; font-size: 12px; color: #8a6a34; margin-left: 4px; }
.rf-have { font-size: 13px; color: var(--ink2); display: inline-flex; align-items: center; gap: 4px; } .rf-have b { color: #a0361a; font-size: 15px; }
.rf-ess { width: 22px; height: 22px; background: radial-gradient(circle, #2a1a10, #0c0705 80%); border-radius: 3px; }
.rf-say { margin: 3px 0 6px; }
.rf-wrap { display: flex; gap: 12px; }
.rf-items { list-style: none; margin: 0; padding: 0; flex: 0 0 44%; max-height: 260px; overflow: auto; border-top: 2px solid #6d5636; border-bottom: 2px solid #6d5636; }
.rf-items li { display: flex; align-items: center; gap: 6px; padding: 3px 5px; border-bottom: 1px dotted rgba(90,60,30,0.45); font-size: 13px; cursor: pointer; }
.rf-items li img { background: rgba(40,28,18,0.85); }
.rf-items li span { flex: 1; text-shadow: 0 0 1px rgba(0,0,0,0.6); }
.rf-items li small { font-size: 11px; color: #8a5a2a; white-space: nowrap; }
.rf-items li:hover { background: rgba(255,240,200,0.45); }
.rf-items li.on { background: linear-gradient(90deg, rgba(142,42,34,0.16), rgba(201,162,79,0.12)); box-shadow: inset 3px 0 0 #8e2a22; }
.rf-right { flex: 1; min-width: 0; }
.rf-name { font-family: var(--title); font-size: 17px; letter-spacing: 1px; text-shadow: 0 0 1px rgba(0,0,0,0.5); } .rf-name small { font-family: var(--font); font-size: 11px; color: var(--ink2); }
.rf-lines, .rf-result ul { list-style: none; margin: 4px 0; padding: 0; }
.rf-line { display: flex; align-items: flex-start; gap: 7px; padding: 4px 6px; border-bottom: 1px dotted rgba(90,60,30,0.4); cursor: pointer; font-size: 13px; color: #2c3f73; }
.rf-lines .rf-line:hover { background: rgba(255,240,200,0.5); }
.rf-dot { flex: 0 0 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 1.5px solid #6d5636; background: rgba(255,250,235,0.6); }
.rf-line.pick { background: rgba(142,42,34,0.1); } .rf-line.pick .rf-dot { border-color: #8e2a22; background: radial-gradient(circle at 40% 40%, #d8503a, #8e2a22 70%); box-shadow: 0 0 4px rgba(200,60,30,0.6); }
.rf-body { display: flex; flex-wrap: wrap; gap: 0 10px; align-items: baseline; }
.rf-af { font-style: normal; font-size: 11px; color: #8a6a34; }
.rf-cost { margin: 6px 0; font-size: 13px; color: var(--ink2); } .rf-cost .short { color: #b0301e; font-weight: 700; } .rf-cost em { font-size: 11px; }
.rf-go, .rf-yes, .rf-again { padding: 5px 14px; font-family: var(--title) !important; font-size: 15px; letter-spacing: 2px; background: linear-gradient(#7a1a12, #4a0c08); border: 1px solid #c9a24f; color: #f6e2b0;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.3), 0 1px 2px #000; }
.rf-go:disabled { filter: grayscale(0.85) brightness(0.8); cursor: default; }
.rf-ask { margin-top: 6px; padding: 6px 8px; border: 1px solid #8e2a22; border-left: 4px solid #8e2a22; background: rgba(255,236,214,0.6); }
.rf-ask p { margin: 0 0 6px; font-size: 13px; } .rf-ask b { color: #8e2a22; }
.rf-ask .link, .rf-btns .link { margin-left: 10px; background: none; border: none; color: var(--ink2); text-decoration: underline; font-size: 13px; }
.rf-result { padding: 4px 0; }
.rf-res-name { font-family: var(--title); font-size: 16px; text-shadow: 0 0 1px rgba(0,0,0,0.5); } .rf-res-name b { color: var(--red); margin: 0 4px; }
.rf-cols { display: flex; gap: 8px; align-items: center; } .rf-cols > div:not(.rf-arrow) { flex: 1; min-width: 0; }
.rf-cols h5 { margin: 4px 0 0; font-family: var(--title); font-weight: 400; color: var(--ink2); font-size: 13px; letter-spacing: 3px; }
.rf-arrow { font-family: var(--title); color: var(--red); font-size: 22px; }
.rf-result .rf-line { cursor: default; } .rf-result .rf-line.same { opacity: 0.6; }
.rf-result .rf-line.old { color: #6a4a3a; text-decoration: line-through; text-decoration-color: rgba(30,20,10,0.85); text-decoration-thickness: 2px; }
.rf-result .rf-line.old .rf-dot { background: #2a1e14; border-color: #2a1e14; }
.rf-result .rf-line.new { background: linear-gradient(90deg, rgba(232,190,90,0.32), rgba(232,190,90,0.05)); color: #6a3a08; font-weight: 700; animation: rf-glow 1.6s ease-out 1; }
.rf-result .rf-line.new .rf-dot { border-color: #c9a24f; background: radial-gradient(circle at 40% 40%, #fff2b8, #d8a842 60%, #8a5a10); }
@keyframes rf-glow { 0% { box-shadow: 0 0 0 rgba(255,170,60,0); background-color: rgba(255,170,60,0.6); } 40% { box-shadow: 0 0 14px rgba(255,150,40,0.7); } 100% { box-shadow: none; } }
.rf-btns { margin-top: 8px; }
.rf-open { margin: 4px 0 6px; }
body.phone .rf-wrap, body.phone .rf-cols { flex-direction: column; align-items: stretch; } body.phone .rf-items { flex-basis: auto; max-height: 150px; } body.phone .rf-arrow { transform: rotate(90deg); text-align: center; }
/* 보부상 등짐 (lib/peddler.js): 짐 꾸러미는 무명 보자기 결, 「보부상의 물건」은 쪽빛 보자기 */
.shop-item.pd-item { border-color: #8a7046; background: linear-gradient(90deg, rgba(255,248,226,0.55), rgba(232,214,176,0.3)); }
.shop-item.pd-bundle, .shop-item.pd-mat { background: repeating-linear-gradient(45deg, rgba(255,250,235,0.35) 0 6px, rgba(220,204,170,0.32) 6px 7px); }
.shop-item.pd-special { border: 1px solid #3a5a8a; background: linear-gradient(90deg, rgba(58,90,138,0.22), rgba(255,250,235,0.3)); }
.shop-item.pd-special .nm { font-family: var(--title); letter-spacing: 1px; }
.shop-item .pd-unid { font-size: 11px; color: #8a6a44; margin-left: 4px; }

/* 세로 휴대폰 첫 화면: 아래 판이 높아 제첨 자리가 모자라면(title.js placePlaque → body.jc-tight) 머리말을 줄여 쪽지와 겹치지 않게 */
body.jc-tight #title .lead { font-size: 12.5px; line-height: 1.5; margin: 0 0 4px; }
body.jc-tight #title .title-box { padding-top: 8px; padding-bottom: 8px; }

/* ── 표적 패(캔버스, ui.js placeTarget)와 위쪽 HUD ──
   세로 휴대폰은 가운데 위가 한 칸뿐 — 표적을 잡는 동안 지역 이름을 접는다 (밤 습격 도장은 왼쪽 위로 비켜 간다, nightrush.js place).
   PC·태블릿 기운 줄은 가운데(표적 패 자리)까지 뻗지 않게: 화면 반 − 패 반쪽(140) − 테·틈. UI 크기(zoom)는 --uis 로 되돌려 잰다 */
body.phone.portrait.tgt-on #zone-name { display: none; }
body:not(.phone) #buffs { max-width: min(520px, max(260px, calc(50vw / var(--uis, 1) - 16px - 164px))); max-height: 140px; }   /* 좁아진 만큼 셋째 줄까지 (sysbox 는 --bfb 로 따라 내려간다) */
body.has-party:not(.phone) #buffs { max-width: min(520px, max(244px, calc(50vw / var(--uis, 1) - 232px - 164px))); }   /* 좁으면 표적 패가 비켜 간다 */
body.phone:not(.portrait) #buffs { max-width: calc(50vw / var(--uis, 1) - 170px); }
body.phone:not(.portrait):not(.short) #buffs { top: 31px; }   /* 키 큰 가로(태블릿 터치): 지역 이름(위 8~28px) 아래로 — 낮은 가로는 지역 이름을 숨긴다 */

/* ── 잠룡 창(C): 디아2 캐릭터 판 — 한지 위에 옻칠 값 상자, 두 단(PC) / 책갈피(휴대폰·좁은 창). ui.js renderStats ── */
#panel-stats { width: 640px; }
#panel-stats.cs-tabbed { width: 400px; }
body.phone #panel-stats { width: min(560px, calc(100vw - 12px)); border-width: 16px; padding: 2px 8px; }
body.phone #panel-stats h3 { font-size: 17px; margin-bottom: 2px; }
.cs-plate { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; }
.cs-name { display: flex; flex-direction: column; min-width: 0; }
.cs-name b { font-family: var(--title); font-weight: 400; font-size: 20px; color: var(--ink); letter-spacing: 1px; white-space: nowrap; }
.cs-name span { font-size: 12px; color: #6d5636; white-space: nowrap; }
.cs-xp { position: relative; flex: 1; height: 18px; background: linear-gradient(#1c0d08, #2c140c); border: 1px solid #8a6a3a; box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255,240,200,0.4); overflow: hidden; }
.cs-xp i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#d8b25a, #9a7428 60%, #6e4e18); box-shadow: inset 0 1px 0 rgba(255,240,180,0.5); }
.cs-xp span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 16px; color: #f6e6c0; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }
.cs-xp em { font-style: normal; color: #ffd77a; margin-left: 4px; }
.cs-tabs { display: none; gap: 3px; margin: 0 0 6px; border-bottom: 2px solid #6d3a20; }
.cs-tabbed .cs-tabs { display: flex; }
.cs-tab { flex: 1; padding: 5px 2px 4px; border: 1px solid #5a2a18; border-bottom: none; border-radius: 6px 6px 0 0; background: linear-gradient(#5a1a12, #3a0e0a);
  color: #d8b88a; font-family: var(--title); font-size: 15px; letter-spacing: 1px; opacity: 0.8; box-shadow: inset 0 1px 0 rgba(255,200,140,0.18); white-space: nowrap; }
.cs-tab i { font-style: normal; font-size: 11px; color: #c9a24f; margin-right: 3px; }
html.lang-en .cs-tab { flex: 1 1 auto; font-size: 13px; letter-spacing: 0; padding-left: 4px; padding-right: 4px; }   /* 영어 이름이 길어 넷이 한 줄에 들게 */
@media (max-width: 480px) { html.lang-en .cs-tab { font-size: 12px; padding-left: 2px; padding-right: 2px; } html.lang-en .cs-tab i { display: none; } }
.cs-tab.on { opacity: 1; background: linear-gradient(#9a2a1e, #6a160e); color: #ffe8b8; border-color: #c9a24f; }
.cs-cols { display: flex; gap: 14px; align-items: flex-start; }
.cs-col { flex: 1 1 0; min-width: 0; }
.cs-tabbed .cs-cols, .cs-tabbed .cs-col { display: contents; }
.cs-tabbed .cs-sec { display: none; }
.cs-tabbed #stats-body[data-tab="0"] .cs-sec[data-tab="0"], .cs-tabbed #stats-body[data-tab="1"] .cs-sec[data-tab="1"],
.cs-tabbed #stats-body[data-tab="2"] .cs-sec[data-tab="2"], .cs-tabbed #stats-body[data-tab="3"] .cs-sec[data-tab="3"] { display: block; }
.cs-tabbed .cs-sec > .cs-h:first-child { display: none; }
.cs-sec + .cs-sec { margin-top: 8px; }
.cs-h { display: flex; align-items: center; gap: 6px; font-family: var(--title); font-size: 17px; color: var(--blue); letter-spacing: 2px; margin: 2px 0 4px; padding-bottom: 2px; border-bottom: 1px solid rgba(110,80,40,0.45); }
.cs-h i, .cs-seal { display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-family: var(--title); width: 20px; height: 20px; font-size: 13px; letter-spacing: 0;
  color: #f4dcc0; background: radial-gradient(circle at 40% 35%, #b23a2c, #7a1a12 70%); border-radius: 3px; box-shadow: 0 0 0 1px #3a120c, inset 0 1px 0 rgba(255,200,170,0.3); transform: rotate(-3deg); }
.cs-h2 { margin-top: 10px; }
.cs-pts { font-size: 13px; color: #6d1a12; margin: 0 0 4px; } .cs-pts b { font-size: 15px; } .cs-pts span { font-size: 11px; color: #7a6040; }
/* 능력치 줄: 인장 · 이름 · 옻칠 값 상자 · + */
.cs-attr { display: grid; grid-template-columns: 24px 1fr auto auto; align-items: center; column-gap: 6px; padding: 4px 2px 5px; border-bottom: 1px dotted #a08a62; }
.cs-attr .cs-seal { width: 22px; height: 22px; font-size: 14px; background: radial-gradient(circle at 40% 35%, #3a4a7a, #1c2648 70%); box-shadow: 0 0 0 1px #10162a, inset 0 1px 0 rgba(200,210,255,0.3); }
.cs-an { min-width: 0; line-height: 1.15; } .cs-an b { font-size: 15px; } .cs-an small { display: block; font-size: 11px; color: #6d5636; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.lang-en .cs-an small { white-space: normal; line-height: 1.2; }   /* 영어 설명은 길다 — 말줄임 대신 줄바꿈 */
.cs-box { min-width: 44px; padding: 2px 6px; text-align: center; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; color: #ffd77a;
  background: linear-gradient(#2a0e0a, #120604); border: 1px solid #b08a48; box-shadow: inset 0 1px 4px #000, 0 1px 0 rgba(255,240,200,0.5); text-shadow: 0 1px 2px #000; }
.cs-attr.up .cs-box { color: #a8d0ff; } .cs-attr.down .cs-box { color: #ff7a60; }
.cs-plus { width: 24px; height: 24px; padding: 0; font-size: 16px; line-height: 1; background: linear-gradient(#7a1a12, #4a0c08); border: 1px solid #c9a24f; color: #f6e2b0;
  box-shadow: inset 0 1px 0 rgba(255,220,160,0.3), 0 1px 2px #000; }
.cs-brk, .cs-per { grid-column: 2 / -1; font-size: 11px; line-height: 1.4; }
.cs-brk { color: #5a4a36; } .cs-per { color: #8a4a20; }
/* 값 줄: 누르면 풀이 */
.cs-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 8px; padding: 3px 2px; border-bottom: 1px dotted #a08a62; font-size: 14px; }
.cs-row.has-n { cursor: pointer; } .cs-row.has-n .cs-l { text-decoration: underline dotted rgba(110,80,40,0.55); text-underline-offset: 3px; }
.cs-row.has-n:hover { background: rgba(142,42,34,0.06); }
.cs-v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; } .cs-v small { font-weight: 400; color: #6d5636; font-size: 12px; }
.cs-n { display: none; flex-basis: 100%; font-size: 11.5px; line-height: 1.5; color: #4a3a2a; background: rgba(120,90,50,0.12); border-left: 2px solid #8e2a22; padding: 3px 6px; margin: 3px 0 1px; }
.cs-row.open .cs-n { display: block; }
.cs-row.hpc .cs-v { color: #8e2a22; } .cs-row.mpc .cs-v { color: var(--blue); }
/* 저항: 인장 · 이름 · (장비 − 깎임 =) 옻칠 상자 · −100…75 막대 */
.cs-rnote { margin: 0 0 4px; font-size: 12px; line-height: 1.5; color: #4a3a2a; }
.cs-rat { font-size: 12px; color: #6d5636; margin-bottom: 4px; } .cs-rat b { color: var(--red); font-weight: 400; font-family: var(--title); font-size: 14px; }
.cs-res { display: grid; grid-template-columns: 24px 3em 1fr; grid-template-rows: auto 5px; align-items: center; column-gap: 6px; padding: 4px 2px 3px; border-bottom: 1px dotted #a08a62; }
.cs-res .cs-seal { grid-row: 1 / 3; width: 22px; height: 22px; font-size: 14px; }
.r-fire .cs-seal { background: radial-gradient(circle at 40% 35%, #e0602a, #9a2a10 70%); }
.r-cold .cs-seal { background: radial-gradient(circle at 40% 35%, #4a8ac0, #1c4a78 70%); }
.r-poison .cs-seal { background: radial-gradient(circle at 40% 35%, #5a9a3a, #2a5a1a 70%); }
.r-curse .cs-seal { background: radial-gradient(circle at 40% 35%, #8a5ab0, #4a2468 70%); }
.cs-rn { font-size: 14px; }
.cs-rv { justify-self: end; font-size: 12px; color: #6d5636; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cs-raw { color: var(--ink); } .cs-pen { color: #9a2a20; }
.cs-rv b { display: inline-block; min-width: 46px; margin-left: 2px; padding: 1px 6px; text-align: center; font-size: 15px; color: #f0e0b8;
  background: linear-gradient(#2a0e0a, #120604); border: 1px solid #8a6a3a; box-shadow: inset 0 1px 4px #000, 0 1px 0 rgba(255,240,200,0.5); text-shadow: 0 1px 2px #000; }
.cs-res.neg .cs-rv b { color: #ff6a50; border-color: #c0392b; }
.cs-res.cap .cs-rv b { color: #ffd24a; border-color: #e0b84a; text-shadow: 0 0 6px rgba(255,200,60,0.7), 0 1px 2px #000; }
.cs-over { margin-left: 4px; color: #8a6a2a; font-size: 10px; }
.cs-rbar { grid-column: 2 / -1; position: relative; height: 4px; background: rgba(60,40,20,0.22); }
.cs-rbar::before { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: #3a120c; opacity: 0.5; }
.cs-rbar i { position: absolute; top: 0; bottom: 0; background: #6a5a3a; }
.cs-rbar u { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #b08a48; }
.cs-res.neg .cs-rbar i { background: #c0392b; } .cs-res.cap .cs-rbar i { background: linear-gradient(90deg, #b08a48, #ffd24a); }
.r-fire:not(.neg):not(.cap) .cs-rbar i { background: #b0502a; } .r-cold:not(.neg):not(.cap) .cs-rbar i { background: #3a6a9a; }
.r-poison:not(.neg):not(.cap) .cs-rbar i { background: #4a7a2a; } .r-curse:not(.neg):not(.cap) .cs-rbar i { background: #6a4a8a; }
#panel-stats .stat-tip { margin: 6px 0 2px; }
body.phone.short #panel-stats .cs-plate { margin-bottom: 3px; } body.phone.short #panel-stats .cs-name b { font-size: 16px; }
.cs-tabbed .cs-tabs { position: sticky; top: -6px; z-index: 2; padding-top: 4px; background: url("../ui/tex_hanji.png") center / 340px; }
body.phone.short #panel-stats h3 { display: none; }   /* 낮은 가로 휴대폰: 제목 줄 대신 패찰이 이름을 보인다 */

/* ── 쓰러짐: 동료를 기다린다 (ui.js deadWait) — 기다리는 동안은 화면을 덜 가리고 아래로 비켜 동행이 오는 것을 본다 ── */
#dead { transition: background 0.4s; }
#dead.waiting { justify-content: flex-end; padding-bottom: max(18vh, 120px); background: radial-gradient(ellipse at 50% 45%, rgba(20,0,0,0) 30%, rgba(30,0,0,0.42) 100%); pointer-events: none; }
#dead.waiting > * { pointer-events: auto; }
body:not(.phone) #dead.waiting { padding-bottom: calc(17vh + 104px); }   /* PC·태블릿: 아래 메뉴 줄(#mini) 위로 */
#dead.waiting .dead-title { font-size: 40px; letter-spacing: 10px; opacity: 0.85; }
#dead.waiting #dead-msg { margin: 4px 0 8px; font-size: 13px; opacity: 0.8; }
#dead-wait { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: -6px 0 14px; padding: 10px 18px 12px; min-width: 240px; max-width: min(420px, calc(100vw - 32px));
  background: linear-gradient(rgba(14,26,16,0.86), rgba(8,14,9,0.9)); border: 1px solid #5f8a5a; box-shadow: 0 0 0 3px rgba(0,0,0,0.5), 0 6px 18px rgba(0,0,0,0.6); text-align: center; }
#dead-wait[hidden] { display: none; }
#dead-wait p { margin: 0; }
.dw-who { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
.dw-n b { color: #c8ffd6; font-family: var(--title); font-weight: 400; font-size: 17px; }
.dw-n small { margin-left: 5px; padding: 0 5px; font-size: 11px; color: #12200f; background: #9fe0a8; border-radius: 2px; vertical-align: 2px; }
.dw-sub, .dw-gone { font-size: 12px; color: #b8c8a8; line-height: 1.6; }
.dw-on { font-family: var(--title); font-size: 19px; color: #e8ffe8; letter-spacing: 2px; }
.dw-on em { font-style: normal; display: inline-block; animation: dw-dots 1.4s steps(4) infinite; overflow: hidden; width: 1.2em; vertical-align: bottom; text-align: left; }
@keyframes dw-dots { from { width: 0; } to { width: 1.2em; } }
#dead-wait i, .dw-on i { font-style: normal; display: inline-flex; align-items: center; justify-content: center; width: 1.45em; height: 1.45em; margin-right: 8px; font-family: 'Noto Serif KR', serif; font-weight: 700; font-size: 0.85em;
  color: #f4ffe8; background: #3f7a3a; border: 1px solid #12200f; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18); transform: rotate(-4deg); }
#dead-waitb { margin-top: 6px; padding: 8px 16px; font-family: var(--title); font-size: 16px; color: #f0ffe8; background: linear-gradient(#3c5e34, #1c3018); border: 1px solid #12200f; box-shadow: 0 0 0 1px #7aa86a; }
#dead-waitb:hover { filter: brightness(1.2); }
#dead.waiting #revive { opacity: 0.85; font-size: 13px; padding: 6px 12px; }

/* ── 메뉴 단추 歸·鑑 (ui.js scrollBtns): 남은 장 수, 없으면 흐리게 ── */
.minimenu .scb { position: relative; font-size: 19px; }
.minimenu .scb .scn { position: absolute; right: -3px; bottom: -3px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; box-sizing: border-box;
  font: 700 10px/15px var(--font); color: #1a120a; background: #f0d488; border: 1px solid #2a0a06; text-shadow: none; }
.minimenu .scb.none { filter: grayscale(0.9) brightness(0.6); }
.minimenu .scb.none .scn { background: #8a8070; }
body.phone.portrait #tmenu .scb, body.phone.short #tmenu .scb { width: 40px; height: 40px; font-size: 17px; }
body.tablet #mini .scb { width: 50px; height: 50px; }
body.pc #mini .scb { font-size: calc(var(--ms) * 0.42); }

/* 첫 화면: 누르기 전에는 그림과 제첨만 (boot.js waitTap) */
#title .title-box { transition: opacity 0.9s ease, transform 0.9s ease; }
#title.tap-wait .title-box { opacity: 0; visibility: hidden; transform: translateY(8px); pointer-events: none; }
#tap-hint { position: absolute; left: 0; right: 0; bottom: max(7vh, 36px); text-align: center; font-family: 'Song Myung', serif; font-size: 17px; letter-spacing: 0.4em;
  color: rgba(236, 222, 190, 0.82); text-shadow: 0 0 10px rgba(0,0,0,0.85), 0 0 2px #000; pointer-events: none; opacity: 0; transition: opacity 0.6s; }
#title.tap-wait #tap-hint { opacity: 1; animation: tapHint 2.6s ease-in-out infinite; }
@keyframes tapHint { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }

/* 서막: 다 쓴 뒤 '누르면 넘긴다' (story.js intro — 저절로 넘어가지 않는다) */
#intro .intro-hint { position: absolute; left: 0; right: 0; bottom: 26px; text-align: center; font-family: 'Song Myung', serif; font-size: 15px; letter-spacing: 0.35em;
  color: rgba(236, 222, 190, 0.75); text-shadow: 0 0 8px #000; opacity: 0; transition: opacity 0.6s; pointer-events: none; }
#intro.intro-ready .intro-hint { opacity: 1; animation: tapHint 2.6s ease-in-out infinite; }

/* 아이폰 홈 화면 앱(전체 화면): 처음 열 때 화면 높이를 상태바만큼 작게 잡아 아래가 까맣게 비던 일 — 주소창이 없으니 큰 화면 높이(lvh)로 깐다 */
@supports (height: 100lvh) {
  @media (display-mode: fullscreen), (display-mode: standalone) {
    html, body { height: 100lvh; }
    #backdrop, .screen, #cv, #hud, #intro, #loading, #scrollv, #inst-sheet { bottom: auto; height: 100lvh; }
  }
}
/* 낮은 화면(휴대폰 가로): 잠룡 명부 줄을 촘촘하게, 꾸밈 글 두 줄은 접어 셋째 줄까지 보이게 */
@media (max-height: 520px) {
  #chars .chars-box > .note, #chars .chars-grid .note { display: none; }
  #char-list { margin: 6px 0; }
  #char-list li { padding: 5px 10px; margin: 4px 0; }
  #char-list .nm { font-size: 16px; }
  #char-list .meta { font-size: 12px; }
  #char-list .go { padding: 3px 12px; font-size: 14px; }
}
/* 휴대폰 가로: 퀘스트 추적 창(「行」 인장)은 구슬 바로 아래 — 직업·레벨 글은 구슬 오른쪽으로 옮겼다 (ui.js drawHUDTouch, --orb-b = 구슬 아랫변) */
body.phone:not(.portrait) #tracker { top: calc(var(--orb-b, 132px) + 8px); }

/* 터치에서 상점을 열었을 때 (ui.js layoutShop): 상점은 목록만 스크롤, 닫기는 오른쪽 위 ✕, 주인 말은 두 줄까지. 세로에선 행낭의 장비 인형을 접는다 */
body.shop-open #panel-npc { display: flex; flex-direction: column; overflow: hidden; padding-top: 10px; }
body.shop-open #panel-npc #npc-name { flex: none; margin: 0 40px 4px 0; }
body.shop-open #panel-npc #npc-line { flex: none; margin: 0 0 6px; font-size: 13.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.shop-open #panel-npc #npc-shop { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
body.shop-open #panel-npc > .close { position: absolute; top: 6px; right: 8px; width: 40px; height: 40px; padding: 0; margin: 0; font-size: 0; border: 1px solid #8a6a3a; border-radius: 50%; background: rgba(60,30,18,0.9); z-index: 3; }
body.shop-open #panel-npc > .close::before { content: '✕'; font-size: 18px; line-height: 38px; color: #f3e6c4; }
body.shop-open .shop-item { padding: 4px 6px; margin: 3px 0; }
body.shop-open .shop-item .ic { width: 36px; height: 36px; } body.shop-open .shop-item .ic img { max-width: 36px; max-height: 36px; }
body.shop-open.portrait #panel-inv #doll, body.shop-open #panel-inv .note { display: none; }
body.shop-open.short:not(.portrait) #panel-npc #npc-line { -webkit-line-clamp: 1; font-size: 12.5px; margin-bottom: 3px; }
/* 휴대폰 가로(낮은 화면): 구슬이 맨 위로 올라갔다 (ui.js) — 걸린 기운은 구슬 오른쪽 줄 (용병 패가 있으면 그 오른쪽) */
body.phone.short:not(.portrait) #buffs { top: var(--orb-t, 12px); left: var(--orb-r, 180px); max-width: max(110px, calc(100vw / var(--uis, 1) - var(--orb-r, 180px) - 330px)); }
body.phone.short.has-merc:not(.portrait) #buffs { left: calc(var(--orb-r, 180px) + 176px); max-width: max(110px, calc(100vw / var(--uis, 1) - var(--orb-r, 180px) - 506px)); }

/* 다른 잠룡 살펴보기 (social.js) — 동행 창과 같은 한지 창 */
#panel-insp { left: 50%; top: 70px; transform: translateX(-50%); width: 360px; max-width: calc(100vw / var(--uis, 1) - 16px); max-height: calc(100vh / var(--uis, 1) - 90px); overflow-y: auto; z-index: 22; }
#panel-insp h3 { display: flex; align-items: baseline; gap: 6px; }
#panel-insp h3 small { font-family: var(--font); font-size: 13px; color: var(--ink2); letter-spacing: 0; }
#panel-insp h3 .close { margin-left: auto; background: none; border: none; color: var(--ink2); font-size: 18px; cursor: pointer; }
#insp-meta { margin: -4px 0 6px; }
#insp-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; }
.ins-row { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 2px 4px; border-bottom: 1px dashed rgba(110,80,40,0.25); cursor: default; }
.ins-row:not(.empty) { cursor: help; } .ins-row:not(.empty):hover { background: rgba(255,240,200,0.5); }
.ins-sl { flex: none; width: 3.2em; font-size: 11.5px; color: var(--ink2); }
.ins-ic { flex: none; width: 30px; height: 30px; display: grid; place-items: center; background: rgba(40,28,18,0.85); border: 2px solid #6d5636; box-sizing: border-box; }
.ins-ic img { max-width: 28px; max-height: 28px; }
.ins-nm { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.25; color: var(--ink); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ins-row.empty .ins-nm { color: rgba(74,58,42,0.45); }
#insp-st { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 4px; padding-top: 6px; border-top: 1px solid rgba(110,80,40,0.35); font-size: 13px; }
#insp-st em { font-style: normal; color: var(--ink2); font-size: 11.5px; margin-right: 3px; }
#insp-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
#insp-acts .lq-btn { flex: 1; min-height: 34px; }
body.phone #panel-insp { top: max(8px, env(safe-area-inset-top)); }
body.phone.portrait #insp-eq { grid-template-columns: 1fr; }
body.phone.portrait .ins-row { min-height: 30px; }
#insp-acts .lq-btn { white-space: nowrap; padding: 4px 8px; font-size: 13.5px; letter-spacing: 1px; }
body.phone.portrait #insp-acts .lq-btn { font-size: 12.5px; letter-spacing: 0; padding: 4px 4px; }
body.phone.portrait .ins-row.empty { display: none; }
body.phone #panel-insp { max-height: calc(100vh / var(--uis, 1) - 24px); }
/* 설명창: 한 벌(세트) — 구성품·단계 효과, 입은 것·켜진 것만 밝게 (ui.js setTip) */
.set-box { margin: 6px 0 2px; padding-top: 5px; border-top: 1px dashed rgba(99,196,107,0.35); }
#tip .set-box .set-h, .set-box .set-h { color: #63c46b; } .set-box .set-h small { color: #8fb890; font-size: 0.85em; }
.set-pc, .set-bn { font-size: 0.92em; color: #6f7a6c; line-height: 1.45; }
.set-pc { padding-left: 8px; } .set-pc.on { color: #63c46b; }
.set-bn.on { color: #9fe0a2; }

/* 말 고르기 (첫 화면 오른쪽 위, public/js/i18n.js · boot.js) — 먹빛 바탕에 금 테, 고른 말은 한지색 */
.lang-pick { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 30; display: flex; gap: 0;
  border: 1px solid rgba(201,162,79,0.55); background: rgba(12,10,8,0.55); box-shadow: 0 2px 10px rgba(0,0,0,0.45); }
.lang-pick button { font: 14px 'Gowun Batang', 'Noto Serif KR', serif; color: #bfae8a; background: transparent; border: 0; padding: 6px 12px; cursor: pointer; letter-spacing: 0.04em; min-height: 32px; }
.lang-pick button + button { border-left: 1px solid rgba(201,162,79,0.35); }
.lang-pick button.on { background: #e9dcc0; color: #3a2414; }
.lang-pick button:not(.on):hover { color: #f0dfb4; }
/* 영어 제목 (영어 손님만, boot.js) — 왼쪽 위, 먹빛 위 한지색 */
.en-title { position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); z-index: 29; max-width: 46vw;
  font: 400 clamp(15px, 2.2vw, 24px)/1.25 'Gowun Batang', serif; letter-spacing: 0.06em; color: #e9dcc0; text-shadow: 0 1px 6px #000, 0 0 14px #000; pointer-events: none; }
.en-title small { display: block; margin-top: 3px; font-size: 0.5em; letter-spacing: 0.12em; color: #bfae8a; }
/* 영어: 행낭 아래 엽전 줄이 두 줄로 꺾이지 않게 */
html.lang-en .inv-foot .gold { white-space: nowrap; }
/* 세로 화면: 제첨이 오른쪽 위를 차지하므로 말 고르기는 왼쪽 위, 영어 제목은 그 아래 */
@media (max-aspect-ratio: 4/5) {
  .lang-pick { right: auto; left: max(12px, env(safe-area-inset-left)); }
  .lang-pick button { font-size: 13px; padding: 5px 10px; min-height: 30px; }
  .en-title { top: calc(max(12px, env(safe-area-inset-top)) + 42px); max-width: 52vw; font-size: 17px; }
}

/* 첫걸음 안내 (coach.js) — 한 줄 띠: 붉은 낙관 + 할 일 하나. 길잡이 안내(#gtip)보다 작고 조작을 막지 않는다 */
#coach { position: absolute; left: 50%; bottom: calc(22vh + 10px); transform: translateX(-50%); z-index: 44; display: flex; align-items: center; gap: 10px;
  width: max-content; max-width: min(560px, calc(100vw - 24px)); padding: 8px 10px 8px 8px; pointer-events: auto;
  background: linear-gradient(180deg, rgba(24,14,8,0.94), rgba(12,8,6,0.94)); border: 1px solid #8a6a36; box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 6px 18px rgba(0,0,0,0.55);
  animation: coin 0.3s ease-out; }
#coach.hidden { display: none; }
@keyframes coin { from { opacity: 0; transform: translate(-50%, 10px); } }
#coach .co-seal { flex: none; width: 34px; height: 34px; display: grid; place-items: center; font-family: var(--title); font-size: 19px; color: #f6e0c8;
  background: #9a2a1e; border: 2px solid #5e140d; border-radius: 3px; transform: rotate(-4deg); }
#coach .co-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#coach .co-t { font-family: var(--title); font-size: 15px; color: #ffcf7a; }
#coach .co-b { font-size: 13.5px; line-height: 1.6; color: #efe2c4; }
#coach .co-b b { color: #ffd27a; }
#coach kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; margin: 0 1px; font: bold 12px/1.55 'Gowun Batang', serif; text-align: center; color: #2a1a10;
  background: linear-gradient(#f4e6c4, #d8c294); border: 1px solid #6a4a22; border-bottom-width: 3px; border-radius: 3px; }
#coach .co-x { flex: none; align-self: flex-start; width: 26px; height: 26px; padding: 0; font-size: 13px; color: #c8b48a; background: transparent; border: 1px solid rgba(168,128,62,0.5); cursor: pointer; }
#coach.co-done { border-color: #c9a24f; }
#coach.co-done .co-seal { background: #3a6a2a; border-color: #1e3a14; }
#coach.co-done .co-b { opacity: 0.55; }
body.phone #coach { bottom: auto; top: 18vh; max-width: calc(100vw / var(--uis, 1) - 20px); }   /* coach.js place() 가 말 칸 위로 옮긴다 */
body.phone.short #coach { top: 56px; }
.coach-ring { animation: coring 1.2s ease-in-out infinite !important; }
@keyframes coring { 0%, 100% { box-shadow: 0 0 0 2px rgba(255,214,120,0.9), 0 0 10px 2px rgba(255,190,90,0.55); } 50% { box-shadow: 0 0 0 5px rgba(255,214,120,0.35), 0 0 22px 6px rgba(255,190,90,0.25); } }

/* ── 처음 하는 사람 시험(UX) 손질 ── */
/* 행낭 맞춤 (ui.js fitInv): 장비 인형·칸·용병 인형을 같은 배율로 줄인다. 제목 줄·단추·도움말 글은 그대로 */
#panel-inv #doll, #panel-inv #grid, #panel-inv #mc-doll-grid { zoom: var(--ik, 1); }
#panel-inv .inv-r { min-width: 0; }
#panel-inv #doll { width: 428px; margin-left: auto; margin-right: auto; }   /* 줄어도 가운데에 (창 너비는 그대로 두고 인형·칸만 준다) */
#panel-inv #grid, #panel-inv #mc-doll-grid { margin-left: auto; margin-right: auto; }
#panel-inv .inv-foot { flex-wrap: wrap; row-gap: 4px; }
#panel-inv .inv-foot .lq-btn, #panel-inv .inv-foot .gold { white-space: nowrap; }
#panel-inv.inv-wide .inv-body { display: flex; align-items: flex-start; gap: 12px; }
#panel-inv.inv-wide .inv-l { flex: none; }
#panel-inv.inv-wide .inv-r { flex: 1 1 auto; }
#panel-inv.inv-wide #doll { margin-top: 0; }
#panel-inv .inv-help { margin: 6px 0 0; line-height: 1.5; }
body.phone #panel-inv, body.phone.short #panel-stats, body.phone.short #panel-skills, body.phone.short #panel-help, body.phone.short #panel-chron, body.phone.short #panel-set { border-width: 14px; }
/* 행낭 칸의 어두운 물건(쇠·먹빛 무기)이 바탕에 묻히지 않게: 옅은 테두리 빛 */
#grid .cell-item img, #doll .slot img { filter: drop-shadow(0 0 1.5px rgba(244,226,180,0.55)); }
html.lang-en #panel-inv .gold { line-height: 1.5; padding-bottom: 1px; overflow: visible; }   /* 「Coins 114 nyang」 g 꼬리가 잘리던 것 */

/* 창 제목 줄(✕)은 창 안을 굴려도 늘 위에 붙어 있다 — 낮은 화면에서 굴리면 닫기가 사라지던 것 */
#panel-inv > h3, #panel-stats > h3, #panel-skills > h3, #panel-chron > h3, #panel-mentor > h3 { position: sticky; top: -6px; z-index: 6; margin-top: -6px; padding-top: 6px; background: inherit; background-clip: border-box; }
body.phone #panel-stats > h3 { top: -2px; margin-top: -2px; padding-top: 2px; }
body.phone.short #panel-stats > h3 { position: sticky !important; top: 0; height: 0; padding: 0; margin: 0; background: none; }   /* hudx.css 의 relative 를 이긴다 — 굴려도 ✕ 가 구석에 남는다 */
body.phone.short #panel-stats > h3 .close { background: rgba(60,30,18,0.88); border: 1px solid #8a6a3a; border-radius: 50%; color: #f3e6c4; }
body.touch #panel-stats, body.touch #panel-skills { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* 설정: 낮은 가로 화면에서 왼쪽 현판 줄이 잘리던 것 — 줄을 촘촘히, 넘치면 그 줄만 굴린다 */
body.phone.short .set-menu { overflow-y: auto; min-height: 0; gap: 5px; scrollbar-width: none; }
body.phone.short .set-plq { min-height: 34px; padding: 5px 34px 5px 10px; flex: none; }
body.phone.short .set-plq small { display: none; }
body.phone.short .set-plq b { font-size: 15px; }

/* 묻는 쪽지 (ui.js ask): 귀한 물건 팔기 — 옻칠 바탕·붉은 낙관, 창 가운데 위에 */
#ui-ask { position: absolute; z-index: 55; transform: translate(-50%, -50%); width: max-content; max-width: min(360px, calc(100vw - 24px)); display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px 16px 14px; text-align: center; border: 14px solid transparent; border-image: url("../ui/frame_najeon.png") 58 stretch;
  background: rgba(14,8,6,0.97); background-clip: padding-box; box-shadow: 0 10px 34px rgba(0,0,0,0.8); animation: gtin2 0.18s ease-out; }
#ui-ask.hidden { display: none; }
@keyframes gtin2 { from { opacity: 0; } }
#ui-ask .ua-seal { width: 30px; height: 30px; display: grid; place-items: center; font-family: var(--title); font-size: 17px; color: #f6e0c8; background: #9a2a1e; border: 2px solid #5e140d; border-radius: 3px; transform: rotate(-4deg); }
#ui-ask p { margin: 0; font-size: 14.5px; line-height: 1.6; color: #efe2c4; word-break: keep-all; }
#ui-ask p b { color: #ffd27a; font-weight: 400; font-family: var(--title); }
#ui-ask div { display: flex; gap: 10px; }
#ui-ask button { min-width: 92px; padding: 7px 14px; font-family: var(--title); font-size: 16px; border: 1px solid #c9a24f; color: #f6e2b0; background: linear-gradient(#3a2a1e, #1a120a); cursor: pointer; }
#ui-ask .yes { background: linear-gradient(#9a2a1e, #5a0e08); }

/* PC 말 칸: 흐린 채로는 땅 누르기를 가로채지 않는다 — 왼쪽 갈래 고르기(지역/전체)만 누를 수 있고, Enter·말하기 단추로 열면 다 살아난다 */
body:not(.phone) #chatbox:not(:focus-within) { pointer-events: none !important; }
body:not(.phone) #chatbox:not(:focus-within) #chat-ch { pointer-events: auto; }

/* 휴대폰 공격·줍기 단추 이름 (touch.js data-cap) — 「손 단추」가 어느 것인지 알게 */
body.phone .tb[data-cap]::after { content: attr(data-cap); position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  padding: 0 5px; font: 11px/15px var(--font); letter-spacing: 0; color: #f6e6c0; background: rgba(20,10,6,0.82); border: 1px solid rgba(201,162,79,0.7); border-radius: 3px; }
body.phone .tb.big[data-cap]::after { bottom: 2px; }
/* 첫걸음 빛 고리를 더 또렷하게 */
.coach-ring { animation: coring2 1.1s ease-in-out infinite !important; }
@keyframes coring2 { 0%, 100% { box-shadow: 0 0 0 3px rgba(255,222,130,1), 0 0 16px 6px rgba(255,190,80,0.8); } 50% { box-shadow: 0 0 0 7px rgba(255,214,120,0.5), 0 0 30px 12px rgba(255,180,70,0.45); } }

/* 길잡이 작은 쪽지 (guide.js gt-mini): 처음 들어옴 말고는 가운데를 비켜 작게 — 싸움터를 가리지 않는다. 8초 뒤 저절로 접힌다 */
#gtip.gt-mini { left: auto; right: 16px; bottom: calc(17vh + 64px); transform: none; width: min(300px, calc(100vw - 24px)); border-width: 12px; padding: 6px 10px 8px; animation: gtmini 0.3s ease-out; }
@keyframes gtmini { from { opacity: 0; transform: translateX(14px); } }
#gtip.gt-mini .gt-title { font-size: 15px; margin-bottom: 3px; }
#gtip.gt-mini .gt-body { font-size: 12.5px; line-height: 1.6; }
#gtip.gt-mini .gt-btns { margin-top: 6px; }
#gtip.gt-mini .gt-btns button { padding: 3px 9px; font-size: 12px; }
body.touch #gtip.gt-mini { right: auto; left: 50%; top: max(8px, env(safe-area-inset-top)); bottom: auto; transform: translateX(-50%); width: min(340px, calc(100vw / var(--uis, 1) - 120px)); }
body.phone.portrait #gtip.gt-mini { top: 96px; width: calc(100vw / var(--uis, 1) - 70px); left: 10px; transform: none; }

/* 쓰러짐: 제자리 부활을 못 하는 까닭 (ui.js died) */
#revive-here:disabled { opacity: 0.7; cursor: default; font-size: 13px; border-style: dashed !important; }

/* 대화 넘기기 글: 터치는 「누르기」 */
.dlg-next .touch-only { display: none; }
body.touch .dlg-next .touch-only { display: inline; } body.touch .dlg-next .pc-only { display: none; }

/* 퀘스트 추적: 한 글자만 다음 줄로 떨어지지 않게 */
#tracker .tq-t, #tracker .tq-h, #tracker .tq-n { word-break: keep-all; overflow-wrap: anywhere; }
/* 길잡이 책갈피: 넘치면 잘리지 않고 다음 줄로 */
#panel-help .help-tabs { flex-wrap: wrap; overflow: visible; row-gap: 3px; }
/* 실록 때(날짜) 글씨: 한지 위에서 읽히게 */
#chron-list .when { color: #5e4a2c; font-size: 12px; }
/* 명부: 「지우기」를 「입장」에서 떼어 놓는다 (잘못 누르지 않게) */
#char-list .acts { gap: 16px; }
#char-list .del { padding: 4px 6px; border-left: 1px dotted #a08a62 !important; margin-left: 2px; }
/* PC 첫걸음 띠: 메뉴 줄(#mini, 17vh 위 아이콘+이름)을 덮지 않게 그 위로 */
body.pc #coach { bottom: calc(17vh + 74px); }
/* 낮은 가로 휴대폰: 행낭은 위 메뉴 줄까지 덮고 화면 높이를 다 쓴다 (✕ 는 제목 줄에) · 제목·도움말을 촘촘히 */
body.phone.short #panel-inv { top: max(6px, env(safe-area-inset-top)) !important; max-height: calc(100vh - 12px); }
body.phone.short #panel-inv > h3 { font-size: 17px; padding-bottom: 2px; margin-bottom: 2px; }
body.phone.short #panel-inv .inv-help { font-size: 11px; line-height: 1.4; margin-top: 3px; }
body.phone.short #panel-inv .inv-foot { margin-top: 4px; }
/* 낮은 가로 휴대폰: 잠룡(C)·기술(K) 창도 화면 높이를 다 쓴다 (예전엔 위 52px 아래부터라 값 상자 한 줄 반만 보였다) */
body.phone.short #panel-stats, body.phone.short #panel-skills { top: max(6px, env(safe-area-inset-top)) !important; max-height: calc(100vh - 12px); }
body.uis.phone.short #hud #panel-inv, body.uis.phone.short #hud #panel-stats, body.uis.phone.short #hud #panel-skills { max-height: calc(100vh / var(--uis, 1) - 12px); }   /* UI 크기(zoom)를 걸었을 때도 (hudx.css 의 −64px 를 이긴다) */
body.phone.short #panel-stats .cs-tabs { margin-right: 40px; }   /* 구석 ✕ 자리를 비운다 */

/* 마우스 포인터 (PC) — public/ui/cur_*.png: 옻칠 바탕·놋쇠 테 화살촉 / 몹 위 환도 / 사람 위 붉은 「話」 / 물건 위 놋쇠 「拾」 낙관. 가리키는 끝 2,2.
   main.js curFor 가 #cv 의 data-cur 를 바꾼다 (가리킨 것이 바뀔 때만). 터치 기기(body.touch)는 손대지 않는다. 글 칸은 글 커서 그대로 */
body:not(.touch), body:not(.touch) *:not(input):not(textarea):not([contenteditable]) {
  cursor: url("../ui/cur_arrow.png") 2 2, default !important;
  cursor: -webkit-image-set(url("../ui/cur_arrow.png") 1x, url("../ui/cur_arrow@2x.png") 2x) 2 2, default !important;
  cursor: image-set(url("../ui/cur_arrow.png") 1x, url("../ui/cur_arrow@2x.png") 2x) 2 2, default !important;
}
body:not(.touch) #cv[data-cur="atk"] {
  cursor: url("../ui/cur_attack.png") 2 2, crosshair !important;
  cursor: -webkit-image-set(url("../ui/cur_attack.png") 1x, url("../ui/cur_attack@2x.png") 2x) 2 2, crosshair !important;
  cursor: image-set(url("../ui/cur_attack.png") 1x, url("../ui/cur_attack@2x.png") 2x) 2 2, crosshair !important;
}
body:not(.touch) #cv[data-cur="talk"] {
  cursor: url("../ui/cur_talk.png") 2 2, pointer !important;
  cursor: -webkit-image-set(url("../ui/cur_talk.png") 1x, url("../ui/cur_talk@2x.png") 2x) 2 2, pointer !important;
  cursor: image-set(url("../ui/cur_talk.png") 1x, url("../ui/cur_talk@2x.png") 2x) 2 2, pointer !important;
}
body:not(.touch) #cv[data-cur="pick"] {
  cursor: url("../ui/cur_pick.png") 2 2, pointer !important;
  cursor: -webkit-image-set(url("../ui/cur_pick.png") 1x, url("../ui/cur_pick@2x.png") 2x) 2 2, pointer !important;
  cursor: image-set(url("../ui/cur_pick.png") 1x, url("../ui/cur_pick@2x.png") 2x) 2 2, pointer !important;
}

/* 손님으로 바로 시작 (boot.js · server.js /api/auth/guest) — 구글 단추 아래, 한 단계 낮은 무게 */
#guest-area { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 300px; text-align: center; }
#guest-area .or { font-size: 12px; color: #b8a888; letter-spacing: .2em; }
#guestbtn { padding: 9px 22px; font-family: var(--title); font-size: 16px; letter-spacing: 1px; color: #f3e6c4; background: url("../ui/tex_bandaji.png") center / 200px, #4a2a16;
  border: 1px solid #c9a24f; box-shadow: inset 0 0 0 1px rgba(0,0,0,.5); cursor: pointer; }
#guestbtn:hover, #guestbtn:focus-visible { filter: brightness(1.15); outline: none; }
#guestbtn:disabled { filter: grayscale(.6) brightness(.8); }
#guest-area .note { color: #cdbd9a; line-height: 1.5; }
#guest-link { margin: 10px 0 4px; padding: 8px 10px; border: 1px dashed #8a6a3a; background: rgba(255,240,200,.35); }
#guest-link .note { margin: 0 0 6px; }
#guest-link .msg { min-height: 1.2em; margin: 4px 0 0; font-size: 13px; }

/* 추적 창 — 퀘스트가 많으면 휴대폰에서 아래로 길어져 조이스틱·허리띠까지 덮었다 (2026-10 사용자 스크린샷). story.js quests:
   휴대폰은 첫 줄만 펼치고 나머지는 「막 · 이름 n/m」 한 줄, 넷째부터는 「그 밖 N개」, 높이는 조이스틱 위까지 */
/* 휴대폰에서 넘칠 때: 손가락으로 끌어 올려 본다 (story.js fitTracker 가 높이와 .scr/.more 를 정한다) */
body.phone #tracker.scr, body.tablet #tracker.scr { pointer-events: auto !important; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: rgba(168,21,14,0.7) transparent; }
body.phone #tracker.scr::-webkit-scrollbar, body.tablet #tracker.scr::-webkit-scrollbar { width: 3px; }
body.phone #tracker.scr::-webkit-scrollbar-thumb, body.tablet #tracker.scr::-webkit-scrollbar-thumb { background: rgba(168,21,14,0.7); border-radius: 2px; }
body.phone #tracker.scr .trk-btn, body.tablet #tracker.scr .trk-btn { position: sticky; top: 0; z-index: 1; }
body.phone #tracker.more, body.tablet #tracker.more { -webkit-mask-image: linear-gradient(#000 calc(100% - 12px), transparent); mask-image: linear-gradient(#000 calc(100% - 12px), transparent); }

/* 첫 화면·명부 누르기: 먹물 한 방울 + 튀는 먹 점 (boot.js) — 어두운 수묵화 위에서도 보이게 가장자리에 옅은 금빛 고리 */
.ink-tap { position: fixed; z-index: 60; width: 84px; height: 84px; margin: -42px 0 0 -42px; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,10,6,0.55) 0 16%, rgba(16,10,6,0.2) 36%, rgba(16,10,6,0) 60%);
  box-shadow: inset 0 0 0 1px rgba(232,206,150,0.4), 0 0 14px rgba(232,206,150,0.15); animation: inkTap 0.7s cubic-bezier(.2,.7,.3,1) forwards; }
.ink-tap.seal { background: radial-gradient(circle, rgba(142,28,18,0.55) 0 14%, rgba(142,28,18,0.18) 34%, rgba(142,28,18,0) 58%); box-shadow: inset 0 0 0 1px rgba(232,206,150,0.5); }
.ink-tap i { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: rgba(16,10,6,0.6); animation: inkDot 0.6s ease-out forwards; }
.ink-tap.seal i { background: rgba(142,28,18,0.6); }
@keyframes inkTap { from { transform: scale(0.15); opacity: 0.95; } to { transform: scale(1.35); opacity: 0; } }
@keyframes inkDot { from { transform: translate(0, 0) scale(1); opacity: 0.9; } to { transform: translate(var(--dx), var(--dy)) scale(0.4); opacity: 0; } }
#title button:active, #chars button:active, #char-list li:active { transform: translateY(1px) scale(0.98); filter: brightness(0.94); }
