:root {
  color-scheme: light;
  --viewport-top-gap: 6px;
  --viewport-bottom-gap: 0px;
  --system-bottom-gap: max(16px, env(safe-area-inset-bottom, 0px), var(--viewport-bottom-gap));
  --system-top-gap: max(6px, env(safe-area-inset-top, 0px), var(--viewport-top-gap));
  --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);
  --login-bg:
    radial-gradient(circle at 16% 18%, rgba(255,255,255,0.18) 0 9%, transparent 10%),
    linear-gradient(144deg, rgba(9, 36, 88, 0.96), rgba(20, 95, 176, 0.9) 40%, rgba(222, 49, 45, 0.82) 74%, rgba(25, 126, 79, 0.82)),
    #092458;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

[hidden] {
  display: none !important;
}

input,
textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

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: calc(22px + var(--system-top-gap)) 22px calc(22px + var(--system-bottom-gap));
}

.screen.active {
  display: block;
}

.auth-screen {
  position: relative;
  overflow: hidden;
  background: var(--login-bg);
  color: white;
}

.boot-screen {
  display: none;
  place-items: center;
  background: var(--login-bg);
  color: white;
}

.boot-screen.active {
  display: grid;
}

.boot-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.boot-card h1 {
  margin: 0;
  font-size: 2.4rem;
}

.boot-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 800;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,0.34);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-screen > * {
  position: relative;
  z-index: 1;
}

.brand-block {
  min-height: 43vh;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding-bottom: 18px;
}

.login-icon {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(6, 32, 28, 0.28);
  margin-bottom: 14px;
}

.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;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
}

.remember-row input {
  width: 17px;
  height: 17px;
  min-height: auto;
  accent-color: #de312d;
}

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);
}

.auth-panel #googleBtn {
  color: #fff;
  background: #de312d;
  border-color: #b82424;
  box-shadow: 0 10px 24px rgba(222, 49, 45, 0.28);
}

.auth-panel #googleBtn .google-dot {
  background: conic-gradient(#4285f4 0 25%, #34a853 0 50%, #fbbc05 0 75%, #ea4335 0);
}

.auth-panel .email-login-btn {
  color: var(--ink);
  background: #edf3f0;
  border: 1px solid var(--line);
  box-shadow: none;
}

.auth-panel .primary-btn:active {
  background: #dfe8e3;
}

.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.full-width {
  width: 100%;
}

.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;
}

.diagnostic-note {
  display: inline-flex;
  margin: 3px 0 0;
  padding: 3px 7px;
  border-radius: 999px;
  color: #8a5a00;
  background: #fff3d8;
  font-size: 0.72rem;
  font-weight: 850;
}

.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;
}

.stats-bars {
  width: 17px;
  height: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  align-items: end;
}

.stats-bars i {
  display: block;
  border-radius: 999px 999px 2px 2px;
  background: currentColor;
}

.stats-bars i:nth-child(1) {
  height: 8px;
}

.stats-bars i:nth-child(2) {
  height: 15px;
}

.stats-bars i:nth-child(3) {
  height: 11px;
}

.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: calc(132px + var(--system-bottom-gap));
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 7px;
}

.stats-grid article {
  min-height: 50px;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 4px;
}

.stats-grid span {
  font-size: 1.12rem;
  font-weight: 950;
  line-height: 1;
}

.stats-grid small {
  color: var(--muted);
  font-size: 0.68rem;
  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;
}

.album-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(58vw, 280px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 950;
  text-align: left;
}

.album-picker-btn span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-picker-modal {
  max-height: min(680px, calc(100vh - 64px - env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap)));
}

.album-picker-list {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px;
}

.album-picker-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.album-picker-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
  list-style: none;
}

.album-picker-group summary::-webkit-details-marker {
  display: none;
}

.album-picker-group summary::after {
  content: "⌄";
  color: var(--muted);
  font-weight: 900;
}

.album-picker-group[open] summary::after {
  content: "⌃";
}

.album-picker-options {
  display: grid;
  gap: 4px;
  padding: 0 8px 8px;
}

.album-picker-option {
  min-height: 42px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: #f7faf8;
  color: var(--ink);
  text-align: left;
  font-weight: 850;
}

.album-picker-option.active {
  color: white;
  background: var(--green);
}

.album-picker-option small {
  color: inherit;
  opacity: 0.78;
  font-size: 0.72rem;
  font-weight: 800;
}

