/* Species-first mode: fish picker (overlay), best-meralar list (main sheet), ranked map markers and map buttons. */

/* ---------- Picker (full-screen overlay) ---------- */
.spk { display: grid; gap: 2px; }
.spk-top {
  position: sticky; top: -16px; z-index: 2; margin: -16px -16px 0; padding: 12px 16px 10px;
  background: var(--bg);
}
.spk-search { padding-right: 4px; }
.spk-search .search-clear { flex: none; width: 44px; height: 44px; }
.spk-intro { margin: 4px 4px 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.45; }
.spk-sec { margin-top: 4px; }
.spk .list-title { margin-top: 16px; }
.spk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.spk-tile {
  position: relative; min-width: 0; min-height: 116px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 6px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-1); color: var(--ink); text-align: center;
  transition: border-color 0.15s, transform 0.12s var(--ease);
}
.spk-tile:hover { border-color: var(--brand); }
.spk-tile:active { transform: scale(0.97); }
.spk-pic {
  width: 100%; height: 46px; display: grid; place-items: center; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand-ink);
}
.spk-name { font-size: 0.92rem; font-weight: 750; line-height: 1.2; overflow-wrap: anywhere; }
.spk-alias { margin-top: -3px; font-size: 0.74rem; color: var(--ink-3); overflow-wrap: anywhere; }
.spk-hint { display: grid; justify-items: center; gap: 2px; margin-top: auto; padding-top: 2px; }
.spk-hint .chip-lvl { font-size: 0.74rem; }
.spk-hint .tag { gap: 3px; padding: 1px 7px; font-size: 0.72rem; white-space: normal; text-align: center; }
.spk-hint small { font-size: 0.7rem; color: var(--ink-3); line-height: 1.2; }
.spk-tile.is-out .spk-pic { background: var(--surface-2); color: var(--ink-3); }
.spk-tile.is-hazard, .spk-tile.is-banned { background: var(--surface-2); box-shadow: none; }
.spk-tile.is-hazard .spk-pic, .spk-tile.is-banned .spk-pic { background: var(--danger-bg); color: var(--danger-ink); }
.spk-tile[aria-disabled="true"] .spk-name { color: var(--ink-2); }
.spk-tile.is-current { border: 2px solid var(--brand); padding: 7px 5px 9px; background: var(--brand-soft); }
.spk-tile.is-current .spk-pic { background: var(--surface); }
.spk-cur {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: var(--on-brand);
}
.spk-cur svg { stroke-width: 3; }
@media (max-width: 359px) {
  .spk-season .spk-tile:nth-child(n + 9) { display: none; }
}
.spk-empty { padding: 32px 12px; }
.spk-empty p { max-width: 30ch; }

