/* lerosfish — Stardew-style wooden panels over a night-water backdrop. */

:root {
  --tan: #ffd284;
  --tan-2: #f6c06a;
  --tan-3: #eaa954;
  --orange: #dc7b05;
  --orange-hi: #f3a43b;
  --brown: #b14e05;
  --outline: #5b2b2a;
  --ink: #3e1f12;
  --ink-soft: #7a4a2a;
  --sky: #1b2440;
  --sky-2: #22305a;
  --water: #1f3d63;
  --water-2: #1a3456;
  --green: #5fcf3a;
  --green-dark: #2f7a1c;
  --gold: #ffd23a;
  --cream: #fff3d6;
  --grey: #a3937d;

  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: calc(var(--tg-safe-area-inset-left, 0px) + var(--tg-content-safe-area-inset-left, 0px));
  --safe-right: calc(var(--tg-safe-area-inset-right, 0px) + var(--tg-content-safe-area-inset-right, 0px));
}

@supports (padding: max(0px, env(safe-area-inset-top))) {
  :root {
    --safe-top: max(env(safe-area-inset-top), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
    --safe-bottom: max(env(safe-area-inset-bottom), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
    --safe-left: max(env(safe-area-inset-left), calc(var(--tg-safe-area-inset-left, 0px) + var(--tg-content-safe-area-inset-left, 0px)));
    --safe-right: max(env(safe-area-inset-right), calc(var(--tg-safe-area-inset-right, 0px) + var(--tg-content-safe-area-inset-right, 0px)));
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--sky);
  background-image: linear-gradient(var(--sky) 0 38%, var(--sky-2) 38% 46%, var(--water) 46% 78%, var(--water-2) 78% 100%);
  color: var(--ink);
  font: 15px/1.35 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-user-drag: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--brown);
  margin: 10px 0 6px;
}

p {
  margin: 0;
}

.muted {
  color: var(--ink-soft);
}

.small {
  font-size: 12px;
}

.hidden {
  display: none !important;
}

/* ---- shell ---- */

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.boot {
  margin: auto;
  font-size: 48px;
}

.noscript {
  color: var(--cream);
  text-align: center;
}

.content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) 14px calc(10px + var(--safe-left));
}

.screen {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 6px calc(6px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(6px + var(--safe-left));
  background: var(--brown);
  border-top: 3px solid var(--outline);
  box-shadow: inset 0 3px 0 var(--orange);
}

.tab {
  appearance: none;
  border: 3px solid var(--outline);
  background: var(--tan-3);
  color: var(--ink);
  padding: 4px 0 3px;
  min-height: 48px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font: 700 10.5px/1.1 var(--font);
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(91, 43, 42, 0.35);
}

.tab-icon {
  font-size: 19px;
  line-height: 1.1;
}

.tab-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.tab.on {
  background: var(--tan);
  box-shadow: inset 0 0 0 2px var(--orange-hi);
  transform: translateY(-2px);
}

/* ---- panels ---- */

.panel {
  position: relative;
  background: var(--tan);
  border: 3px solid var(--outline);
  box-shadow:
    inset 0 0 0 3px var(--orange),
    inset 0 0 0 5px var(--brown),
    0 4px 0 rgba(0, 0, 0, 0.35);
  padding: 13px 14px;
}

.panel > h2 {
  margin-bottom: 8px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.head-count {
  font: 800 15px var(--mono);
  color: var(--brown);
}

/* ---- buttons ---- */

.btn,
.seg,
.chip-btn {
  appearance: none;
  font: 800 15px/1.1 var(--mono);
  cursor: pointer;
  border: 3px solid var(--outline);
  min-height: 44px;
  padding: 8px 14px;
  background: var(--tan-2);
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--tan-3), inset 0 3px 0 #ffe3a8;
  touch-action: manipulation;
}

.btn.primary {
  background: var(--orange);
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--outline);
  box-shadow: inset 0 -3px 0 var(--brown), inset 0 3px 0 var(--orange-hi);
}

.btn.small {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}

.btn.ghost {
  background: transparent;
  box-shadow: none;
}

.btn.icon {
  min-width: 44px;
  padding: 6px;
}