.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: 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,
.tool-icon-btn {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 950;
}

.tool-icon-btn {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tool-icon-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.share-tool-btn {
  color: var(--green);
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.sticker-grid {
  display: grid;
  gap: 28px;
}

.app-version-footer {
  margin: 28px 0 4px;
  color: rgba(101, 114, 111, 0.62);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.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;
  gap: 5px;
  place-items: center;
  position: relative;
  border: 0;
  background: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.sticker.missing {
  color: #7c8582;
}

.sticker.owned .sticker-disc {
  background: #647083;
  color: white;
}

.sticker.shiny .sticker-disc {
  color: #7b5300;
  background:
    radial-gradient(circle at 28% 20%, rgba(255,255,255,.72) 0 12%, transparent 13%),
    linear-gradient(145deg, #fff7d7 0%, #f4c64a 48%, #d99a14 100%);
  border: 1px solid rgba(148, 96, 0, .2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 8px 18px rgba(158, 111, 20, .18);
}

.sticker.dupe {
  color: white;
}

.sticker.favorite {
  color: var(--blue);
}

.sticker-disc {
  width: 56px;
  height: 64px;
  display: grid;
  place-items: center;
  position: relative;
  border: 0;
  border-radius: 14px;
  background: #eef2f6;
  color: #65717e;
  font-weight: 950;
  font-size: 1.1rem;
  box-shadow: inset 0 0 0 1px rgba(20, 32, 29, 0.04);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.sticker.dupe .sticker-disc {
  background: #6b7788;
  color: white;
}

.sticker.shiny.owned .sticker-disc,
.sticker.shiny.dupe .sticker-disc {
  color: #ffffff;
  background:
    radial-gradient(circle at 28% 20%, rgba(255,255,255,.35) 0 12%, transparent 13%),
    linear-gradient(145deg, #9a6a08 0%, #6d4d08 48%, #3e3320 100%);
  border: 1px solid rgba(62, 51, 32, 0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 8px 18px rgba(78, 54, 6, .24);
}

.sticker.favorite .sticker-disc {
  background: #fff3d8;
  color: #a07100;
}

.sticker.shiny.favorite .sticker-disc {
  color: #7b5300;
  background:
    radial-gradient(circle at 28% 20%, rgba(255,255,255,.72) 0 12%, transparent 13%),
    linear-gradient(145deg, #fff7d7 0%, #f4c64a 48%, #d99a14 100%);
}

.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;
}

.sticker-stepper {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sticker-stepper button {
  width: 25px;
  height: 25px;
  min-height: 25px;
  position: absolute;
  pointer-events: auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #f2f6f4;
  font-size: 0.95rem;
  font-weight: 950;
  line-height: 1;
}

.sticker-stepper button[data-delta="1"] {
  left: 2px;
  top: -7px;
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.sticker-stepper button[data-delta="-1"] {
  left: 2px;
  bottom: -8px;
}

.map {
  display: grid;
  place-items: stretch;
  height: 320px;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #dfe8e3;
}

.map-empty {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
  padding: 18px;
  text-align: center;
}

.visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.visibility-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.map-locate-btn {
  margin-bottom: 10px;
}

.match-distance {
  display: grid;
  gap: 4px;
  min-width: 112px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.match-distance select {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: white;
  font-size: 0.82rem;
  font-weight: 900;
}

.user-map-label {
  background: transparent;
  border: 0;
}

.user-map-label button,
.self-map-label button {
  min-height: 30px;
  max-width: 112px;
  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;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.self-map-label {
  background: transparent;
  border: 0;
  z-index: 10000 !important;
}

.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;
}

.popup-status {
  display: inline-flex;
  margin-top: 8px;
  min-height: 30px;
  align-items: center;
  padding: 0 9px;
  border-radius: 7px;
  color: #8a5a00;
  background: #fff3d8;
  font-size: 0.76rem;
  font-weight: 900;
}

.map-popup-options {
  margin-top: 7px;
}

.map-popup-options summary {
  min-height: 28px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

.nearby-list {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.nearby-card,
.match-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.nearby-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: center;
  padding: 9px;
}

.nearby-card.blocked {
  opacity: 0.58;
}

.person-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  font-weight: 950;
  font-size: 0.86rem;
}

.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: 6px;
}

.person-actions button,
.subtle-action {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf9;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
}

.nearby-card .trade-detail summary {
  min-height: 34px;
  padding: 6px 8px;
}

.nearby-card .trade-numbers {
  padding: 8px;
}

.match-distance-highlight {
  color: var(--ink);
  font-weight: 950;
}

.person-actions .danger {
  color: var(--red);
  background: #fff5f4;
  border-color: rgba(217, 79, 69, 0.35);
}

.person-actions .status-btn {
  color: #8a5a00;
  background: #fff3d8;
  border-color: rgba(243, 178, 60, 0.34);
  cursor: default;
}

.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: min(520px, calc(100svh - 330px - env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap)));
  display: grid;
  align-items: start;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px) + var(--viewport-bottom-gap));
}

.match-card {
  display: grid;
  gap: 7px;
  height: clamp(360px, calc(100svh - 354px - env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap)), 540px);
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.match-reason {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.18;
}

.match-reason strong {
  font-weight: 950;
}

.match-profile {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.trade-summary {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.trade-summary div {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 8px;
  background: #f3f7f5;
  border-radius: 8px;
  overflow: hidden;
}

.trade-summary strong {
  display: block;
  margin-bottom: 4px;
}

.sticker-line {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.28;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sticker-code {
  font-weight: 750;
}

.sticker-code.shiny-code {
  color: #a66f00;
  font-weight: 950;
}

.match-actions {
  align-self: end;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding-bottom: 1px;
}

.chat-options {
  min-width: 102px;
}

.match-options {
  grid-column: 1 / -1;
}

.match-options summary {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.78rem;
  background: #f8fbfa;
}

.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 auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.summary-chat-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
}

.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 - env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap)));
}

.chat-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.chat-modal-actions .close-chat-action {
  grid-column: 2;
  min-height: 44px;
}

.chat-modal-actions .chat-options,
.chat-modal-actions #chatRateBtn {
  min-height: 38px;
}

.rating-stars {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.rating-stars button {
  min-height: 48px;
  border: 1px solid rgba(217, 154, 20, 0.28);
  border-radius: 8px;
  color: #b77a00;
  background: #fff7df;
  font-size: 1.85rem;
  font-weight: 950;
  line-height: 1;
}

.rating-stars button.active {
  color: #7b5300;
  background: linear-gradient(145deg, #fff3be, #f3b23c);
  border-color: rgba(148, 96, 0, 0.35);
}

.notifications-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.notification-item.unread {
  border-color: rgba(31, 138, 112, 0.36);
  background: #eef8f3;
}

.notification-item strong {
  font-size: 0.88rem;
}

.notification-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.notification-item button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--green);
  font-size: 0.76rem;
  font-weight: 850;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  max-height: 340px;
  overflow: auto;
  padding: 10px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 0 0, rgba(240, 164, 40, 0.08), transparent 28%),
    #eef7f2;
}

.chat-bubble {
  width: fit-content;
  max-width: 82%;
  display: grid;
  gap: 2px;
  padding: 8px 10px 6px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(16, 35, 29, 0.08);
}

.chat-bubble.theirs {
  align-self: flex-start;
  border-bottom-left-radius: 3px;
  background: #fff;
}

.chat-bubble.mine {
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  background: #dff4ec;
}

.chat-bubble-name {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 950;
}

.chat-bubble p {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.chat-bubble time {
  justify-self: end;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.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;
}

.album-stats-content {
  display: grid;
  gap: 16px;
}

.album-stats-cover {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  align-items: center;
  padding-bottom: 4px;
}

.album-stats-cover img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(18, 32, 28, .16);
}

.album-stats-meta {
  display: grid;
  gap: 9px;
}

.album-stats-meta p {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
}

.stats-mini-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd7d2;
  border-radius: 8px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 950;
}

.album-stats-summary {
  display: grid;
  gap: 12px;
  padding: 14px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.album-stats-summary h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.15rem;
}

.album-stats-feature {
  display: grid;
  grid-template-columns: 74px 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.album-ring {
  --percent: 0;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, white 57%, transparent 58%),
    conic-gradient(var(--green) calc(var(--percent) * 1%), #d9ece6 0);
}

.album-ring span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  font-size: .78rem;
  font-weight: 950;
}

.album-stats-feature small,
.album-stats-list small {
  display: block;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}

.album-stats-feature strong,
.album-stats-list strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
}

