:root {
  color-scheme: dark;
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  --ink: #f6f1dc;
  --muted: rgba(246, 241, 220, .66);
  --lime: #d8ef85;
  --deep: #071f2e;
  --glass: rgba(5, 28, 39, .66);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #071f2e; color: var(--ink); }
button { font: inherit; }

.game-shell { position: relative; width: 100%; height: 100%; min-height: 560px; isolation: isolate; overflow: hidden; }
#lake { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.game-shell::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(2, 16, 25, .15) 0%, transparent 38%, rgba(1, 12, 20, .42) 100%);
}

.topbar { position: absolute; inset: max(22px, env(safe-area-inset-top)) 28px auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 11px; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.26); border-radius: 50%; color: var(--lime); font-size: 26px; background: rgba(3,25,35,.35); backdrop-filter: blur(10px); }
.brand div, .weather div { display: flex; flex-direction: column; }
.brand strong { font-size: .92rem; font-weight: 800; }
.brand span:last-child { margin-top: 2px; color: var(--muted); font-size: .7rem; letter-spacing: .01em; }

.stats { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid rgba(255,255,255,.15); border-radius: 18px; background: rgba(4,29,40,.5); box-shadow: 0 12px 38px rgba(0,0,0,.13); backdrop-filter: blur(16px); }
.stats > div { min-width: 76px; padding: 4px 12px; display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,.11); }
.stats span { color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.stats strong { margin-top: 1px; font-size: 1rem; font-variant-numeric: tabular-nums; }
.icon-button, .close-button { border: 0; color: var(--ink); cursor: pointer; background: transparent; }
.icon-button { width: 38px; height: 38px; border-radius: 12px; font-size: 1.1rem; transition: .2s; }
.icon-button:hover { background: rgba(255,255,255,.1); }
.icon-button[aria-pressed="false"] { opacity: .42; text-decoration: line-through; }

.weather { position: absolute; top: 108px; right: 30px; display: flex; align-items: center; gap: 10px; text-align: right; }
.weather strong { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.weather span:last-child { color: var(--muted); font-size: .68rem; margin-top: 3px; }
.sun-dot { width: 9px; height: 9px; border-radius: 50%; background: #ffcd70; box-shadow: 0 0 16px #ffc55c; }

.guide { position: absolute; left: 50%; top: 22%; width: min(520px, calc(100% - 40px)); transform: translateX(-50%); text-align: center; transition: opacity .4s, transform .4s; pointer-events: none; text-shadow: 0 2px 20px rgba(0,0,0,.3); }
.guide.hidden { opacity: 0; transform: translate(-50%, -16px); }
.guide > span, .catch-kicker { color: var(--lime); font-size: .68rem; font-weight: 800; letter-spacing: .18em; }
.guide h1 { margin: 10px 0 8px; font-size: clamp(1.9rem, 5vw, 3.8rem); line-height: 1.06; letter-spacing: -.045em; }
.guide p { max-width: 460px; margin: auto; color: rgba(255,255,255,.78); font-size: clamp(.84rem, 1.5vw, 1rem); line-height: 1.65; }

.controls { position: absolute; left: 50%; bottom: max(66px, calc(env(safe-area-inset-bottom) + 54px)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.primary-button { position: relative; min-width: 218px; min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 22px; border: 1px solid rgba(255,255,255,.38); border-radius: 999px; color: #0a2932; background: var(--lime); box-shadow: 0 12px 42px rgba(0,0,0,.25), inset 0 1px rgba(255,255,255,.55); cursor: pointer; transition: transform .18s, filter .18s, background .25s; touch-action: none; }
.primary-button:hover { transform: translateY(-2px); filter: brightness(1.05); }
.primary-button:active, .primary-button.active { transform: translateY(1px) scale(.98); }
.primary-button.bite { background: #ffcf68; animation: bitePulse .55s infinite alternate; }
.primary-button.danger { background: #ff8d76; }
.primary-button:disabled { cursor: default; filter: saturate(.4); opacity: .8; }
.button-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(4,40,47,.24); border-radius: 50%; font-size: 1.45rem; }
.primary-button > span:last-child { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.primary-button b { font-size: .82rem; letter-spacing: .1em; }
.primary-button small { margin-top: 4px; font-size: .65rem; opacity: .62; }
.controls p { margin: 0; color: rgba(255,255,255,.56); font-size: .67rem; }
kbd { padding: 3px 6px; border: 1px solid rgba(255,255,255,.26); border-radius: 5px; font: 600 .6rem inherit; background: rgba(4,28,38,.45); }
@keyframes bitePulse { to { transform: translateY(-3px) scale(1.025); box-shadow: 0 15px 52px rgba(255,198,81,.3); } }

.fight-panel { position: absolute; left: 50%; bottom: 164px; width: min(460px, calc(100% - 36px)); padding: 14px 16px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 17px; background: var(--glass); backdrop-filter: blur(16px); box-shadow: 0 18px 50px rgba(0,0,0,.18); transform: translate(-50%, 18px); opacity: 0; pointer-events: none; transition: .3s; }
.fight-panel.visible { transform: translate(-50%, 0); opacity: 1; }
.fight-heading, .fight-meta { display: flex; align-items: center; justify-content: space-between; }
.fight-heading span { color: var(--muted); font-size: .64rem; font-weight: 700; letter-spacing: .12em; }
.fight-heading strong { color: var(--lime); font-size: .7rem; }
.tension-track { position: relative; height: 10px; margin: 10px 0 9px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,.13); }
.safe-zone { position: absolute; left: 35%; width: 32%; inset-block: 0; background: rgba(216,239,133,.16); border-inline: 1px solid rgba(216,239,133,.5); }
.tension-fill { height: 100%; width: 35%; border-radius: inherit; background: linear-gradient(90deg, #79d8bc, #d8ef85); transition: width .08s linear, background .2s; }
.tension-fill.hot { background: linear-gradient(90deg, #ffcf68, #ff776f); }
.fight-meta { color: var(--muted); font-size: .66rem; }
.fight-meta b { margin-left: 3px; color: var(--ink); font-variant-numeric: tabular-nums; }

.toast { position: absolute; left: 50%; top: 45%; padding: 10px 16px; border-radius: 99px; color: var(--ink); background: rgba(2,25,34,.72); backdrop-filter: blur(10px); font-size: .78rem; font-weight: 600; opacity: 0; transform: translate(-50%, 10px); transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.catch-card { position: absolute; left: 50%; top: 50%; width: min(370px, calc(100% - 36px)); padding: 28px; border: 1px solid rgba(255,255,255,.22); border-radius: 28px; color: var(--ink); text-align: center; background: rgba(5,32,43,.9); box-shadow: 0 28px 90px rgba(0,0,0,.45); backdrop-filter: blur(22px); opacity: 0; visibility: hidden; transform: translate(-50%, -46%) scale(.94); transition: .35s cubic-bezier(.2,.8,.2,1); }
.catch-card.visible { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.close-button { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; font-size: 1.5rem; opacity: .7; }
.close-button:hover { background: rgba(255,255,255,.08); }
.fish-illustration { margin: 14px auto 2px; font-size: 5rem; filter: drop-shadow(0 12px 14px rgba(0,0,0,.3)); animation: fishFloat 2s ease-in-out infinite alternate; }
@keyframes fishFloat { to { transform: translateY(-6px) rotate(-3deg); } }
.catch-card h2 { margin: 4px 0; font-size: 1.75rem; letter-spacing: -.04em; }
.catch-card p { margin: 0 0 20px; color: var(--muted); font-size: .84rem; }
.again-button { width: 100%; padding: 14px; border: 0; border-radius: 14px; color: #0b2831; background: var(--lime); font-size: .78rem; font-weight: 800; letter-spacing: .1em; cursor: pointer; }

footer { position: absolute; left: 28px; right: 28px; bottom: max(20px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; color: rgba(255,255,255,.45); font-size: .62rem; letter-spacing: .04em; }

@media (max-width: 650px) {
  .game-shell { min-height: 500px; }
  .topbar { inset-inline: 16px; top: max(14px, env(safe-area-inset-top)); }
  .brand span:last-child, .weather, .stats span { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .stats > div { min-width: 55px; padding-inline: 8px; }
  .guide { top: 18%; }
  .guide p { max-width: 330px; }
  .controls { bottom: max(55px, calc(env(safe-area-inset-bottom) + 45px)); }
  .fight-panel { bottom: 150px; }
  .primary-button { min-height: 58px; min-width: 200px; }
  #keyboardHint { display: none; }
  footer { left: 16px; right: 16px; }
  footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
