/* Five real fish thumbnails; collection details reuse the existing dialog. */
.legend-slots {
  position: fixed; z-index: 6; top: calc(154px + env(safe-area-inset-top));
  right: max(28px, env(safe-area-inset-right));
  display: grid; grid-template-columns: repeat(5, 44px); gap: 4px;
  padding: 4px; border: 1px solid #b7d2ca; border-radius: 8px;
  background: rgb(14 43 58 / 35%);
}
.legend-slots:empty,
#stage[data-phase="title"] .legend-slots { display: none; }
.legend-slot {
  display: grid; justify-items: center; align-content: center; gap: 1px;
  width: 44px; min-width: 44px; min-height: 44px; padding: 3px 1px;
  border: 1px solid #1e4b61; border-radius: 5px;
  background: #e7f2e9; color: #173d53; font-size: 10px; line-height: 1.3;
  touch-action: manipulation;
}
.legend-slot img { width: 40px; height: 27px; object-fit: contain; }
.legend-slot-name { display: block; width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.legend-slot.is-unlocked { background: #fff1c5; border-color: #bd8b2d; }
.legend-slot.is-locked img,
.legend-card.is-locked img { filter: brightness(0); opacity: 1; }
.legend-slot:hover { background: #fff7d8; }
.legend-slot:focus-visible { outline: 3px solid #ffe083; outline-offset: 2px; }
.legend-summary { display: flex; justify-content: space-between; margin: 0 0 14px; font-size: 13px; }
.legend-summary strong { color: #815c15; }
.legend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.legend-card { min-width: 0; border: 1px solid #cbd7cc; border-radius: 10px; overflow: hidden; background: #fffdf4; }
.legend-card-art { position: relative; display: grid; place-items: center; min-height: 114px; background: #e8efdf; }
.legend-card-art img { display: block; max-width: 100%; width: 100%; height: 114px; object-fit: contain; }
.legend-card.is-unlocked .legend-card-art { background: radial-gradient(ellipse, #ffefb0, #eef1df); }
.legend-badge { position: absolute; left: 8px; top: 8px; padding: 3px 6px; border-radius: 4px; background: #173d53; color: #fff5d5; font-size: 10px; }
.legend-card-info { padding: 12px; }
.legend-card h3 { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.legend-species { margin-top: 3px; font-size: 11px; color: #526c68; }
.legend-records { display: grid; gap: 5px; margin: 12px 0; font-size: 11px; line-height: 1.4; }
.legend-records > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3px 8px; }
.legend-records dt { color: #526c68; }
.legend-records dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.legend-unknown, .legend-habitat { margin-top: 8px; font-size: 11px; line-height: 1.7; color: #526c68; overflow-wrap: anywhere; }
/* This notice never traps focus or intercepts play; only its close target does. */
.legend-discovery {
  position: fixed; z-index: 8; top: clamp(206px, 34svh, 330px); left: 50%; transform: translateX(-50%);
  width: min(350px, calc(100vw - 24px)); display: grid; grid-template-columns: 76px minmax(0, 1fr) 44px;
  align-items: center; gap: 8px; padding: 12px 8px; border: 2px solid #f7d57a; border-radius: 12px;
  background: #173d53f5; color: #fff9e5; box-shadow: 0 0 26px #ffe29270; pointer-events: none;
  overflow: hidden;
}
.legend-discovery > img { width: 76px; height: 64px; object-fit: contain; }
.legend-discovery-copy { min-width: 0; }
.legend-discovery-copy p { font-size: 11px; color: #ffe292; margin-bottom: 3px; }
.legend-discovery-copy strong { display: block; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.legend-discovery-copy > span { display: block; font-size: 13px; margin-top: 3px; font-variant-numeric: tabular-nums; }
#legend-discovery-close { position: relative; z-index: 1; min-width: 44px; min-height: 44px; background: #fff2ca; color: #173d53; border-radius: 8px; font-size: 26px; pointer-events: auto; }
.legend-discovery:not([hidden]) { animation: legend-discovery-enter .45s ease-out; }
.legend-discovery:not([hidden])::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, #fff6c750 50%, transparent 80%); transform: translateX(-110%); animation: legend-discovery-light 1s ease-out; pointer-events: none; }
@keyframes legend-discovery-enter { from { opacity: 0; margin-top: 10px; } to { opacity: 1; margin-top: 0; } }
@keyframes legend-discovery-light { to { transform: translateX(110%); } }
@media (max-width: 760px) {
  .legend-slots { top: calc(135px + env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); grid-template-columns: 44px; }
  #stage:is([data-phase="success"], [data-phase="miss"]) .legend-slots { grid-template-columns: repeat(5, 44px); }
  .legend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .legend-grid { grid-template-columns: minmax(0, 1fr); }
  .legend-card { display: grid; grid-template-columns: 90px minmax(0, 1fr); }
  .legend-card-art { min-height: 108px; }
  .legend-card-art img { height: 86px; }
  .legend-card-info { padding: 10px; }
  .legend-discovery { gap: 6px; grid-template-columns: 62px minmax(0, 1fr) 44px; }
  .legend-discovery > img { width: 62px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .legend-slots { top: calc(138px + env(safe-area-inset-top)); grid-template-columns: repeat(5, 44px); }
  .legend-discovery { top: calc(144px + env(safe-area-inset-top)); }
}
@media (prefers-reduced-motion: reduce) {
  .legend-discovery:not([hidden]), .legend-discovery:not([hidden])::after { animation: none; }
  .legend-discovery::after { display: none; }
}