/* "Why can't I pick this?" card */
.spk-why {
  position: absolute; z-index: 5;
  left: calc(var(--safe-l) + 12px); right: calc(var(--safe-r) + 12px); bottom: calc(var(--safe-b) + 12px);
  display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--danger-line); box-shadow: var(--shadow-2);
  max-height: 70%; overflow-y: auto; overscroll-behavior: contain;
  animation: spkUp 0.22s var(--ease);
}
.spk-why-ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--danger-bg); color: var(--danger-ink); }
.spk-why-body { min-width: 0; flex: 1; }
.spk-why-title { font-weight: 800; font-size: 1.02rem; line-height: 1.3; }
.spk-why-text { margin-top: 4px; font-size: 0.92rem; line-height: 1.45; color: var(--ink-2); }
.spk-why-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.spk-why-acts .btn { min-height: 44px; padding: 0 16px; font-size: 0.95rem; }
@keyframes spkUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- List in the main sheet ---------- */
.spx { position: relative; min-height: 100%; }
.spx-top {
  position: relative; padding: 26px 16px 12px; background: var(--surface);
  border-bottom: 1px solid var(--line); border-radius: 22px 22px 0 0;
}
.spx-progress { position: absolute; top: 0; left: 22px; right: 22px; height: 3px; overflow: hidden; border-radius: 2px; opacity: 0; transition: opacity 0.2s; }
.spx-progress::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: var(--brand-2); border-radius: 2px; transform: translateX(-100%);
}
.spx.is-busy .spx-progress { opacity: 1; }
.spx.is-busy .spx-progress::after { animation: spxIndet 1.1s var(--ease) infinite; }
@keyframes spxIndet { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.spx-head { display: flex; align-items: flex-start; gap: 12px; }
.spx-pic {
  flex: none; width: 60px; height: 44px; margin-top: 2px; display: grid; place-items: center;
  border-radius: 14px; background: var(--brand-soft); color: var(--brand-ink);
}
.spx-titles { flex: 1; min-width: 0; padding-top: 1px; }
.spx-title { font-size: 1.2rem; line-height: 1.22; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.spx-sub { margin-top: 3px; font-size: 0.86rem; line-height: 1.35; color: var(--ink-2); }
.spx-close { flex: none; margin: -6px -8px 0 0; }
/* Inside a host that renders its own title bar (title + ✕): no duplicate title or close button. */
.spx.is-hosted .spx-top { padding-top: 12px; border-radius: 0; }
.spx.is-hosted .spx-title, .spx.is-hosted .spx-close { display: none; }
.spx.is-hosted .spx-head { align-items: center; }
.spx.is-hosted .spx-pic { margin-top: 0; }
.spx.is-hosted .spx-sub { margin-top: 0; font-size: 0.92rem; }
.spx-change {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px 0 10px;
  border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--line);
  font-size: 0.9rem; font-weight: 700; color: var(--ink); white-space: nowrap;
}
.spx-change .ic-slot { color: var(--brand-ink); }
.spx-change::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.spx-change:hover { border-color: var(--brand); }

.spx-days { display: flex; gap: 6px; margin: 12px -16px 0; padding: 2px 16px 4px; }
.spx-day {
  flex: none; min-width: 56px; min-height: 46px; display: grid; justify-items: center; align-content: center; gap: 0;
  padding: 4px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  transition: background 0.15s, border-color 0.15s, transform 0.12s var(--ease);
}
.spx-day:active { transform: scale(0.96); }
.spx-day b { font-size: 0.88rem; font-weight: 750; line-height: 1.2; }
.spx-day small { font-size: 0.72rem; line-height: 1.2; color: var(--ink-3); }
.spx-day.is-sel { padding: 3px 9px; border: 2px solid var(--brand); background: var(--brand-soft); }
.spx-day.is-sel small { color: var(--ink-2); }
/* Best mera score of the day (filled in the background), with a band dot; the week's best day gets a star. */
.spx-day-score {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 30px; height: 18px; margin-top: 2px;
  font-size: 0.8rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink);
}
.spx-day-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--band, var(--muted)); box-shadow: 0 0 0 1px rgba(14, 26, 36, 0.15); }
.spx-day-score.is-pending { width: 28px; min-width: 0; height: 8px; margin: 7px auto 5px; border-radius: 4px; background: var(--skel); }
.spx-day.is-best .spx-day-score::after { content: "★"; margin-left: -1px; font-size: 0.78rem; color: var(--accent); }

.spx-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.spx-mode { flex: 0 1 auto; min-width: 0; }
.spx-mode button { padding: 0 12px; }
.spx-mode button svg { color: var(--brand-ink); }
@media (max-width: 430px) {
  .spx-mode button .ic-slot { display: none; }
}
@media (max-width: 374px) {
  .spx-mode button { padding: 0 11px; }
  .spx-change { padding: 0 12px 0 9px; }
}

.spx-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 0 4px; }
.spx-scope > .ic-slot { color: var(--brand-ink); }
.spx-scope-title { flex: 1 1 auto; min-width: 0; font-size: 1rem; font-weight: 750; line-height: 1.3; }
.spx-scope-btn {
  position: relative; min-height: 34px; padding: 0 12px; border-radius: var(--pill);
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 750; font-size: 0.85rem; white-space: nowrap;
}
.spx-scope-btn::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }

