:root {
  color-scheme: dark;
  font-family: Nunito, Arial, sans-serif;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

html,
body,
#app,
#wrap {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

html,
body,
body * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

img,
canvas {
  -webkit-user-drag: none;
  user-drag: none;
}

/* The game title/logo is intentionally removed from loading and menu screens. */
.loading-logo,
.menu-logo,
.menu {
  display: none !important;
}

.loading-inner {
  width: min(72vw, 440px) !important;
  padding-inline: max(18px, env(safe-area-inset-left)) !important;
}

#platform-start {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 54%, rgba(40, 187, 225, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(1, 17, 35, 0.1), rgba(1, 13, 29, 0.52));
  opacity: 0;
  transition: opacity 180ms ease;
}

#platform-start.is-visible {
  opacity: 1;
}

#platform-start-button {
  position: relative;
  min-width: clamp(190px, 30vw, 310px);
  min-height: clamp(68px, 11vh, 92px);
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 14px 40px 16px;
  color: #07324a;
  background: linear-gradient(180deg, #fff46c 0%, #ffc52e 62%, #f59a18 100%);
  box-shadow:
    0 8px 0 #b95f0b,
    0 16px 30px rgba(0, 0, 0, 0.38),
    inset 0 3px 0 rgba(255, 255, 255, 0.72);
  font: 900 clamp(28px, 5vmin, 48px) / 1 Lilita One, Nunito, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

#platform-start-button:hover {
  filter: saturate(1.08) brightness(1.05);
  transform: translateY(-1px);
}

#platform-start-button:active {
  transform: translateY(6px);
  box-shadow:
    0 2px 0 #b95f0b,
    0 8px 18px rgba(0, 0, 0, 0.32),
    inset 0 3px 0 rgba(255, 255, 255, 0.6);
}

html[data-game-lang="ru"] button[data-sdk-label] img {
  display: none !important;
}

html[data-game-lang="ru"] button[data-sdk-label]::after {
  content: attr(data-sdk-label);
  display: grid;
  place-items: center;
  min-width: 128px;
  min-height: 48px;
  padding: 8px 18px;
  box-sizing: border-box;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(180deg, #ffb32f, #e96a18);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 4px 0 #963b10;
  font: 900 clamp(19px, 3.2vmin, 32px) / 1 Lilita One, Nunito, sans-serif;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

html[data-game-lang="ru"] .badge-new,
html[data-game-lang="ru"] .badge-record {
  width: auto;
  min-width: 58px;
  height: 24px;
  margin-left: 7px;
  padding: 2px 7px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(180deg, #ffcc31, #ed7c0c);
  box-shadow: 0 2px 0 #9c4008, inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font: 900 11px/16px Nunito, Arial, sans-serif;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  vertical-align: middle;
}

html[data-game-lang="ru"] .badge-record {
  min-width: 68px;
  background: linear-gradient(180deg, #42bfff, #176bd4);
  box-shadow: 0 2px 0 #0b3f91, inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

html[data-game-lang="ru"] .badge-new::after,
html[data-game-lang="ru"] .badge-record::after {
  content: attr(data-sdk-badge);
}

html[data-game-lang="ru"] .shop-tab {
  min-width: 92px;
  padding-left: 7px;
  padding-right: 7px;
  font-size: 13px;
}

html[data-game-lang="ru"] .shop-tag,
html[data-game-lang="ru"] .shop-buy {
  font-size: 12px;
}

@media (max-width: 720px), (max-height: 520px) {
  #platform-start {
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  #platform-start-button {
    min-width: min(62vw, 240px);
    min-height: 58px;
    padding: 10px 28px 12px;
    border-width: 3px;
    box-shadow: 0 6px 0 #b95f0b, 0 12px 24px rgba(0, 0, 0, 0.36);
  }

  .loading-inner {
    width: min(78vw, 360px) !important;
  }
}

@media (max-height: 430px) {
  #platform-start-button {
    min-height: 52px;
    font-size: 27px;
  }
}

/* Fit the actual game viewport, including browser chrome/fullscreen changes. */
#wrap {
  width: var(--game-width, 100%);
  height: var(--game-height, 100dvh);
}

#hud {
  --edge: 12px;
  --action-size: 112px;
  --hud-top: max(var(--edge), var(--sat));
  --hud-right: max(var(--edge), var(--sar));
  --hud-bottom: max(var(--edge), var(--sab));
  --hud-left: max(var(--edge), var(--sal));
}

/* Lilita One has no Cyrillic glyphs; Safari's cursive fallback is unreadable. */
html[data-game-lang="ru"] #hud,
html[data-game-lang="ru"] #hud *,
html[data-game-lang="ru"] .loading-label,
html[data-game-lang="ru"] #platform-start-button {
  font-family: Nunito, Arial, sans-serif;
}
html[data-game-lang="ru"] #hud { font-weight: 700; }
html[data-game-lang="ru"] .lvl-label,
html[data-game-lang="ru"] .lvl-num,
html[data-game-lang="ru"] .catch-name,
html[data-game-lang="ru"] .modal-title,
html[data-game-lang="ru"] .shop-item-name,
html[data-game-lang="ru"] #hud button,
html[data-game-lang="ru"] #platform-start-button {
  font-weight: 900;
}

