@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Outfit:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg: #0a0a0f;
  --surface: #14141c;
  --surface-2: #1c1c28;
  --text: #f2f2f5;
  --text-dim: #9a9aa8;
  --accent: #e9d6b9;

  --bronze: #b08d57;
  --silver: #c0c0c0;
  --gold: #ffd700;
  --legendary-1: #ff5f6d;
  --legendary-2: #ffc371;
  --legendary-3: #47cf73;
  --legendary-4: #4fa8ff;
  --legendary-5: #c04fff;

  /* Set from app.js via AdMob's BannerAdPluginEvents.SizeChanged — the native
     banner (a real view above the WebView, not a DOM element) has no size
     until it loads, so this stays 0px whenever no banner is showing. */
  --banner-height: 0px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .display {
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.04em;
  margin: 0;
}

/* ---------- Auth screen ---------- */

.auth-screen {
  max-width: 400px;
  margin: 0 auto;
  min-height: 100vh;
  padding: calc(80px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.auth-screen[hidden] { display: none; }

.auth-logo { width: 72px; height: auto; margin-bottom: 16px; }

.auth-screen h1.display { font-size: 48px; margin-bottom: 12px; }

.auth-tagline {
  color: var(--text-dim);
  font-size: 15px;
  margin: 0 0 32px;
}

.auth-screen form { width: 100%; text-align: left; }

.auth-error {
  color: #ff8080;
  font-size: 13px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 128, 128, 0.1);
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.auth-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  cursor: pointer;
  min-height: 44px;
}

.settings-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  min-width: 44px;
  min-height: 44px;
}

.topbar-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

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

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: calc(96px + env(safe-area-inset-bottom) + var(--banner-height));
}

.app[hidden] { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: calc(24px + env(safe-area-inset-top)) 20px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  width: 28px;
  height: auto;
}

.topbar h1 {
  font-size: 32px;
}

.topbar .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-dim);
}

/* ---------- Empty state ---------- */

.empty-banner {
  margin: 0 20px 16px;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  text-align: center;
}

.empty-banner p {
  margin: 0 0 12px;
  color: var(--text-dim);
  font-size: 15px;
}

.load-error-banner {
  margin: 0 20px 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 128, 128, 0.1);
  text-align: center;
}

.load-error-banner p {
  margin: 0;
  color: #ff8080;
  font-size: 14px;
}

.load-error-banner button {
  background: none;
  border: none;
  color: #ff8080;
  text-decoration: underline;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
}

/* ---------- Dex grid ---------- */

.dex-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 0 20px;
}

.dex-card {
  aspect-ratio: 4 / 5;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  /* No justify-content here on purpose — the icon below is a flex item that
     grows to fill whatever space the name (and, when present, the tier badge)
     don't need, so it always fills "the rest of the card" while name/badge
     stay anchored to the bottom, however tall that bottom block happens to be. */
  gap: 8px;
  padding: 14px 10px 12px;
  text-align: center;
  min-height: 44px;
  border: 1px solid var(--surface-2);
}

.dex-card.locked {
  /* A few shades brighter than --surface on purpose: the silhouette itself
     is forced to pure black (brightness(0) below), so it needs contrast
     against the card background to actually read as a fish shape rather
     than disappearing into it. */
  background: #1a1a24;
  color: var(--surface-2);
}

.dex-card .fish-icon {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Before the catch: the same 3D model, forced to solid black via `brightness(0)`
   so it reads as a silhouette rather than showing its real colors/textures. */
.dex-card.locked .fish-icon {
  filter: brightness(0);
}

/* Interactive (drag to rotate) like the detail-page hero; a plain tap without
   drag still bubbles up and opens the species page. */
model-viewer.fish-icon {
  --poster-color: transparent;
  background-color: transparent;
}

.dex-card-name {
  flex: 0 0 auto;
}

.dex-card-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.length-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface);
  padding: 3px 10px;
  border-radius: 999px;
}

.dex-card.locked .dex-card-name {
  font-size: 15px;
  color: var(--text-dim);
  opacity: 0.7;
}

.dex-card.unlocked {
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}

.dex-card.unlocked .dex-card-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.dex-card.unlocked .tier-badge {
  flex: 0 0 auto;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 3px 12px;
  border-radius: 999px;
}

