* {
  box-sizing: border-box;
}
body {
  margin: auto;
  max-width: 650px;
  font: 16px/1.45 system-ui, sans-serif;
  color: #103e39;
  background: #f7f6ee;
}
header,
main {
  padding: 18px 20px;
}
header,
.bar,
nav,
.row,
#ranges,
header span,
.primary {
  display: flex;
  align-items: center;
  gap: 9px;
}
header img {
  border-radius: 11px;
}
header b {
  font-size: 23px;
  letter-spacing: -1px;
}
header span {
  margin-left: auto;
  font-size: 14px;
  gap: 4px;
}
svg {
  width: 22px;
  height: 22px;
}
header svg {
  width: 16px;
}
main {
  padding-top: 2px;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
.hero {
  border-radius: 22px;
  padding: 24px;
  background: #bceada url(coast.svg) right bottom/auto 100% no-repeat;
  height: 198px;
  overflow: hidden;
}
small {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
}
h1,
h2,
p {
  margin: 12px 0;
}
h1 {
  font: 600 36px/1.05 Georgia, serif;
  letter-spacing: -1.6px;
}
.hero h1 {
  font-size: 48px;
}
h2 {
  font-size: 19px;
  letter-spacing: -0.5px;
}
p,
em,
footer,
#accuracy {
  color: #506862;
  font-size: 14px;
}
em {
  display: block;
  font-style: normal;
  font-weight: 400;
  margin-top: 3px;
}
.bar {
  justify-content: space-between;
  margin-top: 12px;
}
button,
input,
a {
  font: inherit;
  color: inherit;
}
button,
a {
  cursor: pointer;
  border-radius: 13px;
  border: 1px solid #cddad3;
  background: white;
  padding: 12px;
  font-weight: 650;
}
button:hover {
  border-color: #15705e;
}
button:disabled {
  opacity: 0.6;
}
button[aria-pressed='true'] {
  background: #ceefdf;
  border-color: #16715c;
}
#ranges {
  gap: 6px;
}
#ranges button {
  flex: 1;
  padding: 11px 0;
  font-size: 15px;
}
.primary {
  justify-content: center;
  background: #104b42;
  color: white;
  border: 0;
  width: 100%;
  margin-top: 14px;
  padding: 15px;
}
#gps {
  text-align: center;
}
#shortcuts {
  margin-top: 22px;
}
.row {
  text-align: left;
  width: 100%;
  margin: 8px 0;
  padding: 15px;
  gap: 14px;
  overflow-wrap: anywhere;
}
.row span {
  flex: 1;
}
.row svg {
  color: #176953;
  padding: 10px;
  background: #ddf4e8;
  width: 44px;
  height: 44px;
  border-radius: 13px;
}
.row strong {
  font-size: 13px;
  color: #167051;
}
nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(650px, 100%);
  background: white;
  border-top: 1px solid #d4ded7;
  padding: 8px 15px calc(8px + env(safe-area-inset-bottom));
}
nav button {
  flex: 1;
  border: 0;
  font-size: 13px;
  padding: 7px;
}
nav svg {
  display: block;
  margin: 0 auto 3px;
}
input[type='search'] {
  background: white;
  width: 100%;
  border: 1px solid #b7cac2;
  border-radius: 14px;
  padding: 14px;
  margin: 10px 0;
}
label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
input[type='checkbox'] {
  width: 19px;
  height: 19px;
  accent-color: #16715c;
}
footer {
  text-align: center;
  margin: 24px auto;
}
footer button {
  background: none;
  border: 0;
  font-size: 13px;
  padding: 6px;
  text-decoration: underline;
}
#sources {
  display: block;
  margin: auto;
}
dialog {
  width: min(94%, 560px);
  max-height: 88dvh;
  padding: 22px;
  border: 0;
  border-radius: 20px;
  color: inherit;
  overflow-wrap: anywhere;
}
dialog::backdrop {
  background: #062c27a6;
}
#close {
  display: block;
  margin-left: auto;
  position: sticky;
  top: 0;
}
a {
  display: inline-block;
  text-decoration: none;
  margin: 4px 8px 4px 0;
  background: #e4f5ed;
}
article {
  background: #fff2ce;
  border: 1px dashed #ac7717;
  padding: 16px;
  border-radius: 12px;
  margin: 12px 0;
}
code {
  font-size: 18px;
  font-weight: bold;
  user-select: all;
}
details {
  white-space: pre-wrap;
  margin: 12px 0;
}
#lens {
  position: relative;
  background: #112d2a;
  border-radius: 18px;
  overflow: hidden;
}
video {
  display: block;
  width: 100%;
  height: 36dvh;
  object-fit: cover;
}
#frame {
  position: absolute;
  inset: 33% 6%;
  border: 2px solid #99fecb;
  border-radius: 12px;
  color: white;
  display: grid;
  place-items: center;
  font-size: 30px;
}
#match {
  position: absolute;
  bottom: 6px;
  left: 3%;
  width: 94%;
  padding: 7px;
  font-size: 14px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 365px) {
  main,
  header {
    padding-inline: 12px;
  }
  .hero {
    padding: 16px;
    height: 170px;
  }
  .hero h1 {
    font-size: 39px;
  }
}
@media (max-width: 410px) {
  .hero h1 {
    font-size: clamp(34px, 11vw, 45px);
  }
  .hero {
    background-size: auto 90%;
  }
}