.spx-notices { display: grid; gap: 8px; padding: 12px 12px 0; }
.spx-notices:empty { display: none; }
.spx-note {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); font-size: 0.9rem; line-height: 1.4;
}
.spx-note > .ic-slot { margin-top: 1px; }
.spx-note b { display: block; font-weight: 750; color: var(--ink); }
.spx-note p { margin-top: 2px; color: var(--ink-2); }
.spx-note-danger { background: var(--danger-bg); border-color: var(--danger-line); }
.spx-note-danger > .ic-slot { color: var(--danger-ink); }
.spx-note-caution, .spx-note-stale { background: var(--caution-bg); border-color: var(--caution-line); }
.spx-note-caution > .ic-slot, .spx-note-stale > .ic-slot { color: var(--caution-ink); }
.spx-note-info { background: var(--info-bg); border-color: transparent; }
.spx-note-info > .ic-slot { color: var(--brand-ink); }
.spx-note-better { background: var(--ok-bg); border-color: rgba(12, 163, 12, 0.35); }
.spx-note-better > .ic-slot { color: #0a8a0a; }
:root[data-theme="dark"] .spx-note-better > .ic-slot { color: #5fd35f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .spx-note-better > .ic-slot { color: #5fd35f; } }
.spx-note-btn {
  position: relative; margin-top: 6px; min-height: 34px; padding: 0 14px; border-radius: var(--pill);
  background: var(--brand); color: var(--on-brand); font-weight: 750; font-size: 0.88rem;
}
.spx-note-btn::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }

.spx-body { padding: 12px 12px 0; transition: opacity 0.2s; }
.spx.is-busy .spx-body { opacity: 0.45; pointer-events: none; }
.spx-hint { padding: 2px 4px 10px 28px; font-size: 0.84rem; line-height: 1.4; color: var(--ink-3); }
.spx-list { list-style: none; display: grid; gap: 8px; }
.spx-row {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "rank main badge" ". meta meta";
  column-gap: 10px; row-gap: 8px; align-items: center; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
  color: var(--ink); text-align: left; transition: border-color 0.15s, transform 0.12s var(--ease);
}
.spx-row:hover { border-color: var(--brand); }
.spx-row:active { transform: scale(0.99); }
.spx-rank {
  grid-area: rank; align-self: start; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-weight: 800; font-size: 0.92rem;
}
.spx-row.is-top .spx-rank { background: var(--brand); border-color: transparent; color: var(--on-brand); }
.spx-main { grid-area: main; min-width: 0; display: grid; gap: 1px; }
.spx-name { font-size: 1.04rem; font-weight: 750; line-height: 1.25; overflow-wrap: anywhere; }
.spx-area { font-size: 0.82rem; color: var(--ink-3); line-height: 1.3; overflow-wrap: anywhere; }
.spx-badge { grid-area: badge; align-self: start; }
.spx-meta { grid-area: meta; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.spx-best { display: inline-flex; align-items: center; gap: 4px; font-size: 0.86rem; font-weight: 700; color: var(--ink); }
.spx-best .ic-slot { color: var(--brand-ink); }
.spx-best.is-none { font-weight: 600; color: var(--ink-3); }
.spx-best.is-none .ic-slot { color: var(--ink-3); }
.spx-reason {
  display: inline-flex; align-items: center; max-width: 100%; padding: 2px 9px; border-radius: var(--pill);
  background: var(--brand-soft); color: var(--brand-ink); font-size: 0.78rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere;
}
.spx-closed { font-size: 0.75rem; }
@media (max-width: 359px) {
  .spx-badge .badge-label { display: none; }
  .spx-row { padding: 10px; column-gap: 8px; }
}

.spx-loading { display: flex; align-items: center; gap: 8px; padding: 0 4px 10px; font-size: 0.9rem; color: var(--ink-3); }
.spx-skel { display: grid; gap: 8px; }
.spx-row-skel { pointer-events: none; }
.spx-row-skel .spx-main { gap: 8px; }
.spx-row-skel .spx-rank { border: 0; }
.spx-row-skel .skel-line { height: 12px; }

.spx-state { display: grid; justify-items: center; gap: 10px; padding: 22px 18px; text-align: center; }
.spx-state h3 { font-size: 1.05rem; }
.spx-state p { color: var(--ink-2); line-height: 1.45; max-width: 36ch; }
.spx-state-ic {
  width: 64px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink);
}
.spx-error .spx-state-ic { width: 52px; border-radius: 50%; background: var(--danger-bg); color: var(--danger-ink); }

.spx-foot { display: grid; gap: 2px; padding: 12px 16px 0; font-size: 0.82rem; line-height: 1.45; color: var(--ink-3); }
.spx-howto { justify-self: start; font-size: 0.95rem; }

/* ---------- Ranked markers on the map ---------- */
.spm-wrap { background: none; border: 0; outline: none; }
.spm { position: relative; width: 100%; height: 100%; transition: transform 0.15s var(--ease); }
.spm::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; } /* 44 px touch target */
.spm-b {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--band, #0b5e8e); color: #0e1a24; border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(7, 16, 25, 0.38); font: 800 12px/1 var(--font); letter-spacing: -0.02em;
  transition: inset 0.15s var(--ease);
}
.spm-top::before { inset: -2px; }
.spm-top .spm-b { border-width: 3px; font-size: 15px; box-shadow: 0 3px 10px rgba(7, 16, 25, 0.45); }
.spm-rank {
  position: absolute; top: -7px; left: -7px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px;
  display: grid; place-items: center; background: #0b5e8e; color: #fff; border: 2px solid #fff;
  font: 800 12px/1 var(--font); box-shadow: 0 1px 3px rgba(7, 16, 25, 0.35);
}
.spm-name {
  position: absolute; top: 50%; left: calc(100% + 4px); transform: translateY(-50%);
  max-width: 150px; padding: 3px 9px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--surface); color: var(--ink); font: 750 12px/1.35 var(--font);
  box-shadow: 0 1px 5px rgba(7, 16, 25, 0.3);
}
.spm-wrap.spm-left .spm-name { left: auto; right: calc(100% + 4px); }
.spm-wrap.no-label .spm-name { display: none; }
.spm-wrap.is-tucked .spm-b { inset: 8px; border-width: 2px; font-size: 0; box-shadow: 0 1px 3px rgba(7, 16, 25, 0.4); }
.spm-wrap.is-tucked .spm::before { inset: 0; }
.spm-wrap.is-stale { opacity: 0.45; }
.spm-wrap.is-hidden { display: none; }
.spm-wrap:hover .spm, .spm-wrap:focus-visible .spm { transform: scale(1.08); }
.spm-wrap:focus-visible .spm-b { outline: 3px solid var(--brand-2); outline-offset: 2px; }

