:root {
  --accent: #2a0018;
  --text: #151115;
  --muted: #8e898d;
  --bg: #f6f6f7;
  --panel: #ffffff;
  --line: #ece9eb;
  --chip: #f0dce0;
  --danger: #b65754;
  --found: #5d9055;
  --shadow: 0 8px 22px rgba(23, 15, 20, .07);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
.app-shell { width: min(100%, 430px); min-height: 100vh; margin: 0 auto; background: var(--bg); position: relative; overflow: hidden; }
.view { display: none; min-height: 100vh; padding: clamp(28px, 6vh, 58px) 16px 34px; }
#boardView { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
#boardView { padding-top: 10px; }
.view.is-active { display: block; }
.topbar { display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: start; gap: 12px; min-height: 40px; margin-bottom: 12px; }
.city-button { min-width: 0; padding: 0; background: transparent; color: var(--muted); text-align: left; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city-button b { color: var(--text); }
.icon-button, .back-button, .ghost-button { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); color: var(--text); box-shadow: var(--shadow); font-size: 24px; }
.ghost-button { background: transparent; box-shadow: none; color: #d7d4d6; }
.back-button { font-size: 28px; }
.active-filters { min-width: 0; min-height: 40px; max-height: 64px; display: flex; flex-wrap: wrap; align-items: center; align-content: center; gap: 6px 8px; overflow: hidden; scrollbar-width: none; }
.active-filters:empty { min-height: 40px; }
.filter-pill { height: 28px; padding: 0 12px; border-radius: 15px; background: var(--chip); color: var(--text); display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; flex: 0 0 auto; }
.filter-pill span { font-size: 17px; line-height: 1; }
.filter-pill-static { cursor: default; user-select: none; }
.filter-pill-static img { width: 16px; height: 16px; display: block; }
.board-panel { margin: 0 -16px; padding: 16px 16px 24px; border-radius: 22px; background: var(--panel); box-shadow: 0 1px 0 var(--line); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 24px; background: #f0eeee; margin-bottom: 24px; }
.segmented button { min-height: 40px; border-radius: 22px; background: transparent; color: #aaa5a9; }
.segmented button.is-selected { color: #fff; background: var(--accent); }
.board-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 24px; min-width: 0; }
.pet-card { min-width: 0; max-width: 100%; background: transparent; text-align: left; padding: 0; color: var(--text); overflow: hidden; }
.pet-card img { width: 100%; aspect-ratio: .88 / 1; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 8px; }
.pet-card h3 { margin: 0 0 3px; min-height: 34px; color: var(--text); font-size: 15px; line-height: 1.12; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.pet-card p { margin: 0 0 7px; min-height: 26px; color: #777176; font-size: 11px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pet-card small { color: #8b858a; font-size: 10px; line-height: 1.2; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.screen-header { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; margin-bottom: 18px; }
.screen-header.simple { margin-bottom: 8px; }
.screen-header h1 { margin: 0; text-align: center; font-size: 17px; }
.ad-form, .filters-form { display: grid; gap: 18px; }
.photo-picker { min-height: 188px; border-radius: 20px; background: #e3e3e4; color: #9b989b; display: grid; place-items: center; align-content: center; gap: 8px; overflow: hidden; }
.photo-picker input { display: none; }
.photo-placeholder { font-size: 34px; color: #aaa; }
.field-label, .range-card > span, .detail-sheet h2 { color: #898589; font-size: 11px; text-transform: uppercase; }
.choice-row, .chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice, .chip { min-height: 48px; padding: 0 16px; border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); color: var(--text); }
.chip { min-height: 32px; border-radius: 16px; padding: 0 13px; }
.choice.is-selected, .chip.is-selected { box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow); }
.textarea-wrap { display: grid; gap: 10px; }
.textarea-wrap span { font-size: 16px; font-weight: 650; }
.text-input-wrap { display: grid; gap: 8px; }
.text-input-wrap span { font-size: 16px; font-weight: 650; }
.text-input-wrap input { width: 100%; min-height: 54px; padding: 0 16px; border: 1px solid #eceaec; border-radius: 12px; background: var(--panel); color: var(--text); font-size: 16px; }
[hidden] { display: none !important; }
textarea { width: 100%; height: 122px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--panel); }
.map-block h2, .date-grid h2 { margin: 0 0 12px; font-size: 16px; }
.map-preview { width: 100%; aspect-ratio: 2 / 1; min-height: 168px; border-radius: 10px; overflow: hidden; background: #eef2f3; position: relative; display: block; }
.map-preview iframe { width: 100%; height: 100%; border: 0; display: block; }
.location-picker { touch-action: pan-x pan-y; }
.fallback-picker iframe { pointer-events: none; }
.fallback-map-marker { position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; border: 4px solid #fff; border-radius: 50% 50% 50% 0; background: var(--accent); transform: translate(-50%, -100%) rotate(-45deg); box-shadow: 0 3px 9px rgba(0,0,0,.25); z-index: 2; }
.location-update-button { width: 100%; height: 44px; margin-top: 10px; border-radius: 22px; background: var(--panel); color: var(--accent); box-shadow: var(--shadow); font-weight: 600; }
.address { margin: 0; font-size: 16px; }
.map-address { margin-top: 12px; color: var(--muted); line-height: 1.3; }
.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.date-grid h2 { grid-column: 1 / -1; }
.date-grid input, .select-field { width: 100%; height: 58px; border: 0; border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); padding: 0 16px; }
.date-grid input {
  min-width: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: light;
}
.date-grid input::-webkit-date-and-time-value {
  min-height: 58px;
  margin: 0;
  text-align: left;
  display: flex;
  align-items: center;
}
.date-grid input::-webkit-calendar-picker-indicator {
  opacity: .55;
  padding: 10px 0 10px 10px;
}
.primary-button, .secondary-button, .danger-button { width: 100%; height: 48px; border-radius: 26px; font-weight: 650; }
.primary-button { background: var(--accent); color: #fff; }
.secondary-button { background: #f8f0ea; color: var(--text); }
.danger-button { background: #efd4d7; color: #8a4647; }
.hero-card { height: 326px; margin: -58px -16px 0; padding: 52px 16px 18px; background: center / cover no-repeat var(--hero, #e7e7e8); position: relative; display: flex; align-items: end; }
.back-on-photo { position: absolute; top: 52px; left: 16px; background: rgba(255,255,255,.45); color: #fff; }
.hero-badges { display: flex; gap: 8px; align-items: center; position: relative; z-index: 2; }
.preview-carousel { position: absolute; inset: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.preview-carousel::-webkit-scrollbar { display: none; }
.preview-carousel img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; scroll-snap-stop: always; }
.hero-card .back-on-photo { z-index: 3; }
.preview-counter { position: absolute; right: 16px; bottom: 18px; z-index: 2; min-width: 44px; padding: 5px 9px; border-radius: 14px; background: rgba(25,20,23,.58); color: #fff; text-align: center; font-size: 12px; }
.badge { padding: 7px 12px; border-radius: 18px; color: #fff; font-size: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); background: var(--danger); }
.badge.found { background: var(--found); }
.badge.neutral { background: rgba(43, 37, 40, .62); }
.detail-sheet { margin: 0 -16px; padding: 22px 16px 106px; border-radius: 22px 22px 0 0; background: var(--bg); display: grid; gap: 18px; }
.detail-sheet h2 { margin: 0 0 8px; }
.info-card, .contact-card, .owner-card { background: var(--panel); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.info-card small { color: #9d999d; }
.info-card p { margin: 4px 0 0; line-height: 1.2; }
.attributes { display: grid; gap: 8px; color: #8f8b8e; }
.attributes b { color: var(--text); font-weight: 500; }
.contact-card { min-height: 46px; display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.contact-card p { margin: 0; }
.tg { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; }
.tg { background: #111; border-radius: 50%; }
.owner-card { min-height: 58px; display: flex; align-items: center; gap: 12px; }
.owner-card p { margin: 0; flex: 1; }
.avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: #dedcdf center / cover no-repeat; }
.sticky-actions { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(430px, 100%); padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 18px rgba(28,17,24,.08); }
.two-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.range-card { display: grid; gap: 12px; padding: 18px 16px 14px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); }
.range-card b { text-align: center; font-weight: 500; }
.range-card small { display: flex; justify-content: space-between; color: #555; font-size: 14px; }
input[type="range"] { accent-color: #eccbd0; }
.bottom-space { margin-top: 6px; }
#filtersView .filters-form { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
#filtersView .bottom-space {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(358px, calc(100% - 32px));
  margin: 0;
  z-index: 12;
  box-shadow: 0 10px 26px rgba(42, 0, 24, .18);
}
.verify-screen, .close-screen { display: grid; gap: 20px; }
.verify-screen h1, .close-screen h1 { margin: 6px 24px 0; text-align: center; font-size: 26px; line-height: 1.05; font-family: Impact, "Arial Narrow", sans-serif; font-weight: 400; }
.verify-screen > p { margin: -10px 0 6px; text-align: center; color: #696468; line-height: 1.15; }
.photo-strip { margin: 0 -16px; padding-left: 16px; display: grid; grid-auto-flow: column; grid-auto-columns: 100px 230px 230px; gap: 8px; overflow-x: auto; }
.photo-strip:not(.has-photos) { width: 100%; margin: 0; padding: 0; grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); overflow: visible; }
.photo-strip:not(.has-photos) .upload-tile { width: 100%; }
.photo-strip img, .upload-tile { height: 372px; border-radius: 22px; object-fit: cover; }
.verify-photo-item { width: 220px; height: 372px; position: relative; scroll-snap-align: start; }
.verify-photo-item img { width: 100%; height: 100%; display: block; }
.verify-photo-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  min-height: 32px;
  max-height: 32px;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(25,20,23,.72);
  color: #fff;
  font-size: 0;
  line-height: 0;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0,0,0,.2);
  -webkit-appearance: none;
  appearance: none;
}
.verify-photo-remove::before,
.verify-photo-remove::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transform-origin: center;
}
.verify-photo-remove::before { transform: translate(-50%, -50%) rotate(45deg); }
.verify-photo-remove::after { transform: translate(-50%, -50%) rotate(-45deg); }
.upload-tile { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); font-size: 32px; }
.verify-screen small { color: #898589; text-transform: uppercase; font-size: 11px; }
.reason-list { display: grid; gap: 9px; }
.reason { min-height: 46px; border-radius: 10px; background: var(--panel); padding: 0 12px; display: flex; align-items: center; justify-content: space-between; text-align: left; }
.reason span { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); display: grid; place-items: center; color: #fff; }
.reason.is-selected { background: #e8e7e7; }
.reason.is-selected span { background: var(--accent); border-color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: min(360px, calc(100% - 32px)); padding: 12px 16px; border-radius: 18px; background: var(--accent); color: #fff; box-shadow: var(--shadow); z-index: 20; }
@media (max-width: 360px) { .board-grid { gap: 24px 14px; } .choice { padding: 0 13px; } }

.board-cta {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(358px, calc(100% - 32px));
  height: 52px;
  border-radius: 28px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 10px 26px rgba(42, 0, 24, .18);
  z-index: 12;
}
@media (max-width: 390px) {
  .view { padding-left: 14px; padding-right: 14px; }
  .board-panel { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  .board-grid { gap: 26px 18px; }
  .pet-card h3 { font-size: 14px; }
  .pet-card p { font-size: 10.5px; }
  .photo-strip { grid-auto-columns: 98px 220px 220px; }
}
@media (max-width: 340px) {
  .board-grid { gap: 22px 12px; }
  .segmented button { min-height: 38px; }
  .choice, .chip { padding-left: 12px; padding-right: 12px; }
  .board-cta { width: calc(100% - 24px); }
}

.empty-state {
  margin: 28px 10px 8px;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
}
.map-open-link {
  position: absolute;
  right: 10px;
  bottom: 10px;
  height: 32px;
  padding: 0 12px;
  border-radius: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(42, 0, 24, .9);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  z-index: 2;
}
.photo-preview-strip {
  width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(146px, 72%);
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
}
.photo-preview-item {
  position: relative;
  min-width: 0;
  scroll-snap-align: start;
}
.photo-preview-strip img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 18px;
}
.photo-preview-item .verify-photo-remove { top: 8px; right: 8px; }
@media (max-width: 390px) {
  .view { padding-top: clamp(22px, 5vh, 42px); padding-left: 14px; padding-right: 14px; }
  .board-panel { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  .board-grid { gap: 26px 18px; }
  .pet-card h3 { font-size: 14px; min-height: 32px; }
  .pet-card p { font-size: 10.5px; min-height: 25px; }
  .segmented { margin-bottom: 18px; }
}
@media (max-width: 340px) {
  .board-grid { gap: 22px 12px; }
  .pet-card img { border-radius: 7px; }
  .choice, .chip { padding-left: 12px; padding-right: 12px; }
}

/* Mobile WebView hardening */
.icon-button,
.back-button,
.ghost-button {
  inline-size: 38px;
  block-size: 38px;
  min-inline-size: 38px;
  max-inline-size: 38px;
  min-block-size: 38px;
  max-block-size: 38px;
  aspect-ratio: 1 / 1;
  padding: 0;
  flex: 0 0 38px;
  line-height: 1;
  border-radius: 999px;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.screen-header { grid-template-columns: 38px minmax(0, 1fr) 38px; }
.screen-header h1 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar { grid-template-columns: minmax(0, 1fr) 38px; }
.city-button { min-width: 0; display: flex; align-items: center; overflow: hidden; white-space: nowrap; }
.city-button b { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 650; color: var(--text); }
.filter-button { background: transparent; box-shadow: none; }
.filter-button img { width: 40px; height: 40px; display: block; }
.board-panel, .detail-sheet, .ad-form, .filters-form { min-width: 0; }
.board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pet-card, .pet-card * { min-width: 0; }
.primary-button, .secondary-button, .danger-button, .board-cta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 390px) {
  .app-shell { max-width: 100%; }
  .view { padding-top: 22px; }
  .hero-card { margin-top: -22px; }
  .back-on-photo { top: 24px; }
  .board-grid { gap: 24px 16px; }
  .pet-card img { aspect-ratio: .94 / 1; }
}
@media (max-width: 340px) {
  .board-grid { gap: 20px 10px; }
  .pet-card h3 { font-size: 13px; }
  .pet-card p { font-size: 10px; }
}

/* Telegram leaves its own header above the Mini App. Keep app screens aligned. */
.view { padding-top: 0; }
@media (max-width: 390px) { .view { padding-top: 0; } }
.hero-card { margin-top: 0; }
.back-on-photo { top: 16px; }
.map-block.compact .map-preview { margin-top: 14px; }

.auth-view { padding-left: 16px; padding-right: 16px; }
.auth-back { min-height: 52px; display: flex; align-items: center; }
.auth-screen { min-height: calc(100vh - 52px); padding: 64px 14px 34px; display: grid; align-content: start; gap: 28px; }
.auth-login-screen { padding-top: 80px; }
.auth-heading { text-align: center; }
.auth-heading h1 { margin: 0; font-family: Impact, "Arial Narrow", sans-serif; font-size: 34px; line-height: 1.05; font-weight: 400; letter-spacing: 0; }
.auth-heading p, .auth-subheading p { margin: 10px 0 0; color: #aaa6a9; font-size: 16px; }
.auth-form { display: grid; gap: 16px; }
.auth-field { min-height: 82px; padding: 14px 18px 10px; border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); display: grid; align-content: center; position: relative; }
.auth-field > span { color: #999599; font-size: 13px; }
.auth-field input { min-width: 0; width: 100%; height: 34px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); caret-color: var(--accent); cursor: text; user-select: text; -webkit-user-select: text; font-size: 18px; }
.auth-field:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow); }
.password-field { padding-right: 52px; }
.password-field button { position: absolute; right: 16px; top: 50%; width: 34px; height: 34px; transform: translateY(-50%); border-radius: 50%; background: transparent; color: #aaa6a9; font-size: 20px; }
.auth-subheading { margin: 12px 0 0; }
.auth-subheading h2 { margin: 0; font-size: 18px; }
.auth-subheading p { margin-top: 3px; }
.auth-contact { min-height: 88px; grid-template-columns: 34px 1fr; padding-left: 58px; }
.auth-contact b { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: #999599; }
.auth-contact span { grid-column: 1 / -1; }
.auth-contact input { grid-column: 1 / -1; }
.auth-submit { margin-top: 12px; height: 58px; }
.primary-button:disabled { opacity: .65; cursor: wait; pointer-events: none; }
.auth-switch { justify-self: center; padding: 4px 0; background: transparent; color: #aaa6a9; font-size: 16px; }
.auth-switch b { color: var(--text); }
.auth-error { margin: 0; padding: 0 4px; color: #a44141; font-size: 13px; line-height: 1.35; }
.auth-confirmation { padding-top: 100px; }
.spam-warning { margin: 0; padding: 16px; border: 2px solid #a44141; border-radius: 8px; color: #8d3030; background: #fff1f1; text-align: center; font-size: 20px; line-height: 1.3; font-weight: 800; }
@media (max-width: 390px) {
  .auth-screen { padding-top: 48px; }
  .auth-login-screen { padding-top: 68px; }
  .auth-heading h1 { font-size: 31px; }
  .auth-field { min-height: 76px; border-radius: 18px; }
}
