/* ==========================================================================
   Fishing Hunter — game shell styles
   Scoped with .fh-* so the shared site stylesheet can't reach in and neither
   can we reach out.
   ========================================================================== */

:root {
  --fh-ink:        #eaf4ff;
  --fh-ink-dim:    #9db4cc;
  --fh-gold:       #ffd24a;
  --fh-gold-soft:  #ffe9a3;
  --fh-cyan:       #6fd7ff;
  --fh-red:        #ff6a6a;
  --fh-green:      #6ef0b0;
  --fh-panel:      rgba(9, 20, 34, 0.88);
  --fh-panel-line: rgba(140, 200, 255, 0.18);
  --fh-chip:       rgba(6, 16, 28, 0.55);
  --fh-radius:     14px;
  --fh-font:       'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --fh-safe-t:     env(safe-area-inset-top, 0px);
  --fh-safe-b:     env(safe-area-inset-bottom, 0px);
  --fh-safe-l:     env(safe-area-inset-left, 0px);
  --fh-safe-r:     env(safe-area-inset-right, 0px);
}

/* Defensive: if the native `hidden` attribute is ever used, no later class
   rule (e.g. a `display:flex` utility) should be able to silently override
   it and turn an overlay into an invisible click-blocker. */
[hidden] { display: none !important; }

html, body.fh-body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #061426;
  color: var(--fh-ink);
  font-family: var(--fh-font);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* --------------------------------------------------------------------------
   Shared site header (injected by /js/layout.js from /partials/header.html).
   /css/styles.css also styles it; these rules load after and deliberately
   override, so the header reads as part of the game rather than the site chrome.
   Visible on the menu, hidden during play.
   -------------------------------------------------------------------------- */
.fh-site-header {
  position: relative;
  z-index: 40;
  font-size: 13px;
}
.fh-site-header header {
  padding: 10px calc(16px + var(--fh-safe-r)) 10px calc(16px + var(--fh-safe-l));
  padding-top: calc(10px + var(--fh-safe-t));
  background: rgba(4, 12, 22, .72);
  border-bottom: 1px solid var(--fh-panel-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.fh-site-header nav { gap: 10px; flex-wrap: wrap; }
.fh-site-header a {
  color: var(--fh-ink-dim);
  text-decoration: none;
  padding: 5px 9px;
  border-radius: 8px;
  transition: color .2s ease, background .2s ease;
}
.fh-site-header a:hover { color: var(--fh-ink); background: rgba(255,255,255,.07); }
.fh-site-header a.active { color: var(--fh-gold); background: rgba(255,210,74,.12); }
.fh-site-header #onlineCount { color: rgba(157,180,204,.75); white-space: nowrap; }
.fh-site-header #authStatus { color: var(--fh-ink-dim); }

body:has(.fh-root.is-playing) .fh-site-header,
body:has(.fh-root.is-playing) #footer { display: none; }

@media (max-width: 640px) {
  .fh-site-header #onlineCount { display: none; }
  .fh-site-header { font-size: 12px; }
}

.fh-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.fh-stage { position: absolute; inset: 0; }
.fh-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* --------------------------------------------------------------------------
   HUD
   -------------------------------------------------------------------------- */
.fh-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity .25s ease;
}
.fh-root.is-playing .fh-hud { opacity: 1; }
.fh-hud > * { pointer-events: none; }
.fh-hud button { pointer-events: auto; }

.fh-hud-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: calc(12px + var(--fh-safe-t)) calc(14px + var(--fh-safe-r)) 0 calc(14px + var(--fh-safe-l));
}

.fh-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--fh-chip);
  border: 1px solid var(--fh-panel-line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
  font-variant-numeric: tabular-nums;
}
.fh-chip-label { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--fh-ink-dim); }
.fh-chip-value { font-size: 22px; font-weight: 800; letter-spacing: .01em; }
.fh-chip-unit  { font-size: 12px; font-weight: 700; color: var(--fh-gold); }

.fh-chip-balance .fh-chip-value { color: var(--fh-gold); text-shadow: 0 0 18px rgba(255,210,74,.35); }
.fh-root.is-cash .fh-chip-balance { border-color: rgba(255,210,74,.45); }

.fh-hud-top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fh-biome {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--fh-chip);
  border: 1px solid var(--fh-panel-line);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fh-ink-dim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.fh-icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  border: 1px solid var(--fh-panel-line);
  background: var(--fh-chip);
  color: var(--fh-ink);
  font-size: 17px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .12s ease, background .2s ease;
}
.fh-icon-btn:hover { background: rgba(30, 70, 110, .7); }
.fh-icon-btn:active { transform: scale(.93); }

