:root {
  color-scheme: light;
  --bg: #eef8f6;
  --bg-strong: #dff4f1;
  --surface: #ffffff;
  --surface-soft: #f7fffd;
  --ink: #123033;
  --muted: #5f7475;
  --line: #cbe2df;
  --cyan: #05aeca;
  --teal: #0f766e;
  --green: #46ba78;
  --coral: #ff6b5f;
  --sun: #ffd166;
  --shadow: 0 18px 42px rgba(18, 48, 51, 0.16);
  --shadow-soft: 0 10px 24px rgba(18, 48, 51, 0.1);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
  background:
    linear-gradient(135deg, rgba(5, 174, 202, 0.16), transparent 34%),
    linear-gradient(205deg, rgba(255, 107, 95, 0.14), transparent 30%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(5, 174, 202, 0.32);
  outline-offset: 2px;
}

svg {
  display: block;
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon-sprite symbol#icon-paw path,
.brand-mark svg,
.photo-drop .photo-preview svg {
  fill: currentColor;
  stroke: none;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--surface);
  background: var(--teal);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.ghost-action,
.primary-action,
.submit-action,
.range-chip {
  border: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.icon-button[disabled] {
  color: var(--muted);
  cursor: default;
  opacity: 0.7;
}

.primary-action,
.submit-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-size: 0.94rem;
  font-weight: 800;
  white-space: nowrap;
}

.primary-action,
.submit-action {
  color: #ffffff;
  background: var(--coral);
  box-shadow: 0 10px 20px rgba(255, 107, 95, 0.26);
}

.ghost-action {
  color: var(--teal);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 18px;
  align-items: start;
  padding-top: 14px;
}

.map-panel,
.feed-panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(203, 226, 223, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.map-panel {
  padding: 16px;
}

.feed-panel {
  padding: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h1,
.section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.55rem, 4vw, 2.65rem);
  line-height: 1;
  font-weight: 850;
}

.section-heading h2 {
  font-size: 1.42rem;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.section-heading.compact {
  align-items: end;
}

.section-heading select {
  width: 142px;
  min-height: 38px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 0.88rem;
}

.range-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.range-strip::-webkit-scrollbar {
  display: none;
}

.range-label,
.range-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.range-label {
  color: var(--muted);
  background: transparent;
}

.range-chip {
  color: var(--teal);
  background: #eaf8f4;
}

.range-chip.is-active {
  color: #ffffff;
  background: var(--teal);
}

.map-stage {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(255, 255, 255, 0.56) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.52) 1px, transparent 1px),
    linear-gradient(155deg, rgba(70, 186, 120, 0.32), transparent 42%),
    linear-gradient(25deg, rgba(5, 174, 202, 0.24), transparent 44%),
    #cfeee8;
  background-size: 38px 38px, 38px 38px, auto, auto, auto;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.14);
}

.map-path,
.map-water,
.map-park {
  position: absolute;
  pointer-events: none;
}

.map-path {
  height: 44px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(18, 48, 51, 0.06);
}

.path-one {
  inset: 38% -12% auto 8%;
  transform: rotate(-12deg);
}

.path-two {
  inset: 66% 12% auto -18%;
  transform: rotate(18deg);
}

.map-water {
  inset: auto -6% 10% 44%;
  height: 130px;
  background: rgba(5, 174, 202, 0.34);
  border-radius: 70% 35% 0 0;
  transform: rotate(-8deg);
}

.map-park {
  width: 220px;
  height: 160px;
  background: rgba(70, 186, 120, 0.32);
  border: 1px solid rgba(47, 142, 95, 0.16);
  border-radius: 38% 62% 44% 56%;
}

.park-one {
  left: 9%;
  top: 10%;
}

.park-two {
  right: 8%;
  bottom: 19%;
  transform: rotate(24deg);
}

.map-label {
  position: absolute;
  z-index: 1;
  padding: 6px 8px;
  color: rgba(18, 48, 51, 0.62);
  background: rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  font-size: 0.76rem;
  font-weight: 800;
}

.label-north {
  top: 10%;
  right: 11%;
}

.label-south {
  left: 10%;
  bottom: 11%;
}

.label-east {
  right: 15%;
  top: 49%;
}

.marker-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.cat-marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #ffffff;
  background: var(--coral);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(18, 48, 51, 0.24);
  transform: translate(-50%, -50%);
}

.cat-marker svg {
  width: 20px;
  height: 20px;
}

.cat-marker.is-selected {
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(5, 174, 202, 0.2), 0 14px 28px rgba(18, 48, 51, 0.24);
}

