/* =========================================================
   보스 202X — UI 스킨 v2 (제공 프레임 스프라이트 9분할 적용)
   어두운 도시 범죄극 · 금색 포인트 · 적색 위험 · 청색 선택
   ========================================================= */
:root {
  --bg: #080f14; --bg2: #0d141b; --panel: #111820; --panel2: #1a2330; --panel3: #222d3b;
  --line: #2a3542; --gold: #d4a63a; --gold2: #f0cf6b; --gold-dim: #8a6d2a;
  --text: #e6e2d8; --muted: #8b939e; --blue: #3a7bd5; --blue2: #5b9cf0; --green: #2ecc71; --orange: #e67e22; --red: #c0392b; --red2: #e74c3c;
  --font: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --serif: "Noto Serif KR", "Nanum Myeongjo", "Batang", "바탕", Georgia, serif;
  --f-panel: url(../assets/panels/panel_tall.png);
  --f-thin: url(../assets/buttons/btn_dark.png);
  --f-gold: url(../assets/buttons/btn_gold.png);
  --f-red: url(../assets/buttons/btn_red.png);
  --f-grey: url(../assets/buttons/btn_grey.png);
  --f-title: url(../assets/panels/titlebar.png);
  --f-divider: url(../assets/panels/divider4.png);
  --noise: none; --skyline: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: #000; color: var(--text); font-family: var(--font); font-size: 14px; overflow: hidden; }
body { user-select: none; }
img { -webkit-user-drag: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #0b1118; border-left: 1px solid #1a2330; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #4a3b1c, #2c2412); border: 1px solid #6b5422; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #8a6d2a, #5a4416); }

/* ---------- 9분할 프레임 믹스인 ---------- */
.fr-panel { border: 12px solid transparent; border-image: var(--f-panel) 24 fill / 12px stretch; }
.fr-thin { border: 7px solid transparent; border-image: var(--f-thin) 16 fill / 7px stretch; }

#app { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; background: #060a0f var(--noise); display: flex; flex-direction: column; overflow: hidden; }
#app::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 20%, rgba(40,60,85,.25), transparent 60%), radial-gradient(ellipse at 50% 100%, rgba(0,0,0,.6), transparent 60%); pointer-events: none; }
#app.menu-mode #top, #app.menu-mode #nav, #app.menu-mode #detail, #app.menu-mode #actions { display: none; }
#app.full-mode #nav, #app.full-mode #detail { display: none; }

/* ---------- 상단 정보 바 ---------- */
#top { position: relative; z-index: 2; height: 68px; flex: none; display: flex; align-items: center; padding: 0 12px; gap: 14px; margin: 4px 6px 0; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; }
#top .logo { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: 21px; color: var(--gold2); letter-spacing: 2px; margin-right: 8px; text-shadow: 0 0 14px rgba(212,166,58,.45), 0 2px 0 #3d2c08; }
#top .logo img { width: 34px; height: 34px; filter: drop-shadow(0 0 6px rgba(212,166,58,.5)); }
#top .stat { display: flex; align-items: center; gap: 8px; padding: 2px 10px; height: 40px; min-width: 128px; border: 6px solid transparent; border-image: var(--f-thin) 16 fill / 6px stretch; }
#top .stat img { width: 24px; height: 24px; filter: drop-shadow(0 1px 2px #000); }
#top .stat .lbl { font-size: 10.5px; color: var(--muted); display: block; letter-spacing: 1px; }
#top .stat .val { font-size: 14.5px; font-weight: 700; color: var(--text); white-space: nowrap; text-shadow: 0 1px 2px #000; }
#top .stat .val.gold { color: var(--gold2); } #top .stat .val.pos { color: var(--green); } #top .stat .val.neg { color: var(--red2); }
#top .spacer { flex: 1; }
#top .quick { display: flex; gap: 6px; }

/* ---------- 본문 3단 ---------- */
#body { flex: 1; display: flex; min-height: 0; position: relative; z-index: 1; }
#nav { width: 236px; flex: none; margin: 4px 0 4px 6px; padding: 8px 6px; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; display: flex; flex-direction: column; gap: 3px; }
#nav .navbtn { display: flex; align-items: center; gap: 10px; padding: 9px 12px; height: 44px; border: 6px solid transparent; border-image: var(--f-thin) 16 fill / 6px stretch; color: var(--muted); cursor: pointer; font-size: 14px; transition: color .12s, filter .12s; background: transparent; width: 100%; text-align: left; opacity: .85; }
#nav .navbtn img { width: 26px; height: 26px; opacity: .8; filter: drop-shadow(0 1px 2px #000); }
#nav .navbtn .key { margin-left: auto; font-size: 11px; color: #5b6675; font-family: var(--serif); }
#nav .navbtn:hover { color: var(--text); opacity: 1; filter: brightness(1.25); }
#nav .navbtn.active { border-image: var(--f-gold) 24 fill / 8px stretch; border-width: 8px; color: var(--gold2); opacity: 1; text-shadow: 0 0 8px rgba(240,207,107,.4); }
#nav .navbtn.active img { opacity: 1; }
#nav .navsep { height: 10px; margin: 6px 4px; background: var(--f-divider) center / auto 8px no-repeat; opacity: .8; }
#nav .navfoot { margin-top: auto; font-size: 11px; color: #5b6675; text-align: center; padding: 8px; line-height: 1.5; }
#main { flex: 1; min-width: 0; padding: 14px 16px; overflow: auto; position: relative; }
#main.fade { animation: screenin .22s ease-out; }
@keyframes screenin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#detail { width: 344px; flex: none; margin: 4px 6px 4px 0; padding: 10px 8px; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; overflow: auto; }

/* ---------- 하단 액션 바 ---------- */
#actions { position: relative; z-index: 2; height: 76px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; margin: 0 6px 4px; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; }
#actions .spacer { flex: 1; }
#actions .hint { color: var(--muted); font-size: 12px; }

/* ---------- 패널 ---------- */
.panel { position: relative; padding: 12px 14px; border: 8px solid transparent; border-image: var(--f-thin) 16 fill / 8px stretch; }
.panel.gold { border: 12px solid transparent; border-image: var(--f-panel) 24 fill / 12px stretch; padding: 10px 12px; }
.ptitle { font-family: var(--serif); font-size: 15px; font-weight: 700; color: var(--gold2); letter-spacing: 1px; margin: 0 0 12px; padding-bottom: 10px; display: flex; align-items: center; gap: 8px; text-shadow: 0 1px 0 #000, 0 0 10px rgba(212,166,58,.25); background: var(--f-divider) center bottom / auto 8px no-repeat; }
.ptitle img { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px #000); }
.ptitle .right { margin-left: auto; font-family: var(--font); font-size: 12px; color: var(--muted); font-weight: 400; text-shadow: none; }
.sub { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.gold { color: var(--gold2); } .pos { color: var(--green); } .neg { color: var(--red2); } .warn { color: var(--orange); } .blue { color: var(--blue2); }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.flex1 { flex: 1; min-width: 0; }
h1.screen { font-family: var(--serif); font-size: 23px; color: var(--gold2); margin: 0 0 14px; letter-spacing: 3px; display: flex; align-items: center; gap: 12px; text-shadow: 0 0 16px rgba(212,166,58,.35), 0 2px 0 #3d2c08; padding-bottom: 8px; background: var(--f-divider) left bottom / auto 8px no-repeat; }
h1.screen .sub { font-family: var(--font); letter-spacing: 0; font-size: 12px; text-shadow: none; }

/* ---------- 버튼 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 14px; border: 12px solid transparent; border-image: var(--f-gold) 24 fill / 12px stretch; color: var(--text); font-size: 14px; cursor: pointer; transition: filter .12s, transform .08s; white-space: nowrap; background: transparent; text-shadow: 0 1px 2px #000; line-height: 1; }
.btn img { width: 20px; height: 20px; filter: drop-shadow(0 1px 2px #000); }
.btn:hover { filter: brightness(1.3) saturate(1.1); color: #fff; }
.btn:active { transform: translateY(1px); filter: brightness(.9); }
.btn.primary { color: var(--gold2); font-weight: 700; filter: brightness(1.15); text-shadow: 0 0 8px rgba(240,207,107,.5), 0 1px 2px #000; }
.btn.primary:hover { filter: brightness(1.45); color: #fff6d6; }
.btn.danger { border-image: var(--f-red) 24 fill / 12px stretch; }
.btn.danger:hover { filter: brightness(1.35); }
.btn.blue { color: #bcd8ff; }
.btn.ghost { border-image: var(--f-thin) 16 fill / 8px stretch; border-width: 8px; color: var(--muted); }
.btn.ghost:hover { color: var(--text); filter: brightness(1.4); }
.btn.small { height: 32px; padding: 0 8px; font-size: 12px; border-width: 8px; border-image-width: 8px; }
.btn.small img { width: 16px; height: 16px; }
.btn.big { height: 54px; font-size: 16px; padding: 0 26px; border-width: 14px; border-image-width: 14px; letter-spacing: 1px; }
.btn:disabled, .btn.disabled { border-image: var(--f-grey) 24 fill / 12px stretch; opacity: .45; cursor: not-allowed; filter: grayscale(.7); transform: none; color: #9aa3ad; }
.btn.ghost:disabled { border-image: var(--f-thin) 16 fill / 8px stretch; }
.btn.small:disabled { border-image-width: 8px; }
.btn.selected { color: #fff; filter: brightness(1.4); box-shadow: 0 0 0 1px var(--blue2) inset; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gold-dim); margin-bottom: 12px; padding-left: 4px; }
.tab { padding: 8px 16px; cursor: pointer; color: var(--muted); border: 1px solid transparent; border-bottom: none; font-size: 13px; letter-spacing: 1px; transition: all .12s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold2); border-color: var(--gold-dim); background: linear-gradient(180deg, rgba(212,166,58,.18), rgba(212,166,58,.04)); text-shadow: 0 0 8px rgba(240,207,107,.4); }

/* ---------- 리스트 ---------- */
.list { display: flex; flex-direction: column; gap: 3px; }
.lrow { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border: 6px solid transparent; border-image: var(--f-thin) 16 fill / 6px stretch; cursor: pointer; min-height: 58px; transition: filter .1s; }
.lrow:hover { filter: brightness(1.3); }
.lrow.active { border-image: var(--f-gold) 24 fill / 8px stretch; border-width: 8px; }
.lrow.dim { opacity: .55; }
.lrow .name { font-weight: 700; font-size: 14px; text-shadow: 0 1px 2px #000; }
.lrow .meta { font-size: 11px; color: var(--muted); }
.lrow .right { margin-left: auto; text-align: right; font-size: 12px; }
.portrait { width: 44px; height: 44px; border: 4px solid transparent; border-image: var(--f-panel) 24 fill / 4px stretch; background: radial-gradient(circle at 50% 30%, #2b3644, #0d131a); object-fit: cover; object-position: top; flex: none; }
.portrait.lg { width: 64px; height: 64px; border-width: 5px; border-image-width: 5px; }
.portrait.sq { width: 84px; height: 84px; border-width: 6px; border-image-width: 6px; }
.pimg { object-fit: contain; object-position: bottom; background: radial-gradient(circle at 50% 35%, #2b3644, #0a0f15 70%); }
.bigportrait { width: 280px; height: 270px; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; object-fit: contain; object-position: bottom; background: radial-gradient(circle at 50% 35%, #34435a, #0a0f15 72%); }
.tag { display: inline-block; padding: 2px 7px; border-radius: 2px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); background: rgba(0,0,0,.35); margin-right: 4px; }
.tag.gold { color: var(--gold2); border-color: var(--gold-dim); } .tag.red { color: var(--red2); border-color: #6b2a25; } .tag.blue { color: var(--blue2); border-color: #2c4a72; } .tag.green { color: var(--green); border-color: #245c3a; } .tag.orange { color: var(--orange); border-color: #6d3d12; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; font-size: 11px; background: var(--gold-dim); color: #fff; text-align: center; }

/* ---------- 수치 / 게이지 ---------- */
.stat-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.stat-row img { width: 20px; height: 20px; filter: drop-shadow(0 1px 1px #000); }
.stat-row .k { width: 64px; color: var(--muted); }
.stat-row .v { width: 34px; text-align: right; font-weight: 700; }
.bar { flex: 1; height: 9px; background: #06090d; border: 1px solid #3a2f16; box-shadow: inset 0 1px 3px #000; overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(180deg, #f0cf6b, #a97f24); box-shadow: inset 0 -2px 3px rgba(0,0,0,.4); transition: width .3s; }
.bar.blue .fill { background: linear-gradient(180deg, #7fb4ff, #2f5f9c); }
.bar.green .fill { background: linear-gradient(180deg, #5ef08a, #1d6b3f); }
.bar.red .fill { background: linear-gradient(180deg, #ff8a7a, #8a2a22); }
.bar.tall { height: 15px; }
.kv { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #273140; font-size: 13px; }
.kv .k { color: var(--muted); } .kv .v { font-weight: 700; }
.kv.total { border-bottom: none; border-top: 1px solid var(--gold-dim); margin-top: 4px; padding-top: 8px; }

/* ---------- 카드 (대형 프레임: 적=조직원 · 청=전술 · 녹=행동) ---------- */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 12px; }
.card { position: relative; width: 122px; height: 194px; cursor: pointer; flex: none; background: url(../assets/cards/frame_blue.png) center / 100% 100% no-repeat; transition: transform .14s, filter .14s; filter: drop-shadow(0 4px 6px rgba(0,0,0,.7)); }
.card.unique { background-image: url(../assets/cards/frame_red.png); }
.card.action { background-image: url(../assets/cards/frame_green.png); }
.card:hover { transform: translateY(-5px) scale(1.03); filter: drop-shadow(0 10px 14px rgba(0,0,0,.8)) brightness(1.12); z-index: 2; }
.card.selected { transform: translateY(-10px) scale(1.05); filter: drop-shadow(0 0 12px rgba(240,207,107,.9)) brightness(1.15); z-index: 3; }
.card.disabled { opacity: .5; filter: grayscale(.7) drop-shadow(0 2px 4px #000); }
.card.up .cname { color: #fff3c4; }
.card .upmark { color: var(--green); font-weight: 900; text-shadow: 0 0 6px rgba(94,240,138,.8); }
.card .cost { position: absolute; left: 4px; top: 3px; width: 28px; height: 28px; background: url(../assets/cards/gem_blue.png) center / contain no-repeat; color: #fff; font-weight: 900; font-size: 13px; display: flex; align-items: center; justify-content: center; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 2px #000; z-index: 2; }
.card.unique .cost { background-image: url(../assets/cards/gem_red.png); }
.card.action .cost { background-image: url(../assets/cards/gem_yellow.png); color: #1a1205; text-shadow: 0 0 2px #fff3c4; }
.card .art { position: absolute; left: 14px; right: 14px; top: 27px; height: 92px; display: flex; align-items: center; justify-content: center; }
.card .art img { max-width: 66px; max-height: 66px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.9)); }
.card .cname { position: absolute; left: 12px; right: 12px; top: 104px; height: 18px; line-height: 18px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--gold2); background: linear-gradient(90deg, transparent, rgba(4,6,9,.85) 15%, rgba(4,6,9,.85) 85%, transparent); text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .5px; }
.card .cdesc { position: absolute; left: 15px; right: 15px; top: 132px; height: 46px; font-size: 9.6px; line-height: 1.3; color: #e2e6ea; text-align: center; display: flex; align-items: center; justify-content: center; padding: 0 2px; text-shadow: 0 1px 2px #000, 0 0 3px #000; background: rgba(4,6,9,.55); overflow: hidden; }
.card .csrc { position: absolute; right: 14px; bottom: 3px; font-size: 9px; color: #c8b06a; text-shadow: 0 1px 2px #000; }
.card .ccount { position: absolute; left: 14px; bottom: 3px; font-size: 10px; color: var(--gold2); font-weight: 700; text-shadow: 0 1px 2px #000; }
.card.sm { width: 86px; height: 137px; }
.card.sm .cost { width: 20px; height: 20px; font-size: 10px; left: 3px; top: 2px; }
.card.sm .art { top: 19px; height: 64px; left: 10px; right: 10px; } .card.sm .art img { max-width: 44px; max-height: 44px; }
.card.sm .cname { top: 72px; height: 15px; line-height: 15px; font-size: 9.5px; left: 8px; right: 8px; }
.card.sm .cdesc { top: 93px; height: 32px; font-size: 7.6px; left: 11px; right: 11px; }
.actioncard { display: flex; gap: 10px; padding: 6px 8px; border: 7px solid transparent; border-image: var(--f-thin) 16 fill / 7px stretch; align-items: center; cursor: pointer; transition: filter .1s; }
.actioncard:hover { filter: brightness(1.3); }
.actioncard.disabled { opacity: .45; cursor: not-allowed; }
.actioncard img { width: 40px; height: 40px; filter: drop-shadow(0 1px 2px #000); }
.actioncard .t { font-weight: 700; color: var(--gold2); font-size: 13px; }
.actioncard .d { font-size: 11px; color: var(--muted); }

/* ---------- 지도 ---------- */
.mapwrap { width: 100%; height: 100%; display: flex; flex-direction: column; position: relative; }
.hatch { pointer-events: none; }
.decor.outside { fill: rgba(0,0,0,.35); stroke: #1a232d; }
.citytabs { margin: 0 0 8px; }
.citytabs .tab { padding: 6px 14px; }
.outline { fill: none; stroke-width: 1.6; stroke-opacity: .75; pointer-events: none; filter: url(#glow); }
.outline.selected { stroke-width: 3; stroke-opacity: 1; filter: url(#glow2); animation: outlinepulse 1.6s ease-in-out infinite; }
@keyframes outlinepulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: .45; } }
.dlabelgrp { cursor: pointer; }
.dlabel.sel { fill: #cfe3ff; }
.pin path { filter: drop-shadow(0 3px 3px rgba(0,0,0,.8)); }
.pin.hq path { animation: pinbob 2.4s ease-in-out infinite; }
@keyframes pinbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.maplist { position: absolute; left: 22px; top: 22px; width: 150px; padding: 8px 8px 6px; border: 8px solid transparent; border-image: var(--f-thin) 16 fill / 8px stretch; font-size: 12px; }
.maplist .mlhead { font-family: var(--serif); color: var(--gold2); font-size: 15px; letter-spacing: 2px; margin-bottom: 6px; padding-bottom: 6px; background: var(--f-divider) center bottom / auto 6px no-repeat; }
.maplist .mlhead .sub { font-family: var(--font); letter-spacing: 0; font-size: 10.5px; }
.maplist .mlrow { display: flex; align-items: center; gap: 6px; padding: 4px 4px; cursor: pointer; border-left: 2px solid transparent; }
.maplist .mlrow:hover { background: rgba(255,255,255,.06); }
.maplist .mlrow.active { border-left-color: var(--blue2); background: rgba(91,156,240,.12); }
.maplist .mlrow .dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 5px currentColor; flex: none; }
.maplist .mlrow .n { flex: 1; }
.maplist .mlrow .v { font-weight: 700; color: var(--muted); }
.maplist .mlrow .v.gold { color: var(--gold2); }
.mapwrap svg { width: 100%; flex: 1; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; background: #060a0f; }
.district { fill: #1a2431; stroke: #3a4756; stroke-width: 1.5; cursor: pointer; transition: fill-opacity .15s; }
.district:hover { stroke: var(--gold2) !important; stroke-opacity: 1 !important; stroke-width: 2.5; }
.district.selected { stroke: var(--blue2) !important; stroke-opacity: 1 !important; stroke-width: 3; filter: drop-shadow(0 0 10px rgba(91,156,240,.8)); }
.framebox { border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, #1d2733, #080c11); }
.decor { fill: rgba(0,0,0,.15); stroke: #232e3b; stroke-width: 1; }
.dlabel { fill: #f2eee4; font-family: var(--serif); font-size: 19px; font-weight: 700; pointer-events: none; text-shadow: 0 0 6px #000, 0 2px 3px #000; letter-spacing: 2px; }
.dlabel.decor { fill: #4a5666; font-size: 13px; letter-spacing: 3px; }
.dsub { fill: #d6c48f; font-size: 11px; pointer-events: none; text-shadow: 0 1px 2px #000; }
.river { fill: none; }
.road { display: none; }
.marker { pointer-events: none; }
.marker text { font-size: 10px; fill: #fff; text-anchor: middle; }
.maplegend { display: flex; gap: 14px; padding: 8px 8px 0; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.maplegend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; box-shadow: 0 0 4px currentColor; }

/* ---------- 모달 ---------- */
#overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.74); backdrop-filter: blur(2px); z-index: 50; }
#overlay.show { display: flex; }
.modal { width: 640px; max-width: 92%; max-height: 88%; overflow: auto; border: 16px solid transparent; border-image: var(--f-panel) 24 fill / 16px stretch; padding: 12px 18px 16px; animation: pop .18s ease-out; filter: drop-shadow(0 20px 40px rgba(0,0,0,.9)); }
.modal.wide { width: 920px; } .modal.xwide { width: 1120px; }
.modal h2 { font-family: var(--serif); color: var(--gold2); margin: -4px 0 14px; font-size: 19px; letter-spacing: 2px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 44px 0 52px; border: 0 solid transparent; border-width: 8px 40px 8px 50px; border-image: var(--f-title) 12 50 12 62 fill / 8px 40px 8px 50px stretch; text-shadow: 0 1px 0 #000, 0 0 10px rgba(212,166,58,.4); }
.modal h2 img { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px #000); }
.modal .mbody { font-size: 14px; line-height: 1.65; color: #dcd8cf; white-space: pre-line; }
.modal .mbtns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.event-layout { display: flex; gap: 20px; }
.event-layout .txt { flex: 1; }
.event-layout .img { width: 268px; height: 268px; flex: none; display: flex; align-items: center; justify-content: center; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; background: radial-gradient(circle, #1d2733, #080c11); }
.event-layout .img img { max-width: 230px; max-height: 230px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.8)); }
.choice { display: flex; align-items: center; gap: 12px; padding: 8px 12px; margin-top: 6px; min-height: 46px; border: 7px solid transparent; border-image: var(--f-thin) 16 fill / 7px stretch; cursor: pointer; transition: filter .12s; }
.choice:hover { filter: brightness(1.35); }
.choice .n { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f0cf6b, #8a6d2a); border: 1px solid #fff3c4; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #1a1205; flex: none; }
.choice .tags { margin-left: auto; white-space: nowrap; }
.result-box { margin-top: 14px; padding: 12px; border-left: 3px solid var(--gold); background: rgba(212,166,58,.1); font-size: 14px; }

/* ---------- 툴팁 / 토스트 ---------- */
#tooltip { position: absolute; z-index: 90; max-width: 320px; padding: 10px 12px; background: rgba(8,12,17,.97); border: 1px solid var(--gold-dim); box-shadow: 0 0 0 1px #000, 0 6px 20px rgba(0,0,0,.8); color: var(--text); font-size: 12px; line-height: 1.5; pointer-events: none; display: none; white-space: pre-line; }
#toasts { position: absolute; left: 254px; bottom: 90px; z-index: 80; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { padding: 8px 14px; background: rgba(10,14,19,.96); border: 1px solid var(--gold-dim); border-left: 3px solid var(--gold); font-size: 13px; animation: fadein .2s; max-width: 540px; box-shadow: 0 4px 12px rgba(0,0,0,.7); }
.toast.bad { border-left-color: var(--red2); } .toast.good { border-left-color: var(--green); }
@keyframes fadein { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 메인 메뉴 ---------- */
#menu { position: absolute; inset: 0; overflow: hidden; }
#menu canvas, #menu .skyimg { position: absolute; inset: 0; width: 100%; height: 100%; }
#menu .boss { position: absolute; right: 120px; bottom: 0; height: 580px; filter: drop-shadow(0 0 40px rgba(0,0,0,.95)) brightness(.85); opacity: .95; }
#menu .menubox { position: absolute; left: 120px; top: 130px; width: 600px; }
#menu .title { font-family: var(--serif); font-size: 68px; font-weight: 900; color: var(--gold2); letter-spacing: 8px; text-shadow: 0 0 30px rgba(212,166,58,.45), 0 4px 0 #5a4212, 0 8px 20px rgba(0,0,0,.9); line-height: 1; }
#menu .subtitle { color: #b7ae98; letter-spacing: 4px; font-size: 13px; margin: 12px 0 34px 4px; padding-bottom: 12px; background: var(--f-divider) left bottom / auto 9px no-repeat; width: 420px; }
#menu .mbtn { display: block; width: 320px; height: 50px; padding: 0 18px; margin-bottom: 6px; border: 12px solid transparent; border-image: var(--f-gold) 24 fill / 12px stretch; background: transparent; color: var(--text); font-size: 16px; cursor: pointer; text-align: left; letter-spacing: 3px; transition: filter .12s, transform .12s; text-shadow: 0 1px 2px #000; }
#menu .mbtn:hover { filter: brightness(1.4); color: var(--gold2); transform: translateX(6px); }
#menu .mbtn:disabled { opacity: .35; cursor: default; filter: grayscale(.8); transform: none; }
#menu .ver { position: absolute; left: 120px; bottom: 30px; color: #5b6675; font-size: 12px; letter-spacing: 1px; }
.newgame { max-width: 1120px; margin: 0 auto; }
.newgame input[type=text] { width: 100%; height: 40px; padding: 0 12px; background: #06090d; border: 1px solid var(--gold-dim); box-shadow: inset 0 2px 6px #000; color: var(--text); font-size: 15px; font-family: inherit; }
.newgame input[type=text]:focus { outline: none; border-color: var(--gold2); box-shadow: inset 0 2px 6px #000, 0 0 8px rgba(240,207,107,.3); }
.optbox { padding: 10px 12px; border: 7px solid transparent; border-image: var(--f-thin) 16 fill / 7px stretch; cursor: pointer; transition: filter .1s; }
.optbox:hover { filter: brightness(1.3); }
.optbox.active { border-image: var(--f-gold) 24 fill / 9px stretch; border-width: 9px; }
.optbox .t { font-weight: 700; color: var(--gold2); margin-bottom: 4px; }
.optbox .d { font-size: 12px; color: var(--muted); }

/* ---------- 전투 ---------- */
#battle { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; background: #070a0f var(--skyline) center / cover no-repeat; }
#battle::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4,6,10,.55), rgba(4,6,10,.75) 60%, rgba(4,6,10,.95)); pointer-events: none; }
#battle > * { position: relative; }
#battle .btop { height: 60px; display: flex; align-items: center; gap: 18px; padding: 0 14px; margin: 4px 6px 0; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; }
#battle .btop .t { font-family: var(--serif); color: var(--gold2); font-size: 18px; letter-spacing: 2px; text-shadow: 0 0 10px rgba(212,166,58,.4); }
#battle .stage { flex: 1; display: flex; padding: 8px 30px; gap: 16px; min-height: 0; position: relative; overflow: hidden; }
#battle .side { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
#battle .unit { display: flex; align-items: center; gap: 12px; padding: 2px 6px; border: 8px solid transparent; border-image: var(--f-thin) 16 fill / 8px stretch; position: relative; transition: transform .1s, filter .15s; }
#battle .unit.enemy { flex-direction: row-reverse; text-align: right; }
#battle .unit.dead { opacity: .35; filter: grayscale(1); }
#battle .unit.dead.targetable { opacity: .85; filter: grayscale(.4) drop-shadow(0 0 10px rgba(94,240,138,.8)); }
#battle .unit.targetable { cursor: pointer; border-image: var(--f-gold) 24 fill / 10px stretch; border-width: 10px; filter: drop-shadow(0 0 10px rgba(240,207,107,.6)); }
#battle .unit.targetable:hover { filter: drop-shadow(0 0 16px rgba(240,207,107,1)) brightness(1.25); }
#battle .unit.acting { filter: drop-shadow(0 0 14px rgba(91,156,240,.9)); }
#battle .unit.hit { animation: shake .35s; }
#battle .unit.taunt .uimg { box-shadow: 0 0 0 2px var(--orange); }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
#battle .unit .uimg { width: 92px; height: 92px; object-fit: contain; object-position: bottom; background: radial-gradient(circle at 50% 40%, #2f3c4d, #0a0f15 72%); border: 6px solid transparent; border-image: var(--f-panel) 24 fill / 6px stretch; flex: none; }
#battle .unit.enemy .uimg { border-image: var(--f-red) 24 fill / 6px stretch; }
#battle .unit .info { flex: 1; min-width: 0; }
#battle .unit .uname { font-weight: 700; font-size: 15px; text-shadow: 0 1px 2px #000; }
#battle .unit .urole { font-size: 11px; color: var(--muted); }
#battle .unit .hpbar { height: 15px; background: #06090d; border: 1px solid #3a2f16; box-shadow: inset 0 1px 3px #000; overflow: hidden; margin-top: 6px; position: relative; }
#battle .unit .hpbar .f { height: 100%; background: linear-gradient(180deg, #5ef08a, #1d6b3f); transition: width .3s; }
#battle .unit .hpbar .f.low { background: linear-gradient(180deg, #ff8a7a, #8a2a22); }
#battle .unit .hpbar .sh { position: absolute; left: 0; top: 0; height: 100%; background: rgba(91,156,240,.55); }
#battle .unit .hpbar span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 13px; color: #fff; text-shadow: 0 1px 2px #000; }
#battle .unit .st { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; justify-content: inherit; }
#battle .unit.enemy .st { justify-content: flex-end; }
#battle .sticon { font-size: 10px; padding: 1px 5px; border-radius: 2px; background: #1f2937; border: 1px solid #33404f; color: #cfd5dc; }
#battle .sticon.buff { border-color: #245c3a; color: var(--green); } #battle .sticon.debuff { border-color: #6b2a25; color: var(--red2); }
#battle .intent { position: absolute; left: 10px; top: -12px; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: #2a1512; border: 1px solid var(--red2); color: #ffb9b0; z-index: 2; box-shadow: 0 2px 6px #000; }
#battle .intent.guard { background: #10233a; border-color: var(--blue2); color: #bcd8ff; } #battle .intent.heal { background: #10301e; border-color: var(--green); color: #b8f0cd; }
#battle .center { width: 220px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
#battle .vs { font-family: var(--serif); font-size: 54px; color: var(--gold-dim); text-shadow: 0 0 24px rgba(212,166,58,.35), 0 4px 0 #2a1f08; letter-spacing: 4px; }
#battle .center .obj { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }
#battle .float { position: absolute; font-weight: 900; font-size: 28px; color: #fff; text-shadow: 0 0 6px #000, 0 2px 0 #000; pointer-events: none; animation: floatup .9s ease-out forwards; z-index: 5; font-family: var(--serif); }
#battle .float.dmg { color: #ff6b5b; } #battle .float.heal { color: #5ef08a; } #battle .float.miss { color: #ccc; font-size: 18px; } #battle .float.heavy { font-size: 38px; color: #ffa33b; }
@keyframes floatup { 0% { transform: translateY(0) scale(.8); opacity: 0; } 15% { opacity: 1; transform: translateY(-10px) scale(1.2); } 100% { transform: translateY(-64px) scale(1); opacity: 0; } }
#battle .fx { position: absolute; width: 96px; height: 96px; pointer-events: none; animation: fxpop .5s ease-out forwards; z-index: 4; }
@keyframes fxpop { 0% { transform: scale(.4) rotate(-10deg); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.4) rotate(5deg); opacity: 0; } }
#battle .stage.flash::after { content: ''; position: absolute; inset: 0; background: rgba(231,76,60,.18); animation: flash .25s ease-out forwards; pointer-events: none; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
#battle .bbottom { height: 244px; flex: none; display: flex; align-items: stretch; gap: 14px; padding: 4px 14px; margin: 0 6px 4px; border: 10px solid transparent; border-image: var(--f-panel) 24 fill / 10px stretch; }
#battle .energy { width: 120px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
#battle .energy .orb { width: 78px; height: 78px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #9cc6ff, #1e3d66 62%, #0b1a2e); border: 2px solid #5b9cf0; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 900; color: #fff; text-shadow: 0 2px 4px #000; box-shadow: 0 0 26px rgba(91,156,240,.6), inset 0 0 12px rgba(0,0,0,.5); font-family: var(--serif); }
#battle .energy .lbl { font-size: 11px; color: var(--muted); }
#battle .hand { flex: 1; display: flex; gap: 8px; align-items: center; justify-content: center; overflow-x: auto; padding: 10px 4px 6px; }
#battle .hand .card.deal { animation: dealin .3s cubic-bezier(.2,.8,.3,1.2) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes dealin { from { opacity: 0; transform: translateY(40px) rotate(-6deg) scale(.8); } to { opacity: 1; transform: none; } }
#battle .bctrl { width: 176px; flex: none; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
#battle .blog { position: absolute; right: 24px; top: 70px; width: 300px; max-height: 300px; overflow: auto; background: rgba(8,12,17,.94); border: 1px solid var(--gold-dim); padding: 8px 10px; font-size: 11px; color: #b9c0c8; display: none; z-index: 6; }
#battle .blog.show { display: block; }
#battle .blog div { padding: 2px 0; border-bottom: 1px dashed #1f2937; }
#battle .banner { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-family: var(--serif); font-size: 50px; font-weight: 900; color: var(--gold2); letter-spacing: 8px; text-shadow: 0 0 30px rgba(0,0,0,1), 0 0 16px rgba(212,166,58,.7), 0 4px 0 #3d2c08; pointer-events: none; animation: banner 1.2s ease-out forwards; z-index: 7; }
#battle .banner.red { color: var(--red2); text-shadow: 0 0 30px #000, 0 0 16px rgba(231,76,60,.7), 0 4px 0 #3d0c08; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.3); letter-spacing: 20px; } 20% { opacity: 1; transform: scale(1); letter-spacing: 8px; } 80% { opacity: 1; } 100% { opacity: 0; } }
.prep-unit { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border: 7px solid transparent; border-image: var(--f-thin) 16 fill / 7px stretch; cursor: pointer; transition: filter .1s; }
.prep-unit:hover { filter: brightness(1.3); }
.prep-unit.on { border-image: var(--f-gold) 24 fill / 9px stretch; border-width: 9px; }
.prep-unit.off { opacity: .45; cursor: not-allowed; }
.powerbar { display: flex; height: 24px; overflow: hidden; border: 1px solid var(--gold-dim); box-shadow: inset 0 2px 4px #000; font-size: 12px; font-weight: 700; }
.powerbar .a { background: linear-gradient(180deg, #f0cf6b, #8a6d2a); color: #1a1205; display: flex; align-items: center; padding-left: 8px; }
.powerbar .e { background: linear-gradient(180deg, #a03a30, #4a1713); color: #fff; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; flex: 1; }

/* ---------- 저장 슬롯 ---------- */
.saveslot { display: flex; align-items: center; gap: 14px; padding: 6px 12px; min-height: 60px; border: 7px solid transparent; border-image: var(--f-thin) 16 fill / 7px stretch; cursor: pointer; transition: filter .1s; }
.saveslot:hover { filter: brightness(1.3); }
.saveslot.active { border-image: var(--f-gold) 24 fill / 9px stretch; border-width: 9px; }
.saveslot .no { font-family: var(--serif); font-size: 18px; color: var(--gold-dim); width: 72px; letter-spacing: 1px; }
.saveslot .info { flex: 1; } .saveslot .info .t { font-weight: 700; } .saveslot .info .m { font-size: 12px; color: var(--muted); }
.saveslot.empty .info .t { color: #4d5866; }

/* ---------- 도감 / 통계 ---------- */
.codexgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.codexitem { border: 7px solid transparent; border-image: var(--f-thin) 16 fill / 7px stretch; padding: 6px; text-align: center; cursor: pointer; transition: filter .1s; }
.codexitem:hover { filter: brightness(1.3); } .codexitem.active { border-image: var(--f-gold) 24 fill / 9px stretch; border-width: 9px; }
.codexitem img { width: 100px; height: 100px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.8)); }
.codexitem.locked img { filter: brightness(0) contrast(0) opacity(.5); }
.codexitem .n { font-size: 12px; margin-top: 4px; font-weight: 700; }
.chart { width: 100%; height: 160px; background: #06090d; border: 1px solid var(--gold-dim); box-shadow: inset 0 2px 6px #000; }
.setrow { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; border-bottom: 1px dashed #273140; }
.toggle { width: 54px; height: 26px; border-radius: 13px; background: #101820; border: 1px solid var(--gold-dim); position: relative; cursor: pointer; box-shadow: inset 0 2px 4px #000; }
.toggle::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #8b939e, #3a424c); transition: all .15s; }
.toggle.on { background: linear-gradient(90deg, #8a6d2a, #d4a63a); border-color: var(--gold2); }
.toggle.on::after { left: 31px; background: radial-gradient(circle at 40% 35%, #fff9e0, #d4a63a); }
.seg { display: inline-flex; border: 1px solid var(--gold-dim); overflow: hidden; }
.seg button { border: none; background: transparent; color: var(--muted); padding: 6px 12px; cursor: pointer; }
.seg button.on { background: rgba(212,166,58,.25); color: var(--gold2); }
.logrow { padding: 6px 8px; border-bottom: 1px dashed #273140; font-size: 13px; display: flex; gap: 10px; }
.logrow .t { color: var(--muted); width: 90px; flex: none; font-size: 11px; }
.logrow.good { color: var(--green); } .logrow.bad { color: var(--red2); } .logrow.battle { color: var(--orange); } .logrow.ai { color: #9fb3c8; } .logrow.event { color: var(--gold2); } .logrow.story { color: #d9c9ff; }
.ending { text-align: center; padding: 40px; }
.ending h1 { font-family: var(--serif); font-size: 46px; color: var(--gold2); letter-spacing: 8px; text-shadow: 0 0 30px rgba(212,166,58,.5), 0 4px 0 #3d2c08; }
.ending.defeat h1 { color: var(--red2); text-shadow: 0 0 30px rgba(231,76,60,.5), 0 4px 0 #3d0c08; }
.ending p { font-size: 16px; color: #cfd5dc; max-width: 640px; margin: 10px auto 30px; line-height: 1.7; }
.report table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report td { padding: 5px 6px; border-bottom: 1px dashed #273140; }
.report td.r { text-align: right; }
.report tr.total td { border-top: 1px solid var(--gold-dim); border-bottom: none; font-weight: 700; padding-top: 8px; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid #3a4756; border-bottom-width: 2px; border-radius: 3px; font-size: 11px; color: var(--muted); background: #0a0f15; }
.dim-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
