:root {
  --hotspot: rgba(255, 255, 255, 0.16);
  --hotspot-border: rgba(255, 255, 255, 0.45);
  --hotspot-glow: rgba(255, 243, 200, 0.55);
  --overlay-backdrop: rgba(24, 19, 14, 0.56);
  --panel: #efe7d7;
  --panel-border: rgba(83, 63, 42, 0.28);
  --panel-shadow: rgba(30, 18, 10, 0.24);
  --ink: #2d2015;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: #f1eee8;
  color: var(--ink);
}

a,
button {
  color: inherit;
}

button {
  font: inherit;
}

body.overlay-open {
  overflow: hidden;
}

.page-shell {
  min-height: 100vh;
  width: 100%;
}

.map-scene {
  width: 100%;
  min-height: 100vh;
}

.map-layer {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: #f1eee8;
}

.map-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.hotspot {
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 2px solid transparent;
  background: transparent;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  cursor: pointer;
}

.hotspot:hover,
.hotspot:focus-visible {
  transform: translate(-50%, -50%) scale(1.06);
  border-color: var(--hotspot-border);
  background: var(--hotspot);
  box-shadow: 0 0 0 0.35rem var(--hotspot-glow);
  outline: none;
}

.hotspot[data-label]::after {
  content: attr(data-label);
  position: absolute;
  z-index: 3;
  left: 50%;
  top: -0.7rem;
  transform: translate(-50%, -0.4rem);
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(52, 38, 25, 0.9);
  color: #fff7eb;
  font-size: 0.78rem;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.hotspot[data-label]:hover::after,
.hotspot[data-label]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, -0.8rem);
}

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

.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 10vh 1.5rem;
}

.game-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-backdrop);
}

.game-window {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  height: min(80vh, 46rem);
  max-height: calc(100vh - 20vh);
  display: grid;
  padding: 1.5rem 1.5rem 1.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 1.5rem;
  overflow: hidden;
  background: linear-gradient(180deg, #d6e3e6 0%, #e7d8b6 100%);
  box-shadow: 0 1.25rem 3.5rem var(--panel-shadow);
}

.game-window--market {
  width: min(980px, 100%);
  height: min(80vh, 42rem);
}

.game-window__content {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 1.25rem;
}

.game-window__hero {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid rgba(83, 63, 42, 0.34);
  border-radius: 1rem;
  background-image: url("assets/bridge.png");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: cover;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 247, 235, 0.2);
}

.fishing-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.catch-flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 52% 56%, var(--flash-color, rgba(255, 231, 140, 0.2)) 0%, rgba(255, 255, 255, 0.18) 18%, rgba(255, 255, 255, 0) 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.1));
  mix-blend-mode: screen;
}

.catch-flash--animate {
  animation: catch-flash-pop 720ms ease-out forwards;
}

.cast-button {
  position: absolute;
  left: 50%;
  top: 62%;
  z-index: 1;
  transform: translate(-50%, -50%);
  min-width: 6.5rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(73, 53, 35, 0.4);
  border-radius: 999px;
  background: rgba(244, 237, 220, 0.92);
  color: var(--ink);
  box-shadow: 0 0.35rem 1rem rgba(33, 23, 14, 0.18);
  cursor: pointer;
}

.cast-button:disabled {
  cursor: default;
}

.cast-button:hover,
.cast-button:focus-visible {
  transform: translate(-50%, -50%) scale(1.03);
  background: rgba(252, 247, 236, 0.96);
  outline: none;
}

.cast-button--casting {
  background: rgba(241, 232, 204, 0.98);
}

.cast-meter {
  position: absolute;
  left: 50%;
  top: calc(62% + 3.1rem);
  transform: translateX(-50%);
  width: min(13rem, 54%);
  height: 0.42rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 247, 235, 0.5);
  box-shadow: inset 0 0 0 1px rgba(83, 63, 42, 0.12);
}

.cast-meter__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f4d35e 0%, #f59e0b 38%, #ef4444 100%);
}

.cast-meter--animate .cast-meter__fill {
  animation: cast-load 500ms linear forwards;
}

.catch-status {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 0.8rem;
  background: rgba(245, 238, 224, 0.85);
  color: rgba(45, 32, 21, 0.9);
  font-size: 0.92rem;
  line-height: 1.3;
}

.ripple-effect {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 2px solid rgba(244, 247, 255, 0.95);
  transform: translate(-50%, -50%);
  animation: ripple-out 900ms ease-out forwards;
}

.catch-burst {
  position: absolute;
  width: var(--burst-size, 14px);
  height: var(--burst-size, 14px);
  border-radius: 999px;
  background: var(--burst-color);
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 1.25rem color-mix(in srgb, var(--burst-color) 74%, white),
    0 0 2rem color-mix(in srgb, var(--burst-color) 48%, white);
  animation: burst-out 1050ms cubic-bezier(0.18, 0.7, 0.2, 1) forwards;
}