.album-stats-total {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.album-stats-total > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: white;
  font-weight: 950;
}

.album-progress {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #d9ece6;
}

.album-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.album-stats-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.album-stats-list article {
  min-height: 86px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
}

.album-stats-list article > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-weight: 950;
}

.album-stats-list article:nth-child(2n) > span {
  background: var(--amber);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(4px + var(--system-bottom-gap));
  z-index: 2500;
  width: min(408px, calc(100% - 18px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr 58px 1fr 1fr;
  gap: 5px;
  padding: 6px;
  margin-bottom: 0;
  background: rgba(246, 250, 248, 0.96);
  border: 1px solid rgba(216, 224, 220, 0.95);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(20, 32, 29, 0.16);
  backdrop-filter: blur(8px);
}

.bottom-nav button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.bottom-nav button.active {
  color: white;
  background: var(--ink);
}

.bottom-nav .bottom-qr-btn {
  min-height: 56px;
  display: grid;
  place-items: center;
  gap: 0;
  align-self: center;
  color: white;
  background: #f08a24;
  border: 3px solid #fff;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(217, 117, 22, 0.26);
}

.bottom-nav .bottom-qr-btn span {
  font-size: 1rem;
  line-height: 0.9;
}

.bottom-nav .bottom-qr-btn b {
  font-size: 0.74rem;
  line-height: 0.9;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom, 0px) + var(--viewport-bottom-gap));
  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: 6000;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: end center;
  top: var(--visual-top, 0px);
  bottom: auto;
  height: var(--visual-height, 100dvh);
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  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);
  max-height: calc(100vh - 48px - env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap));
  overflow: auto;
  overscroll-behavior: contain;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.share-card,
