/* FISHING HELL — page styles. The UI colours shift with the current stage (body[data-stage]). */
:root {
  --bg: #0b1d2e;
  --bg2: #10283e;
  --panel: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .1);
  --ink: #f2f8fc;
  --muted: #9db8cc;
  --accent: #7fd0ff;
  --alert: #ff6a5a;
  --good: #8ff0ae;
  --gold: #ffd24d;
  --font-display: "Dela Gothic One", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --font-body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  color-scheme: dark;
}
body[data-stage="swamp"] { --bg: #12160c; --bg2: #1c2414; --accent: #c8d890; --muted: #a8b296; }
body[data-stage="lava"]  { --bg: #160806; --bg2: #2a100a; --accent: #ffa060; --muted: #c8a898; }
body[data-stage="hell"]  { --bg: #0c0310; --bg2: #1e0818; --accent: #ff7a9a; --muted: #b898ac; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%) fixed, var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  padding-block: 12px 28px;
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
  display: flex; justify-content: center;
  transition: background-color .6s;
}
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 680px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: 1.55rem; margin: 0; letter-spacing: .03em; }
h1 span { color: var(--alert); text-shadow: 0 0 14px rgba(255, 90, 60, .45); }
.hud { display: flex; gap: 6px; align-items: stretch; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px 10px; display: flex; flex-direction: column; align-items: center; min-width: 54px; }
.stat small { font-size: .68rem; color: var(--muted); }
.stat b { font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat.hot b { color: var(--gold); text-shadow: 0 0 10px rgba(255, 210, 77, .6); }
.stat.coin b { color: var(--gold); }
#mute { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 0 10px; font-size: 1.1rem; cursor: pointer; }
#mute:focus-visible, .tab:focus-visible, .item button:focus-visible { outline: 3px solid var(--good); outline-offset: 2px; }

/* stage tabs */
.stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tab {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0;
  transition: background .2s, border-color .2s, transform .1s;
}
.tab:hover:not(:disabled) { background: rgba(255, 255, 255, .1); }
.tab:active:not(:disabled) { transform: scale(.97); }
.tab .no { font-family: var(--font-display); font-size: .62rem; color: var(--muted); letter-spacing: .05em; }
.tab .nm { font-weight: 700; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab .lk { font-size: .62rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.tab.on .no { color: var(--accent); }
.tab:disabled { cursor: default; }
.tab.locked { opacity: .5; }
.tab:disabled:not(.on):not(.locked) { opacity: .6; }

/* canvas stage */
#stage {
  position: relative; height: clamp(400px, 68vh, 620px); border-radius: 16px; overflow: hidden;
  background: #0a2d5a; touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
#stage:focus-visible { outline: 3px solid var(--good); outline-offset: 3px; }
canvas { display: block; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; }

#msg { min-height: 3.1em; text-align: center; font-size: 1rem; line-height: 1.5; display: flex; align-items: center; justify-content: center; text-wrap: balance; padding: 0 6px; }
#msg.alert { color: var(--alert); font-family: var(--font-display); font-size: 1.3rem; }
#msg.good { color: var(--good); }

/* panels */
.panels { display: flex; flex-direction: column; gap: 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.panel h2 { margin: 0; font-size: .95rem; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.panel h2 span { color: var(--muted); font-size: .75rem; font-weight: 500; font-variant-numeric: tabular-nums; }

/* shop */
.shop { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .shop { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.item { background: rgba(0, 0, 0, .18); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.it-top { display: flex; align-items: center; gap: 6px; }
.it-top .ic { font-size: 1.15rem; }
.it-top b { font-size: .9rem; }
.pips { margin-left: auto; display: flex; gap: 3px; }
.pips i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .15); }
.pips i.f { background: var(--gold); box-shadow: 0 0 6px rgba(255, 210, 77, .6); }
.item p { margin: 0; font-size: .72rem; color: var(--muted); line-height: 1.4; flex: 1; }
.item button {
  font: inherit; font-weight: 700; font-size: .8rem; color: #1a1204; background: var(--gold); border: 0; border-radius: 8px; padding: 5px 8px; cursor: pointer;
  transition: transform .1s, filter .2s;
}
.item button:hover:not(:disabled) { filter: brightness(1.1); }
.item button:active:not(:disabled) { transform: scale(.96); }
.item button:disabled { background: rgba(255, 255, 255, .1); color: var(--muted); cursor: default; }

/* ranking */
.rank { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rank li { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: rgba(0, 0, 0, .18); font-variant-numeric: tabular-nums; }
.rank li.me { background: rgba(255, 214, 77, .2); }
.rank .pos { font-family: var(--font-display); width: 2.2em; }
.rank .pt { font-family: var(--font-display); }
.rank .meta { margin-left: auto; color: var(--muted); font-size: .75rem; text-align: right; }
.rank-empty { color: var(--muted); font-size: .85rem; margin: 0; }

/* fish book */
#book { display: flex; flex-direction: column; gap: 12px; }
.bsec h3 { margin: 0 0 6px; font-size: .8rem; color: var(--muted); font-weight: 700; }
.bsec h3 span { font-variant-numeric: tabular-nums; opacity: .8; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.cell { border-radius: 10px; padding: 6px 4px; text-align: center; background: rgba(0, 0, 0, .2); border: 1px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.cell canvas { width: 88px; height: 52px; max-width: 100%; object-fit: contain; }
.cell .q { height: 52px; display: flex; align-items: center; font-size: 1.4rem; color: rgba(255, 255, 255, .25); }
.cell .nm { font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; }
.cell .ct { font-size: .66rem; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1em; }
.cell.found { background: rgba(143, 240, 174, .08); border-color: rgba(143, 240, 174, .18); }
.cell.found .nm { color: var(--ink); font-weight: 700; }
.cell.boss { border-color: rgba(255, 210, 77, .25); }
.cell.boss.found { background: rgba(255, 210, 77, .1); border-color: rgba(255, 210, 77, .45); }
.cell.new { animation: pop .6s ease-out; }
@keyframes pop { from { transform: scale(.8); } 60% { transform: scale(1.08); } to { transform: scale(1); } }

@media (max-width: 420px) {
  h1 { font-size: 1.25rem; }
  .stat { min-width: 46px; padding: 3px 6px; }
  .tab .lk { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