.featured-sighting {
  min-height: 156px;
  margin-bottom: 12px;
}

.featured-card,
.sighting-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.featured-card {
  display: grid;
  grid-template-columns: 42% 1fr;
  min-height: 156px;
  box-shadow: var(--shadow-soft);
}

.sighting-list {
  display: grid;
  gap: 10px;
}

.sighting-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 8px;
  color: inherit;
  text-align: left;
  box-shadow: none;
}

.sighting-card.is-selected {
  border-color: rgba(15, 118, 110, 0.52);
  box-shadow: 0 0 0 3px rgba(5, 174, 202, 0.14);
}

.cat-photo {
  min-height: 0;
  background-color: #cbe2df;
  background-image: url("./assets/cat-sheet.png");
  background-repeat: no-repeat;
  background-size: 300% 100%;
}

.cat-photo.frame-0 {
  background-position: 0 50%;
}

.cat-photo.frame-1 {
  background-position: 50% 50%;
}

.cat-photo.frame-2 {
  background-position: 100% 50%;
}

.cat-photo.uploaded {
  background-size: cover;
  background-position: center;
}

.featured-card .cat-photo {
  min-height: 156px;
}

.sighting-card .cat-photo {
  width: 78px;
  height: 78px;
  border-radius: 6px;
}

.sighting-copy {
  min-width: 0;
  padding: 10px 10px 10px 0;
}

.featured-card .sighting-copy {
  padding: 12px;
}

.sighting-copy h3 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.2;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-card .sighting-copy h3 {
  font-size: 1.15rem;
}

.sighting-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  color: var(--teal);
  background: #eaf8f4;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
}

.capture-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.capture-panel.is-open {
  display: block;
}

.capture-scrim {
  position: absolute;
  inset: 0;
  background: rgba(18, 48, 51, 0.38);
}

.capture-sheet {
  position: absolute;
  right: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
  width: min(520px, calc(100% - 28px));
  max-height: calc(100svh - 28px);
  overflow: auto;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateX(50%);
}

.sheet-grip {
  justify-self: center;
  width: 42px;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
}

.sheet-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-title-row h2 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.05;
}

.sheet-title-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.photo-drop {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 118px;
  padding: 8px;
  background: var(--surface-soft);
  border: 1px dashed rgba(15, 118, 110, 0.45);
  border-radius: var(--radius);
}

.photo-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.photo-preview {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  overflow: hidden;
  color: var(--teal);
  background: #eaf8f4;
  border-radius: 6px;
  background-position: center;
  background-size: cover;
}

.photo-preview svg {
  width: 42px;
  height: 42px;
}

.photo-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.photo-copy strong {
  font-size: 1rem;
}

.photo-copy span {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.field-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.field-grid select,
.field-grid input {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 0.94rem;
}

.wide-field {
  grid-column: 1 / -1;
}

.privacy-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  color: var(--teal);
  background: #eaf8f4;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 800;
}

.submit-action {
  width: 100%;
  min-height: 48px;
  font-size: 0.98rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 30;
  display: none;
  max-width: min(420px, calc(100% - 28px));
  padding: 11px 14px;
  color: #ffffff;
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  font-size: 0.9rem;
  font-weight: 750;
}

.toast.is-visible {
  display: block;
}

@media (min-width: 1200px) {
  .map-stage {
    min-height: 620px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .map-stage {
    min-height: 430px;
  }

  .feed-panel {
    margin-bottom: 82px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 8px 0;
    background: linear-gradient(180deg, rgba(238, 248, 246, 0.96), rgba(238, 248, 246, 0.78));
    backdrop-filter: blur(12px);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: 100%;
    padding: 10px 10px 22px;
  }

  .brand span:last-child {
    font-size: 1.08rem;
  }

  .primary-action {
    width: 46px;
    padding: 0;
  }

  .primary-action span {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .map-panel,
  .feed-panel {
    padding: 12px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h1 {
    font-size: 1.9rem;
  }

  .ghost-action span {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .map-stage {
    min-height: 360px;
  }

  .featured-card {
    grid-template-columns: 1fr;
  }

  .featured-card .cat-photo {
    min-height: 190px;
  }

  .field-grid,
  .photo-drop {
    grid-template-columns: 1fr;
  }

  .photo-preview {
    width: 100%;
    height: 160px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .cat-marker,
  .toast,
  .capture-sheet {
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  }

  .cat-marker:hover {
    transform: translate(-50%, -50%) scale(1.08);
  }
}
