/* 작살 사냥 화면 스타일: 진한 바다색 패널 + 황동 강조, 위험은 붉은색 */
:root {
  --ink: #f4efe4;
  --ink2: #d9d2c2;
  --panel: rgba(6, 17, 26, 0.78);
  --panel2: rgba(12, 30, 42, 0.92);
  --line: rgba(224, 178, 90, 0.35);
  --brass: #e2b45c;
  --brass2: #f6d58e;
  --danger: #ff4b36;
  --ok: #5fd1a5;
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #071521; color: var(--ink); font-family: var(--font); -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
canvas#c { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
button { font-family: inherit; color: inherit; border: 0; cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }

#fxlayer { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.dmg { position: absolute; left: 0; top: 0; font-weight: 900; font-size: 22px; color: #fff; text-shadow: 0 2px 0 #000, 0 0 10px rgba(0,0,0,.6); white-space: nowrap; }
.dmg.weak { color: var(--brass2); font-size: 32px; }
.dmg.air { color: #9fe3ff; }
.dmg.sp { color: #ffb36b; font-size: 38px; }
.dmg.miss { color: #c9d3d8; font-size: 16px; font-weight: 700; }

#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 3; box-shadow: inset 0 0 140px 30px rgba(255, 30, 10, 0); transition: box-shadow .25s; }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 3; background: #fff; opacity: 0; }

/* ===== 전투 HUD ===== */
#hud.cine > *:not(#banner):not(#callout) { display: none !important; }
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#topbar { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(58vw, 560px); text-align: center; }
.boss-name { font-weight: 800; font-size: 15px; letter-spacing: .02em; text-shadow: 0 1px 3px #000; margin-bottom: 5px; display: flex; justify-content: center; gap: 8px; align-items: baseline; }
#bossPhase { font-size: 12px; color: var(--danger); font-weight: 800; }
.bar { position: relative; height: 10px; background: rgba(0, 0, 0, .6); border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(226,180,92,.45), 0 1px 4px rgba(0,0,0,.5); }
.boss-bar { height: 12px; }
#bossFill { position: absolute; inset: 0; width: 100%; background: linear-gradient(#f2d48e, #c8913a); transition: width .12s; z-index: 2; }
#bossGhost { position: absolute; inset: 0; width: 100%; background: #fff; opacity: .55; transition: width .6s .25s; z-index: 1; }
.boss-bar .mark { position: absolute; top: -2px; bottom: -2px; left: 15%; width: 2px; background: var(--ok); z-index: 3; }
.boss-bar.exhausted #bossFill { background: linear-gradient(#8ff0c8, #2fa57a); }
#podPips { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
#podPips i { width: 34px; height: 6px; border-radius: 3px; background: rgba(0,0,0,.5); overflow: hidden; position: relative; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
#podPips i b { position: absolute; inset: 0; background: #e8e2d6; }
#podPips i.done b { background: var(--ok); }

#shipPanel { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); width: 150px; display: grid; grid-template-columns: 34px 1fr; gap: 5px 8px; align-items: center; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#hullFill { position: absolute; inset: 0; background: linear-gradient(#7fe0b8, #2c9d77); transition: width .2s; }
#hullFill.low { background: linear-gradient(#ff8a72, #d63a24); }
.boost-bar { height: 6px; }
#boostFill { position: absolute; inset: 0; background: linear-gradient(#a6dcff, #3b8fd0); }
#pauseBtn { pointer-events: auto; position: absolute; top: calc(8px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); width: 42px; height: 42px; border-radius: 12px; background: rgba(0,0,0,.35); display: grid; place-items: center; }
#pauseBtn svg { width: 20px; height: 20px; fill: var(--ink); }

#cross { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
#cross i { position: absolute; inset: 0; border: 2px solid rgba(255,255,255,.85); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.35); transition: transform .08s, border-color .1s; }
#cross b { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
#cross.on i { border-color: #ff7a5c; transform: scale(.82); }
#cross.weak i { border-color: var(--brass2); border-width: 3px; transform: scale(.7); }
#cross.weak b { background: var(--brass2); }
#offArrow { position: absolute; width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent; border-bottom: 22px solid var(--brass); filter: drop-shadow(0 1px 3px #000); display: none; }

#callout { position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); font-size: 20px; font-weight: 900; text-align: center; padding: 8px 18px; border-radius: 10px; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; white-space: nowrap; text-shadow: 0 2px 4px #000; }
#callout.danger { color: #ffd2c8; background: rgba(140, 18, 6, .62); }
#callout.good { color: #1b1408; background: rgba(246, 213, 142, .92); text-shadow: none; }
#callout.show { opacity: 1; }
#banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; font-size: 44px; font-weight: 900; letter-spacing: .06em; color: var(--brass2); text-shadow: 0 3px 0 #2a1a05, 0 0 30px rgba(0,0,0,.6); opacity: 0; transition: opacity .3s, transform .3s; transform: scale(1.1); }
#banner.show { opacity: 1; transform: scale(1); }
#banner small { display: block; font-size: 16px; color: var(--ink); letter-spacing: 0; margin-top: 4px; font-weight: 700; }

#stick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); background: rgba(0,0,0,.12); display: none; }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px; border-radius: 50%; background: rgba(255,255,255,.35); box-shadow: 0 0 0 2px rgba(255,255,255,.4); }
#stick.boost #stickKnob { background: rgba(120, 200, 255, .7); }
#stickHint, #aimHint { position: absolute; bottom: calc(26px + env(safe-area-inset-bottom)); font-size: 12px; font-weight: 700; color: rgba(255,255,255,.75); text-shadow: 0 1px 3px #000; line-height: 1.45; transition: opacity .6s; }
#stickHint { left: calc(26px + env(safe-area-inset-left)); }
#aimHint { left: 50%; transform: translateX(-50%); }
.faded { opacity: 0 !important; }

#fireBtn, #specialBtn { pointer-events: auto; position: absolute; border-radius: 50%; display: grid; place-items: center; font-weight: 900; }
#fireBtn { right: calc(22px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)); width: 104px; height: 104px; background: radial-gradient(circle at 50% 38%, #d8482c 0%, #9c2412 52%, #3a1009 53%, #2a1a12 64%, #b98a3e 66%, #6f4d1d 74%, #2a2017 76%); font-size: 20px; letter-spacing: .04em; text-shadow: 0 2px 2px rgba(0,0,0,.6); box-shadow: 0 5px 0 rgba(20,10,4,.85), 0 8px 20px rgba(0,0,0,.5); }
#fireBtn.cool { filter: saturate(.4) brightness(.8); }
#fireBtn:active { transform: translateY(2px); }
#specialBtn { right: calc(140px + env(safe-area-inset-right)); bottom: calc(34px + env(safe-area-inset-bottom)); width: 74px; height: 74px; background: radial-gradient(circle at 50% 40%, #26323a 0%, #141c22 62%, #8d6a32 64%, #4d3a1c 72%, #1b1712 74%); font-size: 12px; line-height: 1.15; text-align: center; color: var(--ink2); }
#specialBtn.ready { background: radial-gradient(circle at 50% 40%, #ffe2a0 0%, #d48a2a 60%, #8d6a32 64%, #4d3a1c 72%, #1b1712 74%); color: #2a1604; animation: pulse 1s infinite; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: rgba(255,255,255,.18); stroke-width: 6; }
.ring circle + circle { stroke: #fff; stroke-dasharray: 289; stroke-dashoffset: 289; stroke-linecap: round; }
#specialBtn .ring circle + circle { stroke: var(--brass2); }
#fireBtn span, #specialBtn span { position: relative; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 200, 100, .25); } }
#captureBtn { pointer-events: auto; position: absolute; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 18px 44px; border-radius: 16px; font-size: 24px; font-weight: 900; color: #0d2018; background: linear-gradient(#a8f5d2, #3bbf8c); box-shadow: 0 5px 0 #145c42, 0 8px 22px rgba(0,0,0,.5); animation: pulse2 .9s infinite; }
@keyframes pulse2 { 50% { transform: translateX(-50%) scale(1.06); } }

/* ===== 화면 공통 ===== */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .28em; color: var(--brass); }
.primary { background: linear-gradient(#f6d58e, #d39b3e); color: #241505; font-weight: 900; font-size: 20px; padding: 15px 48px; border-radius: 14px; box-shadow: 0 4px 0 #6d4612, 0 10px 24px rgba(0,0,0,.4); }
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #6d4612; }
.primary:disabled { filter: grayscale(.8) brightness(.7); }
.ghost { background: rgba(255,255,255,.08); padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.ghost.on { background: rgba(226, 180, 92, .22); box-shadow: inset 0 0 0 1.5px var(--brass); color: var(--brass2); }
.row { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 14px; flex-wrap: wrap; }

#title { background: linear-gradient(90deg, rgba(3, 10, 16, .82) 0%, rgba(3, 10, 16, .45) 45%, rgba(3,10,16,0) 70%); justify-content: flex-start; }
.title-wrap { margin-left: max(6vw, 28px); max-width: 420px; }
#title h1 { font-size: clamp(44px, 8vw, 76px); margin: 8px 0 22px; font-weight: 900; line-height: 1; letter-spacing: -.02em; text-shadow: 0 4px 20px rgba(0,0,0,.6); }
#title h1 small { display: block; font-size: .36em; color: var(--brass2); letter-spacing: .3em; margin-top: 10px; font-weight: 800; }
#title .row { justify-content: flex-start; }
#title .primary { margin-top: 18px; font-size: 24px; padding: 17px 64px; }
.howto { font-size: 13px; color: var(--ink2); line-height: 1.6; margin-top: 20px; max-width: 340px; }

/* ===== 항구 ===== */
#harbor { flex-direction: column; justify-content: space-between; align-items: stretch; padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); pointer-events: none; }
#harbor > * { pointer-events: auto; }
.harbor-top { display: flex; justify-content: space-between; align-items: center; }
.gold { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 900; background: var(--panel); padding: 6px 16px; border-radius: 12px; }
.coin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2c2, #e2b45c 55%, #8a5d18); box-shadow: 0 0 0 1px #6d4612; }
.harbor-body { flex: 1; display: flex; justify-content: space-between; gap: 14px; min-height: 0; margin: 10px 0; pointer-events: none; }
.panel { pointer-events: auto; background: var(--panel); border-radius: 16px; padding: 12px; width: min(330px, 34vw); overflow-y: auto; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.panel h2 { font-size: 13px; letter-spacing: .2em; color: var(--brass); margin: 2px 4px 10px; }
.tcard { display: block; width: 100%; text-align: left; background: rgba(255,255,255,.05); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.tcard.sel { box-shadow: inset 0 0 0 2px var(--brass); background: rgba(226,180,92,.12); }
.tcard.locked { opacity: .5; }
.tcard .tn { display: flex; justify-content: space-between; align-items: baseline; font-weight: 900; font-size: 16px; }
.tcard .tag { font-size: 11px; color: var(--brass2); font-weight: 800; letter-spacing: .1em; }
.tcard .st { color: var(--brass); font-weight: 400; letter-spacing: 0; }
.tcard .st.off { color: rgba(255,255,255,.18); }
.tcard .td { font-size: 12px; color: var(--ink2); margin-top: 4px; line-height: 1.5; }
.tcard .tr { font-size: 12px; margin-top: 6px; display: flex; gap: 10px; color: var(--ink); font-weight: 700; }
.tcard .lock { color: #ffb4a6; }
.ucard { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; background: rgba(255,255,255,.05); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.ucard.preview { box-shadow: inset 0 0 0 2px #7fc8ff; }
.ucard .un { font-weight: 900; font-size: 15px; }
.ucard .pips { display: flex; gap: 3px; margin-top: 5px; }
.ucard .pips i { width: 14px; height: 5px; border-radius: 2px; background: rgba(255,255,255,.15); }
.ucard .pips i.on { background: var(--brass); }
.ucard .uv { font-size: 12px; color: var(--ink2); grid-column: 1; }
.ucard .ub { grid-row: 1 / span 3; grid-column: 2; align-self: center; background: linear-gradient(#f6d58e, #d39b3e); color: #241505; font-weight: 900; padding: 9px 12px; border-radius: 10px; font-size: 13px; display: flex; align-items: center; gap: 5px; }
.ucard .ub.no { background: rgba(255,255,255,.1); color: var(--ink2); }
.hint { font-size: 11px; color: var(--ink2); margin: 4px; line-height: 1.5; }
.go { align-self: center; font-size: 22px; padding: 15px 70px; }

/* ===== 결과 ===== */
#result, #pause { background: rgba(3, 9, 14, .55); }
.result-card { background: var(--panel2); border-radius: 20px; padding: 22px 30px; min-width: min(420px, 92vw); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 0 0 1px var(--line); }
.result-card h2 { font-size: 34px; margin: 6px 0 12px; font-weight: 900; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 14px; }
.stats div { background: rgba(255,255,255,.05); border-radius: 10px; padding: 8px 4px; font-size: 11px; color: var(--ink2); }
.stats b { display: block; font-size: 19px; color: var(--ink); margin-top: 2px; }
.reward { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 30px; font-weight: 900; color: var(--brass2); }
.next { font-size: 13px; color: var(--ink2); margin: 10px 0 0; line-height: 1.5; }
.sens { gap: 12px; font-size: 13px; }
.sens input { width: 160px; accent-color: var(--brass); }

#rotate { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 20; background: rgba(0,0,0,.6); padding: 6px 14px; border-radius: 10px; font-size: 12px; pointer-events: none; }
#loading { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: #071521; font-weight: 800; letter-spacing: .2em; color: var(--brass); transition: opacity .5s; }

/* 세로 화면 */
@media (orientation: portrait) {
  #topbar { width: 72vw; top: calc(56px + env(safe-area-inset-top)); }
  #shipPanel { width: 130px; }
  #fireBtn { width: 96px; height: 96px; bottom: calc(40px + env(safe-area-inset-bottom)); }
  #specialBtn { right: calc(24px + env(safe-area-inset-right)); bottom: calc(150px + env(safe-area-inset-bottom)); }
  #aimHint { bottom: auto; top: 62%; }
  .title-wrap { margin: 0 auto; text-align: center; }
  #title { background: linear-gradient(180deg, rgba(3,10,16,.2), rgba(3,10,16,.85) 70%); align-items: flex-end; padding-bottom: 40px; }
  #title .row { justify-content: center; }
  .howto { margin-left: auto; margin-right: auto; }
  .harbor-body { flex-direction: column; justify-content: flex-end; }
  .panel { width: 100%; max-height: 30vh; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-height: 420px) and (orientation: landscape) {
  .panel { padding: 8px; }
  .tcard { padding: 7px 10px; margin-bottom: 6px; }
  .tcard .td { display: none; }
  .ucard { padding: 6px 10px; margin-bottom: 5px; }
  .ucard .un { font-size: 14px; }
  .ucard .pips { margin-top: 3px; }
  .ucard .uv { font-size: 11px; }
  .ucard .ub { padding: 7px 10px; }
  .panel h2 { margin: 0 4px 6px; }
  .harbor-body { margin: 6px 0; }
  .go { padding: 11px 60px; font-size: 19px; }
  .result-card { padding: 14px 22px; }
  .result-card h2 { font-size: 26px; margin: 4px 0 8px; }
  #title h1 { margin-bottom: 10px; }
  .howto { margin-top: 10px; }
}
