:root {
  color-scheme: light;
  --ink: #142428;
  --muted: #69777b;
  --line: #dbe5e8;
  --panel: #ffffff;
  --soft: #f3f7f7;
  --deep: #083f4d;
  --reef: #0f8f8b;
  --coral: #ee6f57;
  --sun: #f2b84b;
  --kelp: #466b54;
  --shadow: 0 18px 60px rgba(12, 38, 45, 0.12);
  --radius: 8px;
  --icon-home: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='black' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m3 11 9-8 9 8'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3Cpath d='M10 20v-6h4v6'/%3E%3C/svg%3E");
  --icon-pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='black' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s7-5.1 7-12a7 7 0 1 0-14 0c0 6.9 7 12 7 12Z'/%3E%3Ccircle cx='12' cy='9' r='2.5'/%3E%3C/svg%3E");
  --icon-seal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='black' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m12 2 2.7 3.7 4.5.4-.4 4.5 3.2 3.4-4 2.2-1.3 4.4-4.7-1.7-4.7 1.7L6 16.2l-4-2.2 3.2-3.4-.4-4.5 4.5-.4L12 2Z'/%3E%3Cpath d='m8.8 12 2.1 2.1 4.4-4.5'/%3E%3C/svg%3E");
  --icon-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='black' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c1.8-4 5-6 8-6s6.2 2 8 6'/%3E%3C/svg%3E");
  --icon-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='black' stroke-width='2.6' viewBox='0 0 24 24'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --icon-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='black' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E");
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #edf4f3;
}

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

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

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

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 660px) 320px;
  gap: 22px;
  min-height: 100vh;
  padding: 18px;
}

.rail,
.side-panel {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 18px 12px;
  border-right: 1px solid rgba(8, 63, 77, 0.12);
}

.brand,
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 2px 10px rgba(8, 63, 77, 0.18);
}

.rail-nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 700;
}

.nav-link.active {
  color: var(--deep);
  background: rgba(15, 143, 139, 0.12);
}

.icon,
.icon-button,
.create-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  overflow: hidden;
  color: transparent;
  background: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: 22px;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 22px;
}

.icon {
  color: currentColor;
}

.icon:has(+ span) {
  flex: 0 0 28px;
}

.icon,
.icon-button,
.create-button {
  mask-image: var(--icon-home);
  -webkit-mask-image: var(--icon-home);
}

[aria-label="Spots"] .icon,
[href="#spots"] .icon {
  mask-image: var(--icon-pin);
  -webkit-mask-image: var(--icon-pin);
}

.icon {
  color: currentColor;
}

.nav-link[href="#spots"] .icon {
  mask-image: var(--icon-pin);
  -webkit-mask-image: var(--icon-pin);
}

.nav-link[href="#badges"] .icon {
  mask-image: var(--icon-seal);
  -webkit-mask-image: var(--icon-seal);
}

.nav-link[href="#profile"] .icon {
  mask-image: var(--icon-user);
  -webkit-mask-image: var(--icon-user);
}

.main {
  min-width: 0;
  padding-bottom: 88px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: env(safe-area-inset-top) 14px 10px;
  background: rgba(237, 244, 243, 0.88);
  backdrop-filter: blur(16px);
}

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

.icon-button,
.avatar-button,
.create-button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 40px;
  height: 40px;
  color: var(--deep);
  background: currentColor;
  mask-image: var(--icon-down);
  -webkit-mask-image: var(--icon-down);
}

.avatar-button,
.composer-avatar {
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.avatar-button,
.avatar-button img,
.composer-avatar,
.composer-avatar img {
  width: 38px;
  height: 38px;
}

.avatar-button img,
.composer-avatar img,
.story img,
.profile-photo {
  object-fit: cover;
  border-radius: 50%;
}

.view {
  display: none;
}

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

.stories {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 88px;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0 14px;
  scrollbar-width: none;
}

.stories::-webkit-scrollbar {
  display: none;
}

.story {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.story-ring {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  padding: 3px;
  background: conic-gradient(from 20deg, var(--coral), var(--sun), var(--reef), var(--coral));
  border-radius: 50%;
}

.story img {
  width: 64px;
  height: 64px;
  border: 3px solid #fff;
}

.composer,
.post,
.login-card,
.leaderboard,
.spot-card,
.badge-card,
.profile-stats,
.profile-badges {
  background: var(--panel);
  border: 1px solid rgba(8, 63, 77, 0.1);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(8, 63, 77, 0.04);
}

.composer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.composer-button {
  flex: 1;
  min-height: 42px;
  padding: 0 14px;
  color: var(--muted);
  text-align: left;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.feed {
  display: grid;
  gap: 16px;
}

.post {
  overflow: hidden;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.post-head img,
.leader-row img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
}

.post-user {
  min-width: 0;
  flex: 1;
}

.post-user strong,
.post-user span,
.leader-row span,
.story span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-user span,
.post-location,
.badge-meta,
.spot-meta,
.login-card p,
.profile-info p {
  color: var(--muted);
  font-size: 0.88rem;
}

.post-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--soft);
}

.post-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  color: var(--deep);
  background: #e7f5f2;
  border: 1px solid rgba(15, 143, 139, 0.22);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.post-body {
  padding: 12px;
}

.post-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--deep);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0 16px;
}

