:root {
  color-scheme: dark;
  --bg: #0b1114;
  --panel: #111a1f;
  --panel-2: #172329;
  --line: rgba(221, 234, 235, 0.14);
  --text: #edf6f4;
  --muted: #9db1af;
  --accent: #5fd1c1;
  --warn: #f2bd66;
  --danger: #ef8f7a;
  --good: #8ad37c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  overflow: hidden;
}

.panel {
  display: grid;
  grid-auto-rows: max-content;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(180deg, #101a1f 0%, #0d1418 100%);
  border-right: 1px solid var(--line);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 5;
}

.brand,
.section-title,
.range-row,
.status-strip,
.detail-head,
.weather-grid,
.meta-row,
.brand-actions,
.link-row {
  display: flex;
  align-items: center;
}

.brand,
.section-title,
.status-strip,
.detail-head {
  justify-content: space-between;
  gap: 12px;
}

.kicker {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  font-size: 16px;
}

.badge,
button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.badge {
  padding: 8px 10px;
  color: #061312;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-actions {
  gap: 8px;
}

.small-button {
  min-height: 32px;
  padding: 0 9px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

.filter-accordion {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.filter-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  list-style: none;
}

.filter-accordion summary::-webkit-details-marker {
  display: none;
}

.accordion-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--accent);
  transition: transform 160ms ease;
}

.filter-accordion:not([open]) .accordion-icon {
  transform: rotate(-90deg);
}

.filters {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
button {
  min-height: 38px;
  color: var(--text);
  background: var(--panel-2);
  padding: 0 10px;
  font: inherit;
}

button {
  cursor: pointer;
  color: #071412;
  background: var(--accent);
  border: 0;
  font-weight: 800;
}

.range-row {
  gap: 8px;
}

.range-row input {
  width: 100%;
}

.toggle {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.toggle input {
  min-height: auto;
  margin-top: 2px;
}

.status-strip {
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-strip div {
  display: grid;
  gap: 2px;
}

.status-strip b {
  font-size: 18px;
}

.status-strip span {
  color: var(--muted);
  font-size: 11px;
}

.list-wrap {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.anchorage-list {
  overflow: auto;
  display: grid;
  gap: 9px;
  padding-right: 4px;
}

.anchorage-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.anchorage-card:hover,
.anchorage-card.is-active {
  border-color: rgba(95, 209, 193, 0.72);
  background: rgba(95, 209, 193, 0.09);
}

.meta-row {
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #cfe2df;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
}

.chip.good {
  color: #08200c;
  background: var(--good);
}

.chip.warn {
  color: #251700;
  background: var(--warn);
}

.notice {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.map-area {
  position: relative;
  min-width: 0;
}

#map {
  background: #0a1b20;
}

.detail-card {
  position: absolute;
  right: 18px;
  top: 18px;
  width: min(440px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  overflow: auto;
  background: rgba(14, 24, 29, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  z-index: 450;
}

.detail-card.is-hidden {
  display: none;
}

.detail-close {
  position: sticky;
  top: 8px;
  float: right;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 8px 8px -40px 0;
  color: var(--text);
  background: rgba(7, 20, 17, 0.72);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  z-index: 2;
  backdrop-filter: blur(10px);
}

.detail-close:hover {
  background: rgba(239, 143, 122, 0.9);
}

.detail-empty {
  padding: 18px;
  color: var(--muted);
}

.detail-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(135deg, rgba(95, 209, 193, 0.28), rgba(114, 167, 255, 0.18)),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 28%),
    #223035;
}

.detail-image.is-fallback {
  object-fit: contain;
}

.photo-section {
  display: grid;
  gap: 0;
  background: #172329;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.photo-caption {
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
  font-size: 11px;
}

.photo-gallery {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  grid-auto-rows: 104px;
  gap: 3px;
  background: #223035;
}

.photo-link-gallery {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(86px, auto);
}

.photo-tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
}

.photo-link-tile {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 16px;
  min-height: 86px;
  text-align: center;
  font-weight: 700;
  background:
    linear-gradient(135deg, rgba(95, 209, 193, 0.22), rgba(114, 167, 255, 0.16)),
    #223035;
}

.photo-link-tile:first-child {
  grid-row: auto;
  grid-column: auto;
}

.photo-link-tile b,
.photo-link-tile span {
  position: static;
}

.photo-link-tile span {
  display: block;
  max-width: 100%;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  line-height: 1.3;
  opacity: 1;
}

.photo-tile img,
.photo-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background:
    linear-gradient(135deg, rgba(95, 209, 193, 0.22), rgba(114, 167, 255, 0.16)),
    #223035;
}

.photo-tile:first-child {
  grid-row: span 2;
  grid-column: span 1;
}

.photo-tile span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 5px 7px;
  color: rgba(255, 255, 255, 0.88);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.68));
  font-size: 10px;
  line-height: 1.25;
  opacity: 0;
  transition: opacity 160ms ease;
}

