:root {
  color-scheme: dark;
  --bg: #06131a;
  --panel: rgba(7, 25, 33, 0.82);
  --panel-2: rgba(11, 34, 44, 0.72);
  --line: rgba(140, 205, 230, 0.14);
  --line-strong: rgba(140, 205, 230, 0.28);
  --ink: #eef8fc;
  --muted: #92aebd;
  --gold: #ffc45e;
  --gold-2: #ff9f3d;
  --ice: #63d6ff;
  --mint: #6ff0c0;
  --danger: #ff7d7d;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  font-family: "Inter", "Segoe UI", "Roboto", system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(4, 13, 19, 0.55), rgba(4, 13, 19, 0.88) 70%),
    url("assets/bg.webp") center / cover no-repeat,
    radial-gradient(circle at 30% 0%, #12384a, #06131a 62%);
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  touch-action: manipulation;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 30%, transparent 40%, rgba(2, 8, 12, 0.55) 100%);
  z-index: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

svg {
  display: block;
}

.ic {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: -0.15em;
  flex: 0 0 auto;
}

#app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px clamp(12px, 2.4vw, 26px) 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- HUD ---------- */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.fish-icon {
  width: 34px;
  height: 34px;
  fill: var(--gold);
  filter: drop-shadow(0 4px 10px rgba(255, 180, 84, 0.35));
  flex: 0 0 auto;
}

.fish-icon .eye {
  fill: #21323a;
}

.wallet-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.wallet-text strong {
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.wallet-text span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.wallet-cps {
  font-size: 12px;
  color: var(--mint);
  padding-left: 12px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.wallet-cps b {
  font-weight: 700;
}

.hud-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  color: var(--ice);
  transition: border-color 0.2s, transform 0.15s;
}

.chip svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip:active {
  transform: scale(0.96);
}

.chip.ready {
  color: #0b1a12;
  background: linear-gradient(180deg, #8ff7cb, #45d8a1);
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(80, 230, 170, 0.3);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.15s;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}

.icon-btn:hover {
  border-color: var(--line-strong);
}

.icon-btn:active {
  transform: scale(0.94);
}

/* ---------- Layout ---------- */

.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 14px;
}

/* ---------- Stage ---------- */

.stage {
  position: relative;
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
  border: 1px solid rgba(140, 205, 230, 0.08);
  background:
    radial-gradient(ellipse at 50% 42%, rgba(99, 214, 255, 0.12), transparent 62%),
    linear-gradient(180deg, rgba(8, 26, 35, 0.18), rgba(4, 13, 19, 0.5));
  isolation: isolate;
}

.aurora {
  position: absolute;
  inset: -20% -10% auto;
  height: 80%;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(80, 240, 190, 0.16), transparent 55%),
    radial-gradient(ellipse at 70% 20%, rgba(99, 140, 255, 0.18), transparent 60%);
  filter: blur(18px);
  animation: aurora 16s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: -1;
}

@keyframes aurora {
  0% {
    transform: translateX(-4%) scaleY(1);
    opacity: 0.75;
  }
  100% {
    transform: translateX(5%) scaleY(1.15);
    opacity: 1;
  }
}

.snow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.snow i {
  position: absolute;
  top: -12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(220, 245, 255, 0.75);
  filter: blur(0.4px);
  animation: snowfall linear infinite;
}

@keyframes snowfall {
  from {
    transform: translate3d(0, -10px, 0);
  }
  to {
    transform: translate3d(var(--drift, 20px), 110vh, 0);
  }
}

/* Курсор-лапка только над самим тюленем (класс ставит JS по маске картинки). */
.stage.over-seal {
  cursor: pointer;
}

.seal {
  position: relative;
  z-index: 2;
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.seal img {
  width: clamp(210px, 34vw, 440px);
  max-width: 62vh;
  height: auto;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 26px 34px rgba(0, 0, 0, 0.5));
  animation: sealIdle 4.5s ease-in-out infinite;
}

.seal.pop {
  animation: sealPop 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sealPop {
  0% {
    transform: scale(0.93);
  }
  55% {
    transform: scale(1.035);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes sealIdle {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(0.8deg);
  }
}

.seal-shadow {
  position: absolute;
  bottom: 2%;
  width: 54%;
  height: 8%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.5), transparent 72%);
  filter: blur(10px);
  z-index: -1;
}

.combo {
  position: relative;
  z-index: 2;
  width: min(280px, 70%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.combo.on {
  opacity: 1;
  transform: none;
}

.combo-bar {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.combo-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ice), var(--gold));
  transition: width 0.12s linear;
}

