:root {
  --bg-dark: #1e1e24;
  --bg-panel: rgba(20, 20, 25, 0.9);
  --text-main: #f8f9fa;
  --text-dim: #9ca3af;
  --accent: #3b82f6;

  /* Squid Glow Colors */
  --c-0: #6b7280;
  --c-1: #38bdf8;
  --c-2: #2dd4bf;
  --c-3: #a855f7;
  --c-4: #ec4899;
  --c-5: #f43f5e;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
}

/* App Wrapper Container */
.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Map Container */
.map {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background-color: #0d1117;
}

.logic-meta-chip {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 950;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(9, 12, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  line-height: 1.45;
  letter-spacing: 0.02em;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* UI Panel (Bottom) */
.panel {
  flex: 0 0 auto;
  max-height: clamp(220px, 34dvh, 360px);
  overflow: auto;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-top: 1rem;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.app-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.meta-date {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Slider */
.slider-container {
  margin-bottom: 1rem;
  position: relative;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
  padding: 0 10px;
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  margin: 0;
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: #374151;
  border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -7px;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
  transition: transform 0.1s;
}

.current-time-display {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.current-time-display strong {
  font-size: 1rem;
  color: var(--accent);
  margin-left: 5px;
}

/* Conditions Grid (Modified for 2 columns + full width tide) */
.conditions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.8rem;
  flex: 1;
}

.cond-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cond-label {
  color: var(--text-dim);
  font-size: 0.65rem;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.flex-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.moon-icon,
.weather-icon {
  font-size: 1.5rem;
}

.sub-text {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.weather-detail {
  line-height: 1.3;
}

/* Tide Graph Full Width */
.tide-graph-container {
  grid-column: 1 / -1;
  position: relative;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
}

.tide-svg-wrapper {
  position: relative;
  width: 100%;
  height: 60px;
  margin-top: 0.25rem;
  overflow: hidden;
}

#tide-svg {
  width: 100%;
  height: 100%;
  display: block;
}

#tide-time-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--accent);
  left: 0%;
  /* JS will update this */
  transition: left 0.3s ease;
  z-index: 10;
  box-shadow: 0 0 5px var(--accent);
}

.tide-text-hints {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Legend Bar */
.legend-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.panel-footer {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.seo-copy {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-dim);
}

.footer-link {
  color: var(--text-dim);
  font-size: 0.74rem;
  text-decoration: none;
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--text-main);
  text-decoration: underline;
}

.l-box {
  width: 20px;
  height: 8px;
  border-radius: 4px;
}

.lv-0 {
  background-color: var(--c-0);
}

.lv-1 {
  background-color: var(--c-1);
}

.lv-2 {
  background-color: var(--c-2);
}

.lv-3 {
  background-color: var(--c-3);
}

.lv-4 {
  background-color: var(--c-4);
}

.lv-5 {
  background-color: var(--c-5);
  box-shadow: 0 0 8px var(--c-5);
}

.lv-u {
  background-color: var(--c-0);
}

/* --- Map Markers --- */
.squid-marker {
  display: flex;
  justify-content: center;
  align-items: center;
}

.squid-marker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.marker-comments {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 2px);
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  white-space: nowrap;
  pointer-events: none;
}

.marker-comment-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  gap: 1px;
}

.marker-comment-count {
  font-size: 9px;
  font-weight: 700;
}

.squid-marker-inner {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.squid-marker svg {
  width: 100%;
  height: 100%;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.m-lv-0 {
  color: var(--c-0);
}

.m-lv-1 {
  color: var(--c-1);
}

.m-lv-2 {
  color: var(--c-2);
}

.m-lv-3 {
  color: var(--c-3);
}

.m-lv-4 {
  color: var(--c-4);
}

.m-lv-5 {
  color: var(--c-5);
  filter: none;
}

.squid-marker-inner.m-lv-1 { transform: scale(1.1); }
.squid-marker-inner.m-lv-2 { transform: scale(1.2); }
.squid-marker-inner.m-lv-3 { transform: scale(1.3); }
.squid-marker-inner.m-lv-4 { transform: scale(1.4); }
.squid-marker-inner.m-lv-5 { transform: scale(1.3); }
.squid-marker-inner.m-lv-5 svg { filter: drop-shadow(0 0 6px var(--c-5)); }

/* Shared squid-icon-inline for popups */
.squid-icon-inline {
  display: inline-block;
  vertical-align: middle;
  width: 16px;
  height: 16px;
  margin-right: 2px;
}

.squid-icon-inline svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.pop-lv-0 {
  color: var(--c-0);
}

.pop-lv-1 {
  color: var(--c-1);
}

.pop-lv-2 {
  color: var(--c-2);
}

.pop-lv-3 {
  color: var(--c-3);
}

.pop-lv-4 {
  color: var(--c-4);
}

.pop-lv-5 {
  color: var(--c-5);
  filter: drop-shadow(0 0 5px var(--c-5));
}

/* Dark mode Leaflet Popup */
.leaflet-popup-content-wrapper {
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--accent);
  border-radius: 8px;
}

.leaflet-popup-tip {
  background: var(--bg-panel);
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
}

.popup-content h3 {
  margin: 0 0 10px 0;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 5px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.popup-btn {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  font-weight: bold;
}

.leaflet-layer,
.leaflet-control-zoom-in,
.leaflet-control-zoom-out,
.leaflet-control-attribution {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}
