/* 의천 - 무협 UI 테마 (style.css 위에 덮는다)
   흑칠(검은 옻칠) 판 + 금테(모서리 회문) + 선지 결 + 주홍 낙관 단추. 장식은 모두 인라인 SVG라 따로 받을 파일이 없다.
   한자 제목은 붓글씨체 Ma Shan Zheng(Google Fonts, OFL), 한글은 기존 Song Myung·Gowun Batang. */
:root {
  --lac: #17110d;
  --lac-2: #221a14;
  --lac-3: #2f241b;
  --gold: #c9a23a;
  --gold-2: #f2d27a;
  --gold-dim: rgba(201, 162, 58, .42);
  --txt: #efe6d2;
  --txt-2: #cfc3aa;
  --txt-3: #978a72;
  --brush: 'Ma Shan Zheng', 'Song Myung', serif;
  /* 금테: 바깥 굵은 선 + 안쪽 가는 선 + 모서리 회문(回紋) 꺾쇠와 금 점 */
  --frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%23c9a23a'%3E%3Cpath stroke-width='1.4' d='M1 15V1h14M33 1h14v14M47 33v14H33M15 47H1V33'/%3E%3Cpath stroke-width='1' d='M5 11V5h6M37 5h6v6M43 37v6h-6M11 43H5v-6'/%3E%3Cpath stroke-width='.7' opacity='.55' d='M15 2.6h18M15 45.4h18M2.6 15v18M45.4 15v18'/%3E%3C/g%3E%3Cg fill='%23e8c76a'%3E%3Crect x='7.6' y='7.6' width='2.8' height='2.8'/%3E%3Crect x='37.6' y='7.6' width='2.8' height='2.8'/%3E%3Crect x='37.6' y='37.6' width='2.8' height='2.8'/%3E%3Crect x='7.6' y='37.6' width='2.8' height='2.8'/%3E%3C/g%3E%3C/svg%3E");
  /* 선지 결: 미세한 잡티 */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .92 0 0 0 0 .75 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* 상서로운 구름(祥雲) */
  --cloud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cg fill='none' stroke='%23c9a23a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M8 46c0-10 12-14 19-7 1-12 19-15 25-4 8-9 24-5 23 8 9-2 15 7 10 13'/%3E%3Cpath d='M27 39c-4-1-6 3-4 6s7 2 7-2'/%3E%3Cpath d='M52 35c-5 0-7 6-3 8s8-1 6-5'/%3E%3Cpath d='M75 43c-4 0-5 5-2 7s7 0 6-4'/%3E%3Cpath d='M92 30c6-8 18-6 20 2 4-2 8 1 7 5'/%3E%3C/g%3E%3C/svg%3E");
}