.combo span {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.combo b {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.buffs {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  z-index: 4;
  width: max-content;
  max-width: 92%;
}

.buff {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 196, 94, 0.16);
  border: 1px solid rgba(255, 196, 94, 0.4);
  color: var(--gold);
  backdrop-filter: blur(8px);
  animation: buffIn 0.3s ease;
  font-variant-numeric: tabular-nums;
}

.buff i {
  font-style: normal;
  opacity: 0.85;
}

.buff .ic {
  width: 14px;
  height: 14px;
}

.big-fish {
  width: 30px;
  height: 30px;
  vertical-align: -0.12em;
  stroke-width: 1.6;
}

@keyframes buffIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.9);
  }
}

.tap-hint {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.tap-pill {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(4, 15, 20, 0.4);
}

.tap-pill b {
  color: var(--ice);
  font-variant-numeric: tabular-nums;
}

/* Работники на льдине: крупные карточки с фото. Сетку и размер клетки
   считает main.js, чтобы все работники делили низ сцены поровну. */
.workers {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 4;
  display: grid;
  justify-content: center;
  gap: var(--worker-gap, 8px);
  pointer-events: none;
}

/* Место под полосой, чтобы она не наезжала на тюленя и подсказку. */
.stage.with-workers {
  padding-bottom: var(--workers-h, 0px);
}

/* С работниками тюлень уступает им часть сцены. */
.stage.with-workers .seal img {
  width: var(--seal-size, 300px);
  max-width: none;
}

.workers.empty {
  display: none;
}

.worker {
  position: relative;
  width: var(--cell, 64px);
  height: var(--cell, 64px);
  padding: 0;
  overflow: hidden;
  border-radius: calc(var(--cell, 64px) * 0.14);
  border: 1px solid rgba(140, 205, 230, 0.28);
  background: #0a1e27;
  pointer-events: auto;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  animation: workerIn 0.34s cubic-bezier(0.2, 1.3, 0.5, 1) both;
  animation-delay: calc(var(--i, 0) * 0.05s);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.worker:hover,
.worker:focus-visible {
  transform: translateY(-4px);
  border-color: var(--ice);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.55), 0 0 0 3px rgba(99, 214, 255, 0.18);
}

.worker img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: workerBob 4.2s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * 0.37s);
}

.worker-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22% 8% 7%;
  font-size: calc(var(--cell, 64px) * 0.105);
  line-height: 1.15;
  font-weight: 700;
  color: #eaf7ff;
  text-align: left;
  background: linear-gradient(180deg, rgba(4, 15, 21, 0), rgba(4, 15, 21, 0.9) 62%);
  pointer-events: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.workers.small .worker-name {
  display: none;
}

.worker-count {
  position: absolute;
  top: 5%;
  right: 5%;
  display: grid;
  place-items: center;
  min-width: calc(var(--cell, 64px) * 0.3);
  height: calc(var(--cell, 64px) * 0.25);
  padding: 0 calc(var(--cell, 64px) * 0.07);
  border-radius: 99px;
  background: var(--gold-2);
  color: #201204;
  font-size: calc(var(--cell, 64px) * 0.13);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid rgba(6, 20, 27, 0.9);
}

@keyframes workerIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.82);
  }
}

@keyframes workerBob {
  to {
    transform: scale(1.045);
  }
}

.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}

.float-num {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 20px;
  color: #ffd98a;
  /* Тюлень белый — без тёмного контура цифры на нём теряются. */
  -webkit-text-stroke: 3.5px rgba(3, 14, 19, 0.9);
  paint-order: stroke fill;
  text-shadow: 0 2px 6px rgba(3, 14, 19, 0.9);
  animation: floatNum 0.85s ease-out forwards;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

.float-num.crit {
  color: #fff3c4;
  font-size: 30px;
  -webkit-text-stroke: 4px rgba(3, 14, 19, 0.92);
  text-shadow: 0 0 18px rgba(255, 196, 94, 0.95), 0 2px 8px rgba(0, 0, 0, 0.8);
}

@keyframes floatNum {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -70%) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -190%) scale(0.95);
  }
}

.spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ice);
  transform: translate(-50%, -50%);
  animation: spark 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes spark {
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
  }
}

.golden-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.golden {
  position: absolute;
  top: var(--y, 50%);
  left: var(--x, 20%);
  width: 76px;
  height: 76px;
  padding: 0;
  border-radius: 50%;
  pointer-events: auto;
  background: radial-gradient(circle, rgba(255, 214, 120, 0.35), transparent 70%);
  animation: goldenIn 0.4s cubic-bezier(0.2, 1.4, 0.5, 1) both;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.golden.out {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

.golden::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 214, 120, 0.55);
  animation: goldenRing 1.6s ease-out infinite;
  pointer-events: none;
}