.dex-card.unlocked.tier-bronze { box-shadow: 0 0 14px -4px var(--bronze) inset; }
.dex-card.unlocked.tier-bronze .tier-badge { background: var(--bronze); color: #241a0d; }

.dex-card.unlocked.tier-silver { box-shadow: 0 0 14px -4px var(--silver) inset; }
.dex-card.unlocked.tier-silver .tier-badge { background: var(--silver); color: #1a1a1a; }

.dex-card.unlocked.tier-gold { box-shadow: 0 0 16px -3px var(--gold) inset; }
.dex-card.unlocked.tier-gold .tier-badge { background: var(--gold); color: #241a0d; }

.dex-card.unlocked.tier-legendary {
  box-shadow: 0 0 18px -2px var(--legendary-5) inset;
}
.dex-card.unlocked.tier-legendary .tier-badge {
  background: linear-gradient(90deg, var(--legendary-1), var(--legendary-2), var(--legendary-3), var(--legendary-4), var(--legendary-5));
  color: #10101a;
}

/* ---------- Paid species pack section (dex grid) ---------- */
/* A "buy to unlock" area appended after the free/owned grid, not mixed into
   its silhouette-until-caught cards — a plain black silhouette there would
   wrongly imply "go fish for this locally", when it's actually gated behind
   a purchase. grid-column spans both columns so these read as full-width
   section elements inside the otherwise 2-column .dex-grid. */

.dex-pack-divider {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--surface-2);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.dex-pack-cta {
  grid-column: 1 / -1;
  min-height: 52px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #241a0d;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.dex-pack-cta:active { opacity: 0.85; }

.dex-card.pack-locked {
  /* Same locked-card background as .dex-card.locked (brighter than --surface
     for contrast — see that rule's comment), but a lock icon instead of a
     silhouette: this isn't "you haven't caught it yet", it's "you don't own
     this pack yet". */
  background: #1a1a24;
  color: var(--surface-2);
  justify-content: center;
}

.pack-lock-icon {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  opacity: 0.5;
}

.dex-card.pack-locked .dex-card-name {
  font-size: 15px;
  color: var(--text-dim);
  opacity: 0.7;
}

/* ---------- Bundle preview / purchase overlay ---------- */

.bundle-modal {
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}

.bundle-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  min-width: 0;
  min-height: 0;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

#bundle-title {
  font-size: 26px;
  padding-right: 44px;
  margin-bottom: 8px;
}

.bundle-species-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.bundle-species-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.bundle-species-model {
  width: 100%;
  aspect-ratio: 1;
  --poster-color: transparent;
  background-color: transparent;
}

#bundle-buy,
#bundle-restore {
  width: 100%;
  margin-top: 10px;
}

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom) + var(--banner-height));
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 440px;
  min-height: 52px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #241a0d;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.fab:active { opacity: 0.85; }

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  z-index: 20;
}

.modal-overlay[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
}

.modal h2 { font-size: 26px; margin-bottom: 16px; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field select,
.field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--surface-2);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}

.field input[type="number"],
.field input[type="date"] {
  font-family: 'JetBrains Mono', monospace;
}

.field .error {
  color: #ff8080;
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

.field.invalid .error { display: block; }
.field.invalid input { border-color: #ff8080; }

.photo-add-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--surface-2);
  background: var(--bg);
  color: var(--text-dim);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  cursor: pointer;
}

.photo-preview {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.photo-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  min-width: 0;
  min-height: 0;
  border-radius: 999px;
  border: none;
  background: rgba(10, 10, 15, 0.7);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  min-height: 44px;
  border-radius: 999px;
  border: none;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  cursor: pointer;
  flex: 1;
}

.btn-primary { background: var(--accent); color: #241a0d; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-secondary { background: var(--surface-2); color: var(--text); }

/* ---------- Unlock screen ---------- */

.unlock-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #16161f 0%, #05050a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  text-align: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}

.unlock-overlay[hidden] { display: none; }

.unlock-eyebrow {
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 0.4s ease forwards 0.1s;
}

.unlock-card {
  width: 220px;
  height: 300px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface-2);
  transform: scale(0.6) rotateY(90deg);
  opacity: 0;
  animation: cardFlip 0.7s cubic-bezier(.2,.8,.2,1) forwards 0.2s;
}

.unlock-fish-icon {
  width: 140px;
  height: 140px;
}

.unlock-model {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  background-color: transparent;
}

.unlock-card .species-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 0.03em;
}

.unlock-card .tier-badge {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  letter-spacing: 0.08em;
  padding: 4px 16px;
  border-radius: 999px;
}

