/* «Клюёт!»: ночная зимняя рыбалка. Пиксельные углы и рисунки, палитра «Пингвин, лети!», текст — читаемым шрифтом Rubik. */
:root {
  --bg: #050a2c;
  --navy: #09164a;
  --card: #0c1a55;
  --card2: #10236b;
  --line: #1d3384;
  --ice: #bfe0ff;
  --ice-hi: #f2faff;
  --soft: #c5d7f7;
  --muted: #9db1dd;
  --orange: #ff961c;
  --orange-dk: #e06a14;
  --orange-hi: #ffb45a;
  --gold: #ffc454;
  --green: #7be0b3;
  --red: #ff6a5a;
  --blue: #5496ff;
  --pix: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;     /* заголовки и числа: тот же шрифт, жирнее */
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: var(--aw-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--aw-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ice-hi); }
body {
  font: 400 16px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
img.pix, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.pix { display: inline-block; vertical-align: middle; flex: none; }
h1, h2, h3 { font-family: var(--pix); font-weight: 700; margin: 0; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 19px; line-height: 1.25; }
p { margin: 0; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.num { font-family: var(--pix); font-weight: 700; font-variant-numeric: tabular-nums; }

/* пиксельные углы: вырез ступенькой */
.notch, .card, .btn, .chip, .sheet-box, .code, .bar, .toast {
  --n: 4px;
  clip-path: polygon(0 var(--n), var(--n) var(--n), var(--n) 0, calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n), 100% calc(100% - var(--n)), calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%, var(--n) 100%, var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n)));
}

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; padding-bottom: calc(76px + var(--safe-bottom)); }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 32px 24px; min-height: 70vh; }
.spinner { width: 28px; height: 28px; background: conic-gradient(var(--orange) 0 25%, transparent 0 50%, var(--ice) 0 75%, transparent 0); animation: spin 1s steps(8) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- верхняя строка -------------------------------------------------------------------------- */
.hud {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 8px; align-items: center;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: linear-gradient(var(--bg) 70%, rgba(5, 10, 44, 0));
}
.chip { display: flex; align-items: center; gap: 7px; background: var(--card); padding: 6px 10px; min-height: 40px; border: 0; color: inherit; font: inherit; text-align: left; }
button.chip { cursor: pointer; box-shadow: inset 0 -3px 0 #08134a; }
button.chip:active { transform: translateY(1px); box-shadow: none; }
.chip .num { font-size: 16px; line-height: 1; }
.chip.level { flex: 1; min-width: 0; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px 10px 7px; }
.chip.level .row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.chip.level .lv { font-family: var(--pix); font-weight: 700; font-size: 16px; color: var(--gold); white-space: nowrap; }
.chip.level .xp { font-size: 12px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.chip.level .xpbar { display: block; }
.chip.coins .num { color: var(--gold); }
.xpbar { height: 5px; background: var(--navy); }
.xpbar { display: block; }
.xpbar i { display: block; height: 100%; background: var(--gold); }
.banner { margin: 0 16px 8px; padding: 8px 12px; background: #2a1a05; color: var(--gold); font-size: 14px; }

/* --- сцена ------------------------------------------------------------------------------------ */
.scene { position: relative; overflow: hidden; background: #050a2c; display: flex; justify-content: center; touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer; }
.scene canvas { display: block; }
.scene .badge {
  position: absolute; left: 12px; top: 10px;
  font-family: var(--pix); font-weight: 700; font-size: 14px; color: var(--navy); background: var(--gold); font-variant-numeric: tabular-nums;
  padding: 3px 8px; --n: 3px;
}
.scene .crown-note { position: absolute; right: 12px; top: 10px; font-size: 12px; color: var(--gold); }
.pull {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--pix); font-size: 22px; font-weight: 700;
  padding: 10px 22px; border: 0; cursor: pointer;
  background: var(--orange); color: var(--navy);
  box-shadow: inset 0 -5px 0 var(--orange-dk), inset 0 3px 0 var(--orange-hi);
  animation: pulse 0.5s steps(2) infinite alternate;
}
@keyframes pulse { to { transform: translate(-50%, -50%) scale(1.08); } }
.catch-pop {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center;
  background: rgba(9, 22, 74, 0.94); padding: 8px 12px; white-space: nowrap;
  animation: rise 0.25s steps(4);
}
.catch-pop b { font-weight: 700; }
.catch-pop .new { color: var(--green); font-weight: 700; font-size: 13px; }
@keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }

/* --- карточки и кнопки ---------------------------------------------------------------------- */
.view { padding: 12px 16px 8px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.dim { background: #0a1647; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.bucket-n { font-family: var(--pix); font-size: 36px; line-height: 1.05; font-weight: 800; }
.bucket-n small { font-size: 15px; color: var(--soft); font-weight: 500; margin-left: 6px; }
.bar { height: 12px; background: var(--navy); --n: 2px; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, var(--ice) 0 6px, #9ccbff 6px 8px); }
.bar.full i { background: repeating-linear-gradient(90deg, var(--gold) 0 6px, #e09a1c 6px 8px); }
.bar.boost i { background: repeating-linear-gradient(90deg, var(--green) 0 6px, #4fc493 6px 8px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 16px; border: 0; cursor: pointer; text-decoration: none;
  font-family: var(--pix); font-size: 17px; font-weight: 700; line-height: 1.15;
  background: var(--card2); color: var(--ice-hi);
  box-shadow: inset 0 -4px 0 #0a1a52;
  transition: transform 0.06s steps(1);
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px 0 #0a1a52; }
.btn.primary { background: var(--orange); color: var(--navy); box-shadow: inset 0 -4px 0 var(--orange-dk), inset 0 3px 0 var(--orange-hi); }
.btn.primary:active:not(:disabled) { box-shadow: inset 0 -2px 0 var(--orange-dk); }
.btn.gold { background: var(--gold); color: var(--navy); box-shadow: inset 0 -4px 0 #e09a1c, inset 0 3px 0 #ffe08a; }
.btn.green { background: var(--green); color: var(--navy); box-shadow: inset 0 -4px 0 #4fc493, inset 0 3px 0 #b5f5d9; }
.btn.quiet { background: transparent; box-shadow: none; color: var(--soft); min-height: 40px; }
.btn.small { min-height: 38px; font-size: 15px; padding: 7px 12px; --n: 3px; }
.btn.wide { width: 100%; }
.btn:disabled { cursor: default; background: var(--card2); color: var(--muted); box-shadow: inset 0 -4px 0 #0a1a52; }
.btn:disabled .pix { opacity: 0.5; }
.btn .pix { margin-right: -2px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }
.hint { font-size: 14px; color: var(--soft); }
.hint.bad { color: var(--red); }
.hint.ok { color: var(--green); }

/* --- снасти ---------------------------------------------------------------------------------- */
.gear { flex-direction: row; align-items: center; gap: 12px; }
.gear .ico { width: 52px; height: 52px; background: var(--navy); display: grid; place-items: center; --n: 3px; }
.gear .t { font-family: var(--pix); font-size: 17px; font-weight: 700; }
.pips { display: flex; gap: 3px; margin: 4px 0 3px; flex-wrap: wrap; }
.pips i { width: 9px; height: 6px; background: var(--navy); }
.pips i.on { background: var(--gold); }
.gear .eff { font-size: 14px; color: var(--soft); }
.gear .btn { flex: none; min-width: 92px; }

/* --- коллекция ------------------------------------------------------------------------------- */
.book { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fish { background: var(--card); padding: 10px 6px 9px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; --n: 4px; }
.fish .pond { width: 100%; height: 58px; display: grid; place-items: center; background: linear-gradient(#0a1e6b, #071347); --n: 3px; }
.fish .nm { font-family: var(--pix); font-size: 14px; font-weight: 700; line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; }
.fish .rar { font-size: 12px; text-transform: lowercase; }
.fish .cnt { font-size: 13px; color: var(--soft); }
.fish.locked .nm { color: var(--muted); }

/* --- топ ------------------------------------------------------------------------------------- */
.top-list { display: flex; flex-direction: column; gap: 4px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--card); --n: 3px; }
.trow.me { background: #1b2f7f; box-shadow: inset 3px 0 0 var(--orange); }
.trow .rk { width: 26px; font-family: var(--pix); font-weight: 700; font-size: 16px; color: var(--soft); text-align: right; }
.trow:nth-child(1) .rk { color: var(--gold); }
.trow .nk { flex: 1; font-family: var(--pix); font-weight: 700; font-size: 17px; letter-spacing: 0.06em; display: flex; align-items: center; gap: 6px; }
.trow .kg { font-family: var(--pix); font-weight: 600; font-size: 15px; color: var(--ice); font-variant-numeric: tabular-nums; }
.nick-form { display: flex; gap: 8px; }
.nick-form input {
  flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; border: 0;
  background: var(--navy); color: var(--ice-hi);
  font-family: var(--pix); font-weight: 700; font-size: 20px; letter-spacing: 0.12em; text-transform: uppercase;
  --n: 4px; clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}
.nick-form input:focus { outline: 2px solid var(--orange); outline-offset: -2px; }

/* --- награды --------------------------------------------------------------------------------- */
.gift { flex-direction: row; gap: 12px; align-items: flex-start; }
.gift .pct { width: 62px; height: 62px; flex: none; display: grid; place-items: center; font-family: var(--pix); font-size: 21px; font-weight: 700; background: var(--navy); color: var(--muted); --n: 4px; }
.gift.on .pct { background: var(--gold); color: var(--navy); }
.gift .t { font-family: var(--pix); font-size: 17px; font-weight: 700; }
.gift .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.code { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--navy); padding: 8px 8px 8px 12px; --n: 3px; }
.code .mono { font-size: 16px; letter-spacing: 0.06em; color: var(--gold); user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }
.code button { border: 0; background: transparent; color: var(--soft); cursor: pointer; padding: 6px; display: grid; place-items: center; }
.status-line { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; color: var(--soft); }
.status-line svg { flex: none; margin-top: 1px; }

/* --- нижние вкладки -------------------------------------------------------------------------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center;
  background: #071038; box-shadow: 0 -2px 0 var(--line);
  padding: 6px 4px calc(6px + var(--safe-bottom));
}
.tabs .in { display: flex; width: 100%; max-width: 520px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 4px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; position: relative; }
.tab .ti { height: 22px; display: flex; align-items: center; justify-content: center; }
.tab .pix { opacity: 0.6; filter: grayscale(0.6); }
.tab.on { color: var(--ice-hi); }
.tab.on .pix { opacity: 1; filter: none; }
.tab.on::after { content: ""; position: absolute; top: -6px; left: 30%; right: 30%; height: 3px; background: var(--orange); }
.tab .dot { position: absolute; top: 3px; right: calc(50% - 20px); width: 8px; height: 8px; background: var(--orange); }

/* --- окна ------------------------------------------------------------------------------------ */
.sheet-back { position: fixed; inset: 0; z-index: 20; background: rgba(2, 5, 26, 0); display: flex; align-items: flex-end; justify-content: center; transition: background 0.18s; }
.sheet-back.show { background: rgba(2, 5, 26, 0.72); }
.sheet-box {
  width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
  background: var(--card); padding: 18px 16px calc(16px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 12px;
  transform: translateY(40px); opacity: 0; transition: transform 0.18s steps(4), opacity 0.18s;
  --n: 6px;
}
.sheet-back.show .sheet-box { transform: none; opacity: 1; }
.sheet-text { font-size: 15px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-head button { border: 0; background: transparent; color: var(--soft); padding: 6px; cursor: pointer; }
.pack { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--navy); --n: 4px; }
.pack .ic { width: 30px; flex: none; display: grid; place-items: center; }
.pack .t { font-family: var(--pix); font-size: 17px; font-weight: 700; }
.pack .btn { flex: none; min-width: 84px; }
.species { display: flex; flex-direction: column; gap: 4px; }
.sp { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: var(--navy); --n: 3px; clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px)); }
.sp .ic { width: 48px; display: grid; place-items: center; }
.sp .nm { flex: 1; }
.sp .new { color: var(--green); font-weight: 700; font-size: 13px; margin-left: 6px; }
.sp .n { font-family: var(--pix); font-weight: 700; font-size: 16px; color: var(--soft); font-variant-numeric: tabular-nums; }
.totals { display: flex; gap: 8px; flex-wrap: wrap; }
.totals span { font-family: var(--pix); font-weight: 600; font-size: 15px; padding: 4px 9px; background: var(--navy); }
.totals .c { color: var(--gold); }
.totals .x { color: var(--green); }
.notice { padding: 10px 12px; background: #2a1a05; color: var(--gold); font-size: 14px; display: flex; gap: 10px; align-items: center; --n: 3px; clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px)); }
.notice.green { background: #0b2f2a; color: var(--green); }
.notice.blue { background: #10286f; color: var(--ice-hi); }

/* --- лавка ----------------------------------------------------------------------------------- */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--navy); --n: 4px; clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)); }
.seg button { flex: 1; min-height: 40px; border: 0; background: transparent; color: var(--soft); font: 600 15px/1.1 var(--body); cursor: pointer; padding: 6px 4px; }
.seg button.on { background: var(--card2); color: var(--ice-hi); box-shadow: inset 0 -3px 0 var(--orange); }
.slot { display: flex; flex-direction: column; gap: 8px; }
.slot + .slot { margin-top: 6px; }
.slot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.item { flex-direction: row; align-items: flex-start; gap: 12px; }
.item .ico { width: 56px; height: 56px; flex: none; background: var(--navy); display: grid; place-items: center; --n: 3px; clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px)); }
.item .t { font-family: var(--pix); font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item .about { font-size: 14px; color: var(--soft); margin-top: 2px; }
.item .eff { font-size: 14px; color: var(--green); font-weight: 500; margin-top: 4px; }
.item .act { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.item .act .btn { min-width: 104px; }
.item.worn { box-shadow: inset 3px 0 0 var(--green); }
.item.locked .ico img { filter: grayscale(1) brightness(0.7); }
.item.locked .eff { color: var(--muted); }
.tag { font: 600 12px/1 var(--body); color: var(--navy); background: var(--green); padding: 4px 7px; }
.lock-note { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--soft); font-weight: 500; }

/* --- окно уровня ----------------------------------------------------------------------------- */
.lvl-hero { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--navy); --n: 4px; clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)); }
.lvl-n { width: 64px; height: 64px; flex: none; display: grid; place-items: center; background: var(--gold); color: var(--navy); font: 800 30px/1 var(--pix); --n: 4px; clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)); }
.bar.big { height: 14px; margin: 6px 0; }
.bar.big i { background: repeating-linear-gradient(90deg, var(--gold) 0 6px, #e09a1c 6px 8px); }
.lvl-next { font-weight: 700; color: var(--gold); }
.road { display: flex; flex-direction: column; gap: 4px; }
.lr { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--navy); color: var(--soft); --n: 3px; clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px)); }
.lr.done { opacity: 0.6; }
.lr.next { background: #1b2f7f; color: var(--ice-hi); box-shadow: inset 3px 0 0 var(--orange); }
.lr-n { width: 30px; flex: none; text-align: center; font: 800 17px/1 var(--pix); color: var(--ice-hi); }
.lr-body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.rw { display: inline-flex; align-items: center; gap: 5px; }
.rw.c { color: var(--gold); font-weight: 600; }
.rw.g { color: var(--green); }
.rw.p { color: #ffb4f0; font-weight: 600; }
.lr-s { flex: none; font-size: 12px; font-weight: 600; color: var(--orange); }
.lr.done .lr-s { color: var(--green); }

.toast {
  position: fixed; left: 50%; top: calc(12px + var(--safe-top)); z-index: 30;
  transform: translate(-50%, -16px); opacity: 0; pointer-events: none;
  background: var(--ice-hi); color: var(--navy); padding: 10px 14px; font-size: 14px; font-weight: 500;
  max-width: calc(100% - 32px); width: max-content; transition: opacity 0.15s, transform 0.15s steps(3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--red); color: #fff; }

.footer { text-align: center; padding: 6px 16px 14px; font-size: 12px; color: var(--muted); }
.footer a { color: var(--soft); }
@media (prefers-reduced-motion: reduce) {
  .pull { animation: none; }
  .catch-pop { animation: none; }
}