.btn:active:not(:disabled),
.seg:active,
.chip-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn:disabled {
  background: var(--grey);
  color: #5d5246;
  text-shadow: none;
  box-shadow: none;
  cursor: default;
  opacity: 0.85;
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 2px;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-row .btn {
  flex: 1 1 0;
}

.row-end {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.chip {
  display: inline-block;
  border: 2px solid var(--outline);
  padding: 3px 8px;
  font: 800 12px var(--mono);
  background: var(--tan-2);
}

.chip.on {
  background: var(--green);
  color: #10310a;
}

.tag {
  display: inline-block;
  font: 800 9px/1 var(--mono);
  padding: 2px 3px;
  border: 2px solid #2d4a6b;
  background: #a8d0f0;
  color: #1c3550;
  vertical-align: middle;
}

/* ---- bars ---- */

.bar {
  position: relative;
  height: 20px;
  border: 3px solid var(--outline);
  background: #3a2418;
  overflow: hidden;
}

.bar .fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--green);
  box-shadow: inset 0 -3px 0 var(--green-dark);
}

.bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 11px var(--mono);
  color: var(--cream);
  text-shadow: 1px 1px 0 #000;
}

.small-bar {
  height: 16px;
  margin-top: 5px;
}

/* ---- sprites ---- */

.sprite {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
}

.sprite > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}

.sprite > img.broken {
  visibility: hidden;
}

.sprite.empty {
  border: 2px dashed var(--tan-3);
}

.sprite > .star {
  position: absolute;
  left: -2px;
  bottom: -2px;
}

.sprite.silhouette > img {
  filter: brightness(0);
  opacity: 0.45;
}

.sprite.big {
  margin: 4px auto;
  display: block;
}

/* ---- home ---- */

.profile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.player-name {
  font-size: 18px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.sound-toggle {
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}

.sound-toggle.small-toggle {
  min-width: 38px;
  min-height: 34px;
}

.lvl-badge {
  flex: 0 0 auto;
  font: 800 13px var(--mono);
  color: var(--cream);
  background: var(--brown);
  border: 2px solid var(--outline);
  padding: 3px 7px;
}

.profile-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font: 800 14px var(--mono);
}

.coin {
  width: 14px;
  height: 14px;
  background: var(--gold);
  border: 2px solid #8a5a00;
  box-shadow: inset -2px -2px 0 #e0a800;
}

.species-val {
  margin-left: auto;
}

.clock-line {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px dashed var(--tan-3);
  font: 700 12.5px/1.4 var(--mono);
  color: var(--ink-soft);
  min-height: 1.4em;
}

.casts-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.casts-note {
  font: 700 12px var(--mono);
  text-align: right;
}

.pips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  min-height: 22px;
}

.pip {
  width: 22px;
  height: 22px;
  border: 3px solid var(--outline);
  background: #8f7a62;
}

.pip.on {
  background: #4fa8e8;
  box-shadow: inset -3px -3px 0 #2c6ea3, inset 3px 3px 0 #9fd6ff;
}

.gear {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 52px;
}

.gear-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 2px 4px;
  background: var(--tan-2);
  border: 2px solid var(--tan-3);
}

.gear-row.placeholder {
  background: transparent;
}

.gear-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gear-text small {
  font: 700 11px var(--mono);
  color: var(--brown);
  text-transform: uppercase;
}

.locs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  gap: 6px;
  min-height: 120px;
}

.loc {
  appearance: none;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 7px;
  text-align: left;
  min-height: 52px;
  padding: 6px 8px;
  border: 3px solid var(--outline);
  background: var(--tan-2);
  color: var(--ink);
  font: 700 13px/1.2 var(--font);
  cursor: pointer;
  touch-action: manipulation;
}

.loc-emoji {
  grid-row: 1 / span 2;
  font-size: 22px;
}

.loc-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.loc-lock {
  font: 700 11px var(--mono);
}

.loc.sve .loc-name {
  padding-right: 26px;
}

.loc .tag {
  position: absolute;
  top: -2px;
  right: -2px;
}