body[data-view='browse'] {
  max-width: 1120px;
}
.mast {
  border-radius: 22px;
  background: #bceada url(coast.svg) right bottom/auto 100% no-repeat;
  padding: 26px 32px;
  height: 210px;
}
.mast h1 {
  font-size: 58px;
  line-height: 0.98;
}
#query {
  margin: 16px 0 12px;
  border-color: #75a195;
  padding: 16px;
}
#categories,
.filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
#categories {
  overflow-x: auto;
  padding-bottom: 8px;
}
#categories button {
  white-space: nowrap;
  border-radius: 30px;
  font-size: 14px;
  padding: 10px 16px;
}
#categories button[aria-pressed='true'] {
  background: #104b42;
  color: white;
}
.filters {
  gap: 20px;
  margin: 8px 0 20px;
}
.filters input {
  accent-color: #104b42;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 18px;
  margin-bottom: 26px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  padding: 0;
  text-align: left;
  border-radius: 18px;
  box-shadow: 0 3px 10px #163e3508;
}
.tile img {
  width: 100%;
  aspect-ratio: 1.95;
  object-fit: cover;
}
.tile span {
  padding: 16px 18px 20px;
}
.tile b {
  display: block;
  font-size: 21px;
  letter-spacing: -0.6px;
  margin-top: 4px;
}
.tile small,
#detail small {
  color: #187358;
  text-transform: uppercase;
}
.tile strong {
  display: inline-block;
  margin-top: 12px;
  background: #ffedb9;
  color: #69450b;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 13px;
}
dialog {
  width: min(96%, 740px);
  max-height: 94dvh;
  overscroll-behavior: contain;
}
body:has(dialog[open]) {
  overflow: hidden;
}
#detail .cover {
  width: 100%;
  max-height: 365px;
  object-fit: cover;
  border-radius: 15px;
  display: block;
  margin: 12px 0 18px;
}
#detail .intro {
  font-size: 17px;
  line-height: 1.55;
  color: #214943;
}
#detail a {
  max-width: 100%;
}
#detail .credit {
  font-size: 13px;
  background: none;
  border: 0;
  padding-left: 0;
  text-decoration: underline;
}
#close {
  z-index: 1;
}
@media (max-width: 600px) {
  .mast {
    height: 155px;
    padding: 16px;
    background-size: auto 85%;
  }
  .mast h1 {
    font-size: clamp(31px, 10vw, 46px);
  }
  dialog {
    margin: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 16px 18px 48px;
  }
  .grid {
    gap: 14px;
  }
}

.pager:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 18px 0;
}
.pager button {
  min-width: 100px;
}
.pager select {
  min-height: 44px;
  padding: 0 12px;
  color: #103e39;
  background: white;
  border: 1px solid #b7cac2;
  border-radius: 12px;
  font: inherit;
}
#count { scroll-margin-top: 16px; }
#more { width: 100%; }
