/* 천하 전장도(첫 화면). 먹·종이·인주 세 가지 색으로. 2026-11-06 */
:root {
  --ink: #1d1b17;
  --ink-2: #2a2721;
  --paper: #ebe2cc;
  --paper-2: #d9cdb0;
  --text: #efe7d4;
  --muted: #b3a88f;
  --line: #3e392f;
  --seal: #b8321f;
  --seal-soft: #8b7d63;
  --gold: #d6b26a;
  --river: #5d8aa3;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", serif;
  --han: "Noto Serif TC", "Noto Serif KR", "Songti TC", serif;
  --sans: "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--text); font: 15px/1.6 var(--sans); }
a { color: var(--gold); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.rm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rm-brand { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; }
.rm-brand .seal { font: 600 15px/1.05 var(--han); color: var(--seal); border: 1.5px solid var(--seal); padding: 4px 6px; text-align: center; }
.rm-brand strong { display: block; font: 600 17px var(--serif); }
.rm-brand small { color: var(--muted); font-size: 12px; }
.rm-nav { display: flex; gap: 14px; align-items: center; font-size: 14px; flex-wrap: wrap; }
.rm-nav .current { color: var(--gold); border-bottom: 1px solid var(--gold); }
.rm-nav a { color: var(--muted); text-decoration: none; }
.rm-nav a:hover { color: var(--text); }

.rm-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto auto; gap: 14px; padding: 14px max(16px, env(safe-area-inset-left, 0px)); }
.rm-map-wrap { position: relative; min-width: 0; border-radius: 6px; overflow: hidden; background: var(--paper); box-shadow: 0 0 0 1px #00000040, 0 12px 40px #00000059; aspect-ratio: 2400 / 2175; width: min(100%, calc((100vh - 220px) * 2400 / 2175)); justify-self: center; }
.rm-map { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; }
.rm-map:active { cursor: grabbing; }
.rm-zoom { position: absolute; right: 10px; top: 10px; display: grid; gap: 4px; }
.rm-zoom button { width: 34px; height: 34px; border: 1px solid #0003; border-radius: 4px; background: #f4ecd9e6; color: var(--ink); font: 600 16px var(--han); }
.rm-legend { position: absolute; left: 10px; bottom: 8px; margin: 0; padding: 4px 8px; background: #f4ecd9d9; color: var(--ink); font-size: 12px; border-radius: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lg-mark { width: 18px; height: 18px; display: inline-block; vertical-align: -4px; }
.lg-mark.dim { filter: saturate(.55) brightness(.8); }
.lg-city { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); display: inline-block; margin-left: 4px; }

/* 지도 표식(SVG) */
.city-dot { fill: #2a2620; }
.city-name { font: 600 30px var(--serif); fill: #2b2620; paint-order: stroke; stroke: #efe6cf; stroke-width: 7px; stroke-linejoin: round; }
.city-han { font: 500 19px var(--han); fill: #6f6350; paint-order: stroke; stroke: #efe6cf; stroke-width: 6px; }
.road { stroke: #8f7b58; stroke-width: 3; stroke-dasharray: 10 9; fill: none; opacity: .55; }
/* 전투 표시: 엇갈린 칼(인주색). 준비 중은 옅게 */
.mark { cursor: pointer; }
.mark-hit { fill: transparent; }
.mark-img { pointer-events: none; filter: drop-shadow(0 0 1.5px #f6efdf) drop-shadow(0 0 3px #f6efdfcc) drop-shadow(0 0 6px #f6efdf88); }
.mark:hover .mark-img, .mark.sel .mark-img { filter: drop-shadow(0 0 1.5px #f6efdf) drop-shadow(0 0 4px #f6efdf) drop-shadow(0 0 8px #f6efdf); }
.seal-img { filter: drop-shadow(0 2px 3px #0004); }
.mark .blade { fill: #8a2a1b; }
.mark .guard { fill: #2a1f18; }

.mark:not(.playable) .blade { fill: #6e3f2c; }
.mark.playable .blade { fill: var(--seal); }
.mark:hover, .mark:focus-visible, .mark.sel { opacity: 1; }
.mark:hover .blade, .mark.sel .blade { fill: var(--seal); }
.mark .mark-img { transition: transform .15s; transform-box: fill-box; transform-origin: center; }
.mark.sel .mark-img, .mark:hover .mark-img { transform: scale(1.3); }
.mark:focus, .mark:focus-visible { outline: none; }
.mark:focus-visible .mark-hit { stroke: var(--gold); stroke-width: 4; }
.pulse { fill: none; stroke: var(--seal); stroke-width: 3; opacity: .7; animation: pulse 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0% { transform: scale(.9); opacity: .8; } 100% { transform: scale(1.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; opacity: .4; } }
/* 직인: 마우스를 올리거나 고른 전투에만 */
.seal-box { fill: #f6efe0; stroke: #a8321f; stroke-width: 5; }
.seal-g.playable .seal-box { fill: #b8321f; stroke: #b8321f; }
.seal-ring { fill: none; stroke: #a8321f; stroke-width: 3; }
.seal-han { font: 800 36px var(--han); fill: #a8321f; }
.seal-g.playable .seal-han { fill: #fbeee0; }
.seal-stem { stroke: #8a2a1b; stroke-width: 2; opacity: .55; }
.seal-year { font: 700 32px var(--serif); fill: #2b2620; paint-order: stroke; stroke: #f3ead6; stroke-width: 9px; stroke-linejoin: round; }
.seal-g { animation: seal-in .16s ease-out; }
@keyframes seal-in { from { opacity: 0; transform-origin: center; } to { opacity: 1; } }

/* 오른쪽 전투 칸 */
.rm-panel { background: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; align-self: start; }
.card-art { margin: -14px -14px 0; aspect-ratio: 16 / 9; background: var(--paper-2); overflow: hidden; border-radius: 6px 6px 0 0; display: grid; place-items: center; }
.card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-art .placeholder { font: 600 64px var(--han); color: #8b7d6340; }
.card-kicker { font-size: 12px; letter-spacing: .06em; color: var(--muted); }
.card-title { display: flex; align-items: baseline; gap: 10px; margin: 0; font: 600 26px/1.25 var(--serif); }
.card-title .han { font: 500 18px var(--han); color: var(--muted); }
.card-sides { display: flex; flex-wrap: wrap; gap: 6px; }
.card-sides span { font-size: 12.5px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); }
.card-sides .vs { border: 0; color: var(--muted); padding: 3px 0; }
.card-stars { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 2px; align-items: baseline; }
.card-stars .stars { font-size: 17px; letter-spacing: .08em; color: var(--gold); }
.card-stars .stars i { font-style: normal; color: #8b7d6355; }
.card-stars .stars-label { font-size: 12px; color: var(--muted); }
.card-stars .stars-why { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.card-flavor { margin: 0; font: 15px/1.75 var(--serif); color: var(--text); }
.card-status { font-size: 13px; color: var(--muted); margin: 0; }
.card-go { display: block; text-align: center; padding: 12px; border-radius: 6px; background: var(--seal); color: #fff3e6; font: 700 17px var(--serif); text-decoration: none; letter-spacing: .12em; }
.card-go:hover { background: #cc3a25; }
.card-wait { display: block; text-align: center; padding: 12px; border-radius: 6px; border: 1px dashed var(--line); color: var(--muted); }

/* 연대 막대 */
.rm-time { grid-column: 1 / -1; overflow-x: auto; background: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px 14px; min-width: 0; }
.rm-time-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font: 600 14px var(--serif); }
.rm-time-head small { font: 12px var(--sans); color: var(--muted); }
.rm-timeline { position: relative; height: 140px; margin: 6px 24px 0; min-width: 820px; }
.tl-axis { position: absolute; left: 0; right: 0; top: 66px; height: 1px; background: var(--line); }
.tl-tick { position: absolute; top: 50px; font: 11px var(--sans); color: var(--muted); transform: translateX(-50%); }
.tl-item { position: absolute; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 0; color: var(--text); }
.tl-item .dot { width: 12px; height: 12px; border: 1.5px solid var(--seal-soft); background: var(--ink-2); }
.tl-item.playable .dot { background: var(--seal); border-color: var(--seal); }
.tl-item.sel .dot { outline: 2px solid var(--gold); outline-offset: 2px; }
.tl-item span { font: 12px var(--serif); white-space: nowrap; }
.tl-item.lane0 { top: 32px; flex-direction: column-reverse; }
.tl-item.lane2 { top: 0; flex-direction: column-reverse; }
.tl-item.lane1 { top: 72px; }
.tl-item.lane3 { top: 106px; }
.rm-foot { padding: 6px max(16px, env(safe-area-inset-left, 0px)) 18px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
.rm-foot p { margin: 6px 0; max-width: 90ch; }
.rm-foot .old a { color: var(--muted); }
.brandline { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.brandline img { height: 20px; display: block; }

@media (max-width: 900px) {
  .rm-main { grid-template-columns: minmax(0, 1fr); }
  .rm-map-wrap { width: 100%; }
  .city-name { font-size: 30px; }
}



/* 전투 칸: 나오는 장수 얼굴(AI 창작) */
.card-faces { display: flex; flex-wrap: wrap; gap: 8px 6px; }
.card-faces .cf { margin: 0; width: 52px; text-align: center; }
.card-faces img { display: block; width: 52px; height: 52px; object-fit: cover; object-position: center 30%; border-radius: 50%; border: 2px solid var(--line); background: var(--paper-2); }
.card-faces .f-shu img { border-color: #3f7a4f; }
.card-faces .f-wei img { border-color: #3d5f8a; }
.card-faces .f-wu img { border-color: #a3402c; }
.card-faces figcaption { font: 11.5px/1.3 var(--serif); color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 전투 칸: 이 전투만의 병종·병기(AI 창작 그림) */
.card-specials { display: flex; flex-wrap: wrap; gap: 6px; }
.card-specials .sp { margin: 0; width: 64px; text-align: center; }
.card-specials .sp-img { display: block; width: 64px; height: 64px; border-radius: 6px; background-color: #3b4636; background-repeat: no-repeat; border: 1px solid var(--line); }
.card-specials .sp-img.overlay { background-color: #2b2a26; }
.card-specials figcaption { font: 11.5px/1.3 var(--serif); color: var(--muted); margin-top: 3px; white-space: nowrap; }