.loc.on {
  background: #bfe8a0;
  box-shadow: inset 0 0 0 2px var(--green-dark);
}

.loc.locked {
  background: #c9b79c;
  color: #6a5a48;
  cursor: default;
}

.loc.locked .loc-emoji {
  filter: grayscale(1);
  opacity: 0.6;
}

.cast-dock {
  position: sticky;
  bottom: 0;
  padding: 6px 0 2px;
  z-index: 2;
}

.cast-btn {
  width: 100%;
  min-height: 60px;
  font-size: 22px;
  border-width: 4px;
}

.home-msg:empty {
  display: none;
}

/* ---- state messages ---- */

.state-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 120px;
  text-align: center;
  padding: 10px;
  grid-column: 1 / -1;
  list-style: none;
}

.home-msg .state-msg {
  min-height: 0;
  background: var(--tan);
  border: 3px solid var(--outline);
}

.loading p {
  font: 700 14px var(--mono);
  color: var(--ink-soft);
}

.busy {
  opacity: 0.6;
}

/* ---- collection ---- */

.fish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
  min-height: 300px;
}

.fish-cell {
  appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 8px 4px 6px;
  border: 3px solid var(--tan-3);
  background: var(--tan-2);
  color: var(--ink);
  font: 700 11.5px/1.2 var(--font);
  text-align: center;
}

button.fish-cell {
  cursor: pointer;
  border-color: var(--outline);
}

.fish-cell.unknown {
  background: #d9b77a;
}

.fish-cell.legendary {
  box-shadow: inset 0 0 0 2px var(--gold);
}

.fish-cell.legendary.caught {
  background: #ffe7a0;
}

.fish-name {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fish-meta {
  font: 700 10.5px var(--mono);
  color: var(--ink-soft);
}

.tag.corner {
  position: absolute;
  top: 2px;
  right: 2px;
}

.fish-detail {
  text-align: center;
}

.fish-detail h2 {
  margin: 4px 0 8px;
}

.fish-detail p {
  margin-top: 4px;
  font: 700 14px var(--mono);
}

/* ---- shop ---- */

.shop-body {
  min-height: 300px;
}

.shop-group + .shop-group {
  margin-top: 6px;
}

.shop-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 4px 10px;
  align-items: center;
  padding: 8px;
  margin-bottom: 6px;
  background: var(--tan-2);
  border: 2px solid var(--tan-3);
}

.shop-row.equipped {
  border-color: var(--green-dark);
  background: #d9efb4;
}

.shop-row.locked > .sprite,
.shop-row.locked .shop-text strong {
  opacity: 0.5;
}

.shop-row.locked > .sprite {
  filter: grayscale(1);
}

.shop-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.effect {
  font-size: 13px;
}

.shop-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

/* ---- top ---- */

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 8px;
}

.seg {
  min-height: 40px;
  font-size: 14px;
}

.seg + .seg {
  border-left-width: 0;
}

.seg[aria-pressed="true"],
.chip-btn[aria-pressed="true"] {
  background: var(--orange);
  color: var(--cream);
  text-shadow: 1px 1px 0 var(--outline);
  box-shadow: inset 0 -3px 0 var(--brown);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.chip-btn {
  min-height: 36px;
  padding: 5px 10px;
  font-size: 13px;
  border-width: 2px;
}

.top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 200px;
}

.top-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 4px 8px;
  margin-bottom: 4px;
  background: var(--tan-2);
  border: 2px solid var(--tan-3);
}

.top-row.me {
  background: #bfe8a0;
  border-color: var(--green-dark);
}

.rank {
  font: 800 16px var(--mono);
  text-align: center;
}

.podium .rank {
  font-size: 22px;
}

.top-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-val {
  font: 800 14px var(--mono);
  white-space: nowrap;
}

/* ---- awards ---- */

.ach-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 300px;
}

.ach {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  background: #e3c58d;
  border: 2px solid var(--tan-3);
}

.ach.unlocked {
  background: #ffe7a0;
  border-color: var(--orange);
  box-shadow: inset 0 0 0 2px var(--gold);
}

.ach:not(.unlocked) .ach-emoji {
  filter: grayscale(1);
  opacity: 0.55;
}