.unlock-card.tier-bronze { box-shadow: 0 0 50px 0 var(--bronze); }
.unlock-card.tier-bronze .tier-badge { background: var(--bronze); color: #241a0d; }

.unlock-card.tier-silver { box-shadow: 0 0 50px 0 var(--silver); }
.unlock-card.tier-silver .tier-badge { background: var(--silver); color: #1a1a1a; }

.unlock-card.tier-gold { box-shadow: 0 0 60px 5px var(--gold); }
.unlock-card.tier-gold .tier-badge { background: var(--gold); color: #241a0d; }

.unlock-card.tier-legendary {
  box-shadow: 0 0 70px 10px var(--legendary-5);
  animation: cardFlip 0.7s cubic-bezier(.2,.8,.2,1) forwards 0.2s, legendaryPulse 2s ease-in-out infinite 0.9s;
}
.unlock-card.tier-legendary .tier-badge {
  background: linear-gradient(90deg, var(--legendary-1), var(--legendary-2), var(--legendary-3), var(--legendary-4), var(--legendary-5));
  color: #10101a;
}

.unlock-caption {
  margin-top: 24px;
  font-size: 15px;
  color: var(--text-dim);
  opacity: 0;
  animation: fadeUp 0.4s ease forwards 0.9s;
}

.unlock-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.unlock-dismiss {
  min-height: 44px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid var(--surface-2);
  background: transparent;
  color: var(--text);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0;
  animation: fadeUp 0.4s ease forwards 1.1s;
}

.unlock-share {
  min-height: 44px;
  padding: 0 28px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #05050a;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0;
  animation: fadeUp 0.4s ease forwards 1.1s;
}

@keyframes cardFlip {
  to { transform: scale(1) rotateY(0deg); opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 70px 10px var(--legendary-5); }
  50% { box-shadow: 0 0 90px 20px var(--legendary-3); }
}

/* ---------- Settings screen ---------- */

.settings-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 25;
  overflow-y: auto;
}

.settings-overlay[hidden] { display: none; }

.settings-panel {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px calc(48px + env(safe-area-inset-bottom));
}

.settings-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-header h2 { font-size: 26px; }

.settings-back {
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.settings-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--surface-2);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}

.settings-description {
  font-size: 14px;
  color: var(--text-dim);
  margin: -6px 0 12px;
}

.lang-toggle {
  display: flex;
  gap: 8px;
}

.lang-option {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--surface-2);
  background: var(--surface);
  color: var(--text-dim);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.lang-option.active {
  border-color: var(--accent);
  background: rgba(233, 214, 185, 0.12);
  color: var(--text);
}

.settings-message {
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(233, 214, 185, 0.1);
}

.settings-message.error {
  color: #ff8080;
  background: rgba(255, 128, 128, 0.1);
}

.settings-logout {
  width: 100%;
}

.settings-danger-zone h3 {
  color: #ff8080;
}

.btn-danger {
  width: 100%;
  background: transparent;
  color: #ff8080;
  border: 1px solid rgba(255, 128, 128, 0.4);
}

/* ---------- Species detail view ---------- */
/* Lives inside #app (normal document flow), not a fixed overlay like Settings
   — the FAB is a sibling in #app and stays visible/clickable on top of it. */

.species-view {
  padding: 0 20px 32px;
}

.species-view[hidden] { display: none; }

.species-view-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.species-view-header h2 {
  font-size: 26px;
}

.species-hero {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  margin-bottom: 20px;
}

.species-hero-model {
  width: 100%;
  height: 260px;
  --poster-color: transparent;
  background-color: transparent;
}

/* Before the catch: same model, forced to solid black to read as a silhouette. */
.species-hero-model.locked {
  filter: brightness(0);
}

.species-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.species-stat {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.species-stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.species-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
}

.species-thresholds {
  margin-bottom: 28px;
}

.species-thresholds h3,
.species-log h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}

.species-threshold-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.species-threshold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 10px;
}

.species-threshold-tier {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 999px;
}

.species-threshold-tier.tier-silver { background: var(--silver); color: #1a1a1a; }
.species-threshold-tier.tier-gold { background: var(--gold); color: #241a0d; }
.species-threshold-tier.tier-legendary {
  background: linear-gradient(90deg, var(--legendary-1), var(--legendary-2), var(--legendary-3), var(--legendary-4), var(--legendary-5));
  color: #10101a;
}

.species-threshold-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
}

.species-log-empty {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  padding: 16px;
}

.species-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.catch-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 10px;
}

.catch-entry-info {
  flex: 1;
  min-width: 0;
}

