/* 포켓 슬링샷 캐슬 — 나무 판자·금박 UI (헥사 크라운·왕국 수비대와 같은 톤) */
:root {
  --wood: #2b1f17;
  --wood-2: #3a2a1e;
  --line: #6b4f33;
  --gold: #e3b046;
  --gold-2: #f5d27a;
  --parch: #f4e8cc;
  --muted: #c2ad8a;
  --red: #e2574c;
  --display: "Gowun Batang", "AppleMyungjo", "Batang", serif;
  --body: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fc4e8; color: var(--parch); font-family: var(--body); -webkit-user-select: none; user-select: none; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#cv:active { cursor: grabbing; }
#overlay { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }

.back-btn { position: fixed; top: 12px; left: 12px; z-index: 30; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--parch); text-decoration: none; border-radius: 8px; background: rgba(43,31,23,.88); border: 1px solid var(--line); }
.back-btn:hover { border-color: var(--gold); }

.hud-top { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 20; pointer-events: none; }
.hud-box { display: flex; align-items: center; gap: 16px; padding: 7px 16px; border-radius: 12px; background: linear-gradient(180deg, var(--wood-2), var(--wood)); border: 1px solid var(--line); box-shadow: 0 6px 16px rgba(0,0,0,.35); white-space: nowrap; }
.hud-box .lvname { font: 700 15px var(--display); color: var(--gold-2); }
.hud-box b { font: 700 18px var(--display); font-variant-numeric: tabular-nums; }
.hud-box .sc { font-size: 13px; color: var(--muted); }
.hud-box .sc b { color: var(--parch); margin-right: 2px; }

.hud-right { position: fixed; top: 12px; right: 12px; z-index: 20; display: flex; gap: 6px; }
.mini { width: 40px; height: 38px; border-radius: 9px; background: rgba(43,31,23,.9); border: 1px solid var(--line); font-weight: 700; font-size: 16px; }
.mini:hover { border-color: var(--gold); }