.qr-card,
.profile-card {
  gap: 8px;
  padding: 12px;
}

.compact-modal-copy {
  font-size: 0.88rem;
}

.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;
}

.modal-actions.extra-actions {
  grid-template-columns: 1fr 1fr 1fr;
}

.share-modal-actions #closeShareBtn {
  grid-column: 2;
}

.share-card .modal-actions,
.qr-card .modal-actions {
  gap: 6px;
}

.share-card .primary-btn,
.share-card .secondary-btn,
.qr-card .primary-btn,
.qr-card .secondary-btn {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.84rem;
}

#confirmActionModal {
  z-index: 7200;
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.password-field input {
  min-width: 0;
}

.password-field button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.alias-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: end;
}

.alias-row span {
  padding-bottom: 10px;
}

.compact-alias-btn {
  min-height: 38px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.profile-actions-menu {
  display: block;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.profile-actions-menu[open] {
  display: grid;
  gap: 5px;
  grid-template-columns: 1fr;
}

.profile-actions-menu:not([open]) > :not(summary) {
  display: none;
}

.blocked-users-list {
  display: grid;
  gap: 8px;
}

.blocked-user-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.blocked-user-row strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.blocked-user-row small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.blocked-user-row button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.profile-actions-menu summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--ink);
  padding: 2px 0 4px;
}

.profile-actions-menu .compact-check {
  min-height: 28px;
  padding: 3px 2px;
  gap: 6px;
  font-size: 0.84rem;
}

.menu-action,
.profile-link {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.86rem;
  text-align: left;
  text-decoration: none;
}

.danger-text {
  color: var(--red);
}

.compact-check {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 4px;
  font-weight: 800;
  font-size: 0.86rem;
}

.album-picker-group summary::after {
  content: "v";
}

.album-picker-group[open] summary::after {
  content: "^";
}

@media (max-height: 720px) {
  .match-card {
    height: clamp(340px, calc(100svh - 344px - env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap)), 520px);
  }

  .match-profile {
    padding-bottom: 7px;
  }

  .match-reason {
    font-size: 0.92rem;
  }
}

.share-options {
  display: grid;
  gap: 6px;
}

.share-options button {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  color: var(--ink);
  font-weight: 850;
  font-size: 0.84rem;
}

.share-options button.active {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

#sharePreview {
  width: 100%;
  min-height: 330px;
  max-height: 58vh;
  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;
}

.secondary-btn.qr-action-btn {
  background: #f08a24;
  border-color: #d97516;
  color: #fff;
  font-weight: 950;
}

.compare-match-btn {
  background: #1f8f73 !important;
  border-color: #15735d !important;
  color: #fff !important;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(31, 143, 115, 0.18);
}

