:root {
  color-scheme: light;
  --ink: #14201d;
  --muted: #65726f;
  --line: #d8e0dc;
  --panel: #ffffff;
  --bg: #eef4f1;
  --green: #1f8a70;
  --green-dark: #146452;
  --amber: #f3b23c;
  --red: #d94f45;
  --blue: #3478f6;
  --shadow: 0 18px 50px rgba(20, 32, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(160deg, rgba(31, 138, 112, 0.16), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: #f9fbfa;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 22px;
}

.screen.active {
  display: block;
}

.auth-screen {
  background:
    linear-gradient(rgba(10, 28, 23, 0.1), rgba(10, 28, 23, 0.7)),
    url("https://images.unsplash.com/photo-1611967164521-abae8fba4668?auto=format&fit=crop&w=900&q=80") center/cover;
  color: white;
}

.brand-block {
  min-height: 43vh;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding-bottom: 18px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  font-weight: 900;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: currentColor;
  opacity: 0.72;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 3.15rem;
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.3rem;
  letter-spacing: 0;
}

.lead {
  max-width: 320px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.45;
}

.auth-panel,
.verify-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  min-height: 44px;
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 138, 112, 0.14);
}

.primary-btn,
.secondary-btn,
.icon-btn,
.avatar-btn {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font-weight: 850;
}

.primary-btn {
  color: white;
  background: var(--green);
}

.primary-btn:active {
  background: var(--green-dark);
}

.secondary-btn {
  color: var(--ink);
  background: #edf3f0;
  border: 1px solid var(--line);
}

.secondary-btn.danger {
  color: var(--red);
  background: #fff1f1;
  border-color: rgba(228, 68, 68, 0.28);
}

.secondary-btn.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.83rem;
}

.text-btn {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.google-dot {
  width: 14px;
  height: 14px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 50%;
  background: conic-gradient(#4285f4 0 25%, #34a853 0 50%, #fbbc05 0 75%, #ea4335 0);
  vertical-align: -2px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.verify-screen {
  background: #f8fbfa;
}

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

.topbar.compact {
  justify-content: start;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.topbar select {
  min-width: 138px;
  max-width: 160px;
  border: 0;
  padding: 0;
  min-height: auto;
  background: transparent;
  font-weight: 900;
  font-size: 1rem;
}

.icon-btn,
.avatar-btn {
  width: 44px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  font-size: 1.5rem;
}

.icon-btn.mini {
  position: relative;
  width: 36px;
  min-height: 36px;
  font-size: 0.92rem;
  font-weight: 950;
}

.icon-btn.mini.active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
  font-size: 0.78rem;
}

.icon-btn.mini.has-alert {
  border-color: var(--red);
}

.notify-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  color: white;
  background: var(--red);
  border: 2px solid white;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(228, 68, 68, 0.24);
}

.avatar-btn {
  background: var(--ink);
  color: white;
  font-size: 0.95rem;
}

.app-screen {
  padding-bottom: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 10px;
}

.stats-grid article {
  min-height: 76px;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats-grid span {
  font-size: 1.5rem;
  font-weight: 950;
}

.stats-grid small {
  color: var(--muted);
  font-weight: 750;
}

.album-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

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

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  background: transparent;
}

.segmented button {
  border: 0;
  background: transparent;
  min-height: 44px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 850;
}

.segmented button.active {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 -4px 0 var(--blue);
}

.search-sort-row {
  display: grid;
  grid-template-columns: 1fr 48px 48px;
  gap: 12px;
  align-items: center;
}

.search-box {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  min-height: 52px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f3f6f8;
  color: var(--muted);
}

.search-box span {
  font-size: 1.45rem;
  line-height: 1;
}

.search-box input {
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 1rem;
}

.search-box input:focus {
  box-shadow: none;
}

.sort-btn {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 950;
}

.share-btn {
  color: var(--blue);
}

.tab-view {
  display: none;
}

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

.sticker-grid {
  display: grid;
  gap: 28px;
}

.sticker-section {
  display: grid;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.sticker-section h3 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.sticker-section h3 span {
  margin-left: 6px;
  font-size: 1.05rem;
}

.sticker-grid-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px 12px;
}

.sticker {
  min-height: 58px;
  display: grid;
  place-items: center;
  position: relative;
  border: 0;
  background: transparent;
}

.sticker.missing {
  color: #7c8582;
}

.sticker.owned .sticker-disc {
  background: #6b7788;
  color: white;
}

.sticker.dupe {
  color: white;
}

.sticker.favorite {
  color: var(--blue);
}

.sticker-disc {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  position: relative;
  border: 0;
  border-radius: 50%;
  background: #eef2f6;
  color: #65717e;
  font-weight: 950;
  font-size: 1.1rem;
}

.sticker.dupe .sticker-disc {
  background: #6b7788;
  color: white;
}

.sticker.favorite .sticker-disc {
  background: #fff3d8;
  color: #a07100;
}

.sticker-num {
  line-height: 1;
}

.fav-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  position: absolute;
  right: -4px;
  top: -6px;
  z-index: 2;
  border: 0;
  border-radius: 50%;
  background: white;
  color: var(--muted);
  font-weight: 900;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(20, 32, 29, 0.14);
}

.fav-btn.active {
  color: #d19a00;
  background: white;
}

.qty-badge {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  position: absolute;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  color: white;
  background: var(--blue);
  border: 2px solid white;
  font-size: 0.78rem;
  font-weight: 950;
}

.map {
  height: 320px;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #dfe8e3;
}

.user-map-label {
  background: transparent;
  border: 0;
}

.user-map-label button,
.self-map-label button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(20, 32, 29, 0.22);
  font-size: 0.8rem;
  font-weight: 900;
}