html[data-game-lang="ru"] .doober-xp::after { content: "ОП"; }

.lvl-wrap { top: var(--hud-top); left: var(--hud-left); max-width: 45%; }
.lvl-badge { width: fit-content; }
.xp-bar { max-width: 100%; }
.area-name { letter-spacing: 0; overflow-wrap: anywhere; }
.coins { top: var(--hud-top); right: var(--hud-right); max-width: 45%; }
.mute-btn { top: calc(var(--hud-top) + 54px); right: var(--hud-right); }
.side-btns { left: var(--hud-left); bottom: var(--hud-bottom); }
.main-btn {
  right: var(--hud-right);
  bottom: var(--hud-bottom);
  width: var(--action-size);
  height: var(--action-size);
  font-size: 16px;
  line-height: 1.1;
  padding: 6px;
}
.combo-wrap { padding: 0 6px 4px; }
.spotted { top: calc(var(--hud-top) + 120px); }
.tension-wrap {
  right: calc(var(--hud-right) + var(--action-size) + 16px);
  bottom: calc(var(--hud-bottom) + 8px);
  width: min(440px, calc(100% - var(--hud-left) - var(--hud-right) - var(--action-size) - 16px));
}
.tension-label, .hold-label { letter-spacing: 0; overflow-wrap: anywhere; }
.ftue-cast {
  top: auto;
  bottom: calc(var(--hud-bottom) + 4px);
  left: 50%;
  width: min(210px, calc(100% - 170px));
  transform: translateX(-50%);
}
.ftue-cast .ftue-finger { margin: 0 auto; }
.ftue-label { white-space: normal; text-align: center; margin-left: 0; overflow-wrap: anywhere; }
.ftue-label-btn { font-size: 12px; }
.ftue-btn {
  right: var(--hud-right);
  bottom: calc(var(--hud-bottom) + var(--action-size) + 8px);
  width: var(--action-size);
  height: 86px;
}
.ftue-finger-tap, .ftue-finger-hold { left: 16px; bottom: 16px; width: 66px; height: 66px; }
.ftue-reel-tip {
  left: var(--hud-left);
  right: calc(var(--hud-right) + var(--action-size) + 16px);
  bottom: calc(var(--hud-bottom) + 128px);
  max-width: 400px;
  transform: none;
  padding: 6px 10px;
  font-size: 13px;
}
.ftue-shop {
  left: calc(var(--hud-left) + 84px);
  right: var(--hud-right);
  bottom: calc(var(--hud-bottom) + 94px);
  max-width: 320px;
}
.ftue-shop-tip { white-space: normal; overflow-wrap: anywhere; }
.toast {
  width: calc(100% - var(--hud-left) - var(--hud-right) - 12px);
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 4vw, 40px);
  -webkit-text-stroke-width: 1px;
  z-index: 45;
}
.hint { max-width: calc(100% - 24px); white-space: normal; text-align: center; }