.photo-tile:hover span {
  opacity: 1;
}

.photo-placeholder {
  min-height: 104px;
  animation: pulse 1.2s ease-in-out infinite;
}

.photo-placeholder:first-child {
  grid-row: span 2;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 0.95;
  }
}

.link-row {
  flex-wrap: wrap;
  gap: 8px;
}

.link-row a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  color: #061312;
  background: var(--accent);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.detail-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.detail-head h2 {
  font-size: 20px;
}

.detail-sub {
  color: var(--muted);
  font-size: 13px;
}

.weather-grid {
  align-items: stretch;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.weather-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.weather-cell b {
  font-size: 16px;
}

.weather-cell span {
  color: var(--muted);
  font-size: 11px;
}

.weather-cell.wind-cell {
  grid-template-columns: minmax(0, 1fr) 26px;
  align-items: center;
}

.weather-cell.wind-cell b,
.weather-cell.wind-cell span {
  grid-column: 1;
}

.weather-cell.wind-cell i {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #071411;
  background: var(--accent);
  border-radius: 50%;
  font-style: normal;
  font-size: 17px;
  transform: rotate(var(--wind-rotation));
  transform-origin: center;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-block {
  display: grid;
  gap: 6px;
}

.info-block h3 {
  color: var(--accent);
  font-size: 13px;
}

.info-block p,
.info-block li {
  color: #d9e4e1;
  font-size: 13px;
  line-height: 1.45;
}

.fish-guide {
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fish-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.fish-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  max-width: 100%;
  padding: 0 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
}

.fish-badge span {
  font-size: 16px;
}

.fish-badge b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fish-badge.is-active {
  color: #061312;
  background: var(--accent);
}

.fish-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fish-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: rgba(95, 209, 193, 0.16);
  border-radius: 50%;
  font-size: 24px;
}

.fish-card h4 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
}

.fish-card a {
  display: inline-flex;
  margin-top: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.route-block {
  padding: 10px;
  background: rgba(95, 209, 193, 0.08);
  border: 1px dashed rgba(95, 209, 193, 0.45);
  border-radius: 8px;
}

ul {
  margin: 0;
  padding-left: 18px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: var(--text);
  background: #111a1f;
}

.leaflet-container a {
  color: var(--accent);
}

.marker-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #061312;
  background: #dce7e3;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.34), 0 0 0 4px rgba(0, 0, 0, 0.18);
  line-height: 1;
  transform: translateZ(0);
}

.marker-icon span {
  display: block;
  font-size: 17px;
  line-height: 1;
  transform: translateY(-0.5px);
}

.marker-icon.anchor {
  background: #8ad37c;
}

.marker-icon.anchor.warn,
.marker-icon.lifebuoy.warn {
  background: var(--warn);
}

.marker-icon.lifebuoy {
  background: #b7f06b;
  border-style: dashed;
}

.marker-icon.column {
  background: #f2bd66;
}

.marker-icon.trekking {
  background: #d9b68b;
}

.marker-icon.viewpoint {
  background: #8ad37c;
}

.marker-icon.cave {
  background: #b8a6ff;
}

.marker-icon.waterfall {
  background: #7bdff2;
}

.marker-icon.beach {
  background: #40d8ff;
}

.marker-icon.hook {
  background: linear-gradient(180deg, #ef8f7a 0 48%, #f4fbfa 48% 100%);
}

.marker-icon.harpoon {
  background: #b8c7ff;
}

.marker-icon.service,
.marker-icon.town {
  background: #72a7ff;
}

.marker-icon.operator {
  background: #e891ff;
}

.wind-map-arrow {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #071411;
  background: rgba(64, 216, 255, 0.92);
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.wind-map-arrow span {
  display: block;
  font-size: 30px;
  line-height: 1;
  transform: rotate(var(--wind-rotation));
  transform-origin: center;
}

.wind-map-arrow b {
  display: block;
  margin-top: -8px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.marker-icon:hover {
  z-index: 999;
  transform: scale(1.08);
}

.marker-icon.town span,
.marker-icon.service span,
.marker-icon.operator span {
  font-size: 14px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 46vh 54vh;
  }

  .panel {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 12px;
  }

  .map-area {
    order: 1;
  }

  .detail-card {
    top: auto;
    bottom: 10px;
    right: 10px;
    width: calc(100% - 20px);
    max-height: 58%;
  }

  .weather-grid,
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}