/* combo + announcements ---------------------------------------------------- */
.fh-combo {
  position: absolute;
  top: 84px; left: 50%;
  transform: translateX(-50%);
  font-weight: 900;
  letter-spacing: .06em;
  font-size: calc(20px + var(--combo, 2) * 1.6px);
  color: var(--fh-gold);
  text-shadow: 0 2px 14px rgba(0,0,0,.7), 0 0 26px rgba(255,210,74,.55);
  opacity: 0;
  transition: opacity .2s ease;
}
.fh-combo.is-show { opacity: 1; }
.fh-combo.is-pop { animation: fh-pop .26s cubic-bezier(.2,1.6,.4,1); }
@keyframes fh-pop {
  0%   { transform: translateX(-50%) scale(.7); }
  60%  { transform: translateX(-50%) scale(1.18); }
  100% { transform: translateX(-50%) scale(1); }
}

.fh-announce {
  position: absolute;
  top: 38%; left: 50%;
  transform: translate(-50%, -50%) scale(.9);
  font-weight: 900;
  font-size: clamp(22px, 5vw, 46px);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fh-ink);
  text-shadow: 0 4px 26px rgba(0,0,0,.8);
  opacity: 0;
  white-space: nowrap;
  transition: opacity .3s ease, transform .3s ease;
}
.fh-announce.is-show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.fh-announce.is-biome  { color: var(--fh-cyan);  text-shadow: 0 4px 26px rgba(0,0,0,.8), 0 0 40px rgba(111,215,255,.5); }
.fh-announce.is-event  { color: var(--fh-gold-soft); }
.fh-announce.is-boss   { color: #ff8a5c; text-shadow: 0 4px 26px rgba(0,0,0,.8), 0 0 46px rgba(255,110,60,.6); }
.fh-announce.is-jackpot{ color: var(--fh-gold); text-shadow: 0 4px 26px rgba(0,0,0,.9), 0 0 60px rgba(255,210,74,.85); }
.fh-announce.is-warn   { color: var(--fh-red); font-size: clamp(18px, 3.4vw, 30px); }

/* lock-on reticle ---------------------------------------------------------- */
.fh-target {
  position: fixed;
  top: 0; left: 0;
  opacity: 0;
  transition: opacity .15s ease;
  border: 2px solid var(--tint, #6fd7ff);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(111,215,255,.45), inset 0 0 18px rgba(111,215,255,.25);
  animation: fh-spin 4s linear infinite;
  clip-path: polygon(0 0, 32% 0, 32% 6%, 6% 6%, 6% 32%, 0 32%,
                     100% 0, 68% 0, 68% 6%, 94% 6%, 94% 32%, 100% 32%,
                     100% 100%, 68% 100%, 68% 94%, 94% 94%, 94% 68%, 100% 68%,
                     0 100%, 32% 100%, 32% 94%, 6% 94%, 6% 68%, 0 68%);
}
@keyframes fh-spin { to { rotate: 360deg; } }

/* floating text ------------------------------------------------------------ */
.fh-floats { position: fixed; inset: 0; }
.fh-float {
  position: fixed;
  top: 0; left: 0;
  transform: translate(calc(var(--x) - 50%), calc(var(--y) - 50%)) scale(var(--scale, 1));
  font-weight: 900;
  font-size: 22px;
  color: var(--fh-gold);
  text-shadow: 0 2px 8px rgba(0,0,0,.85), 0 0 16px rgba(255,210,74,.45);
  white-space: nowrap;
  will-change: transform, opacity;
}
.fh-float.is-big     { color: var(--fh-gold-soft); font-size: 30px; }
.fh-float.is-jackpot { color: #fff2c0; font-size: 36px; text-shadow: 0 2px 12px rgba(0,0,0,.9), 0 0 34px rgba(255,210,74,.95); }

.fh-fps {
  position: absolute;
  left: calc(16px + var(--fh-safe-l));
  top: calc(66px + var(--fh-safe-t));
  font-size: 10px;
  color: rgba(160, 190, 220, .35);
  font-variant-numeric: tabular-nums;
}

/* bottom bar --------------------------------------------------------------- */
.fh-hud-bottom {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 0 calc(14px + var(--fh-safe-r)) calc(14px + var(--fh-safe-b)) calc(14px + var(--fh-safe-l));
  flex-wrap: wrap;
}

.fh-bet {
  display: flex;
  align-items: stretch;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--fh-panel-line);
  background: var(--fh-chip);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.fh-bet-btn {
  width: 46px;
  border: 0;
  background: rgba(255,255,255,.05);
  color: var(--fh-ink);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease;
}
.fh-bet-btn:hover:not(:disabled) { background: rgba(111,215,255,.22); }
.fh-bet-btn:disabled { opacity: .3; cursor: not-allowed; }
.fh-bet-mid { padding: 6px 16px; text-align: center; min-width: 74px; }
.fh-bet-label { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--fh-ink-dim); }
.fh-bet-value { display: block; font-size: 22px; font-weight: 800; color: var(--fh-gold); font-variant-numeric: tabular-nums; }

.fh-weapons { display: flex; gap: 8px; flex-wrap: wrap; }
.fh-weapon {
  min-width: 74px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--fh-panel-line);
  background: var(--fh-chip);
  color: var(--fh-ink-dim);
  cursor: pointer;
  display: grid;
  gap: 1px;
  justify-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .12s ease, border-color .2s ease, color .2s ease, background .2s ease;
}
.fh-weapon:active { transform: scale(.95); }
.fh-weapon-icon { font-size: 17px; line-height: 1; }
.fh-weapon-name { font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.fh-weapon-cost { font-size: 10px; opacity: .65; font-variant-numeric: tabular-nums; }
.fh-weapon.is-active {
  color: #061426;
  background: linear-gradient(160deg, var(--fh-gold-soft), var(--fh-gold));
  border-color: rgba(255,210,74,.7);
  box-shadow: 0 6px 22px rgba(255,210,74,.28);
}
.fh-weapon.is-poor { opacity: .38; }

.fh-toggles { display: flex; gap: 8px; margin-left: auto; }
.fh-toggle {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--fh-panel-line);
  background: var(--fh-chip);
  color: var(--fh-ink-dim);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color .2s ease, border-color .2s ease;
}
.fh-toggle-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,.22);
  transition: background .2s ease, box-shadow .2s ease;
}
.fh-toggle.is-on { color: var(--fh-green); border-color: rgba(110,240,176,.45); }
.fh-toggle.is-on .fh-toggle-dot { background: var(--fh-green); box-shadow: 0 0 12px rgba(110,240,176,.8); }