/* A result may grow with localization, long fish names and both record badges. */
.catch-card {
  bottom: var(--hud-bottom);
  width: min(390px, calc(100% - var(--hud-left) - var(--hud-right)));
  max-height: calc(100% - var(--hud-top) - var(--hud-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 16px;
  z-index: 50;
  animation: resultFadeIn 180ms ease-out;
}
@keyframes resultFadeIn { from { opacity: 0; } to { opacity: 1; } }
.catch-rarity { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; letter-spacing: 1px; }
.catch-rarity .badge-new, .catch-rarity .badge-record { flex-shrink: 0; margin-left: 0; animation: none; }
.catch-name { overflow-wrap: anywhere; font-size: clamp(23px, 5vw, 32px); line-height: 1.15; margin: 6px 0; }
.catch-rewards { flex-wrap: wrap; gap: 6px 14px; }
.catch-card .bonus-btn { width: 100%; padding: 10px 12px; font-size: 17px; line-height: 1.3; animation: none; }
.continue-btn { max-width: 100%; min-width: min(180px, 100%); padding: 12px 24px; }
.catch-card .continue-btn { white-space: normal; }
#hud:has(.catch-card) > .spotted,
#hud:has(.catch-card) > .combo-wrap,
#hud:has(.catch-card) > .ftue { display: none; }

.modal-veil {
  padding: var(--hud-top) var(--hud-right) var(--hud-bottom) var(--hud-left);
  z-index: 60;
}
.modal {
  width: min(560px, 100%);
  max-height: 100%;
  min-height: 0;
  padding: clamp(10px, 3vw, 22px);
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
}
.modal * { touch-action: pan-y; }
.modal-title { overflow-wrap: anywhere; font-size: clamp(21px, 5vw, 28px); }
.shop-tabs { gap: 6px; }
.shop-tab, html[data-game-lang="ru"] .shop-tab { min-width: 0; flex: 1; padding: 8px 4px; font-size: 13px; }
.shop-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; padding: 10px; }
.shop-thumb { width: 48px; height: 48px; }
.shop-item-info { min-width: 0; overflow-wrap: anywhere; }
.shop-item-name { font-size: 17px; line-height: 1.2; }
.shop-item-desc { line-height: 1.35; }
.shop-buy { min-width: 76px; padding: 10px 8px; }
.shop-ad-btn { max-width: 100%; padding: 9px 10px; gap: 5px; flex-wrap: wrap; }
.collection-grid { grid-template-columns: repeat(auto-fit, minmax(min(96px, 100%), 1fr)); gap: 8px; }
.col-card { min-width: 0; }
.col-name, .col-stats { overflow-wrap: anywhere; }

@media (max-width: 420px) {
  #hud { --edge: 10px; --action-size: 92px; }
  .lvl-badge { padding: 5px 12px; gap: 7px; }
  .lvl-label, .lvl-num { font-size: 23px; }
  .xp-bar { width: 122px; height: 8px; margin-top: 5px; }
  .area-name { font-size: 12px; margin-top: 4px; }
  .coins { padding: 6px 10px; font-size: 19px; gap: 5px; }
  .coin-icon { width: 24px; height: 24px; }
  .mute-btn { width: 42px; height: 42px; top: calc(var(--hud-top) + 46px); }
  .round-btn { width: 56px; height: 56px; }
  .side-btns { gap: 10px; }
  .combo-wrap { top: calc(var(--hud-top) + 85px); }
  .combo-x { font-size: 36px; }
  .combo-label { font-size: 12px; }
  .spotted { top: 170px; width: calc(100% - 28px); }
  .shop-item { grid-template-columns: 40px minmax(0, 1fr); gap: 6px 9px; }
  .shop-thumb { width: 40px; height: 40px; }
  .shop-buy, .shop-tag { grid-column: 2; justify-self: end; }
  .ftue-shop { left: calc(var(--hud-left) + 66px); bottom: calc(var(--hud-bottom) + 66px); }
  .ftue-cast { width: calc(100% - 144px); }
  .ftue-label { font-size: 15px; }
  .ftue-label-btn { font-size: 12px; }
  .ftue-reel-tip { bottom: calc(var(--hud-bottom) + 118px); font-size: 12px; }
  .tension-label { font-size: 12px; }
  .main-btn { font-size: 13px; }
}

/* Landscape phones lose much of their height to the platform and browser bars. */
@media (max-height: 520px) {
  #hud { --edge: 10px; --action-size: 86px; }
  .lvl-badge { padding: 3px 12px; gap: 6px; border-width: 2px; }
  .lvl-label, .lvl-num { font-size: 20px; }
  .xp-bar { width: 110px; height: 7px; margin-top: 4px; }
  .area-name { font-size: 12px; margin-top: 3px; line-height: 1.2; }
  .coins { padding: 5px 10px; font-size: 18px; gap: 5px; }
  .coin-icon { width: 22px; height: 22px; }
  .mute-btn { top: calc(var(--hud-top) + 42px); width: 38px; height: 38px; }
  .side-btns { flex-direction: row; gap: 10px; }
  .round-btn { width: 50px; height: 50px; }
  .combo-wrap { top: var(--hud-top); }
  .combo-label { font-size: 11px; }
  .combo-x { font-size: 31px; -webkit-text-stroke-width: 1px; }
  .spotted { top: calc(var(--hud-top) + 56px); width: min(260px, calc(100% - 140px)); padding: 5px 10px; border-width: 2px; }
  .spotted-tag { font-size: 11px; letter-spacing: 0; }
  .spotted-name { font-size: 15px; line-height: 1.15; margin: 2px 0 4px; }
  .spotted-bar { height: 5px; }
  .ftue-cast { bottom: calc(var(--hud-bottom) + 3px); width: min(220px, calc(100% - 260px)); }
  .ftue-cast .ftue-finger { width: 64px; height: 64px; }
  .ftue-label { font-size: 14px; line-height: 1.25; }
  .ftue-shop { left: calc(var(--hud-left) + 124px); bottom: calc(var(--hud-bottom) + 3px); }
  .ftue-shop-tip { font-size: 12px; }
  .ftue-btn { height: 60px; }
  .ftue-finger-tap, .ftue-finger-hold { width: 58px; height: 58px; left: 20px; }
  .ftue-label-btn { font-size: 12px; }
  .ftue-reel-tip { bottom: calc(var(--hud-bottom) + 80px); padding: 4px 8px; font-size: 11px; max-width: 330px; }
  .tension-track { height: 14px; }
  .tension-label { font-size: 12px; margin-top: 3px; }
  .hold-track { height: 10px; margin-top: 5px; }
  .hold-label { font-size: 11px; margin-top: 3px; }
  .main-btn { font-size: 12px; }
  .power-wrap { right: var(--hud-right); bottom: var(--hud-bottom); }
  .power-track { width: 25px; height: clamp(44px, calc(var(--game-height, 100dvh) - 125px), 150px); border-width: 2px; }
  .power-label { font-size: 12px; }
  .catch-card { padding: 10px 14px; max-height: calc(100% - var(--hud-top) - var(--hud-bottom) - 84px); }
  .catch-name { font-size: 24px; }
  .catch-kg { font-size: 18px; margin-bottom: 5px; }
  .catch-rarity { font-size: 12px; }
  .catch-rewards { margin-bottom: 6px; }
  .reward { font-size: 17px; }
  .catch-card .bonus-btn { padding: 7px 10px; font-size: 14px; }
  .continue-btn { padding: 10px 20px; font-size: 18px; }
}

@media (max-height: 520px) and (min-width: 500px) {
  .catch-card {
    width: min(600px, calc(100% - var(--hud-left) - var(--hud-right)));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: 4px 16px;
    align-items: center;
  }
  .catch-rarity { grid-column: 1; grid-row: 1; }
  .catch-name { grid-column: 1; grid-row: 2; margin: 0; }
  .catch-kg { grid-column: 1; grid-row: 3; margin: 0; }
  .catch-rewards { grid-column: 1; grid-row: 4; margin: 0; }
  .catch-card .bonus-btn { grid-column: 2; grid-row: 1 / 3; margin: 0; align-self: end; }
  .catch-card .continue-btn { grid-column: 2; grid-row: 3 / 5; width: 100%; min-width: 0; margin-top: 4px; }
  .revive-sub { grid-column: 1; grid-row: 2 / 5; margin: 0; }
}

@media (max-height: 360px) {
  .ftue-btn { height: 28px; }
  .ftue-btn .ftue-finger { display: none; }
  .ftue-label-btn { top: 4px; }
  .catch-card { padding: 8px 10px; gap: 3px 12px; }
  .catch-name { font-size: 20px; }
  .catch-rarity { font-size: 11px; letter-spacing: 0; }
  html[data-game-lang="ru"] .badge-new, html[data-game-lang="ru"] .badge-record { font-size: 10px; min-width: 52px; height: 21px; line-height: 15px; padding: 1px 4px; }
  .catch-card .bonus-btn { font-size: 13px; padding: 6px 8px; }
  .catch-card .continue-btn { font-size: 16px; padding: 9px 14px; }
  .modal-title { margin-bottom: 8px; }
  .shop-coins { margin-bottom: 6px; }
}

@media (max-width: 360px) {
  .shop-tab, html[data-game-lang="ru"] .shop-tab { font-size: 11px; padding-inline: 2px; }
}