/* ---------- Floating map buttons ("Bu bölgede ara", back-to-list chip): top centre, below the map's button row ---------- */
.spmap {
  position: absolute; z-index: 800; left: calc(var(--safe-l) + 12px); right: calc(var(--safe-r) + 12px);
  top: calc(var(--safe-t) + 124px); display: flex; justify-content: center; pointer-events: none;
}
.spmap > * { pointer-events: auto; }
.spmap-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--pill);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-fab);
  font: 750 15px/1.2 var(--font); white-space: nowrap; animation: spmapIn 0.2s var(--ease);
}
.spmap-ic { display: inline-grid; place-items: center; color: var(--brand-ink); }
.spmap-chip {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 2px;
  border-radius: var(--pill); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-fab);
  animation: spmapIn 0.2s var(--ease);
}
.spmap-back {
  min-width: 0; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 10px;
  border-radius: var(--pill); color: var(--ink); font: 750 15px/1.2 var(--font);
}
.spmap-pic { display: inline-grid; place-items: center; color: var(--brand-ink); }
.spmap-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spmap-x { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.spmap-x::before { content: ""; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 1px; background: var(--line); }
.spmap-back:hover, .spmap-x:hover { background: var(--surface-2); }
@keyframes spmapIn { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .spk-tile, .spx-row, .spx-day, .spx-body, .spm, .spmap, .spmap-btn, .spmap-chip, .spk-why { transition: none; animation: none; }
  .spx.is-busy .spx-progress::after { animation-duration: 2.4s; }
}

/* ---------- v2 final: compact head so the half-open sheet shows meralar, not only controls ---------- */
/* Hosted: the host's title bar already shows the fish icon and title; the season sentence stays on one line. */
.spx.is-hosted .spx-pic { display: none; }
.spx.is-hosted .spx-top { padding-bottom: 10px; }
.spx.is-hosted .spx-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spx-days { margin-top: 8px; }
/* Day chips: weekday + best score (the date is in the chip's label for screen readers). */
.spx-day { min-height: 44px; padding: 3px 10px; }
.spx-day small { display: none; }
.spx-controls { margin-top: 8px; }
.spx-body { padding-top: 8px; }
.spx-scope { padding-bottom: 6px; }
.spx-list + .spx-better:not(:empty), .spx-better:not(:empty) { padding: 8px 0; }
.spx-better:empty { display: none; }
.spx-foot .spx-hint { padding: 0 0 4px; }
/* Season-only estimate (no weather): grey, no band word that would suggest known conditions. */
.spx-badge[data-band="na"], .spm[data-band="na"] { --band: #8a9aa9; --band-tint: rgba(138, 154, 169, 0.18); }
.spx-badge[data-band="na"] .badge-label { font-weight: 650; color: var(--ink-3); }
/* Top markers moved aside so they do not cover each other: the circle shifts, a leader line and a dot keep the real spot. */
.spm { transform: translate(var(--dx, 0px), var(--dy, 0px)); }
.spm-wrap:hover .spm, .spm-wrap:focus-visible .spm { transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(1.08); }
.spm-lead {
  display: none; position: absolute; left: 50%; top: 50%; height: 2px; margin-top: -1px; transform-origin: 0 50%;
  background: rgba(14, 26, 36, 0.8); border-radius: 1px; pointer-events: none;
}
.spm-wrap.is-moved .spm-lead { display: block; }
.spm-wrap.is-moved::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: #0e1a24; border: 2px solid #fff; pointer-events: none;
}
/* Narrow phones (320–359 px): one-line title, shorter "Değiştir", tighter controls so the first mera row shows at half. */
.spx-change-short { display: none; }
@media (max-width: 359px) {
  .spx-change-long { display: none; }
  .spx-change-short { display: inline; }
  .spx-change { padding: 0 10px 0 8px; }
  .spx-mode button { padding: 0 9px; }
  .spx-scope-title { font-size: 0.94rem; }
}
