:root {
  color-scheme: light;
  --ink: #0a2430;
  --ink-soft: #53656c;
  --deep-sea: #071f2d;
  --sea: #0d5363;
  --foam: #f2f5f3;
  --surface: #ffffff;
  --lime: #d8ff72;
  --line: #dce4e1;
  --shadow: 0 18px 40px rgba(8, 39, 49, 0.11);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { background: #d9e2df; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--foam);
}

button,
input { font: inherit; }

button { color: inherit; }

.app-shell {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--foam);
  box-shadow: 0 0 60px rgba(7, 31, 45, 0.12);
}

.app-header {
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  color: #fff;
  background: var(--deep-sea);
  border-radius: 0 0 22px 22px;
}

.topbar,
.section-heading,
.counter-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.brand-icon {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 13px;
}

.brand > span { display: flex; flex-direction: column; }
.brand strong { font-size: 18px; line-height: 1.15; }
.brand small { margin-top: 2px; color: rgba(255, 255, 255, 0.58); font-size: 10px; font-weight: 500; }

.header-actions { display: flex; align-items: center; gap: 11px; }

.progress-ring {
  --progress: 0deg;
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--lime) 0deg var(--progress), rgba(255, 255, 255, 0.14) var(--progress) 360deg);
}

.progress-ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--deep-sea);
}