.section-head h1,
.profile-info h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.social-button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 0;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  color: #fff;
  background: var(--deep);
}

.secondary-button {
  color: var(--deep);
  background: #e7f5f2;
  border: 1px solid rgba(15, 143, 139, 0.18);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.map-card {
  min-height: 420px;
  padding: 14px;
  background: #d9eeee;
  border: 1px solid rgba(8, 63, 77, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
}

.philippines-map {
  position: relative;
  min-height: 390px;
  background:
    radial-gradient(circle at 47% 20%, #4caa85 0 5%, transparent 5.4%),
    radial-gradient(circle at 42% 35%, #5cbd91 0 8%, transparent 8.4%),
    radial-gradient(circle at 56% 47%, #589c74 0 6%, transparent 6.4%),
    radial-gradient(circle at 51% 66%, #70bd83 0 9%, transparent 9.5%),
    radial-gradient(circle at 62% 79%, #4e976d 0 7%, transparent 7.4%),
    linear-gradient(180deg, #c7ebee, #9fd6dd);
  border-radius: var(--radius);
}

.map-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--coral);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  box-shadow: var(--shadow);
  transform: rotate(-45deg);
}

.map-pin span {
  transform: rotate(45deg);
  font-size: 0.7rem;
  font-weight: 900;
}

.spot-list,
.badge-grid,
.profile-badges {
  display: grid;
  gap: 12px;
}

.spot-card,
.badge-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
}

.spot-card img,
.badge-art {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius);
}

.spot-card h3,
.badge-card h3,
.login-card h2,
.leaderboard h2 {
  margin: 0 0 4px;
}

.spot-card p,
.badge-card p {
  margin: 6px 0;
}

.badge-art {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--deep), var(--reef));
  font-size: 1.7rem;
  font-weight: 900;
}

.profile-hero {
  overflow: hidden;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid rgba(8, 63, 77, 0.1);
}

.profile-cover {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px 16px;
}

.profile-photo {
  width: 92px;
  height: 92px;
  margin-top: -42px;
  border: 4px solid #fff;
}

.profile-info div {
  min-width: 0;
  flex: 1;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 14px 0;
  overflow: hidden;
}

.profile-stats div {
  display: grid;
  gap: 4px;
  padding: 16px 8px;
  text-align: center;
  background: var(--panel);
}

.profile-stats strong {
  font-size: 1.35rem;
}

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

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.login-card,
.leaderboard {
  padding: 14px;
}

.social-button {
  display: grid;
  place-items: center;
  width: 100%;
  margin-top: 10px;
  color: #fff;
  text-align: center;
}

.facebook {
  background: #1877f2;
}

.instagram {
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
}

.leader-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.leader-row:first-child {
  border-top: 0;
}

.leader-row div {
  min-width: 0;
  flex: 1;
}

.leader-row strong {
  display: block;
}

.bottom-nav {
  display: none;
}

.modal {
  width: min(92vw, 430px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(7, 32, 38, 0.46);
  backdrop-filter: blur(4px);
}

.modal form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.modal h2,
.modal p {
  margin: 0;
}

.install-modal form {
  text-align: center;
}

.install-logo {
  justify-self: center;
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.install-steps {
  display: grid;
  gap: 8px;
  text-align: left;
}

.install-steps span {
  padding: 10px 12px;
  color: var(--deep);
  background: #e7f5f2;
  border: 1px solid rgba(15, 143, 139, 0.18);
  border-radius: var(--radius);
  font-weight: 800;
}

.close-button {
  justify-self: end;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

select,
textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

textarea {
  resize: vertical;
}

.check-row {
  grid-template-columns: 20px 1fr;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 50;
  max-width: min(92vw, 430px);
  padding: 12px 14px;
  color: #fff;
  background: rgba(8, 63, 77, 0.94);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 84px minmax(0, 660px) 280px;
  }

  .rail {
    align-items: center;
  }

  .brand span:last-child,
  .rail .nav-link span:last-child {
    display: none;
  }
}

@media (max-width: 980px) {
  body {
    background: var(--soft);
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  .rail,
  .side-panel {
    display: none;
  }

  .topbar {
    display: flex;
  }

  .main {
    width: min(100%, 680px);
    margin: 0 auto;
    padding: 0 12px 96px;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px 14px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(16px);
  }

  .bottom-nav .nav-link {
    justify-content: center;
    min-height: 48px;
    padding: 0;
  }

  .create-button {
    justify-self: center;
    width: 48px;
    height: 48px;
    color: #fff;
    background: var(--deep);
    border-radius: 50%;
    mask-image: none;
    -webkit-mask-image: none;
  }

  .create-button::before {
    content: "";
    width: 24px;
    height: 24px;
    background: currentColor;
    mask-image: var(--icon-plus);
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: 24px;
    -webkit-mask-image: var(--icon-plus);
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: 24px;
  }
}

@media (max-width: 560px) {
  .stories {
    grid-auto-columns: 78px;
  }

  .story-ring {
    width: 66px;
    height: 66px;
  }

  .story img {
    width: 58px;
    height: 58px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .spot-card,
  .badge-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .spot-card img,
  .badge-art {
    width: 82px;
    height: 82px;
  }

  .profile-cover {
    height: 160px;
  }

  .profile-info {
    align-items: start;
    flex-wrap: wrap;
  }

  .profile-info .secondary-button {
    width: 100%;
  }
}