/* ── 단추: 흑칠 판에 금선, 주요 단추는 주홍 낙관, 고른 것은 금빛 ── */
button {
  background: linear-gradient(#3a2d22, #251c15); color: var(--txt);
  border: 1px solid var(--gold-dim); border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 235, 190, .08), 0 1px 2px rgba(0, 0, 0, .35);
}
button:hover:not(:disabled) { background: linear-gradient(#4a3a2b, #30251c); border-color: #e0bd62; box-shadow: 0 0 0 1px rgba(224, 189, 98, .22), inset 0 1px 0 rgba(255, 235, 190, .14); }
button.primary { background: linear-gradient(#e2bf62, #a7802e); color: #1d140c; border-color: var(--gold-2); text-shadow: 0 1px 0 rgba(255, 240, 200, .4); }
button.primary:hover:not(:disabled) { background: linear-gradient(#f0d07a, #b88f38); }
button.seal { background: linear-gradient(#bd3a2c, #7c1911); color: #fff4e6; border-color: #d9a456; box-shadow: inset 0 0 0 1px rgba(255, 214, 150, .28), 0 2px 6px rgba(0, 0, 0, .4); letter-spacing: 1px; }
button.seal:hover:not(:disabled) { background: linear-gradient(#d04636, #8c1f15); }
button.ghost { background: transparent; box-shadow: none; }
input[type=text], textarea { background: rgba(0, 0, 0, .35) !important; color: var(--txt) !important; border: 1px solid var(--gold-dim) !important; border-radius: 3px; }
kbd { border-color: var(--gold-dim); background: rgba(201, 162, 58, .14); color: var(--gold-2); }

/* ── 금테를 씌우는 판들 ── */
.dialog, .talk { position: relative; border: 12px solid transparent !important; border-image: var(--frame) 15 / 12px stretch !important; }
/* HUD 판은 이미 화면 구석에 absolute로 붙어 있으므로 위치는 건드리지 않고 덧그림으로 테를 씌운다 */
.hud-quest::after, .hud-where::after, .hud-me::after, .hud-log::after, .cb.cbov .cb-top::after, .cb.cbov .cb-dock::after {
  content: ''; position: absolute; inset: -1px; pointer-events: none;
  border: 10px solid transparent; border-image: var(--frame) 15 / 10px stretch;
}
.cb.cbov .cb-top, .cb.cbov .cb-dock { position: relative; }

/* ── 창: 흑칠 바탕. 안쪽 색 변수를 바꿔 목록·행낭·장경각 등을 한꺼번에 어둡게 ── */
.overlay { background: rgba(8, 6, 4, .58); backdrop-filter: blur(2px); }
.dialog {
  --paper: var(--lac); --paper-2: rgba(255, 255, 255, .08); --paper-3: rgba(255, 255, 255, .035);
  --ink: var(--txt); --ink-2: var(--txt-2); --ink-3: var(--txt-3); --line: rgba(201, 162, 58, .24);
  --jade: #5fb08a; --gold: #d9b45a; --hp: #e0614c;
  color: var(--txt); border-radius: 3px; padding: 14px 20px;
  background: var(--grain), radial-gradient(ellipse at 50% -10%, rgba(201, 162, 58, .14), transparent 55%), linear-gradient(#231a14, #15100c);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65), 0 0 0 1px rgba(0, 0, 0, .7);
  scrollbar-width: thin; scrollbar-color: var(--gold-dim) transparent;
}
.dialog::before { content: ''; position: absolute; top: 2px; right: 40px; width: 110px; height: 55px; background: var(--cloud) center / contain no-repeat; opacity: .22; pointer-events: none; }
.dialog-head { position: relative; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--gold) 15%, var(--gold) 85%, transparent) 1; }
.dialog h2 { color: var(--gold-2); letter-spacing: 3px; display: flex; align-items: center; gap: 10px; }
.dialog h2::before { content: '倚'; display: inline-grid; place-items: center; width: 26px; height: 26px; font: 17px/1 var(--brush); color: #ffe9d6;
  background: linear-gradient(#b8352a, #7c1911); border-radius: 3px; box-shadow: inset 0 0 0 1.5px rgba(255, 220, 170, .5); transform: rotate(-4deg); }
.close-x { color: var(--gold-2) !important; background: none !important; border: 0 !important; box-shadow: none !important; font-size: 24px; }
.close-x:hover { color: #fff !important; }
.group-title { color: var(--gold-2); letter-spacing: 2px; display: flex; align-items: center; gap: 8px; }
.group-title::before { content: '◆'; font-size: 9px; color: var(--gold); }
.group-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-dim), transparent); }
.dialog .item { background: linear-gradient(90deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015)); border-color: var(--line); border-radius: 3px; }
.dialog .item:hover { border-color: rgba(201, 162, 58, .5); }
.dialog .item.on { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold), 0 0 12px rgba(201, 162, 58, .12); }
.dialog .item .nm { color: #fff6e4; }
.tag { background: rgba(201, 162, 58, .16); color: var(--gold-2); border: 1px solid var(--gold-dim); }
.bar, .bar-row .bar { background: rgba(0, 0, 0, .45); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6); }
.bar.mas i { background: linear-gradient(90deg, #8a6a24, #e2bf62); }
.next-open { color: #8fe0a8; }
.sv-code { background: rgba(0, 0, 0, .35) !important; color: var(--txt) !important; }
.inv-grid { background: rgba(0, 0, 0, .4); }
.inv-cell { background: linear-gradient(#3a3026, #241d16); border-color: #4a3e30; }
.dialog::-webkit-scrollbar { width: 8px; }
.dialog::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }

/* ── 필드 HUD ── */
.hud-quest, .hud-where, .hud-me, .hud-log, .hud-menu {
  background: var(--grain), linear-gradient(rgba(34, 26, 20, .9), rgba(20, 15, 11, .88)); border: 0; border-radius: 3px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .5);
}
.hud-quest, .hud-log { padding: 14px 16px; }
.q-head { font-family: var(--display); color: var(--gold-2); letter-spacing: 3px; display: flex; align-items: center; gap: 6px; }
.q-head::before { content: '◆'; font-size: 9px; color: var(--gold); }
.q-row { border-top-color: rgba(201, 162, 58, .14); }
.hud-where { padding: 10px 12px; }
.hud-where b { color: var(--gold-2); letter-spacing: 2px; }
.hud-me { padding: 12px 16px; }
.me-name { color: #fff6e4; }
.me-port canvas.portrait { border-radius: 50%; border: 2px solid var(--gold); box-shadow: 0 0 0 3px rgba(0, 0, 0, .5), 0 0 0 4px var(--gold-dim); }
.hbar { height: 15px; border: 1px solid rgba(201, 162, 58, .5); background: #0e0a07; border-radius: 8px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8); }
.hbar i { border-radius: 8px; }
.hbar i::after { content: ''; position: absolute; left: 3px; right: 3px; top: 1px; height: 40%; border-radius: 8px; background: rgba(255, 255, 255, .2); }
.hbar.hp i { background: linear-gradient(#e46a52, #8a1e16); }
.hbar.qi i { background: linear-gradient(#6aa8e2, #22507e); }
.hbar.ins { height: 6px; }
.hbar.ins i { background: linear-gradient(90deg, #8a6a24, #f2d27a); }
/* 메뉴: 옥 메달 */
.hud-menu { padding: 10px; gap: 6px; grid-template-columns: repeat(3, 58px); background: none; box-shadow: none; }
.hud-menu button {
  height: 58px; width: 58px; border-radius: 50%; padding: 0;
  background: radial-gradient(circle at 50% 30%, #4d6a5c, #22322b 62%, #141d19); border: 1.5px solid var(--gold);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .35), inset 0 0 0 4px rgba(201, 162, 58, .35), 0 3px 8px rgba(0, 0, 0, .5);
}
.hud-menu button:hover:not(:disabled) { background: radial-gradient(circle at 50% 30%, #6a8e7c, #2e443a 62%, #18231e); border-color: var(--gold-2); }
.hud-menu b { font-family: var(--brush); font-size: 25px; color: var(--gold-2); text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.hud-menu span { font-size: 10px; color: var(--txt-2); margin-top: -2px; }
.hud-menu kbd { right: -2px; top: -2px; background: var(--lac); border-radius: 8px; }
#minimap { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .55)) drop-shadow(0 0 0 var(--gold)); }
#prompt { background: var(--grain), linear-gradient(#2a2018, #17110c); border: 1px solid var(--gold); border-radius: 3px; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
#zoneTitle .zh { font-family: var(--brush); font-size: 72px; letter-spacing: 14px; color: #fffaf0; }
#toast { background: var(--grain), linear-gradient(#2a2018, #15100c); color: var(--txt); border: 1px solid var(--gold); border-radius: 3px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); padding: 11px 22px; }
.mini-seal { font-family: var(--brush); }

/* ── 캐릭터 생성 ── */
.cr-title h1 { font-family: var(--brush); font-size: 88px; letter-spacing: 16px; color: #f6eedc; text-shadow: 0 6px 24px rgba(0, 0, 0, .7); }
.cr-panel { background: var(--grain), linear-gradient(#211913, #120d0a); box-shadow: -10px 0 40px rgba(0, 0, 0, .45); border-left: 1px solid var(--gold-dim); }
.cr-tab.on { color: var(--gold-2); box-shadow: inset 0 -2px 0 var(--gold); }

/* ── 대화창 ── */
.talk { border-radius: 3px; background: var(--grain), linear-gradient(#241b14, #15100c); box-shadow: 0 16px 50px rgba(0, 0, 0, .65); }
.talk-port { background: radial-gradient(ellipse at 50% 75%, #4a3c2c, #1a140f 75%); border-right: 1px solid var(--gold-dim); }
.talk-name b { color: var(--gold-2); letter-spacing: 2px; }
.talk-bubble { background: var(--grain), #f3ead6; border: 1px solid #c9b48a; border-radius: 3px; box-shadow: inset 0 0 18px rgba(150, 120, 70, .18); }
.talk-opt { background: linear-gradient(#30251c, #1e1712); border-color: var(--gold-dim); border-radius: 3px; }
.talk-opt.sect { background: linear-gradient(#5a2018, #2e100c); border-color: var(--gold); }

/* ── 천하 지도 ── */
.mp-map { border: 1px solid var(--gold); box-shadow: 0 0 0 4px rgba(0, 0, 0, .5), 0 0 0 5px var(--gold-dim), inset 0 0 40px rgba(0, 0, 0, .4); }
.mp-pin b { font-family: var(--display); }

/* ── 전투 HUD ── */
.cb.cbov .cb-top, .cb.cbov .cb-dock { background: var(--grain), linear-gradient(rgba(34, 26, 20, .92), rgba(18, 14, 10, .9)); border: 0; border-radius: 3px; padding: 10px 14px; }
.cb-title { font-family: var(--brush); font-size: 30px; color: var(--gold-2); }
.cb-bar { height: 15px; border: 1px solid rgba(201, 162, 58, .45); background: #0e0a07; border-radius: 8px; }
.cb-bar i { background: linear-gradient(#e46a52, #8a1e16); border-radius: 8px; }
.cb-bar.qi i { background: linear-gradient(#6aa8e2, #22507e); }
.cb-slot { background: var(--grain), linear-gradient(#30251c, #1a140f) !important; color: var(--txt) !important; border: 1px solid var(--gold-dim) !important; border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4); }
.cb-slot:hover:not(:disabled) { border-color: var(--gold-2) !important; }
.cb-slot small, .cb-key { color: var(--txt-3) !important; }
.cb-slot b { color: #fff3dc; }
.cb-cd { background: rgba(0, 0, 0, .62); }
.cb-auto { background: #5a5048; }
.cb-slot.on .cb-auto { background: var(--seal); }
.cb-big { font-family: var(--brush); font-size: 150px; }
.cb-over { background: rgba(10, 8, 6, .62); }
.cb-btns button { color: var(--txt); }
.cb-btns button.primary { color: #1d140c; }
.cb.cbov .cb-top:not(.boss) .cb-foes { display: none; }   /* 잡병 싸움에서는 적 목록이 자리만 차지한다 */
.inv-gslot { background: rgba(255, 255, 255, .04); border-color: var(--line); }
.inv-gslot > span { background: var(--gold); color: #1d140c; }
.mp-side, .inv-detail { background: rgba(255, 255, 255, .035); border-color: var(--line); }

/* 무공 고유 옵션 등급: 범·정·극 */
.tag.opt { font-size: 11px; margin-left: 4px; }
.tag.opt.g1 { color: #8fd0ff; border-color: #4f86a8; background: rgba(79, 134, 168, .18); }
.tag.opt.g2 { color: #ffb36a; border-color: #c8742a; background: rgba(200, 116, 42, .2); }

/* 첫 화면: 메인 그림 · 달 위의 제목 · 흐르는 안개와 꽃잎 */
.ttl { position: fixed; inset: 0; overflow: hidden; background: #15141c; cursor: pointer; user-select: none; }
.ttl-bg, .ttl-ov { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ttl-bg { animation: ttl-zoom 40s ease-in-out infinite alternate; }
@keyframes ttl-zoom { from { transform: scale(1); } to { transform: scale(1.06) translateX(-1%); } }
.ttl-h { font-family: 'Ma Shan Zheng', serif; font-size: 150px; fill: #1a1012; text-anchor: middle; opacity: 0; animation: ttl-ink 2.4s ease-out .3s forwards; }
.ttl-h + .ttl-h { animation-delay: .9s; }
.ttl-seal { font-family: 'Ma Shan Zheng', serif; font-size: 40px; fill: #f6e7c8; text-anchor: middle; }
@keyframes ttl-ink { from { opacity: 0; filter: blur(6px); } to { opacity: .92; filter: blur(0); } }
.ttl-mist { position: absolute; left: -50%; right: -50%; bottom: 8%; height: 34%; pointer-events: none;
  background: radial-gradient(ellipse at 30% 60%, rgba(240, 214, 170, .28), transparent 60%), radial-gradient(ellipse at 75% 50%, rgba(240, 214, 170, .22), transparent 55%);
  filter: blur(18px); animation: ttl-mist 26s linear infinite alternate; }
@keyframes ttl-mist { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
.ttl-petals i { position: absolute; top: -4%; width: 9px; height: 5px; border-radius: 50%; background: #c8452f; opacity: .8; animation: ttl-fall linear infinite; }
@keyframes ttl-fall { from { transform: translate(0, 0) rotate(0); } to { transform: translate(18vw, 108vh) rotate(720deg); } }
.ttl-foot { position: absolute; left: 0; right: 0; bottom: 7%; text-align: center; color: #f4ecda; pointer-events: none; text-shadow: 0 2px 12px rgba(0, 0, 0, .7); }
.ttl-foot h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 34px; letter-spacing: 18px; color: #f2d27a; }
.ttl-foot p { margin: 6px 0 26px; font-size: 15px; color: #d9cdb4; letter-spacing: 3px; }
.ttl-press { font-family: var(--display); font-size: 20px; letter-spacing: 6px; color: #fff4dc; animation: ttl-blink 2.2s ease-in-out infinite; }
@keyframes ttl-blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.ttl-btns { position: absolute; right: 28px; bottom: 26px; display: flex; gap: 8px; }
.ttl-btns button { background: rgba(18, 16, 13, .72); color: #efe7d6; border: 1px solid rgba(201, 162, 58, .55); padding: 9px 18px; }
.ttl-btns button:hover { background: rgba(201, 162, 58, .25); }
@media (max-width: 700px) { .ttl-foot h1 { font-size: 24px; letter-spacing: 10px; } .ttl-btns { left: 16px; right: 16px; justify-content: center; bottom: 14px; } .ttl-foot { bottom: 14%; } }
/* 메인 그림(title.jpg)에는 제목이 그려져 있다: 덧씌운 제목은 기본 그림(.svg)일 때만, 아래는 글씨가 보이게 어둡게 */
.ttl-ov { display: none; }
.ttl.svg .ttl-ov { display: block; }
.ttl:not(.svg) .ttl-foot h1 { display: none; }
.ttl:not(.svg)::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; pointer-events: none; background: linear-gradient(to bottom, transparent, rgba(8, 8, 12, .72)); }
.ttl-foot, .ttl-btns { z-index: 1; }
.ttl:not(.svg) .ttl-mist { opacity: .45; }

/* ── 모바일: 터치 조이스틱 · 살피기 버튼 ── */
html, body { background: #0e0d12; }   /* 아이폰 가로의 노치 옆 여백이 밝게 비치지 않게 */
body { touch-action: manipulation; }
#joy { position: fixed; left: calc(16px + env(safe-area-inset-left)); bottom: 16px; width: 120px; height: 120px; border-radius: 50%; z-index: 15; touch-action: none;
  background: radial-gradient(circle, rgba(30, 24, 18, .2), rgba(30, 24, 18, .55)); border: 2px solid rgba(201, 162, 58, .55); box-shadow: inset 0 0 18px rgba(0, 0, 0, .5); opacity: .7; }
#joy.hold { opacity: 1; }
#joy i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 40% 35%, #6a8e7c, #2e443a 65%, #18231e); border: 2px solid var(--gold-2); box-shadow: 0 3px 8px rgba(0, 0, 0, .5); }
#joyAct { position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: 16px; width: 64px; height: 64px; border-radius: 50%; z-index: 15; padding: 0; touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--gold-2);
  background: radial-gradient(circle at 50% 30%, #4d6a5c, #22322b 62%, #141d19); border: 1.5px solid var(--gold); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .35), 0 3px 8px rgba(0, 0, 0, .5); }
#joyAct b { font-family: var(--brush); font-weight: 400; font-size: 24px; line-height: 1; }
#joyAct span { font-size: 10px; color: var(--txt-2); }
body.touch #hud kbd, body.touch .hud-menu kbd { display: none; }
body.touch .me-quick [data-act=interact] { display: none; }   /* 터치 기기는 오른쪽 아래 살피기 버튼을 쓴다 */

/* ── 모바일 세로 ── */
@media (max-width: 600px) {
  .ttl-bg { object-position: 55% center; }
  .hud-quest { left: 8px; top: 8px; width: calc((100vw - 128px) / .84); max-height: calc(24vh / .84); overflow-y: auto; padding: 8px 10px; font-size: 11px;
    transform: scale(.84); transform-origin: top left; }
  #minimap { top: 8px; right: 8px; width: 104px; height: 104px; }
  .hud-where { top: 118px; right: 8px; bottom: auto; width: 104px; padding: 6px; font-size: 10px; }
  .hud-where b { font-size: 14px; }
  .hud-where .where-btns button { font-size: 10px; padding: 3px 4px; }
  .hud-menu { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); padding: 0; gap: 4px; grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .hud-menu button { width: 100%; height: auto; aspect-ratio: 1; }
  .hud-menu b { font-size: 17px; }
  .hud-menu span { display: none; }
  .hud-me { bottom: calc(52px + env(safe-area-inset-bottom)); width: calc((100vw - 16px) / .86); padding: 6px 10px; gap: 8px;
    transform: translateX(-50%) scale(.86); transform-origin: bottom center; }
  .me-port canvas.portrait { width: 46px; height: 46px; }
  #prompt { bottom: 330px; }
  .cr-title h1 { font-size: 44px; letter-spacing: 8px; }
}

/* ── 모바일 가로 (낮은 화면): 위 칸들은 비율대로 줄이고, 메뉴는 아래 한 줄 ── */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --hs: .74; --sl: max(8px, env(safe-area-inset-left)); --sr: max(8px, env(safe-area-inset-right)); }
  .hud-quest { left: var(--sl); top: 6px; width: 300px; max-height: calc((100vh - 70px) / var(--hs)); overflow-y: auto; padding: 8px 10px; font-size: 12px;
    transform: scale(var(--hs)); transform-origin: top left; }
  #minimap { top: 6px; right: var(--sr); width: 84px; height: 84px; }
  .hud-where { top: 96px; right: var(--sr); bottom: auto; width: 130px; padding: 5px 6px; font-size: 11px; transform: scale(var(--hs)); transform-origin: top right; }
  .hud-where b { font-size: 15px; }
  .hud-where .where-btns button { font-size: 11px; padding: 3px 4px; }
  .hud-me { top: 6px; bottom: auto; left: calc(var(--sl) + 300px * var(--hs) + 8px); transform: scale(var(--hs)); transform-origin: top left;
    width: min(420px, calc((100vw - 300px * var(--hs) - 130px) / var(--hs))); padding: 6px 10px; gap: 8px; }
  .me-port canvas.portrait { width: 44px; height: 44px; }
  .hud-menu { left: auto; right: var(--sr); bottom: 6px; padding: 0; gap: 3px; grid-template-columns: repeat(9, 34px); }
  .hud-menu button { width: 34px; height: 34px; }
  .hud-menu b { font-size: 15px; }
  .hud-menu span { display: none; }
  #prompt { bottom: 48px; }
  #joy { left: calc(var(--sl) + 8px); bottom: 10px; width: 100px; height: 100px; }
  #joy i { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  #joyAct { right: calc(var(--sr) + 9 * 34px + 8 * 3px + 12px); width: 48px; height: 48px; }
  #joyAct b { font-size: 20px; }
  .cr { grid-template-columns: minmax(0, 1fr) 56%; grid-template-rows: none; }
  .cr-panel { border-top: 0; border-left: 1px solid var(--gold-dim); }
  .cr-title { left: 14px; top: 10px; }
  .cr-title h1 { font-size: 36px; letter-spacing: 6px; }
  .cr-title p, .cr-tip, .cr-sum { display: none; }
  .cr-tab { padding: 8px 0; font-size: 16px; }
  .cr-body { padding: 2px 14px 10px; }
  .cr-foot { padding: 8px 12px; }
  .cr-foot button { font-size: 14px; padding: 6px 12px; }
  .ttl-foot { bottom: 4%; }
  .ttl-foot p { margin-bottom: 10px; }
}
@media (max-height: 380px) and (orientation: landscape) { :root { --hs: .62; } }

/* ── 모바일 전투: 위·아래 칸을 줄여 싸움터를 넓게 ── */
@media (max-width: 600px), (max-height: 500px) and (orientation: landscape) {
  .cb.cbov .cb-top, .cb.cbov .cb-dock { zoom: .7; }
  .cb-big { font-size: 80px; }
}
.ttl-tip { font-size: 12px !important; color: #e8d8b8 !important; margin: 8px 0 0 !important; letter-spacing: 1px !important; }

/* 지금 할 일 접기 */
.hud-quest .q-head { cursor: default; }
.hud-quest .q-fold { margin-left: auto; width: 26px; height: 22px; padding: 0; line-height: 20px; font-size: 13px; border-radius: 4px; color: var(--gold-2) !important; }
.hud-quest .q-count { font-family: var(--body); font-size: 11px; letter-spacing: 0; color: var(--txt-2); background: rgba(201, 162, 58, .2); border-radius: 8px; padding: 0 6px; }
.hud-quest.fold { width: auto !important; max-height: none !important; overflow: visible !important; padding-top: 8px; padding-bottom: 8px; }
.hud-quest.fold .q-head { margin-bottom: 0; }
body.touch .hud-quest .q-fold { width: 34px; height: 28px; font-size: 15px; }

/* 천하 지도의 명소·비경 표식과 내 거처 */
.mp-mark { position: absolute; transform: translate(-50%, -50%); width: 14px; height: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font: 10px/1 'Ma Shan Zheng', serif; color: #f2d27a; background: rgba(31, 26, 20, .78); border: 1px solid rgba(232, 200, 106, .7); pointer-events: auto; cursor: default; z-index: 0; }
.mp-mark.dungeon { width: 18px; height: 18px; font-size: 13px; color: #1f1a14; background: #c9962a; border-color: #fff3c8; }
.mp-home { position: absolute; left: calc(50% + 8px); top: -12px; font: normal 12px/18px 'Ma Shan Zheng', serif; width: 18px; height: 18px; border-radius: 50%; background: #c9962a; color: #1f1a14; border: 1px solid #fff3c8; }
.mp-keys { font-family: 'Ma Shan Zheng', var(--body); letter-spacing: .5px; }