.compare-match-menu-action {
  background: #e9f7f2;
  border-color: #9ad9c8;
  color: #11624f;
  font-weight: 950;
}

.qr-card {
  width: min(430px, 100%);
  max-height: calc(100vh - 20px);
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
  text-align: center;
}

.qr-image {
  width: min(330px, 76vw);
  height: min(330px, 76vw);
  margin: 6px auto;
  border: 8px solid #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.qr-kind-options {
  grid-template-columns: 1fr;
}

.qr-scanner-video {
  width: 100%;
  max-height: 42vh;
  border-radius: 8px;
  background: #0f1f1b;
  object-fit: cover;
}

#listCompareText {
  width: 100%;
  min-height: 180px;
  max-height: 40vh;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  font: inherit;
  font-size: 0.9rem;
}

.qr-compare-result {
  text-align: left;
}

.qr-compare-result h3 {
  margin: 6px 0;
}

.qr-match-grid {
  display: grid;
  gap: 8px;
}

.qr-match-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f7faf9;
}

.qr-match-grid p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.compare-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.execute-change-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px;
  max-height: 168px;
  overflow: auto;
  padding: 8px 2px 0;
}

.execute-change-list label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 6px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(15, 36, 31, 0.08);
  font-weight: 800;
  font-size: 0.84rem;
}

.execute-change-list input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.exchange-toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.exchange-toggle-row button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f2;
  color: var(--ink);
  padding: 7px 6px;
  font-weight: 900;
  font-size: 0.76rem;
}

.public-share-screen {
  min-height: 100vh;
  padding: 18px;
  background: #eef7f2;
  color: var(--ink);
}

.public-share-shell {
  width: min(680px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.public-share-head {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.public-share-head img {
  width: 82px;
  height: 82px;
  border-radius: 8px;
  object-fit: cover;
}

.public-share-head h1 {
  margin: 2px 0;
  font-size: 1.35rem;
}

.public-share-content {
  display: grid;
  gap: 14px;
}

.public-share-list {
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.public-share-list h2 {
  margin-bottom: 12px;
}

.public-share-list article {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.public-share-list article:last-child {
  border-bottom: 0;
}

.public-share-list span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 750;
}

.public-download-link {
  text-align: center;
  text-decoration: none;
}

#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;
}

#cameraImportList,
#voiceImportText,
#voiceImportList,
#extraStickersText,
#chatFigusList {
  width: 100%;
  min-height: 140px;
  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;
}

.chat-trade-hints {
  display: grid;
  gap: 8px;
}

.chat-figus-button {
  min-height: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid rgba(31, 138, 112, .24);
  border-radius: 8px;
  color: var(--ink);
  background: #edf8f4;
  text-align: left;
  font-weight: 850;
}

.chat-figus-button strong {
  min-width: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--green);
}

.voice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.camera-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f7;
}

.profile-menu-spacer {
  height: 18px;
}

#profileModal .full-width {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.88rem;
}

.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;
  }

  .match-deck {
    min-height: min(560px, calc(100svh - 286px - env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap)));
  }

  .match-card {
    min-height: 0;
  }

  .person-actions {
    grid-template-columns: 1fr;
  }
}