.ach-emoji {
  font-size: 28px;
  line-height: 1.1;
  width: 36px;
  text-align: center;
  flex: 0 0 auto;
}

.ach-text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.ach-date {
  margin-top: 4px;
  font: 700 11px var(--mono);
  color: var(--brown);
}

/* ---- modal / toast / gate ---- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background: rgba(10, 12, 24, 0.7);
}

.modal-box {
  width: 100%;
  max-width: 360px;
  max-height: 100%;
  overflow-y: auto;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(12px + var(--safe-top));
  z-index: 100;
  max-width: calc(100% - 24px);
  transform: translate(-50%, -150%);
  padding: 10px 14px;
  background: var(--tan);
  border: 3px solid var(--outline);
  box-shadow: inset 0 0 0 2px var(--orange), 0 4px 0 rgba(0, 0, 0, 0.35);
  font: 700 14px var(--font);
  transition: transform 0.15s steps(3);
  pointer-events: none;
}

.toast.show {
  transform: translate(-50%, 0);
}

.gate {
  margin: auto;
  padding: 16px;
  width: 100%;
  max-width: 420px;
}

.gate-panel {
  text-align: center;
  padding: 22px 18px;
}

.gate-icon {
  font-size: 52px;
  margin-bottom: 8px;
}

.gate-panel h1 {
  font-size: 19px;
  margin-bottom: 10px;
}

/* ---- the fishing overlay ---- */

body.gaming {
  overflow: hidden;
}

.game {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--sky);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  cursor: pointer;
}

.game:focus {
  outline: none;
}