.progress-ring > span:first-child {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.profile-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.09);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--lime);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow.dark { color: #39707a; }

h2,
h3,
p { margin-top: 0; }

.counter-card p { margin-bottom: 3px; font-size: 13px; font-weight: 700; }

.catalog,
.trips,
.anglers { padding: 26px 16px 100px; }
.view[hidden] { display: none; }
.section-heading { align-items: end; margin: 0 4px 22px; }
.section-heading h2 { margin-bottom: 0; font: 800 25px "Segoe UI", system-ui, sans-serif; letter-spacing: -0.035em; }
.result-count { color: var(--ink-soft); font-size: 12px; }

.catalog-actions { display: flex; align-items: center; gap: 10px; }

.filter-toggle {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  cursor: pointer;
}

.filter-toggle[aria-expanded="true"] { color: #fff; border-color: var(--deep-sea); background: var(--deep-sea); }
.filter-toggle:focus-visible { outline: 3px solid #77b9bd; outline-offset: 2px; }
.filter-icon { display: flex; width: 18px; flex-direction: column; align-items: flex-end; gap: 3px; }
.filter-icon i { display: block; height: 2px; border-radius: 2px; background: currentColor; }
.filter-icon i:nth-child(1) { width: 18px; }
.filter-icon i:nth-child(2) { width: 13px; }
.filter-icon i:nth-child(3) { width: 8px; }

.filter-indicator {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #a8dfb3;
}

.filter-indicator.occurrence-comum { background: #205c43; }
.filter-indicator.occurrence-incomum { background: #86572f; }
.filter-indicator.occurrence-raro { background: #c94646; }
.filter-indicator.occurrence-rarissimo { background: #eddda9; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.active-trip-banner {
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  padding: 9px 13px;
  margin: -7px 0 14px;
  border: 1px solid #cfe2de;
  border-radius: 16px;
  text-align: left;
  color: var(--ink);
  background: #edf7f3;
  cursor: pointer;
}
.active-trip-banner > span:first-child { font-size: 22px; }
.active-trip-banner > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.active-trip-banner small { color: #658078; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.active-trip-banner strong { overflow: hidden; margin-top: 2px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.active-trip-banner > span:last-child { color: #6b8a82; font-size: 24px; }

.search-box span { color: #678087; font-size: 24px; line-height: 1; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.search-box input::placeholder { color: #92a1a5; }

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 20px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(10, 44, 53, 0.06);
}

.filter-strip[hidden] { display: none; }

.filter-chip {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: #52686e;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.filter-chip.active { border-color: var(--deep-sea); color: #fff; background: var(--deep-sea); }
.filter-chip.occurrence-muito-comum.active { border-color: #80c990; color: #123c29; background: #a8dfb3; }
.filter-chip.occurrence-comum.active { border-color: #205c43; background: #205c43; }
.filter-chip.occurrence-incomum.active { border-color: #86572f; background: #86572f; }
.filter-chip.occurrence-raro.active { border-color: #c94646; background: #c94646; }
.filter-chip.occurrence-rarissimo.active { border-color: #ddc27e; color: #493711; background: #eddda9; }

.fish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fish-card {
  display: block;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border: 0;
  border-radius: 19px;
  background: var(--surface);
  box-shadow: 0 4px 18px rgba(10, 44, 53, 0.06);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.fish-card:active { transform: scale(0.98); }
.fish-card:focus-visible { outline: 3px solid #38a4ac; outline-offset: 3px; }

.card-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: #fff;
}

.rarity-ribbon {
  position: absolute;
  z-index: 1;
  right: -38px;
  bottom: 17px;
  width: 126px;
  height: 12px;
  background: #9aa7a5;
  transform: rotate(-45deg);
  transform-origin: center;
}

.occurrence-comum .rarity-ribbon { background: #205c43; }
.occurrence-incomum .rarity-ribbon { background: #86572f; }
.occurrence-raro .rarity-ribbon { background: #c94646; }
.occurrence-rarissimo .rarity-ribbon { background: #eddda9; }
.occurrence-unassigned .rarity-ribbon { background: #9aa7a5; }

.card-image img { width: 100%; height: 100%; padding: 8px; object-fit: contain; object-position: center; transition: transform 250ms ease; }

.occurrence-dot {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 9px;
  height: 9px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: #a8dfb3;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
}

.occurrence-comum .occurrence-dot { background: #205c43; }
.occurrence-incomum .occurrence-dot { background: #86572f; }
.occurrence-raro .occurrence-dot { background: #c94646; }
.occurrence-rarissimo .occurrence-dot { background: #eddda9; }

.card-count {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  color: #fff;
  border-radius: 999px;
  background: var(--deep-sea);
  font-size: 10px;
  font-weight: 800;
}

.card-count.hidden { display: none; }

.card-copy { display: block; padding: 13px 12px 15px; }
.card-copy strong { display: block; overflow: hidden; font: 800 17px "Segoe UI", system-ui, sans-serif; letter-spacing: -0.02em; text-overflow: ellipsis; white-space: nowrap; }
.card-copy em { display: block; overflow: hidden; margin-top: 4px; color: #75868b; font-family: Georgia, serif; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { padding: 50px 20px; text-align: center; color: var(--ink-soft); }
.empty-state span { display: block; margin-bottom: 10px; color: #78a0a4; font-size: 44px; }
.empty-state h3 { margin-bottom: 6px; color: var(--ink); font: 700 17px "Segoe UI", system-ui, sans-serif; }
.empty-state p { font-size: 13px; }

.fish-dialog {
  width: min(100% - 16px, 620px);
  max-height: calc(100dvh - 16px);
  margin: auto auto 0;
  padding: 0;
  overflow: hidden auto;
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.fish-dialog::backdrop { background: rgba(2, 18, 25, 0.68); backdrop-filter: blur(4px); }
.fish-dialog[open] { animation: slide-up 220ms ease-out; }

@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.dialog-sheet { position: relative; }
.dialog-image-wrap { position: relative; aspect-ratio: 1.35; overflow: hidden; background: #fff; }
.dialog-image-wrap img { width: 100%; height: 100%; padding: 12px; object-fit: contain; object-position: center; }

.close-button {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0 0 3px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(7, 31, 45, 0.74);
  font-size: 25px;
  cursor: pointer;
}

.occurrence-badge {
  position: absolute;
  left: 18px;
  bottom: 15px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #123c29;
  background: #a8dfb3;
  font-size: 10px;
  font-weight: 800;
}

.occurrence-badge.occurrence-comum { color: #fff; background: #205c43; }
.occurrence-badge.occurrence-incomum { color: #fff; background: #86572f; }
.occurrence-badge.occurrence-raro { color: #fff; background: #c94646; }
.occurrence-badge.occurrence-rarissimo { color: #493711; background: #eddda9; }

.dialog-content { padding: 24px 20px max(26px, env(safe-area-inset-bottom)); }
.dialog-content h2 { margin-bottom: 4px; font: 800 29px "Segoe UI", system-ui, sans-serif; letter-spacing: -0.04em; }
.scientific-name { margin-bottom: 4px; color: #667d82; font-family: Georgia, serif; font-size: 14px; font-style: italic; }
.aliases-line { margin-bottom: 0; color: #77878b; font-family: Georgia, serif; font-size: 12px; font-style: italic; }
.aliases-line span:first-child { font-weight: 700; }

.facts-list {
  margin: 22px 0;
  border-top: 1px solid var(--line);
}

.facts-list div { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 48px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.facts-list dt { color: #718287; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.facts-list dd { margin: 0; text-align: right; font-size: 14px; font-weight: 700; }

.counter-card { gap: 12px; padding: 15px; border-radius: 18px; color: #fff; background: var(--deep-sea); }
.counter-card p { margin-bottom: 1px; }
.counter-card small { color: rgba(255, 255, 255, 0.57); font-size: 9px; }

.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 11px; color: var(--deep-sea); background: var(--lime); font-size: 21px; font-weight: 800; cursor: pointer; }
.stepper button:disabled { cursor: not-allowed; opacity: 0.3; }
.stepper strong { min-width: 20px; text-align: center; font: 800 18px "Segoe UI", system-ui, sans-serif; }

.provisional-note { margin: 15px 2px 0; color: #7a898d; font-size: 10px; line-height: 1.5; }

.bottom-nav {
  position: fixed;
  z-index: 5;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: min(100%, 680px);
  min-height: 68px;
  padding: 7px 18px max(7px, env(safe-area-inset-bottom));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -8px 28px rgba(7, 31, 45, 0.08);
  backdrop-filter: blur(12px);
}

.nav-tab {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  color: #73868b;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.nav-tab span { font-size: 20px; filter: grayscale(1); }
.nav-tab.active { color: var(--deep-sea); }
.nav-tab.active span { filter: none; }

.anglers-heading { margin-bottom: 8px; }
.trips-heading { margin-bottom: 8px; }
.trip-list { display: grid; gap: 15px; }
.trip-card { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 4px 18px rgba(10, 44, 53, 0.05); }
.trip-card.active { border-color: #75a7a8; box-shadow: 0 0 0 2px rgba(56, 164, 172, 0.12); }
.trip-select { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border: 0; text-align: left; color: var(--ink); background: transparent; cursor: pointer; }
.trip-select:disabled { cursor: default; }
.trip-select > span { display: flex; min-width: 0; flex-direction: column; }
.trip-select small { margin-bottom: 3px; color: #658078; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.trip-select strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.trip-select em { margin-top: 4px; color: var(--ink-soft); font-size: 10px; font-style: normal; }
.trip-select b { flex: 0 0 auto; padding: 7px 9px; border-radius: 10px; color: #49645d; background: #edf2f0; font-size: 9px; }
.trip-card.active .trip-select b { color: #205c43; background: #def4e5; }
.trip-scoreboard { padding: 13px 16px 15px; border-top: 1px solid var(--line); background: #fbfcfb; }
.trip-scoreboard > p { margin: 0 0 8px; color: #6d7f83; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.score-row { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 12px; }
.score-row span { display: flex; min-width: 0; align-items: center; gap: 9px; font-size: 12px; font-weight: 700; }
.score-row i { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: #4f6d66; background: #e5efeb; font-size: 9px; font-style: normal; }
.score-row:first-of-type i { color: #725817; background: #f8e9af; }
.score-row strong { color: var(--sea); font-size: 13px; }
.trip-empty { padding: 8px 0 3px; color: #849397; font-size: 11px; }
.angler-actions { display: flex; align-items: center; gap: 8px; }
.sync-status { padding: 8px 10px; border: 0; border-radius: 999px; color: #53656c; background: #e4eae8; font-size: 9px; font-weight: 800; cursor: pointer; }
.sync-status[data-status="online"] { color: #205c43; background: #def4e5; }
.sync-status[data-status="local"] { color: #445f67; background: #e4ecec; }
.sync-status[data-status="loading"] { color: #4f6268; background: #e4eae8; }
.sync-status[data-status="attention"] { color: #704c1f; background: #f7e8c7; }
.sync-status[data-status="error"] { color: #8b3535; background: #f7dddd; }
.section-description { margin: 0 4px 22px; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.primary-button,
.submit-button { border: 0; border-radius: 13px; color: #fff; background: var(--deep-sea); font-weight: 800; cursor: pointer; }
.primary-button { padding: 10px 14px; font-size: 12px; }
.angler-list { display: grid; gap: 14px; }
.angler-card { padding: 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 4px 18px rgba(10, 44, 53, 0.05); }
.angler-card.active { border-color: #75a7a8; box-shadow: 0 0 0 2px rgba(56, 164, 172, 0.12); }
.angler-card-header { display: flex; align-items: center; gap: 8px; }
.open-angler { display: flex; min-width: 0; flex: 1; align-items: center; gap: 12px; padding: 7px; border: 0; border-radius: 14px; text-align: left; background: transparent; cursor: pointer; }
.open-angler:active { background: #f0f4f2; }
.open-angler:focus-visible { outline: 3px solid #77b9bd; }
.angler-avatar { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border-radius: 50%; color: #fff; background: var(--sea); font-size: 12px; font-weight: 800; }
.angler-identity { display: block; min-width: 0; flex: 1; }
.angler-identity strong { display: block; overflow: hidden; margin-bottom: 3px; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.angler-identity small { display: block; color: var(--ink-soft); font-size: 11px; }
.angler-chevron { color: #91a0a3; font-size: 25px; line-height: 1; }
.select-angler { padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-size: 10px; font-weight: 800; cursor: pointer; }
.select-angler:disabled { border-color: transparent; color: #39705d; background: #def4e5; cursor: default; }
.identity-label { display: inline-block; border-color: transparent; color: #39705d; background: #def4e5; cursor: default; }

.form-dialog { width: min(100% - 28px, 440px); padding: 0; border: 0; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.form-dialog::backdrop { background: rgba(2, 18, 25, 0.68); backdrop-filter: blur(4px); }
.form-sheet { position: relative; padding: 26px 22px 22px; }
.form-sheet h2 { margin-bottom: 24px; font-size: 24px; }
.form-close { top: 16px; right: 16px; }
.field-label { display: block; margin-bottom: 7px; color: #53656c; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.field-label-spaced { margin-top: 15px; }
.text-field { width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; outline: 0; color: var(--ink); background: var(--surface); }
.text-field:focus { border-color: #4f999f; box-shadow: 0 0 0 3px rgba(56, 164, 172, 0.13); }
.submit-button { width: 100%; min-height: 48px; margin-top: 16px; }
.group-help { margin: -13px 0 22px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.group-code-field { text-transform: uppercase; }
.form-error { margin: 10px 2px -5px; color: #a33131; font-size: 11px; }
.secondary-button { width: 100%; min-height: 42px; margin-top: 7px; border: 0; color: var(--ink-soft); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.personal-mode-note { margin: 0 12px; color: #849397; font-size: 9px; line-height: 1.4; text-align: center; }

.angler-details-dialog { width: min(100% - 16px, 620px); height: calc(100dvh - 88px); max-height: calc(100dvh - 88px); margin: auto auto 0; padding: 0; overflow: hidden auto; border: 0; border-radius: 28px 28px 0 0; background: var(--surface); box-shadow: var(--shadow); }
.angler-details-dialog::backdrop { background: rgba(2, 18, 25, 0.68); backdrop-filter: blur(4px); }
.angler-details-dialog[open] { animation: slide-up 220ms ease-out; }
.angler-details-sheet { position: relative; min-height: 100%; padding: 26px 20px max(28px, env(safe-area-inset-bottom)); }
.angler-details-sheet h2 { margin-bottom: 4px; font-size: 27px; letter-spacing: -0.035em; }
.angler-details-total { margin-bottom: 22px; color: var(--ink-soft); font-size: 12px; }
.angler-catch-list { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; }
.angler-catch-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; min-height: 68px; align-items: center; gap: 12px; padding: 7px 15px 7px 8px; border-bottom: 1px solid var(--line); }
.angler-catch-row:last-child { border-bottom: 0; }
.angler-catch-row img { width: 58px; height: 54px; object-fit: contain; }
.angler-catch-row span { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.angler-catch-row strong { min-width: 38px; text-align: right; color: var(--sea); font-size: 16px; }
.angler-empty-catches { padding: 34px 20px; text-align: center; color: #849397; }
.angler-empty-catches span { display: block; margin-bottom: 5px; font-size: 34px; }
.angler-empty-catches p { margin: 0; font-size: 13px; }

@media (min-width: 560px) {
  .app-header { padding-right: 24px; padding-left: 24px; }
  .catalog,
  .trips,
  .anglers { padding-right: 24px; padding-left: 24px; }
  .fish-grid { gap: 16px; }
  .card-copy { padding: 16px; }
  .card-copy strong { font-size: 19px; }
  .card-copy em { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
