:root {
  color-scheme: light dark;
  --brand: rgb(33 128 79);
  --brand-deep: rgb(15 71 51);
  --brand-soft: rgb(232 247 237);
  --pink: rgb(255 45 85);
  --background: rgb(242 242 247);
  --surface: rgb(255 255 255);
  --surface-secondary: rgb(235 235 240);
  --text: rgb(18 18 20);
  --muted: rgb(101 101 108);
  --tertiary: rgb(143 143 150);
  --border: rgb(0 0 0 / 0.08);
  --shadow: rgb(0 0 0 / 0.08);
  --danger: rgb(220 38 38);
  --card-radius: 14px;
  --compact-radius: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

:root[data-appearance="light"] {
  color-scheme: light;
}

:root[data-appearance="dark"] {
  color-scheme: dark;
  --brand: rgb(54 179 112);
  --brand-deep: rgb(22 101 72);
  --brand-soft: rgb(15 46 33);
  --background: rgb(0 0 0);
  --surface: rgb(14 14 15);
  --surface-secondary: rgb(30 30 32);
  --text: rgb(245 245 247);
  --muted: rgb(171 171 178);
  --tertiary: rgb(132 132 139);
  --border: rgb(255 255 255 / 0.14);
  --shadow: rgb(0 0 0 / 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-appearance="light"]) {
    color-scheme: dark;
    --brand: rgb(54 179 112);
    --brand-deep: rgb(22 101 72);
    --brand-soft: rgb(15 46 33);
    --background: rgb(0 0 0);
    --surface: rgb(14 14 15);
    --surface-secondary: rgb(30 30 32);
    --text: rgb(245 245 247);
    --muted: rgb(171 171 178);
    --tertiary: rgb(132 132 139);
    --border: rgb(255 255 255 / 0.14);
    --shadow: rgb(0 0 0 / 0.28);
  }
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

html {
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.seo-fallback {
  display: grid;
  gap: 12px;
  width: min(100vw - 32px, 560px);
  margin: 72px auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--surface);
}

.app-shell {
  min-height: 100dvh;
  padding-bottom: calc(28px + var(--safe-bottom));
  background: var(--background);
}

.nav-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(14px + var(--safe-top)) 16px 10px;
  background: color-mix(in srgb, var(--background) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
}

.nav-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  max-width: 1180px;
  margin: 0 auto;
}

.logo-link,
.nav-back,
.icon-link {
  display: grid;
  place-items: center;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 8px 18px rgb(33 128 79 / 0.2);
}

.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.nav-title-wrap {
  min-width: 0;
}

.nav-title {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(25px, 4vw, 34px);
  line-height: 1.12;
  font-weight: 740;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-subtitle {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 17px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-link {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: var(--brand);
}

.icon-link:hover,
.icon-link:focus-visible,
.icon-link.is-selected {
  background: var(--brand-soft);
  outline: none;
}

.nav-back {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
}

.page-content {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 16px;
}

.content-stack,
.detail-stack,
.settings-stack {
  display: grid;
  gap: 18px;
}

.detail-stack {
  width: min(100%, 652px);
  margin: 0 auto;
}

.settings-stack {
  width: min(100%, 680px);
  margin: 0 auto;
}

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pill,
.map-selection-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-secondary);
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.section-title {
  margin: 0 2px -6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 17px;
  font-weight: 700;
  text-transform: uppercase;
}

.section-heading {
  margin: 0 2px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 17px;
  font-weight: 700;
}

.list-stack {
  display: grid;
  gap: 12px;
}

.summary-card,
.detail-card,
.settings-card,
.app-promo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: 0 6px 12px var(--shadow);
}

.summary-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 10px 14px;
}

.summary-card:hover,
.summary-card:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
}

.summary-icon,
.settings-icon,
.empty-icon {
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
}

.summary-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}

.summary-icon.heart-on {
  color: var(--pink);
}

.summary-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.summary-title {
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  line-height: 22px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-chevron {
  display: grid;
  place-items: center;
  color: var(--tertiary);
}

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

.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand);
  font-size: 14px;
  line-height: 18px;
  font-weight: 700;
  box-shadow: 0 4px 9px var(--shadow);
}

.control-button.primary {
  border-color: transparent;
  background: var(--brand);
  color: white;
}

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

.control-button.is-selected {
  color: var(--pink);
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 24px;
  align-items: start;
}

.camera-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: 0 6px 12px var(--shadow);
}

.camera-card.is-detail {
  width: 100%;
}

.camera-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--surface-secondary), var(--brand-soft));
}

.camera-image,
.camera-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-image {
  z-index: 2;
  object-fit: cover;
  opacity: 1;
  transition: opacity 160ms ease;
}

.camera-media.has-image .camera-image {
  opacity: 1;
}

.camera-media.is-unavailable .camera-image {
  display: none;
}

.camera-placeholder {
  z-index: 1;
  display: grid;
  place-items: center;
  color: var(--brand);
}

.camera-placeholder > .icon {
  width: 42px;
  height: 42px;
  opacity: 0.95;
}