.bucket-panel {
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.bucket-panel__slots {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid rgba(83, 63, 42, 0.34);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(247, 241, 228, 0.96), rgba(232, 215, 185, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 247, 235, 0.26);
}

.bucket-slot {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border: 1px dashed rgba(88, 68, 44, 0.4);
  border-radius: 0.9rem;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), transparent 42%),
    linear-gradient(180deg, rgba(222, 205, 173, 0.78), rgba(198, 172, 126, 0.88));
  color: rgba(72, 53, 34, 0.92);
  text-align: center;
  padding: 0;
  overflow: hidden;
}

.bucket-slot--filled {
  border-style: solid;
  background: linear-gradient(180deg, rgba(196, 212, 194, 0.94), rgba(140, 172, 146, 0.96));
}

.bucket-slot__overlay {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: 0.45rem 0.35rem 0.4rem;
  background: linear-gradient(180deg, rgba(22, 16, 11, 0) 0%, rgba(22, 16, 11, 0.72) 52%, rgba(22, 16, 11, 0.88) 100%);
  color: #fff7eb;
  line-height: 1.05;
}

.bucket-slot__name {
  font-weight: 600;
  font-size: 0.68rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.bucket-slot__rarity {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.56rem;
  text-transform: capitalize;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.bucket-slot__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.96) contrast(1.02);
}

.market-window {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 1.25rem;
  grid-template-rows: minmax(0, 1fr) auto;
}

.market-sidebar {
  display: grid;
  align-content: start;
  gap: 0.8rem;
  padding: 0.45rem;
  border: 1px solid rgba(83, 63, 42, 0.34);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(238, 228, 205, 0.92), rgba(223, 204, 165, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 247, 235, 0.24);
}

.market-nav-button {
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  background: rgba(255, 249, 236, 0.48);
  color: var(--ink);
  cursor: pointer;
}

.market-nav-button--active {
  border-color: rgba(83, 63, 42, 0.28);
  background: rgba(255, 249, 236, 0.92);
  box-shadow: 0 0.35rem 1rem rgba(33, 23, 14, 0.08);
}

.market-panel {
  min-height: 0;
  display: grid;
}

.market-section {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(83, 63, 42, 0.34);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(247, 241, 228, 0.96), rgba(232, 215, 185, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 247, 235, 0.26);
  padding: 1rem;
  overflow: hidden;
}

.market-section[hidden] {
  display: none;
}

.market-section__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 1rem;
}

.market-section__header h2,
.rod-card h3 {
  margin: 0;
}

.market-section__header p,
.rod-card p,
.market-total,
.market-status,
.market-empty {
  margin: 0;
}

.basket-sale,
.rod-list {
  display: grid;
  gap: 0.75rem;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.basket-sale {
  align-content: start;
  flex: 1 1 auto;
}

.rod-list {
  align-content: start;
  flex: 1 1 auto;
}

.market-line-item,
.rod-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.9rem;
  border-radius: 0.8rem;
  background: rgba(255, 250, 238, 0.68);
  border: 1px solid rgba(83, 63, 42, 0.16);
}

.rod-card {
  flex-direction: column;
  justify-content: flex-start;
}

.rod-card--owned {
  background: rgba(223, 234, 216, 0.78);
}

.market-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.market-button {
  border: 1px solid rgba(73, 53, 35, 0.4);
  border-radius: 999px;
  background: rgba(244, 237, 220, 0.96);
  color: var(--ink);
  padding: 0.7rem 1rem;
  cursor: pointer;
}

.market-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.market-status {
  grid-column: 1 / -1;
  padding: 0.8rem 1rem;
  border-radius: 0.8rem;
  background: rgba(245, 238, 224, 0.85);
}

@keyframes cast-load {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

@keyframes ripple-out {
  0% {
    opacity: 0.95;
    width: 1rem;
    height: 1rem;
  }

  100% {
    opacity: 0;
    width: 7rem;
    height: 7rem;
  }
}

@keyframes catch-flash-pop {
  0% {
    opacity: 0;
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes burst-out {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.18);
  }

  15% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      rotate(var(--burst-angle))
      translateY(calc(var(--burst-distance) * -1))
      scale(0.18);
  }
}

@media (max-width: 820px) {
  .map-layer {
    min-height: 100vh;
  }

  .game-overlay {
    padding: 10vh 0.75rem;
  }

  .game-window {
    height: min(80vh, calc(100vh - 20vh));
    max-height: calc(100vh - 20vh);
    padding: 1rem;
    border-radius: 1.1rem;
  }

  .game-window__content {
    grid-template-columns: minmax(0, 1fr) 11rem;
    gap: 1rem;
  }

  .market-window {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .market-sidebar {
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
  }

  .game-window__hero {
    border-radius: 0.8rem;
  }

  .bucket-panel__slots {
    padding: 0.8rem;
    gap: 0.65rem;
    border-radius: 0.8rem;
  }
}

@media (max-width: 560px) {
  .hotspot:hover,
  .hotspot:focus-visible {
    box-shadow: 0 0 0 0.28rem var(--hotspot-glow);
  }

  .game-window__content {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .game-window__hero {
    background-size: 100% auto;
  }

  .market-actions,
  .market-section__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bucket-panel__slots {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .market-window {
    gap: 0.85rem;
  }

  .market-sidebar {
    grid-auto-flow: row;
    grid-auto-columns: auto;
  }
}