.hud-bottom { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; pointer-events: none; }
.ammo-box { pointer-events: auto; padding: 8px 12px; border-radius: 12px; background: rgba(43,31,23,.88); border: 1px solid var(--line); max-width: 60%; }
.ammo { display: flex; gap: 6px; font-size: 22px; }
.ammo span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #1f160f; border: 1px solid var(--line); }
.ammo span.now { border-color: var(--gold); box-shadow: 0 0 10px rgba(227,176,70,.6); transform: scale(1.12); }
.ammo span.used { opacity: .3; filter: grayscale(1); }
.ammo-name { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.ammo-name:empty { display: none; }
.elev-box { pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: rgba(43,31,23,.88); border: 1px solid var(--line); font-size: 13px; }
.elev-box button { width: 32px; height: 32px; border-radius: 8px; background: #1f160f; border: 1px solid var(--line); font-size: 18px; }
.elev-box b { font: 700 16px var(--display); color: var(--gold-2); }

.aim-info { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 20; margin: 0; padding: 4px 12px; border-radius: 999px; background: rgba(20,14,10,.75); font-weight: 700; font-size: 13px; pointer-events: none; }
.aim-info:empty { display: none; }
.hint { position: fixed; left: 50%; top: 64px; transform: translate(-50%, -6px); z-index: 20; margin: 0; max-width: min(560px, 90vw); text-align: center; padding: 7px 14px; border-radius: 10px; background: rgba(20,14,10,.82); border: 1px solid var(--line); font-size: 13px; line-height: 1.45; opacity: 0; transition: .3s; pointer-events: none; }
.hint.show { opacity: 1; transform: translate(-50%, 0); }

.tbar { position: absolute; left: 0; top: 0; width: 36px; height: 5px; border-radius: 3px; background: #1a0e0c; border: 1px solid #0b0705; overflow: hidden; }
.tbar i { display: block; height: 100%; background: linear-gradient(90deg, #d4423a, #ff7a5a); }
.tbar.king { width: 70px; height: 7px; }
.tbar.king i { background: linear-gradient(90deg, #c8892a, #ffd36a); }
.ftxt { position: absolute; left: 0; top: 0; font: 800 15px var(--body); color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; }
.ftxt.big { color: #ffd76a; font-size: 20px; }

.banner { position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%); z-index: 22; text-align: center; pointer-events: none; opacity: 0; }
.banner.show { animation: banner 2.4s ease forwards; }
.banner b { display: block; font: 700 38px var(--display); color: var(--gold-2); text-shadow: 0 3px 0 #3a2410, 0 0 18px rgba(0,0,0,.6); }
.banner span { font-size: 15px; text-shadow: 0 1px 3px #000; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%); } 15%, 75% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -55%); } }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(12,9,6,.6); overflow: auto; }
.modal[hidden] { display: none; }
.sheet { width: min(680px, 100%); padding: 22px 24px; border-radius: 16px; background: linear-gradient(180deg, var(--wood-2), var(--wood)); border: 1px solid var(--gold); box-shadow: 0 20px 50px rgba(0,0,0,.55); text-align: center; }
.sheet .eyebrow { margin: 0; color: var(--gold); font-size: 12px; letter-spacing: .12em; }
.sheet h2 { margin: 2px 0 8px; font: 700 30px var(--display); color: var(--gold-2); }
.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 6px 0 14px; }
.chapter { margin: 10px 0 0; font: 700 14px var(--display); color: var(--gold-2); letter-spacing: .02em; }
.star-total { margin: 8px 0 0; font-size: 13px; }
.star-total b { color: var(--gold-2); }
.lv { display: grid; gap: 2px; justify-items: center; padding: 10px 4px; border-radius: 10px; background: #1f160f; border: 1px solid var(--line); }
.lv:hover:not(:disabled) { border-color: var(--gold); background: #2a1e14; }
.lv:disabled { opacity: .45; cursor: not-allowed; }
.lv b { font: 700 20px var(--display); color: var(--gold-2); }
.lv .nm { font-size: 11.5px; min-height: 16px; }
.stars { font-size: 14px; letter-spacing: 1px; color: #5a4a36; }
.stars .on { color: var(--gold-2); text-shadow: 0 0 6px rgba(245,210,122,.6); }
.big-stars { font-size: 46px; letter-spacing: 6px; }
.sc { font: 700 22px var(--display); margin: 6px 0 2px; }
.nb { font: 700 12px var(--body); color: #2b1a08; background: var(--gold-2); border-radius: 999px; padding: 2px 8px; vertical-align: middle; }
.ammo-guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; text-align: left; }
.ammo-guide div { display: grid; grid-template-columns: 26px 1fr; column-gap: 6px; padding: 8px; border-radius: 9px; background: rgba(0,0,0,.2); font-size: 12.5px; }
.ammo-guide span { grid-row: span 2; font-size: 20px; }
.ammo-guide small { color: var(--muted); line-height: 1.4; }
.btn-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.primary { padding: 11px 22px; border-radius: 10px; border: 1px solid #f7d98a; font: 700 16px var(--display); color: #2b1a08; background: linear-gradient(180deg, #ffd978, #e3a63a); }
.ghost { padding: 11px 18px; border-radius: 10px; border: 1px solid var(--line); background: #1f160f; font-weight: 600; }

.loading { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: #2b1f17; }
.loading[hidden] { display: none; }
.load-card { width: min(340px, 86vw); text-align: center; }
.load-card h1 { font: 700 28px var(--display); color: var(--gold-2); margin: 0 0 14px; }
.load-track { height: 8px; border-radius: 4px; background: #1a120c; overflow: hidden; border: 1px solid var(--line); }
.load-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c8892a, #f5d27a); transition: width .2s; }
.load-card p { color: var(--muted); font-size: 13px; }
.load-err { max-width: 520px; padding: 0 16px; text-align: center; line-height: 1.6; }

@media (max-width: 760px) {
  .back-btn { padding: 6px 9px; font-size: 12px; }
  .hud-top { top: 54px; }
  .hud-box { gap: 10px; padding: 6px 10px; }
  .hud-box .lvname { font-size: 13px; }
  .hint { top: 100px; }
  .levels { grid-template-columns: repeat(3, 1fr); }
  .ammo-guide { grid-template-columns: 1fr 1fr; }
  .ammo-box { max-width: 62%; }
  .ammo span { width: 30px; height: 30px; font-size: 18px; }
  .aim-info { bottom: 120px; }
}