.self-map-label {
  background: transparent;
  border: 0;
}

.self-map-label button {
  background: var(--green);
}

.popup-action {
  margin-top: 8px;
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
}

.nearby-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.nearby-card,
.match-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.nearby-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.nearby-card.blocked {
  opacity: 0.58;
}

.person-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  font-weight: 950;
}

.person-mark.large {
  width: 58px;
  height: 58px;
  font-size: 1.35rem;
}

.person-title {
  font-weight: 900;
}

.person-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.trade-pill,
.trade-detail {
  grid-column: 1 / -1;
}

.trade-pill,
.trade-detail summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 850;
}

.trade-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  overflow: hidden;
}

.trade-detail summary {
  min-height: 40px;
  align-items: center;
  padding: 0 10px;
  cursor: pointer;
  list-style: none;
}

.trade-detail summary::-webkit-details-marker,
.options-menu summary::-webkit-details-marker {
  display: none;
}

.trade-pill b:first-child,
.trade-detail b:first-child {
  color: var(--green);
}

.trade-pill b:last-child,
.trade-detail b:last-child {
  color: var(--amber);
}

.trade-numbers {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.trade-numbers strong {
  font-size: 0.76rem;
}

.trade-numbers p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.mini-sticker {
  min-width: 42px;
  padding: 5px 7px;
  border-radius: 7px;
  background: #e9f6f2;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.person-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.person-actions button,
.subtle-action {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf9;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
}

.person-actions .danger {
  color: var(--red);
  background: #fff5f4;
  border-color: rgba(217, 79, 69, 0.35);
}

.options-menu {
  position: relative;
}

.options-menu summary {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf9;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

.options-menu[open] {
  z-index: 5;
}

.options-menu[open]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
}

.options-menu button {
  width: 100%;
  margin-top: 6px;
}

.match-deck {
  min-height: 300px;
  display: grid;
  align-items: start;
}

.match-card {
  display: grid;
  gap: 12px;
  min-height: 0;
  box-shadow: var(--shadow);
}

.match-profile {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.trade-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.trade-summary div {
  min-height: 76px;
  padding: 10px;
  background: #f3f7f5;
  border-radius: 8px;
}

.trade-summary strong {
  display: block;
  margin-bottom: 4px;
}

.sticker-line {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.match-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.match-options {
  grid-column: 1 / -1;
}

.accepted-trades {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.accepted-trades strong {
  font-size: 0.84rem;
}

.accepted-trade-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px;
  border-radius: 8px;
  background: #f3f7f5;
  color: var(--muted);
  font-size: 0.8rem;
}

.accepted-trade-row button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
}

.trade-detail-card {
  border: 1px solid rgba(31, 138, 112, 0.24);
  border-radius: 8px;
  background: #eef8f3;
  box-shadow: 0 6px 16px rgba(31, 138, 112, 0.08);
  overflow: hidden;
}

.trade-detail-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.trade-detail-summary::-webkit-details-marker {
  display: none;
}

.trade-detail-summary strong {
  display: block;
  color: var(--ink);
  font-size: 0.88rem;
}

.trade-detail-summary small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.expand-arrow {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--green-dark);
  background: white;
  font-size: 1rem;
  font-weight: 950;
  transition: transform 0.16s ease;
}

.trade-detail-card[open] .expand-arrow {
  transform: rotate(180deg);
}

.trade-detail-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.trade-detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.trade-place,
.trade-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.trade-detail-actions button,
.chat-compose button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
}

.trade-detail-actions button.danger {
  color: var(--red);
  background: #fff1f1;
  border: 1px solid rgba(228, 68, 68, 0.28);
}

.chat-modal-card {
  max-height: min(620px, calc(100vh - 32px));
}

.chat-log {
  display: grid;
  gap: 6px;
  min-height: 220px;
  max-height: 340px;
  overflow: auto;
  padding: 8px;
  border-radius: 8px;
  background: #f7faf9;
}

.chat-log p {
  margin: 0;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.35;
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-compose input {
  min-height: 36px;
}

.reject-btn {
  min-height: 44px;
  border: 1px solid rgba(217, 79, 69, 0.4);
  border-radius: 8px;
  color: var(--red);
  background: #fff5f4;
  font-weight: 900;
}

.accept-btn {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-weight: 900;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bottom-nav button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.bottom-nav button.active {
  color: white;
  background: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  width: min(340px, calc(100% - 34px));
  transform: translateX(-50%);
  padding: 12px 14px;
  color: white;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  z-index: 10;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(20, 32, 29, 0.48);
  z-index: 5000;
}

body:has(.modal-backdrop:not([hidden])) .leaflet-container,
body:has(.modal-backdrop:not([hidden])) .leaflet-pane,
body:has(.modal-backdrop:not([hidden])) .leaflet-control-container {
  z-index: 0;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(430px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.check-row {
  grid-template-columns: 22px 1fr;
  align-items: start;
  color: var(--ink);
  font-weight: 750;
  line-height: 1.35;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.share-options {
  display: grid;
  gap: 8px;
}

.share-options button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  color: var(--ink);
  font-weight: 850;
}

.share-options button.active {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

#sharePreview {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  color: var(--ink);
  background: #f7faf9;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
}

#importText {
  width: 100%;
  min-height: 260px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  color: var(--ink);
  background: #f7faf9;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
}

.privacy-strip {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f7f5;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

@media (max-width: 370px) {
  .screen {
    padding: 16px;
  }

  h1 {
    font-size: 2.7rem;
  }

  .sticker-grid-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .segmented {
    width: 100%;
  }

  .bottom-nav button {
    font-size: 0.78rem;
  }

  .person-actions,
  .match-actions {
    grid-template-columns: 1fr;
  }
}