.game .scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.game-top {
  position: absolute;
  top: calc(8px + var(--safe-top));
  left: calc(8px + var(--safe-left));
  right: calc(8px + var(--safe-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.game-top {
  z-index: 6;
}

.game-top .btn {
  pointer-events: auto;
}

.game-btns {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.game-loc {
  font: 800 14px var(--mono);
  color: var(--cream);
  text-shadow: 2px 2px 0 #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-hint {
  position: absolute;
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  bottom: calc(14px + var(--safe-bottom));
  text-align: center;
  font: 800 15px/1.3 var(--mono);
  color: var(--cream);
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  min-height: 1.3em;
}

.game-hint:empty {
  visibility: hidden;
}

.game-sheet {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  padding: calc(56px + var(--safe-top)) calc(12px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(12px + var(--safe-left));
  background: rgba(10, 12, 24, 0.55);
  cursor: default;
}

.sheet-panel {
  isolation: isolate;
  margin: auto;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.sheet-kicker {
  font: 800 13px var(--mono);
  text-transform: uppercase;
  color: var(--brown);
}

.sheet-title {
  font-size: 20px;
  margin: 10px 0;
}

.sheet-msg {
  font: 700 15px/1.4 var(--font);
  margin: 6px 0 2px;
}

.catch-name {
  font-size: 21px;
  margin-top: 2px;
}

.catch-size {
  font: 800 16px var(--mono);
  color: var(--ink-soft);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 8px;
}

.badge {
  font: 800 12px var(--mono);
  padding: 3px 7px;
  border: 2px solid var(--outline);
  background: var(--tan-2);
}

.badge.perfect {
  background: #ffe066;
}

.badge.new {
  background: #9fe07a;
}

.badge.record {
  background: #8fd0ff;
}

.badge.legend {
  background: #e0a0ff;
}

.gains {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.gain {
  font: 800 16px var(--mono);
}

.gain.xp {
  color: #2f7a1c;
}

.gain.gold {
  color: #a35f00;
}

.treasure {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px;
  text-align: left;
  background: #ffe7a0;
  border: 2px solid var(--orange);
}

.loot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 2px;
}

.loot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 700 12px var(--font);
}

.banner {
  margin-top: 10px;
  padding: 8px;
  background: var(--green);
  color: #10310a;
  border: 3px solid var(--green-dark);
  font: 800 15px var(--mono);
}

.ach-new {
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  margin-top: 8px;
  padding: 8px;
  background: #ffe7a0;
  border: 2px solid var(--orange);
}

.ach-new small {
  display: block;
  font: 700 11px var(--mono);
  color: var(--brown);
  text-transform: uppercase;
}

.ach-new strong {
  display: block;
}

@media (min-width: 420px) {
  .tab {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}

/* ---- catch celebrations ---- */

.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  image-rendering: pixelated;
}

.fx-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2px 0;
}

.fx-stage .sprite.big {
  position: relative;
  z-index: 1;
}

.fx-normal .fx-stage .sprite.big,
.fx-silver .fx-stage .sprite.big,
.fx-gold .fx-stage .sprite.big {
  animation: fx-pop 0.55s cubic-bezier(0.2, 1.4, 0.5, 1) both;
}

.fx-iridium .fx-stage .sprite.big {
  animation:
    fx-pop 0.6s cubic-bezier(0.2, 1.4, 0.5, 1) both,
    fx-glow-iri 0.9s steps(2) 0.6s 5;
}

.fx-legendary .fx-stage .sprite.big {
  animation:
    fx-rise 1.8s ease-out both,
    fx-glow-gold 1s steps(2) 0.4s infinite;
}

.fx-junk .fx-stage .sprite.big {
  animation: fx-plop 0.9s ease-out both;
}

.fx-shrug {
  font: 800 15px var(--mono);
  color: var(--ink-soft);
  animation: fx-appear 0.4s ease-out 0.7s both;
}

.fx-droop {
  animation: fx-droop 1.2s ease-in 0.2s forwards;
}

.fx-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240px;
  height: 240px;
  margin: -120px 0 0 -120px;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  background: repeating-conic-gradient(var(--ray) 0deg 9deg, transparent 9deg 24deg);
  animation:
    fx-spin 7s linear infinite,
    fx-rays-show 3.4s ease-out both;
}

.fx-rays-gold {
  --ray: rgba(255, 196, 40, 0.55);
}

.fx-rays-iridium {
  --ray: rgba(176, 96, 255, 0.45);
}

.fx-rays-legendary {
  --ray: rgba(255, 196, 40, 0.7);
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  animation:
    fx-spin 9s linear infinite,
    fx-rays-long 7s ease-out both;
}

.fx-shimmer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 40%, var(--shine) 40% 52%, transparent 52% 100%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: fx-sweep 0.9s steps(10) 0.5s 2 both;
}

.fx-shimmer-silver {
  --shine: rgba(255, 255, 255, 0.9);
}

.fx-shimmer-gold {
  --shine: rgba(255, 246, 170, 0.9);
}

.fx-shimmer-iridium {
  --shine: rgba(222, 170, 255, 0.95);
}

.fx-shimmer-legendary {
  --shine: rgba(255, 250, 200, 0.95);
  animation-delay: 1.7s;
  animation-iteration-count: 3;
}

.fx-stamp {
  position: absolute;
  top: 4px;
  right: calc(50% - 104px);
  z-index: 3;
  padding: 2px 6px;
  font: 900 14px var(--mono);
  color: #c0392b;
  background: rgba(255, 243, 214, 0.9);
  border: 3px solid #c0392b;
  transform: rotate(-14deg);
  pointer-events: none;
  animation: fx-stamp 0.35s cubic-bezier(0.3, 1.5, 0.5, 1) 0.55s both;
}

.fx-legendary .fx-stamp {
  animation-delay: 1.3s;
}

.fx-banner {
  position: absolute;
  top: -38px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  padding: 6px 14px;
  white-space: nowrap;
  font: 900 20px var(--mono);
  color: #ffd23a;
  background: #6a2c9a;
  border: 3px solid var(--outline);
  box-shadow: inset 0 0 0 2px #c070ff, 0 4px 0 rgba(0, 0, 0, 0.35);
  text-shadow: 2px 2px 0 var(--outline), -2px -2px 0 var(--outline), 2px -2px 0 var(--outline), -2px 2px 0 var(--outline);
  pointer-events: none;
  animation: fx-banner-drop 0.65s ease-out 0.15s both;
}

.fx-flash {
  position: absolute;
  inset: 0;
  z-index: 7;
  background: #fff8e0;
  pointer-events: none;
  animation: fx-flash 0.45s ease-out forwards;
}

.sheet-panel.fx-shake {
  animation: fx-shake 0.5s steps(6);
}

.sheet-panel .banner {
  animation: fx-slide-in 0.45s ease-out 0.8s both;
}

.sheet-panel .ach-new {
  animation: fx-slide-in 0.45s ease-out 1.1s both;
}

.sheet-panel .treasure .sprite {
  animation: fx-chest-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 0.45s both;
}

@keyframes fx-pop {
  0% { transform: translateY(20px) scale(0.2); opacity: 0; }
  55% { transform: scale(1.18); opacity: 1; }
  75% { transform: scale(0.94); }
  100% { transform: none; }
}

@keyframes fx-plop {
  0% { transform: translateY(-60px); opacity: 0; }
  45% { transform: translateY(0) scale(1.25, 0.7); opacity: 1; }
  60% { transform: scale(0.9, 1.12); }
  75% { transform: rotate(-7deg); }
  88% { transform: rotate(5deg); }
  100% { transform: none; }
}

@keyframes fx-droop {
  to { transform: translateY(5px) rotate(3deg); opacity: 0.7; }
}

@keyframes fx-rise {
  0% { transform: translateY(40px) scale(0.7); opacity: 0.2; }
  100% { transform: none; opacity: 1; }
}

@keyframes fx-glow-gold {
  0%, 100% { filter: drop-shadow(2px 0 0 #ffd23a) drop-shadow(-2px 0 0 #ffd23a) drop-shadow(0 2px 0 #ffd23a) drop-shadow(0 -2px 0 #ffd23a); }
  50% { filter: drop-shadow(4px 0 0 #fff2a0) drop-shadow(-4px 0 0 #fff2a0) drop-shadow(0 4px 0 #fff2a0) drop-shadow(0 -4px 0 #fff2a0); }
}

@keyframes fx-glow-iri {
  0%, 100% { filter: drop-shadow(2px 0 0 #c070ff) drop-shadow(-2px 0 0 #7fe0ff) drop-shadow(0 2px 0 #ff9ff0) drop-shadow(0 -2px 0 #c070ff); }
  50% { filter: drop-shadow(4px 0 0 #7fe0ff) drop-shadow(-4px 0 0 #c070ff) drop-shadow(0 4px 0 #c070ff) drop-shadow(0 -4px 0 #ff9ff0); }
}

@keyframes fx-spin {
  to { transform: rotate(360deg); }
}

@keyframes fx-rays-show {
  0% { opacity: 0; scale: 0.3; }
  15% { opacity: 1; scale: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes fx-rays-long {
  0% { opacity: 0; scale: 0.3; }
  10% { opacity: 1; scale: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes fx-sweep {
  from { background-position: 100% 0; }
  to { background-position: 0% 0; }
}

@keyframes fx-stamp {
  0% { opacity: 0; transform: rotate(-14deg) scale(3); }
  60% { opacity: 1; transform: rotate(-14deg) scale(0.9); }
  100% { opacity: 1; transform: rotate(-14deg) scale(1); }
}

@keyframes fx-banner-drop {
  0% { transform: translate(-50%, -140px); }
  70% { transform: translate(-50%, 8px); }
  85% { transform: translate(-50%, -4px); }
  100% { transform: translate(-50%, 0); }
}

@keyframes fx-flash {
  from { opacity: 0.95; }
  to { opacity: 0; }
}

@keyframes fx-shake {
  0%, 100% { transform: none; }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(5px, -4px); }
  60% { transform: translate(-4px, 2px); }
  80% { transform: translate(3px, -2px); }
}

@keyframes fx-slide-in {
  from { transform: translateX(-110%); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes fx-chest-pop {
  0% { transform: scale(0) rotate(-20deg); }
  60% { transform: scale(1.3) rotate(8deg); }
  100% { transform: none; }
}

@keyframes fx-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes fx-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-panel,
  .sheet-panel * {
    animation: fx-fade 0.3s ease-out both !important;
  }

  .fx-rays,
  .fx-shimmer,
  .fx-flash,
  .fx-canvas {
    display: none !important;
  }
}