.catch-entry-length {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
}

.catch-entry-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}

.catch-entry.has-photo { cursor: pointer; }
.catch-entry.has-photo:active { background: var(--surface-2); }

.catch-entry-photo-indicator {
  flex: 0 0 auto;
  font-size: 14px;
}

.catch-entry-tier {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.catch-entry-tier.tier-bronze { background: var(--bronze); color: #241a0d; }
.catch-entry-tier.tier-silver { background: var(--silver); color: #1a1a1a; }
.catch-entry-tier.tier-gold { background: var(--gold); color: #241a0d; }
.catch-entry-tier.tier-legendary {
  background: linear-gradient(90deg, var(--legendary-1), var(--legendary-2), var(--legendary-3), var(--legendary-4), var(--legendary-5));
  color: #10101a;
}

.catch-entry-actions {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}

.catch-entry-actions button {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
}

.catch-entry-actions button:active {
  background: var(--surface-2);
}

/* ---------- Photo viewer ---------- */

.photo-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}

.photo-viewer-overlay[hidden] { display: none; }

.photo-viewer-img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  object-fit: contain;
}

.photo-viewer-actions {
  margin-top: 20px;
  width: 100%;
  max-width: 280px;
  display: flex;
}

.photo-viewer-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  width: 40px;
  height: 40px;
  min-width: 0;
  min-height: 0;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

/* ---------- Share preview ---------- */

.share-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}

.share-preview-overlay[hidden] { display: none; }

.share-preview-card-wrap {
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.share-preview-actions {
  margin-top: 20px;
  width: 100%;
  max-width: 320px;
  display: flex;
  gap: 12px;
}

.share-preview-actions .btn { flex: 1; }

.share-preview-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  width: 40px;
  height: 40px;
  min-width: 0;
  min-height: 0;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

/* ---------- Share card (rendered inside the preview above; scaled down via
   a JS-set transform to fit the screen, rasterized at true size by
   confirmShare() using html-to-image's per-capture style override) ---------- */

.share-card {
  width: 1080px;
  height: 1920px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: radial-gradient(ellipse at center, #16161f 0%, #05050a 100%);
  overflow: hidden;
  transform-origin: top left;
}

.share-card-hero {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.share-card.tier-bronze .share-card-hero.no-photo { background: radial-gradient(ellipse at center, var(--bronze) 0%, #05050a 70%); }
.share-card.tier-silver .share-card-hero.no-photo { background: radial-gradient(ellipse at center, var(--silver) 0%, #05050a 70%); }
.share-card.tier-gold .share-card-hero.no-photo { background: radial-gradient(ellipse at center, var(--gold) 0%, #05050a 70%); }
.share-card.tier-legendary .share-card-hero.no-photo { background: radial-gradient(ellipse at center, var(--legendary-3) 0%, #05050a 70%); }

/* No photo: the species' 3D model render fills most of the hero, over the
   tier-color gradient set above. Has a photo: the same render shrinks into
   a small badge in the corner instead. */
.share-card-model-img.hero-fill {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: 78%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.5));
}

.share-card-model-img.hero-badge {
  position: absolute;
  top: 56px;
  right: 56px;
  width: 180px;
  height: 180px;
  object-fit: contain;
  padding: 16px;
  border-radius: 28px;
  background: rgba(10, 10, 15, 0.55);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.share-card-body {
  position: relative;
  z-index: 1;
  padding: 64px;
  background: linear-gradient(to top, rgba(5,5,10,0.95) 0%, rgba(5,5,10,0.65) 55%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.share-card .species-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 96px;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0.02em;
}

.share-card .tier-badge {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 40px;
  letter-spacing: 0.08em;
  padding: 12px 40px;
  border-radius: 999px;
  align-self: flex-start;
}

.share-card.tier-bronze .tier-badge { background: var(--bronze); color: #241a0d; }
.share-card.tier-silver .tier-badge { background: var(--silver); color: #1a1a1a; }
.share-card.tier-gold .tier-badge { background: var(--gold); color: #241a0d; }
.share-card.tier-legendary .tier-badge {
  background: linear-gradient(90deg, var(--legendary-1), var(--legendary-2), var(--legendary-3), var(--legendary-4), var(--legendary-5));
  color: #10101a;
}

.share-card-stats {
  display: flex;
  gap: 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 36px;
  color: var(--text-dim);
}

.share-card-brand {
  margin-top: 12px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 0.15em;
  color: var(--accent);
}