.collection-sync-notice{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:10px 16px;background:#fff3cf;color:#352908;font-size:14px;flex-wrap:wrap}.collection-sync-notice[hidden]{display:none}.collection-sync-notice button{min-height:40px;padding:6px 12px}.collection-conflict-dialog{width:min(520px,calc(100% - 32px));max-height:85vh;overflow:auto;border:0;border-radius:16px;padding:22px;color:#193b32;background:white}.collection-conflict-dialog::backdrop{background:#0008}.collection-conflict-dialog ul{max-height:40vh;overflow:auto;padding-left:22px}.collection-conflict-dialog button{display:block;min-height:44px;width:100%;margin-top:12px}

.push-controls{padding:16px;margin:12px 0 20px;border:1px solid #cfdfd6;border-radius:12px;background:#f4f8f5}.push-controls h3{margin:0 0 8px}.push-controls label{display:flex;align-items:center;gap:10px;min-height:44px}.push-controls input[type=checkbox]{width:20px;height:20px;flex:0 0 auto}.push-controls .modal-actions{flex-wrap:wrap}.push-controls .modal-actions button{min-height:44px}.push-controls p{overflow-wrap:anywhere}


/* Dialogs follow the visible viewport. Only the album list scrolls inside its sheet. */
body.modal-open { overflow: hidden; }
.modal-backdrop > .modal-card { max-height: 100%; grid-auto-rows: max-content; min-height: 0; }
.modal-backdrop > .album-picker-modal { display: flex; flex-direction: column; max-height: min(720px, 100%); overflow: hidden; gap: 12px; }
.album-picker-header, .album-picker-modal > input, .album-picker-modal > .modal-actions { flex: 0 0 auto; }
.album-picker-header h2 { margin: 0 0 4px; }
.album-picker-modal > .modal-actions { grid-template-columns: 1fr; }
.album-picker-group { margin-bottom: 8px; }
.album-picker-group:last-child { margin-bottom: 0; }
.album-picker-group summary { min-height: 48px; gap: 8px; }
.album-picker-group summary > span:first-child { flex: 1; }
.album-group-count { color: var(--muted); font-size: .8rem; font-weight: 650; }
.album-picker-group summary::after { content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); margin: -4px 3px 0; flex-shrink: 0; }
.album-picker-group[open] summary::after { content: ""; transform: rotate(225deg); margin-top: 4px; }
.album-picker-option { min-height: 48px; grid-template-columns: minmax(0, 1fr) auto; }
.album-picker-option > span { overflow-wrap: anywhere; }
.album-current-label { display: block; margin-top: 2px; font-size: .75rem; font-weight: 500; }
.album-search-results { display: grid; gap: 6px; }
.album-empty { padding: 16px 4px; }
#albumPickerSearch { min-width: 0; min-height: 46px; width: 100%; font-size: 1rem; }
:is(button, summary, input, textarea, select, a):focus-visible { outline: 3px solid #b57400; outline-offset: 2px; }
.topbar > div:first-child { min-width: 0; flex: 1; }
.topbar .icon-btn.mini { width: 44px; min-height: 44px; }
.album-picker-btn { max-width: 100%; min-height: 44px; }
.album-picker-btn span:first-child { white-space: normal; overflow-wrap: anywhere; }
.album-picker-btn span:last-child { flex: 0 0 auto; }
.notification-item button, #profileModal .full-width, .chat-modal-actions .chat-options, .chat-modal-actions #chatRateBtn { min-height: 44px; }
.modal-card :is(input, textarea, select) { max-width: 100%; min-width: 0; }
.modal-card .chat-compose { position: sticky; bottom: 0; background: white; padding: 6px 0; }
.chat-compose input, .chat-compose button { min-height: 44px; }
.chat-log { min-height: min(220px, 28dvh); max-height: min(340px, 40dvh); flex-shrink: 0; }
.chat-bubble { flex-shrink: 0; }
.chat-trade-hints:empty, #chatSubtitle:empty { display: none; }
@media (max-width: 400px) {
  .app-screen > .topbar { flex-wrap: wrap; gap: 4px; }
  .app-screen > .topbar > div:first-child { flex-basis: 100%; }
  .top-actions { margin-left: auto; gap: 8px; }
}
@media (max-width: 370px) {
  .screen { padding-top: calc(16px + var(--system-top-gap)); padding-bottom: calc(22px + var(--system-bottom-gap)); }
  .app-screen { padding-bottom: calc(132px + var(--system-bottom-gap)); }
  .album-picker-modal { padding: 12px; }
}
@media (max-height: 480px) {
  .modal-backdrop { padding-top: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
  .modal-backdrop > .album-picker-modal { gap: 8px; padding: 12px; }
  .album-picker-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .album-picker-header h2 { margin: 0; font-size: 1.1rem; }
}

/* Keep album loading separate from silent collection synchronization. */
.album-loading { min-height: 48vh; padding: 44px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.album-loading strong { font-size: 1.25rem; }
.album-loading-name { max-width: 100%; overflow-wrap: anywhere; }
.album-tools[inert] { opacity: .55; }
.album-loading p { max-width: 28ch; margin: 0; color: var(--muted, #52625d); line-height: 1.5; }
.album-loading-spinner { width: 36px; height: 36px; border: 4px solid #d6e7df; border-top-color: #17694f; border-radius: 50%; animation: album-loading-spin 900ms linear infinite; }
@keyframes album-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .album-loading-spinner { animation: none; } }