@keyframes goldenRing {
  from {
    opacity: 0.85;
    transform: scale(0.92);
  }
  to {
    opacity: 0;
    transform: scale(1.35);
  }
}

.golden img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 214, 120, 0.8);
  box-shadow: 0 0 26px rgba(255, 196, 94, 0.75);
  filter: saturate(1.15) brightness(1.06);
  animation: goldenBob 1.1s ease-in-out infinite alternate;
}

@keyframes goldenIn {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes goldenBob {
  to {
    transform: translateY(-10px) scale(1.06);
  }
}

/* ---------- Panel ---------- */

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.tabs {
  display: grid;
  /* minmax(0, 1fr) — иначе длинное «Автокликеры» распирает колонку и табы наезжают. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.tabs button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 10px 4px;
  border-radius: 12px;
  font-size: clamp(10px, 3.1vw, 12px);
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.tabs button.active {
  color: #08202a;
  background: linear-gradient(180deg, #d8f5ff, #9fe6ff);
  font-weight: 800;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 99px;
  background: var(--gold-2);
  color: #201204;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  vertical-align: 1px;
}

.tab-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.tab {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 205, 230, 0.25) transparent;
  -webkit-overflow-scrolling: touch;
}

.tab.active {
  display: block;
}

.tab::-webkit-scrollbar {
  width: 6px;
}

.tab::-webkit-scrollbar-thumb {
  background: rgba(140, 205, 230, 0.22);
  border-radius: 99px;
}

/* ---------- Shop ---------- */

.buy-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 10px;
  font-size: 12px;
  color: var(--muted);
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.segmented button {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.segmented button.active {
  background: rgba(99, 214, 255, 0.2);
  color: var(--ice);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.item {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 8px 8px 10px;
  border-radius: 15px;
  background: var(--panel-2);
  border: 1px solid transparent;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.12s, opacity 0.18s;
}

/* Хватает рыб — карточка подсвечена, цена зелёная. */
.item.buyable {
  border-color: rgba(110, 240, 192, 0.5);
  background: linear-gradient(120deg, rgba(110, 240, 192, 0.13), rgba(11, 34, 44, 0.72) 55%);
  box-shadow: inset 0 0 0 1px rgba(110, 240, 192, 0.08);
}

.item.buyable:hover {
  border-color: rgba(110, 240, 192, 0.85);
}

.item.buyable .item-cost b {
  color: var(--mint);
}

/* Не хватает — карточка притушена, цена серая, снизу полоска накопления. */
.item.short {
  opacity: 0.66;
}

.item.short .item-thumb img {
  filter: grayscale(0.45) brightness(0.85);
}

.item.short .item-cost b {
  color: #a9c3d0;
}

.item.short .item-cost small {
  color: #ffb4a6;
}

.item:active {
  transform: scale(0.988);
}

.item.locked {
  opacity: 0.5;
  filter: saturate(0.5);
}

.item-fill {
  position: absolute;
  opacity: 0;
  left: 10px;
  right: 10px;
  bottom: 5px;
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  pointer-events: none;
}

.item-fill i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(99, 214, 255, 0.35), rgba(99, 214, 255, 0.75));
  transition: width 0.2s linear;
}

.item.short .item-fill {
  opacity: 1;
}

.item.locked .item-fill {
  display: none;
}

/* Тыкнул, а рыб не хватило — карточка вздрагивает. */
.item.shake {
  animation: itemShake 0.4s ease;
}

@keyframes itemShake {
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

.item.flash {
  animation: itemFlash 0.9s ease;
}

@keyframes itemFlash {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 196, 94, 0);
  }
  30% {
    box-shadow: 0 0 0 2px rgba(255, 196, 94, 0.75);
  }
}

.item-thumb {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 12px;
  overflow: hidden;
  background: #0a1e27;
}

.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.item-thumb .count {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 20px;
  padding: 1px 5px;
  border-radius: 7px;
  background: rgba(2, 10, 14, 0.82);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.item-main {
  min-width: 0;
}

.item-name,
.item-desc,
.item-meta {
  /* Это span'ы внутри кнопки — без block они слипаются в одну строку. */
  display: block;
}

.item-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta span + span::before {
  content: "·";
  margin: 0 5px;
  color: var(--muted);
}

.item-cost {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-right: 2px;
}

.item-cost b {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item-cost small {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.item-cost .lock {
  font-size: 11px;
  color: var(--muted);
}

.item-cost .ok {
  font-size: 10px;
  color: var(--mint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Upgrades ---------- */

.upgrade {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid transparent;
  text-align: left;
  transition: border-color 0.18s, transform 0.12s;
}

.upgrade.buyable {
  border-color: rgba(255, 196, 94, 0.35);
  background: linear-gradient(120deg, rgba(255, 196, 94, 0.12), rgba(11, 34, 44, 0.72) 60%);
}

.upgrade.buyable:hover {
  border-color: rgba(255, 196, 94, 0.6);
}

.upgrade:active {
  transform: scale(0.988);
}

.upgrade-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 196, 94, 0.12);
  border: 1px solid rgba(255, 196, 94, 0.22);
  color: var(--gold);
}

.upgrade-icon .ic {
  width: 22px;
  height: 22px;
}

.upgrade-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.upgrade-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

.upgrade-cost {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.upgrade-cost.no {
  color: var(--muted);
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- Achievements ---------- */

.ach-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  padding: 2px 4px 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.ach-head span {
  color: var(--gold);
  font-weight: 800;
}

.ach-head .ach-bonus {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: none;
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 7px;
}

.ach {
  padding: 10px 8px;
  border-radius: 13px;
  background: var(--panel-2);
  border: 1px solid transparent;
  text-align: center;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  filter: grayscale(1) brightness(0.55);
  opacity: 0.65;
}

.ach.done {
  filter: none;
  opacity: 1;
  border-color: rgba(255, 196, 94, 0.3);
  background: linear-gradient(160deg, rgba(255, 196, 94, 0.13), rgba(11, 34, 44, 0.7));
}

.ach-icon {
  line-height: 1;
  color: var(--muted);
}

.ach-icon .ic {
  width: 24px;
  height: 24px;
}

.ach.done .ach-icon {
  color: var(--gold);
}

.ach-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.ach.done .ach-name {
  color: var(--gold);
}

/* ---------- Cards (More tab) ---------- */

.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 9px;
}

.card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.card p {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.card p b {
  color: var(--ink);
}

.card p.muted {
  color: var(--muted);
}

.prestige-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.prestige-stats div {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
}

.prestige-stats span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.prestige-stats b {
  font-size: 15px;
  color: var(--ice);
  font-variant-numeric: tabular-nums;
}

.btn {
  padding: 10px 14px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  transition: background 0.15s, transform 0.12s, opacity 0.2s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  width: 100%;
  background: linear-gradient(180deg, #8ff7cb, #45d8a1);
  color: #06231a;
  border: 0;
  box-shadow: 0 8px 22px rgba(80, 230, 170, 0.25);
}

.btn.primary:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}

.btn.danger {
  color: var(--danger);
  border-color: rgba(255, 125, 125, 0.3);
}

.row-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-buttons .btn {
  flex: 1 1 120px;
}

.stats-card dl {
  margin: 0;
  display: grid;
  gap: 7px;
}

.stats-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(140, 205, 230, 0.08);
}

.stats-card dl div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.stats-card dt {
  color: var(--muted);
}

.stats-card dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  top: calc(72px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  width: max-content;
  max-width: 92vw;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border-radius: 13px;
  background: rgba(8, 26, 34, 0.95);
  border: 1px solid rgba(255, 196, 94, 0.35);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  font-weight: 600;
  animation: toastIn 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), toastOut 0.3s ease 2.7s forwards;
  backdrop-filter: blur(10px);
}

.toast .ti {
  font-size: 18px;
  line-height: 1;
  color: var(--gold);
  display: flex;
}

.toast .ti .ic {
  width: 19px;
  height: 19px;
}

.toast b {
  color: var(--gold);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.94);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 8, 12, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.2s ease;
}

.modal[hidden] {
  display: none;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal-card {
  width: min(440px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #0d2833, #071820);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}

.modal-card h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.modal-card p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.modal-card .big {
  font-size: 30px;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
  margin: 6px 0 14px;
  font-variant-numeric: tabular-nums;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  /* Кнопки всегда на виду, даже если содержимое модалки прокручивается. */
  position: sticky;
  bottom: -20px;
  margin: 14px -20px -20px;
  padding: 16px 20px 20px;
  background: linear-gradient(180deg, rgba(7, 24, 32, 0), #071820 40%);
}

.modal-actions .btn {
  flex: 1;
}

.credits-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.credits-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2px 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.credits-list li:last-child {
  border-bottom: 0;
}

.credits-list b {
  grid-column: 1 / -1;
  color: var(--ink);
  font-weight: 600;
}

.credits-list span {
  min-width: 0;
}

.credits-list a {
  color: var(--ice);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}

.credits-list a:hover {
  text-decoration: underline;
}

/* ---------- Mobile ---------- */

@media (max-width: 360px) {
  .tabs {
    padding: 6px;
    gap: 3px;
  }

  .tabs button {
    padding: 9px 2px;
  }

  .badge {
    margin-left: 2px;
    min-width: 13px;
    height: 13px;
    font-size: 9px;
  }
}

@media (max-width: 880px) {
  #app {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) min(46dvh, 430px);
    gap: 8px;
  }

  .panel {
    height: 100%;
    max-height: none;
    border-radius: 20px;
  }

  .stage {
    border-radius: 22px;
  }

  .seal img {
    width: clamp(190px, 56vw, 320px);
    max-width: 40vh;
  }

  .wallet {
    padding: 6px 12px 6px 9px;
    gap: 8px;
    border-radius: 15px;
  }

  .fish-icon {
    width: 26px;
    height: 26px;
  }

  .wallet-text strong {
    font-size: 21px;
  }

  .wallet-text span {
    display: none;
  }

  .wallet-cps {
    font-size: 11px;
    padding-left: 9px;
  }

  .chip,
  .icon-btn {
    height: 40px;
  }

  .chip {
    padding: 0 11px;
    font-size: 13px;
  }

  .icon-btn {
    width: 40px;
  }

  .tabs {
    padding: 6px;
  }

  .tabs button {
    padding: 9px 2px;
    font-size: clamp(10px, 2.9vw, 11px);
  }

  .tab {
    padding: 8px;
  }

  .item {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 7px;
  }

  .item-thumb {
    width: 52px;
    height: 52px;
  }

  .item-name {
    font-size: 13px;
  }

  .item-desc {
    -webkit-line-clamp: 1;
  }

  .item-meta {
    font-size: 10px;
  }

  .buy-bar {
    padding-bottom: 7px;
  }

  .toasts {
    top: calc(64px + env(safe-area-inset-top, 0px));
  }
}

@media (max-width: 880px) and (max-height: 700px) {
  .layout {
    grid-template-rows: minmax(0, 1fr) 44dvh;
  }

  .toasts {
    top: calc(62px + env(safe-area-inset-top, 0px));
  }
}

/* Телефон в альбомной ориентации: снова две колонки, иначе сцена исчезает. */
@media (min-width: 600px) and (max-height: 560px) and (orientation: landscape) {
  #app {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 40%);
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
  }

  .seal img {
    width: clamp(150px, 34vh, 260px);
    max-width: 46vh;
  }

  .item-desc {
    display: none;
  }

  .hint {
    font-size: 11px;
    padding: 6px 12px;
  }

  /* В альбоме места мало: тосты уходят в левый верхний угол, чтобы не
     наезжать ни на полосу работников, ни на подсказку тапа. */
  .toasts {
    top: calc(56px + env(safe-area-inset-top, 0px));
    bottom: auto;
    left: calc(12px + env(safe-area-inset-left, 0px));
    transform: none;
    align-items: flex-start;
    max-width: 40vw;
  }

  .toasts .toast {
    font-size: 11px;
    padding: 6px 10px;
  }
}

@media (max-width: 380px) {
  .wallet-cps {
    display: none;
  }

  .item-desc {
    display: none;
  }
}

.hint {
  position: relative;
  z-index: 3;
  margin-top: 2px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #08202a;
  background: linear-gradient(180deg, #d8f5ff, #9fe6ff);
  box-shadow: 0 8px 26px rgba(120, 220, 255, 0.35);
  pointer-events: none;
  animation: hintPulse 1.6s ease-in-out infinite;
}

.hint[hidden] {
  display: none !important;
}

@keyframes hintPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.95;
  }
  50% {
    transform: translateY(-5px) scale(1.04);
    opacity: 1;
  }
}

@media (max-width: 880px) {
  .hint {
    font-size: 12px;
    padding: 7px 14px;
  }
}

/* ---------- Доступность ---------- */

:focus-visible {
  outline: 2px solid #9fe6ff;
  outline-offset: 3px;
  border-radius: 10px;
}

.seal:focus-visible {
  outline-offset: 10px;
  border-radius: 50%;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .snow,
  .aurora,
  .golden::after {
    display: none;
  }

  .golden img,
  .worker img {
    animation: none;
  }
}

.menu-list,
.help-list {
  display: grid;
  gap: 9px;
  margin: 14px 0 4px;
  padding: 0;
}

.menu-list .btn {
  width: 100%;
  justify-content: center;
}

.help-list {
  list-style: none;
  gap: 10px;
}

.help-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.help-list li b {
  color: var(--ink);
}

.help-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ice);
  opacity: 0.7;
}