/* --------------------------------------------------------------------------
   Screens
   -------------------------------------------------------------------------- */
.fh-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 20px;
  background: radial-gradient(120% 90% at 50% 20%, rgba(6,20,38,.55), rgba(3,9,18,.92));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow: auto;
}
.fh-screen.is-open { display: grid; animation: fh-fade .25s ease; }
@keyframes fh-fade { from { opacity: 0; } to { opacity: 1; } }

.fh-panel {
  position: relative;
  width: min(560px, 100%);
  padding: 30px 30px 26px;
  border-radius: 20px;
  background: var(--fh-panel);
  border: 1px solid var(--fh-panel-line);
  box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.06);
  text-align: center;
  animation: fh-rise .3s cubic-bezier(.2,.9,.3,1);
}
@keyframes fh-rise { from { transform: translateY(14px); opacity: 0; } }
.fh-panel-narrow { width: min(400px, 100%); }
.fh-panel-wide   { width: min(940px, 100%); text-align: left; }

.fh-logo {
  margin: 0 0 6px;
  font-size: clamp(34px, 7vw, 54px);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1;
  background: linear-gradient(160deg, #ffffff, #9fd8ff 45%, #ffd24a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.fh-logo span { display: block; color: transparent; }
.fh-tagline { margin: 0 0 24px; color: var(--fh-ink-dim); font-size: 14px; }
.fh-h2 { margin: 0 0 16px; font-size: 26px; font-weight: 800; }
.fh-h3 { margin: 20px 0 8px; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--fh-cyan); }
.fh-body { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: var(--fh-ink); }
.fh-muted { color: var(--fh-ink-dim); }
.fh-note { min-height: 18px; margin: 10px 0 0; font-size: 12px; color: var(--fh-ink-dim); }
.fh-fineprint { margin: 22px 0 0; font-size: 11px; color: rgba(157,180,204,.6); }

.fh-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.fh-actions-stack { flex-direction: column; }
.fh-actions-secondary { margin-top: 14px; }

.fh-btn {
  padding: 14px 26px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.fh-btn:active { transform: scale(.97); }
.fh-btn-primary {
  background: linear-gradient(160deg, #7ee0ff, #2f9fe0);
  color: #04121f;
  box-shadow: 0 10px 28px rgba(47,159,224,.35);
}
.fh-btn-primary:hover { box-shadow: 0 14px 36px rgba(47,159,224,.5); }
.fh-btn-cash {
  background: linear-gradient(160deg, var(--fh-gold-soft), var(--fh-gold));
  color: #241a00;
  box-shadow: 0 10px 28px rgba(255,210,74,.3);
}
.fh-btn-ghost {
  background: rgba(255,255,255,.05);
  border-color: var(--fh-panel-line);
  color: var(--fh-ink);
}
.fh-btn-ghost:hover { background: rgba(255,255,255,.1); }
.fh-btn.is-disabled, .fh-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

/* Sound toggle in the pause overlay — mirrors the HUD mute icon's state. */
.fh-btn-sound[aria-pressed="true"] {
  color: var(--fh-red);
  border-color: rgba(255,106,106,.4);
  background: rgba(255,106,106,.08);
}

.fh-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--fh-panel-line);
  background: rgba(255,255,255,.05);
  color: var(--fh-ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.fh-close:hover { background: rgba(255,255,255,.12); }

.fh-list { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.85; color: var(--fh-ink-dim); }
.fh-list b { color: var(--fh-ink); }

.fh-help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }

/* paytable ----------------------------------------------------------------- */
.fh-paytable { max-height: 52vh; overflow: auto; padding-right: 6px; }
.fh-pt-tier {
  margin: 14px 0 8px;
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--tint, var(--fh-ink-dim));
}
.fh-pt-grid { display: grid; gap: 6px; }
.fh-pt-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.035);
}
.fh-pt-img {
  width: 40px; height: 40px;
  /* every sheet is a 3x3 grid — show the top-left cell only */
  background-size: 300% 300%;
  background-position: 0 0;
  background-repeat: no-repeat;
}
.fh-pt-name { font-size: 13px; font-weight: 600; }
.fh-pt-mult { font-size: 14px; font-weight: 800; color: var(--fh-gold); font-variant-numeric: tabular-nums; }

