:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #68777d;
  --line: #d9e2e2;
  --paper: #f5f7f4;
  --panel: #ffffff;
  --water: #d8edf0;
  --deep: #6da7b2;
  --green: #1f6f61;
  --green-dark: #164f47;
  --amber: #d89231;
  --danger: #9b3027;
  --shadow: 0 16px 40px rgba(27, 48, 52, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.login-body {
  background:
    radial-gradient(circle at top left, rgba(216, 237, 240, 0.92), transparent 38%),
    linear-gradient(180deg, #f7fbfa 0%, #eef4f2 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 18px 14px 92px;
}

.login-shell {
  width: min(100%, 960px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 18px;
  display: grid;
  align-items: center;
  gap: 20px;
}

.login-hero,
.login-panel {
  padding: 22px;
  border: 1px solid rgba(23, 33, 38, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 24px 60px rgba(27, 48, 52, 0.12);
  backdrop-filter: blur(14px);
}

.login-hero h1 {
  margin-top: 10px;
  font-size: clamp(32px, 6vw, 54px);
  line-height: 1.02;
}

.login-copy {
  max-width: 34rem;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.login-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  padding: 5px;
  border-radius: 999px;
  background: #edf4f2;
}

.login-tab {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.login-tab.is-active {
  background: #fff;
  color: var(--green-dark);
  box-shadow: 0 10px 20px rgba(27, 48, 52, 0.08);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.auth-form input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(155, 48, 39, 0.08);
  color: var(--danger);
  font-weight: 700;
}

.auth-submit {
  min-height: 48px;
}

.topbar,
.section-header,
.map-toolbar,
.log-item-top,
.catch-entry-header,
.spot-meta,
.dialog-header,
.spot-card-actions,
.spot-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 14px;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(27, 48, 52, 0.08);
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 2px 0 0;
  line-height: 1.08;
}

h1 {
  font-size: 29px;
}

h2 {
  font-size: 18px;
}

.icon-button,
.pill-button {
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(31, 111, 97, 0.2);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
}

.pill-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
}

.ghost-pill {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(22, 79, 71, 0.16);
  border-radius: 999px;
  background: #fff;
  color: var(--green-dark);
  font-weight: 800;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.user-chip-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.map-panel,
.section-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.period-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f1;
}

.period-tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.period-tab.is-active {
  background: #fff;
  color: var(--green-dark);
  box-shadow: 0 4px 12px rgba(23, 33, 38, 0.08);
}

.map-canvas {
  position: relative;
  overflow: hidden;
  height: 340px;
  border-radius: 8px;
  border: 1px solid #c6dcdd;
  background: #d8edf0;
}

.map-canvas.layer-depth {
  background: #d8edf0;
}

.map-layer-control {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 1000;
  display: grid;
  justify-items: end;
  gap: 6px;
}

.map-layer-button,
.map-layer-option {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(17, 42, 47, 0.16);
}

.map-layer-button {
  padding: 0 12px;
}

.map-layer-menu {
  display: grid;
  width: 92px;
  padding: 4px;
  border: 1px solid rgba(23, 33, 38, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(17, 42, 47, 0.2);
}

.map-layer-menu[hidden] {
  display: none;
}

.map-layer-option {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.map-layer-option.is-active {
  background: #e7f0ec;
  color: var(--green-dark);
}

.weather-toggle[aria-pressed="true"],
.weather-layer-option.is-active {
  background: var(--green);
  color: #fff;
}

.windy-map {
  position: absolute;
  inset: 0;
  z-index: 650;
  background: #d8edf0;
}

.windy-map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.windy-map[hidden] {
  display: none;
}

.windy-data-host {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 320px;
  height: 240px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.windy-data-host iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.weather-layer-control {
  position: absolute;
  right: 10px;
  bottom: 26px;
  left: 10px;
  z-index: 1001;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(23, 33, 38, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 30px rgba(17, 42, 47, 0.18);
}

.weather-layer-control[hidden] {
  display: none;
}

.weather-layer-option {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.weather-layer-option:disabled {
  opacity: 0.42;
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-attribution {
  font-size: 11px;
}

.spot-pin-icon,
.pending-pin-icon {
  background: transparent;
  border: 0;
}

.spot-pin,
.pending-pin,
.spot-dot {
  position: relative;
  display: grid;
  background: var(--marker-color, var(--green-dark));
  box-shadow: 0 10px 20px rgba(17, 42, 47, 0.28);
}

.spot-pin,
.pending-pin {
  width: 30px;
  height: 30px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  transform: rotate(-45deg);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease,
    background 160ms ease;
}

.spot-pin.is-active {
  background: #ef6c00;
  box-shadow:
    0 0 0 4px rgba(239, 108, 0, 0.22),
    0 14px 28px rgba(17, 42, 47, 0.34);
  filter: saturate(1.08) brightness(1.02);
  transform: rotate(-45deg) scale(1.12);
}

.spot-pin span,
.pending-pin span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  line-height: 1;
  transform: rotate(45deg);
}

.spot-pin svg,
.spot-meta svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spot-meta svg {
  width: 14px;
  height: 14px;
  margin-right: 5px;
}

.spot-meta span span {
  display: inline;
}

.spot-pin::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid transparent;
  border-radius: 50%;
  transform: rotate(45deg);
  transition:
    border-color 160ms ease,
    opacity 160ms ease;
}

.spot-pin.is-active::after {
  border-color: rgba(255, 255, 255, 0.92);
}

.spot-dot {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  opacity: 0.62;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.25),
    0 6px 16px rgba(17, 42, 47, 0.18);
}

.spot-dot.is-active {
  width: 15px;
  height: 15px;
  opacity: 0.88;
  box-shadow:
    0 0 0 4px rgba(239, 108, 0, 0.24),
    0 8px 18px rgba(17, 42, 47, 0.24);
}

.pending-pin {
  width: 22px;
  height: 22px;
  background: #1976d2;
  box-shadow:
    0 0 0 4px rgba(25, 118, 210, 0.16),
    0 10px 20px rgba(17, 42, 47, 0.24);
}

.spot-card,
.weather-snapshot,
.toggle-group,
.catch-detail,
.spot-manager-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6faf8;
}

.spot-card {
  margin-top: 10px;
  padding: 12px;
}

.spot-card-actions {
  margin-top: 12px;
  justify-content: flex-end;
}

.spot-manager-card {
  margin-top: 10px;
  padding: 12px;
}

.spot-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
}

.icon-choice {
  display: grid;
  min-width: 0;
  min-height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--green-dark);
  font-weight: 900;
}

.icon-choice svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-choice.is-active {
  border-color: rgba(31, 111, 97, 0.34);
  background: var(--green);
  color: #fff;
}

.icon-choice-all {
  font-size: 12px;
}

.map-panel + .weather-grid {
  display: none;
}

.spot-list-item {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.spot-list-item.is-active {
  border-color: rgba(31, 111, 97, 0.32);
  background: #e7f0ec;
}

.spot-list-item-main {
  display: grid;
  gap: 4px;
}

.spot-list-item-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.spot-list-item-name svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spot-list-item-meta {
  color: var(--muted);
  font-size: 12px;
}

.spot-meta {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin: 10px 0;
}

.spot-meta span,
.species-chip,
.weather-snapshot span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e7f0ec;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  padding: 10px;
}

input,
select {
  min-height: 42px;
  padding: 0 10px;
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.metric-card {
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(27, 48, 52, 0.08);
}

.metric-card span,
.log-form label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.log-form {
  display: grid;
  gap: 10px;
}

.log-form label > input,
.log-form label > select,
.log-form label > textarea {
  margin-top: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.log-list,
.stats-list,
.catch-fields {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.log-item,
.stat-row,
.catch-entry {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.log-item-top,
.catch-entry-header {
  align-items: flex-start;
}

.log-item strong {
  display: block;
}

.log-item span,
.log-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.log-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.small-button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.small-button.danger {
  color: var(--danger);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-row span {
  font-weight: 800;
}

.stat-row strong {
  display: grid;
  min-width: 34px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #e7f0ec;
  color: var(--green-dark);
}

.species-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.add-species {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-top: 12px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 8px 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  display: grid;
  min-height: 42px;
  place-items: center;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.bottom-nav button.is-active {
  background: #e7f0ec;
  color: var(--green-dark);
}

.marker-dialog,
.log-dialog {
  width: min(calc(100% - 24px), 500px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(13, 32, 36, 0.34);
}

.marker-dialog::backdrop,
.log-dialog::backdrop {
  background: rgba(16, 31, 36, 0.42);
}

.marker-form,
.log-form {
  padding: 14px;
}

.dialog-header {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -14px -14px 4px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.ghost-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  border: 0;
  background: var(--green);
  color: #fff;
}

.secondary-button {
  border: 1px dashed rgba(31, 111, 97, 0.45);
  background: #fff;
  color: var(--green-dark);
}

.weather-snapshot,
.toggle-group,
.catch-detail {
  padding: 12px;
}

.weather-snapshot div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.toggle-group legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.toggle-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.toggle-group input {
  width: auto;
}

.catch-detail {
  display: grid;
  gap: 10px;
}

.catch-detail[hidden] {
  display: none;
}

@media (min-width: 620px) {
  .app-shell {
    padding-top: 28px;
  }
}
