/* Lanternfall — game shell styles. Dark, lantern-lit; touch-first. */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #0c0f1a; touch-action: none;
  -webkit-user-select: none; user-select: none; }
body { font-family: -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #e8e4d8; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ------------------------------- menus ------------------------------- */
.scr { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; background: radial-gradient(ellipse at 50% 30%, #1a2030 0%, #0c0f1a 70%);
  z-index: 30; padding: 20px; overflow-y: auto; }
.backlink { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 18px;
  color: #8f96ad; text-decoration: none; font-size: 14px; }
.backlink:hover { color: #ffd9a0; }
.game-title { font-size: clamp(44px, 9vw, 84px); letter-spacing: 0.02em; font-weight: 800; }
.game-title .lantern { color: #ffd9a0; text-shadow: 0 0 24px rgba(255, 180, 90, 0.45); }
.game-title .fall { color: #6f7d9e; }
.game-sub { color: #a9b1c7; font-size: clamp(15px, 2.4vw, 19px); }
.map-note { color: #6f7d9e; font-size: 13px; margin-top: -6px; }
.mp-note { color: #565f78; font-size: 12px; margin-top: 10px; }
.hint { color: #8f96ad; font-size: 13px; margin-top: -6px; }
.scr-h { font-size: clamp(22px, 4vw, 32px); color: #ffd9a0; }

.btn { background: #232a3d; color: #e8e4d8; border: 1px solid #3a4460; border-radius: 10px;
  padding: 12px 28px; font-size: 17px; cursor: pointer; min-width: 200px; }
.btn:hover { background: #2c3550; }
.btn.primary { background: #7a4f1d; border-color: #b07a33; color: #ffe9c7; font-weight: 700; }
.btn.primary:hover { background: #935f24; }
.btn.small { min-width: 0; padding: 8px 16px; font-size: 14px; text-decoration: none;
  display: inline-block; text-align: center; }
.btn-row { display: flex; gap: 10px; margin-top: 4px; }

#scen-list, #trinket-list { display: flex; flex-direction: column; gap: 10px; width: min(560px, 92vw); }
.scen { display: flex; flex-direction: column; gap: 3px; text-align: left; background: #1a2030;
  border: 1px solid #333d58; border-radius: 12px; padding: 12px 16px; cursor: pointer; color: inherit; }
.scen:hover { border-color: #b07a33; }
.scen.sel { border-color: #ffd9a0; background: #242c42; }
.scen-name { font-size: 17px; font-weight: 700; color: #ffd9a0; }
.scen-desc { font-size: 13.5px; color: #a9b1c7; line-height: 1.45; }
.scen-best { font-size: 12px; color: #6f7d9e; }

/* settings */
.set-box { width: min(520px, 92vw); background: #1a2030; border: 1px solid #333d58;
  border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 18px; }
.set-row { display: flex; flex-direction: column; gap: 8px; }
.set-lbl { font-size: 15px; color: #ffd9a0; }
.set-lbl b { color: #ffe9c7; }
.set-hint { font-size: 12.5px; color: #8f96ad; line-height: 1.5; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 90px; background: #232a3d; color: #e8e4d8;
  border: 1px solid #3a4460; border-radius: 8px; padding: 9px 10px; font-size: 14px; cursor: pointer; }
.seg button.sel { background: #7a4f1d; border-color: #b07a33; color: #ffe9c7; font-weight: 700; }
.set-row.check { flex-direction: row; align-items: center; gap: 10px; font-size: 14.5px;
  cursor: pointer; }
.set-row.check input { width: 18px; height: 18px; accent-color: #b07a33; }
#rng-sens { width: 100%; accent-color: #b07a33; min-height: 24px; }

.help-box { width: min(640px, 92vw); background: #1a2030; border: 1px solid #333d58;
  border-radius: 12px; padding: 18px 20px; line-height: 1.55; font-size: 14.5px; }
.help-box h3 { color: #ffd9a0; margin: 10px 0 4px; font-size: 15px; }
.help-box .tip { color: #a9b1c7; font-style: italic; }

/* ------------------------------- HUD ------------------------------- */
#game-ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#touch-layer { position: absolute; inset: 0; pointer-events: auto; }
#hud-vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(190, 30, 20, 0.55) 100%);
  transition: opacity 0.25s; }
#hud-vignette.flash { animation: dmg 0.3s; }
@keyframes dmg { 0% { box-shadow: inset 0 0 120px rgba(255, 40, 20, 0.8); } 100% { box-shadow: none; } }
#crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 26px; color: rgba(255, 233, 199, 0.9); text-shadow: 0 0 4px #000; }
#hud-hitmark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 20px; color: #fff; text-shadow: 0 0 4px #000; }
#hud-hitmark.head { color: #ffd35e; font-size: 24px; }
#hud-hitmark.anim { animation: hit 0.14s; }
@keyframes hit { from { transform: translate(-50%, -50%) scale(1.5); } }

.hud-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 16px;
  display: flex; align-items: center; gap: 14px; }
#hud-round { font-size: 34px; font-weight: 800; color: #ff9d47;
  text-shadow: 0 0 14px rgba(255, 120, 40, 0.6); min-width: 40px; }
#hud-embers { font-size: 20px; font-weight: 700; color: #ffe9c7; text-shadow: 0 0 6px #000; }
#hud-power { font-size: 11px; color: #ff7d6e; border: 1px solid #ff7d6e; padding: 2px 7px;
  border-radius: 6px; opacity: 0.85; }
#hud-tonics { display: flex; gap: 5px; }
.tonic-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); }

.hud-btns { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 14px;
  display: flex; gap: 8px; }
.hud-btns button { pointer-events: auto; background: rgba(26, 32, 48, 0.7); color: #e8e4d8;
  border: 1px solid #3a4460; border-radius: 9px; font-size: 17px; padding: 6px 10px; cursor: pointer; }

.hud-bottom { position: absolute; right: 18px; bottom: 24px;
  text-align: right; text-shadow: 0 0 6px #000; }
body.touch .hud-bottom { right: auto; left: 50%; transform: translateX(-50%);
  bottom: max(18px, env(safe-area-inset-bottom)); text-align: center; }
#hud-weapon { font-size: 14px; color: #a9b1c7; }
#hud-ammo { font-size: 26px; font-weight: 800; color: #ffe9c7; }
#hud-ammo.low { color: #ff7d6e; }

#hud-prompt { position: absolute; left: 50%; bottom: 34%; transform: translateX(-50%);
  background: rgba(12, 15, 26, 0.82); border: 1px solid #b07a33; color: #ffe9c7;
  padding: 9px 18px; border-radius: 10px; font-size: 15.5px; white-space: nowrap; max-width: 92vw; }
#hud-charge { position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  color: #9fd8ff; font-size: 16px; text-shadow: 0 0 8px #000; }
#hud-toast { position: absolute; left: 50%; top: max(58px, calc(env(safe-area-inset-top) + 48px));
  transform: translateX(-50%); background: rgba(26, 32, 48, 0.88); border: 1px solid #3a4460;
  padding: 9px 16px; border-radius: 10px; font-size: 14.5px; max-width: 88vw; text-align: center; }
#hud-banner { position: absolute; left: 50%; top: 30%; transform: translateX(-50%);
  font-size: clamp(22px, 5vw, 34px); font-weight: 800; color: #9fd8ff; letter-spacing: 0.12em;
  text-shadow: 0 0 18px rgba(110, 203, 255, 0.7); }
#hud-banner.pop { animation: pop 0.5s; }
@keyframes pop { 0% { transform: translateX(-50%) scale(1.6); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
/* kill-chain ladder tiers: ember → blaze → inferno → legendary gold */
#hud-banner.tier1 { color: #ffd6a0; text-shadow: 0 0 16px rgba(255, 190, 110, 0.7); }
#hud-banner.tier2 { color: #ffb35e; text-shadow: 0 0 20px rgba(255, 150, 60, 0.85); }
#hud-banner.tier3 { color: #ff8b3d; text-shadow: 0 0 26px rgba(255, 120, 40, 0.95); font-size: clamp(26px, 6vw, 40px); }
#hud-banner.tier4 { color: #ffd54d; text-shadow: 0 0 34px rgba(255, 213, 77, 1); font-size: clamp(30px, 7vw, 46px); }
/* active-effect chips (insta-kill / double embers / locker sale) */
#hud-status { background: rgba(26, 32, 48, 0.8); border: 1px solid #4a4030;
  color: #ffd54d; padding: 4px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 700;
  letter-spacing: 0.04em; white-space: pre; }
/* golden pulse for top celebration tiers */
#hud-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255, 213, 77, 0.32) 0%, rgba(255, 150, 50, 0.12) 45%, transparent 75%); }
#hud-flash.anim { animation: goldflash 0.7s; }
@keyframes goldflash { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
#hud-ammo.warn { color: #ffc25e; }
/* wisp-round splash tint (round number goes spectral) */
#hud-splash.wisp { color: rgba(120, 216, 255, 0.9); text-shadow: 0 0 60px rgba(110, 203, 255, 0.8); }
#hud-splash { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  font-size: clamp(90px, 22vw, 180px); font-weight: 900; color: rgba(255, 90, 40, 0.85);
  text-shadow: 0 0 60px rgba(255, 90, 40, 0.7); pointer-events: none; }
#hud-splash.anim { animation: splash 2.4s forwards; }
@keyframes splash { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; } 100% { opacity: 0; } }

/* ----------------------------- touch controls ----------------------------- */
#stick { position: absolute; width: 120px; height: 120px; border-radius: 50%;
  border: 2px solid rgba(255, 233, 199, 0.25); background: rgba(26, 32, 48, 0.3);
  left: 40px; bottom: 60px; display: none; pointer-events: none; }
#stick.on { border-color: rgba(255, 233, 199, 0.5); }
#stick-knob { position: absolute; left: 50%; top: 50%; margin: -26px 0 0 -26px; width: 52px;
  height: 52px; border-radius: 50%; background: rgba(255, 233, 199, 0.35); }
.tbtn { position: absolute; pointer-events: auto; display: none; align-items: center;
  justify-content: center; border-radius: 50%; border: 2px solid rgba(255, 233, 199, 0.35);
  background: rgba(26, 32, 48, 0.55); color: #ffe9c7; font-size: 24px; }
body.touch #stick, body.touch .tbtn { display: flex; }
body.touch .tbtn.hidden { display: none; }
#btn-fire { right: 26px; bottom: 88px; width: 92px; height: 92px; font-size: 40px;
  background: rgba(122, 79, 29, 0.55); border-color: rgba(255, 180, 90, 0.55); }
#btn-fire svg { width: 46px; height: 46px; } /* shared family FIRE reticle (games/CLAUDE.md rule 7) */
#btn-reload { right: 132px; bottom: 40px; width: 58px; height: 58px; }
#btn-swap { right: 30px; bottom: 200px; width: 58px; height: 58px; }
#btn-interact { right: 148px; bottom: 130px; width: 64px; height: 64px; }
#btn-interact.lit { background: rgba(176, 122, 51, 0.75); border-color: #ffd9a0; }
#btn-melee { right: 108px; bottom: 210px; width: 56px; height: 56px; }
#btn-grenade { left: 40px; bottom: 200px; width: 56px; height: 56px; }
#btn-trinket { left: 116px; bottom: 210px; width: 52px; height: 52px; }
#btn-trinket.spent { opacity: 0.35; }
#hud-pots { font-size: 16px; color: #ffd9a0; text-shadow: 0 0 6px #000; }

/* left-handed touch layout: action cluster on the left, stick zone on the right */
body.lefty #btn-fire { right: auto; left: 26px; }
body.lefty #btn-reload { right: auto; left: 132px; }
body.lefty #btn-swap { right: auto; left: 30px; }
body.lefty #btn-interact { right: auto; left: 148px; }
body.lefty #btn-melee { right: auto; left: 108px; }
body.lefty #btn-grenade { left: auto; right: 40px; }
body.lefty #btn-trinket { left: auto; right: 116px; }

/* ------------------------------- overlay ------------------------------- */
#overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center;
  justify-content: center; background: rgba(6, 8, 14, 0.72); }
.panel { background: #1a2030; border: 1px solid #3a4460; border-radius: 16px;
  padding: 28px 30px; display: flex; flex-direction: column; gap: 12px; align-items: center;
  width: min(440px, 92vw); text-align: center; }
.panel h2 { color: #ffd9a0; font-size: 24px; }
.ov-sub { color: #a9b1c7; font-size: 15px; }
.ov-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin: 6px 0;
  font-size: 13.5px; color: #a9b1c7; }
.ov-stats div { display: flex; flex-direction: column; gap: 2px; }
.ov-stats b { color: #ffe9c7; font-size: 19px; }

#loading { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  gap: 14px; align-items: center; justify-content: center; background: #0c0f1a;
  color: #8f96ad; font-size: 16px; }
#loadbar { width: min(320px, 70vw); height: 8px; border-radius: 4px; overflow: hidden;
  background: #1a2030; border: 1px solid #333d58; }
#loadbar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #b07a33, #ffd9a0);
  transition: width 0.15s; }
#loadnote { font-size: 12px; color: #565f78; }

@media (max-width: 700px) {
  .btn { min-width: 170px; font-size: 15px; padding: 10px 20px; }
  #hud-round { font-size: 26px; }
  #hud-embers { font-size: 17px; }
}

.ov-leave { color: #8fa0c4; font-size: 13px; text-decoration: none; margin-top: 4px; display: inline-block; }
.ov-leave:hover { color: #fff; }