/* progress ----------------------------------------------------------------- */
.fh-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
  margin-top: 18px;
}
.fh-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6fd7ff, #ffd24a);
  transition: width .2s ease;
}
.fh-progress-pct { margin: 8px 0 0; font-size: 12px; color: var(--fh-ink-dim); font-variant-numeric: tabular-nums; }

/* summary ------------------------------------------------------------------ */
.fh-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0 0 22px;
  text-align: left;
}
.fh-stat {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
}
.fh-stat-label { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--fh-ink-dim); }
.fh-stat-value { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fh-stat-value.is-up { color: var(--fh-green); }
.fh-stat-value.is-down { color: var(--fh-red); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .fh-help-cols { grid-template-columns: 1fr; gap: 12px; }
  .fh-panel { padding: 24px 20px 20px; }
}

@media (max-width: 640px) {
  .fh-chip-value { font-size: 18px; }
  .fh-chip { padding: 7px 11px; gap: 6px; }
  .fh-chip-score { display: none; }
  .fh-biome { display: none; }

  .fh-hud-bottom { gap: 8px; }
  .fh-bet-btn { width: 40px; font-size: 19px; }
  .fh-bet-mid { min-width: 58px; padding: 5px 10px; }
  .fh-bet-value { font-size: 18px; }

  .fh-weapons { order: 3; width: 100%; justify-content: space-between; }
  .fh-weapon { min-width: 0; flex: 1; padding: 7px 4px; }
  .fh-weapon-name { font-size: 10px; }
  .fh-toggles { margin-left: auto; }
  .fh-toggle { padding: 9px 11px; font-size: 11px; }

  .fh-stats { grid-template-columns: 1fr; }
  .fh-combo { top: 68px; }
}

/* Landscape phones: the bottom bar must not eat the playfield. */
@media (max-height: 460px) and (orientation: landscape) {
  .fh-hud-bottom { padding-bottom: calc(8px + var(--fh-safe-b)); }
  .fh-weapon { padding: 5px 8px; }
  .fh-weapon-name { display: none; }
  .fh-hud-top { padding-top: calc(8px + var(--fh-safe-t)); }
}

@media (prefers-reduced-motion: reduce) {
  .fh-target { animation: none; }
  .fh-panel, .fh-screen { animation: none; }
  .fh-combo.is-pop { animation: none; }
}