.placeholder-logo {
  position: absolute;
  display: grid;
  place-items: center;
  width: 54px;
  height: 44px;
  color: color-mix(in srgb, var(--brand) 35%, transparent);
  transform: translateY(36px);
}

.favorite-button,
.play-button {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.36);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--text);
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.18);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.favorite-button {
  top: 10px;
  right: 10px;
}

.favorite-button.is-favorite {
  color: var(--pink);
}

.play-button {
  right: 10px;
  bottom: 10px;
  color: white;
  background: rgb(0 0 0 / 0.42);
}

.camera-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  min-height: 58px;
  padding: 10px 14px 12px;
}

.camera-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.camera-name:hover,
.camera-name:focus-visible {
  color: var(--brand);
  outline: none;
}

.map-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  line-height: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.detail-card {
  display: grid;
  padding: 2px 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  min-height: 48px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  line-height: 20px;
}

.detail-row:last-child {
  border-bottom: 0;
}

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

.detail-row a {
  color: var(--brand);
  font-weight: 700;
}

.search-form {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 6px 8px 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: 0 6px 12px var(--shadow);
}

.search-form input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 22px;
}

.search-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.search-submit {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-size: 14px;
  font-weight: 800;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 300px;
  padding: 44px 24px;
  text-align: center;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.empty-state strong {
  color: var(--text);
  font-size: 17px;
  line-height: 22px;
}

.empty-state p {
  max-width: 320px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 21px;
}

.settings-section {
  display: grid;
  gap: 8px;
}

.settings-card {
  overflow: hidden;
}

.settings-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 62px;
  padding: 12px 16px;
}

.settings-row.is-link:hover,
.settings-row.is-link:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--brand-soft) 58%, transparent);
}

.settings-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: transparent;
}

.settings-icon.crown {
  color: rgb(178 121 0);
}

.settings-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.settings-title {
  color: var(--text);
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
}

.settings-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 16px 16px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-secondary);
}

.language-segmented,
.appearance-segmented {
  grid-template-columns: repeat(3, 1fr);
}

.segmented button {
  min-height: 34px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segmented button.is-selected {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 5px var(--shadow);
}

.app-promo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
}

.bottom-app-promo {
  width: 100%;
}

.app-promo-icon {
  display: block;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 22%;
  box-shadow:
    0 8px 18px rgb(0 0 0 / 0.18),
    inset 0 0 0 1px rgb(255 255 255 / 0.18);
}

.app-promo-copy {
  min-width: 0;
}

.app-promo-title {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 19px;
  font-weight: 700;
}

.app-promo-text {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 15px;
  font-weight: 500;
}

.app-store-badge-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  min-width: 120px;
  min-height: 40px;
  border-radius: 8px;
}

.app-store-badge {
  display: block;
  width: 120px;
  height: 40px;
}

.app-store-badge-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

.map-page {
  display: grid;
  gap: 12px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.map-select-label select {
  min-height: 36px;
  max-width: min(62vw, 340px);
  padding: 5px 34px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.map-report {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.map-shell {
  position: relative;
  overflow: hidden;
  min-height: calc(100dvh - 190px);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--surface-secondary);
  box-shadow: 0 6px 12px var(--shadow);
}

.camera-map {
  position: absolute;
  inset: 0;
  min-height: 520px;
}

.map-selection {
  position: absolute;
  z-index: 500;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 8px 22px rgb(0 0 0 / 0.18);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.map-camera-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  width: 100%;
}

.map-camera-card strong,
.map-camera-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-camera-card strong {
  font-size: 15px;
  line-height: 20px;
}

.map-camera-card > span {
  grid-column: 1;
  color: var(--muted);
  font-size: 13px;
}

.map-camera-card .inline-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-content: end;
}

.map-error {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 420px;
  color: var(--muted);
  font-weight: 700;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.logo-mark .icon,
.pill .icon,
.summary-icon .icon,
.settings-icon .icon,
.empty-icon .icon,
.map-selection-count .icon {
  width: 18px;
  height: 18px;
}

.leaflet-container {
  font-family: var(--font);
}

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

@media (max-width: 760px) {
  .nav-bar {
    padding-inline: 12px;
  }

  .nav-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .logo-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .logo-mark img {
    width: 100%;
  }

  .nav-actions {
    gap: 0;
  }

  .icon-link {
    width: 34px;
    height: 34px;
  }

  .page-content {
    padding: 14px 16px;
  }

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

  .camera-body {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .map-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .map-select-label {
    justify-content: space-between;
  }

  .map-select-label select {
    max-width: 68vw;
  }

  .map-shell {
    min-height: calc(100dvh - 232px);
  }

  .camera-map {
    min-height: 460px;
  }

  .map-camera-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .map-camera-card .inline-actions {
    grid-column: 1;
    grid-row: auto;
    justify-content: start;
  }
}

@media (max-width: 430px) {
  .nav-title {
    font-size: 26px;
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .nav-subtitle {
    display: none;
  }

  .icon-link {
    width: 32px;
  }

  .summary-title,
  .camera-name {
    white-space: normal;
  }

  .search-form {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .search-submit {
    grid-column: 1 / -1;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
