/* BayPick — neutral backgrounds with green brand accents. */
:root {
  --bg:          #FFFFFF;
  --surface:     #FFFFFF;
  --surface-alt: #F7F7F7;
  --primary:     #28513A;
  --primary-fill:#bbf59a;
  --primary-hover:#ADEB8F;
  --primary-05:  rgba(40, 81, 58, 0.04);
  --primary-10:  rgba(40, 81, 58, 0.10);
  --primary-soft:#EAF8E0;
  --accent:      #E2683D;
  --chip:        #EAF3E3;
  --ink:         #232323;
  --ink-60:      rgba(0, 0, 0, 0.55);
  --ink-50:      rgba(0, 0, 0, 0.5);
  --ink-45:      rgba(0, 0, 0, 0.45);
  --ink-40:      rgba(0, 0, 0, 0.4);
  --line:        #E5E5E5;
  --line-soft:   #EEEEEE;
  --line-field:  #DDDDDD;
  --topbar-h:    65px;

  --font-ui:    -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-brand: 'Space Grotesk', var(--font-ui);
  --font-read:  Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

[hidden] { display: none !important; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}

.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-tagline { margin: 0; font-family: 'DM Sans', var(--font-ui); font-size: 16px; line-height: 1.5; color: #536159; white-space: nowrap; font-weight: 500; letter-spacing: -.25px; }
.topbar-with-ad .brand { align-items: center; gap: 16px; }
.topbar-home { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; }
.topbar-home .brand { align-items: center; gap: 16px; min-width: 0; }
.topbar-home .account-btn { max-width: 190px; }
.topbar-home .account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.brand-mark {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 24px;
  color: var(--primary);
  letter-spacing: -0.5px;
  text-decoration: none;
}
.brand-mark:hover { color: var(--accent); text-decoration: none; }
.brand-mark:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 3px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.account-slot { position: relative; }

/* Reserved header ad layout (currently disabled). */
.baypick-page { --topbar-h: 65px; }
.topbar-with-ad {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 24px;
}
.topbar-with-ad .brand, .topbar-with-ad .topbar-actions { min-width: 0; }
.topbar-with-ad .account-btn { max-width: 190px; }
.topbar-with-ad .account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-ad { width: 468px; max-width: 100%; min-width: 0; justify-self: center; }
.header-ad-label { color: var(--ink-45); font-size: 10px; line-height: 12px; margin-bottom: 3px; text-align: center; }
.header-ad-slot { width: 100%; height: 60px; }
.header-ad-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: 1px dashed var(--line-field);
  border-radius: 6px;
  background: rgba(255, 255, 255, .6);
  color: var(--ink-45);
  font-size: 12px;
  letter-spacing: .3px;
}
.header-ad .adsbygoogle { display: inline-block; width: 100%; height: 100%; }

/* ---------- buttons ---------- */

.btn {
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  border: 1px solid transparent;
}

.btn-outline {
  padding: 8px 18px;
  border: 1.5px solid var(--primary);
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
}
.btn-outline:hover { background: var(--primary-soft); }

.btn-outline-sm {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1.5px solid var(--primary);
  background: var(--surface);
  color: var(--primary);
  font-size: 12.5px;
}
.btn-outline-sm:hover { background: var(--primary-soft); }

.btn-quiet {
  padding: 8px 16px;
  border: 1px solid var(--line-field);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
}
.btn-quiet:hover { background: var(--surface-alt); }

.btn-primary {
  border-radius: 8px;
  border: none;
  background: var(--primary-fill);
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:hover { background: var(--primary-hover); }

.link-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.icon-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}
.icon-close:hover { background: rgba(0, 0, 0, 0.1); }

/* ---------- account menu ---------- */

.avatar {
  border-radius: 50%;
  background: var(--primary-fill);
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; font-size: 12px; }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }

.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--surface);
  cursor: pointer;
}
.account-btn:hover { background: var(--surface-alt); }
.account-btn .account-name { font-size: 13px; font-weight: 600; color: var(--ink); }

.menu-scrim { position: fixed; inset: 0; z-index: 80; }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 81;
  min-width: 150px;
  overflow: hidden;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
}
.menu-item + .menu-item { border-top: 1px solid rgba(0, 0, 0, 0.06); }
.menu-item:hover { background: var(--primary-05); }

/* ---------- layout ---------- */

.main { height: calc(100vh - var(--topbar-h)); }

.view-home {
  display: flex;
  height: 100%;
  min-width: 1020px;
  overflow-x: auto;
}

.view-profile {
  height: 100%;
  overflow-y: auto;
  padding: 32px 40px;
}

/* ---------- region rail ---------- */

.region-nav {
  width: 200px;
  flex-shrink: 0;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid var(--line);
  background: var(--surface-alt);
  overflow-y: auto;
}

.region-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  background: transparent;
  color: var(--ink);
}
.region-btn:hover { background: var(--primary-10); }
.region-btn.is-active,
.region-btn.is-active:hover { background: var(--primary-fill); color: var(--primary); }

/* ---------- map ---------- */

.map-pane {
  flex: 1 1 38%;
  min-width: 0;
  border-right: 1px solid var(--line);
}
.map-pane iframe { width: 100%; height: 100%; border: none; display: block; }

/* ---------- place list ---------- */

.list-pane {
  flex: 1 1 420px;
  min-width: 420px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.list-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-45);
  flex-shrink: 0;
}

.list-scroll { flex: 1; overflow-y: auto; }
.shared-place-status { padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface-alt); color: var(--ink-50); font-size: 13px; line-height: 1.5; }

/* ---------- place card ---------- */

.card { border-bottom: 1px solid var(--line-soft); }

.card.is-open {
  background: var(--surface-alt);
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  margin: 10px 12px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.profile-body .card.is-open { margin: 10px 0; }
.profile-body .card-title { min-width: 0; overflow-wrap: anywhere; }
.card-submission-status { padding: 0 20px 12px; }
.place-submission-actions { padding: 0 20px 16px; }
.place-submission-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.place-submission-actions .btn-primary { padding: 9px 18px; }
.btn-delete-post { color: #a32b2b; border-color: #e6bcbc; cursor: pointer; }
.btn-delete-post:hover { background: #fff2f2; }
.place-submission-buttons button:disabled { opacity: 0.6; cursor: wait; }
.place-deletion-notice { padding: 12px 20px; font-size: 13px; color: var(--primary); }

.card-head { display: flex; align-items: center; }
.card-head:hover { background: var(--primary-05); }

.card-header {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 16px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}
.card.is-open .card-header { color: var(--primary); }

.card-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--surface-alt);
}

/* Image-led cards in the map's place feed. */
#place-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* Keep scrolling rows tall enough for the full image and caption. */
  grid-auto-rows: max-content;
  gap: 20px 16px;
  padding: 16px;
  align-content: start;
  align-items: start;
  background: var(--surface-alt);
}
.card-feed {
  min-width: 0;
  background: var(--surface);
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  box-shadow: 0 2px 8px #00000005;
  overflow: hidden;
}
#place-list .card-feed:hover {
  border-color: #c8c8c8;
  box-shadow: 0 4px 14px #0000000d;
}
.card-cover {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  cursor: pointer;
  background: #f0f0f0;
}
.card-cover:focus-visible { outline-offset: -4px; }
.card-feed .card-image,
.card-image-placeholder { aspect-ratio: 4 / 5; }
.card-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #8c8c8c;
  background: #f0f0f0;
}
.card-image-question {
  font-family: var(--font-brand);
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
}
.card-image-hint { font-size: 12px; }
.card-feed .card-head { align-items: flex-start; }
.card-feed .card-header {
  padding: 12px 12px 6px;
  gap: 6px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.card-feed .chevron { width: 11px; height: 11px; }
#place-list .card-head { display: block; }
#place-list .card-header {
  display: block;
  width: 100%;
  height: auto;
  white-space: normal;
}
#place-list .card-title {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
#place-list .chevron { display: none; }
.card-feed .fav-btn { margin: 8px 6px 0 0; width: 30px; height: 30px; }
.card-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 12px 12px;
  font-size: 11px;
  color: var(--ink-60);
}
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.card-caption .fav-btn { margin: 0; }
.card-caption { flex-wrap: wrap; gap: 4px 8px; }
.card-caption .card-meta { flex: 1 1 90px; }
.card-preview-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
.card-comment-count { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 32px; height: 30px; padding: 0 3px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-60); cursor: pointer; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-comment-count svg { display: block; width: 16px; height: 16px; flex-shrink: 0; }
.card-comment-count:hover { background: var(--primary-soft); color: var(--primary); }
.card-preview-actions .fav-btn { width: 30px; height: 30px; margin: 0; }
.card-preview-actions .fav-btn:not(.is-on) { color: var(--ink-60); }
.card-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 0 12px 10px;
  color: var(--ink-60);
  font-size: 12px;
  line-height: 1.5;
}
.card-category {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--primary);
  background: #f1f6ee;
  padding: 2px 6px;
  border-radius: 5px;
}

/* ---------- favourite ---------- */

.fav-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: 13px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.fav-btn:hover { background: rgba(226, 104, 61, 0.1); color: var(--accent); }
.fav-btn:active { transform: scale(0.88); }
.fav-btn.is-on { color: var(--accent); }
.fav-btn.is-on:hover { color: #C4522B; }
.fav-btn svg { display: block; }

.chevron {
  flex-shrink: 0;
  color: var(--ink-40);
  transition: transform 0.15s ease;
}
.card.is-open .chevron { transform: rotate(180deg); color: var(--primary); }

.card-body { padding: 0 20px 22px; }

.tag-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

.tag {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}
.tag-status { color: #2F6B3A; background: #E5F3E6; }

.card-rule { padding-top: 14px; border-top: 1px solid var(--line); }

.field { margin-bottom: 12px; }
.field-label { font-size: 11px; color: var(--ink-40); margin-bottom: 4px; }
.field-value { font-size: 13.5px; word-break: break-word; }
.field-value.is-empty { color: var(--ink-50); }
.field-last {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.card-body > .field-last:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

/* ---------- comments ---------- */

.comments-title {
  font-size: 13px;
  color: var(--ink);
  margin: 0 0 18px;
}

.comment {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.comment-author {
  font-family: var(--font-read);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 3px;
  color: #5A4F3D;
}
.comment-text {
  font-family: var(--font-read);
  font-size: 13.5px;
  color: #3A352B;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comments-empty { font-size: 13px; color: var(--ink-40); margin-bottom: 8px; }

.comment-gate {
  background: var(--surface-alt);
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-60);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.comment-form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.comment-form label { font-size: 12px; font-weight: 600; }
.comment-form .field-input { width: 100%; min-height: 84px; resize: vertical; line-height: 1.6; }
.comment-form button { padding: 9px 16px; font-size: 13.5px; flex-shrink: 0; }
.comment-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.comment-character-count { font-size: 11px; color: var(--ink-50); }
.comment-form button:disabled { opacity: .5; cursor: default; }

.comment-signin { margin-top: 10px; font-size: 13px; color: var(--ink-45); }
.comment-error { margin-top: 10px; font-size: 12.5px; color: #a13426; }
.comment-error, .comment-signin { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.comment-author { color: var(--primary); }
.comment-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.comment-header .comment-author { min-width: 0; overflow-wrap: anywhere; }
.comment-delete-button { flex-shrink: 0; padding: 2px 6px; margin-top: -2px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-50); font-size: 11px; cursor: pointer; }
.comment-delete-button:hover { background: #fbece9; color: #a13426; }
.comment-delete-button:disabled { opacity: .5; cursor: default; }
.comment-delete-preview { margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-alt); }
.comment-delete-preview strong { font-size: 12px; color: var(--primary); }
.comment-delete-preview p { margin: 6px 0 0; font-size: 13px; color: var(--ink-60); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- profile ---------- */

.view-profile > * { max-width: 640px; }
.view-profile > #back-home { margin-bottom: 24px; }

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.profile-id { display: flex; align-items: center; gap: 14px; }
.profile-name-row { display: flex; align-items: center; gap: 10px; min-height: 31px; }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-email { font-size: 12.5px; color: var(--ink-45); }
.nickname-edit-btn {
  padding: 3px 7px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
}
.nickname-edit-btn:hover { background: var(--primary-05); }
.nickname-form { display: flex; align-items: center; gap: 7px; }
.nickname-input { width: 190px; padding: 7px 9px; }
.nickname-form .btn-primary,
.nickname-form .btn { padding: 7px 11px; font-size: 12.5px; }
.nickname-error { margin-top: 5px; color: #a13426; font-size: 12px; }

.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  margin-bottom: 22px;
}

.tab {
  padding: 10px 4px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-50);
  cursor: pointer;
}
.tab:hover { color: var(--primary); }
.tab.is-active { border-bottom-color: var(--primary); color: var(--primary); }

.empty-state { padding: 40px 0; color: var(--ink-40); font-size: 14px; }

/* ---------- modals ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 70;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  z-index: 71;
}

.modal-publish {
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: 86vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
}

.modal-login {
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 32px 28px;
}

.modal-place {
  width: 640px;
  max-width: calc(100vw - 32px);
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 20px;
}
.place-detail-actions { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 0; background: var(--surface); }
.modal-place .icon-close { position: static; background: var(--primary-soft); color: var(--primary); width: 36px; height: 36px; flex-shrink: 0; }
.place-share-button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.place-share-button:hover, .place-share-button[aria-expanded="true"] { background: var(--surface-alt); }
.place-share-button span:first-child { display: flex; }
.share-floating-link { position: fixed; inset: auto; width: 360px; max-width: calc(100vw - 40px); margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: 0 12px 40px #00000026, 0 2px 8px #0000000d; overflow: visible; }
.share-floating-link::backdrop { background: transparent; }
.share-floating-link::before { content: ''; position: absolute; top: -6px; left: var(--share-arrow-left, 80%); width: 11px; height: 11px; background: var(--surface); border-top: 1px solid var(--line); border-left: 1px solid var(--line); transform: rotate(45deg); }
.share-floating-link[data-side="above"]::before { top: auto; bottom: -6px; transform: rotate(225deg); }
.share-floating-heading { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--ink); font-size: 14px; font-weight: 600; }
.share-floating-heading svg { color: var(--primary); flex-shrink: 0; }
.share-floating-row { display: flex; gap: 8px; }
.share-floating-row input { flex: 1; width: 0; min-width: 0; min-height: 42px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-alt); font: inherit; font-size: 12px; color: var(--ink-60); }
.share-floating-copy { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex-shrink: 0; min-height: 42px; padding: 10px 12px; font-size: 12px; }
.share-floating-copy:disabled { opacity: .7; cursor: default; }
.share-floating-status { min-height: 18px; margin: 10px 0 0; color: var(--ink-50); font-size: 12px; font-weight: 400; line-height: 1.5; }
.share-floating-status.is-copied { color: var(--primary); }
@media (max-width: 1020px) { .share-floating-link { padding: 16px; } }
.modal-place .card-feed.is-open { margin: 0; border: none; box-shadow: none; }
.modal-place .card-image,
.modal-place .card-image-placeholder { aspect-ratio: 16 / 9; }
.modal-place .card-cover { cursor: default; }
.modal-place .card-header { margin: 0; font-size: 20px; cursor: default; }
.modal-place .card-head:hover { background: transparent; }
.modal-place .card-body { padding: 8px 12px 12px; }
.modal-place .comment-form { flex-wrap: wrap; }
.modal-place .comment-form .field-input { min-width: 150px; }

body.has-modal { overflow: hidden; }
.scrim-comments { background: #12271a66; backdrop-filter: blur(3px); }
.modal-comments { width: 460px; max-width: calc(100vw - 24px); max-height: calc(100svh - 32px); border-radius: 18px; display: flex; flex-direction: column; }
.comments-modal-header { position: relative; flex-shrink: 0; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.comments-modal-header .icon-close { top: 12px; right: 12px; background: var(--primary-soft); color: var(--primary); }
.comments-modal-eyebrow { font-size: 11px; color: var(--ink-50); margin: 0 0 6px; }
.comments-modal-header h2 { margin: 0; padding-right: 22px; font-size: 19px; line-height: 1.4; overflow-wrap: anywhere; }
.comments-modal-body { overflow: auto; overscroll-behavior: contain; min-height: 0; padding: 22px 24px 24px; }
.modal-comments .comment { padding: 14px 0; margin: 0; }
.modal-comments .comment-author { font-family: inherit; margin-bottom: 6px; }
.modal-comments .comment-text { font-family: inherit; font-size: 13px; color: var(--ink-60); line-height: 1.7; }
.modal-comments .comments-empty:not([role]) { padding: 24px 12px; background: var(--surface-alt); border-radius: 10px; text-align: center; }
@media (max-width: 760px) {
  .comments-modal-header { padding: 18px 20px 14px; }
  .comments-modal-body { padding: 20px; }
}

.modal-confirm {
  width: 400px;
  max-width: calc(100vw - 32px);
  padding: 30px 28px 26px;
}
.modal-confirm .modal-sub { line-height: 1.7; margin: 10px 0 24px; }
.modal-actions { display: flex; justify-content: flex-end; }
.modal-actions .btn-primary { min-width: 84px; }

.scrim-delete { background: rgba(18, 39, 26, 0.38); backdrop-filter: blur(3px); }
.modal-delete {
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  padding: 32px 24px 24px;
  border: 1px solid var(--primary-10);
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(18, 39, 26, 0.24);
}
.delete-modal-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #fff0ed;
  color: #a32b2b;
}
.modal-delete .modal-title { padding: 0; margin: 0 0 12px; font-size: 22px; color: var(--primary); }
.delete-post-name {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.modal-delete .modal-sub { margin: 0 0 24px; line-height: 1.7; color: var(--ink-60); }
.modal-delete .form-error { margin: -10px 0 18px; }
.delete-modal-actions { gap: 12px; }
.delete-modal-actions .btn { flex: 1; min-width: 0; padding: 12px 8px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.delete-modal-actions .btn-quiet { background: var(--primary-soft); border-color: var(--primary-10); color: var(--primary); }
.delete-modal-actions .btn-quiet:hover { background: var(--primary-fill); }
.btn-delete-confirm { border: 1px solid #a32b2b; background: #a32b2b; color: #fff; cursor: pointer; }
.btn-delete-confirm:hover { border-color: #872222; background: #872222; }

.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; padding-right: 32px; }
.modal-sub { font-size: 13px; color: var(--ink-50); margin-bottom: 20px; }
.modal-login .modal-title { margin-bottom: 6px; }
.modal-login .modal-sub { margin-bottom: 24px; }

.auth-error {
  margin: -10px 0 14px;
  color: #a13426;
  font-size: 13px;
  line-height: 1.5;
}

.google-btn:disabled,
.btn:disabled {
  cursor: wait;
  opacity: .58;
}

.form-row { margin-bottom: 14px; }
.form-row-split { display: flex; gap: 12px; }
.form-row-split > .form-row { flex: 1; margin-bottom: 0; }
.form-row-last { margin-bottom: 22px; }

.field-label-form {
  display: block;
  font-size: 12px;
  color: var(--ink-50);
  margin-bottom: 5px;
}

.field-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-field);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}
.field-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-10); }
.field-input.is-invalid { border-color: var(--accent); }

.comment-form .field-input { font-size: 13.5px; }

.form-error { font-size: 12px; color: var(--accent); margin-top: 5px; }
.form-error-general { margin-bottom: 10px; }

.category-field {
  min-width: 0;
  margin-inline: 0;
  padding: 0;
  border: 0;
}
.category-field.is-invalid .category-options {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(226, 104, 61, 0.08);
}
.category-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-field);
  border-radius: 8px;
  background: var(--surface);
}
.category-option { position: relative; cursor: pointer; }
.category-option input { position: absolute; opacity: 0; pointer-events: none; }
.category-option span {
  display: block;
  padding: 6px 10px;
  border: 1px solid var(--line-field);
  border-radius: 999px;
  color: var(--ink-60);
  font-size: 12.5px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.category-option:hover span { border-color: var(--primary); color: var(--primary); }
.category-option input:checked + span {
  border-color: var(--primary);
  background: var(--primary-fill);
  color: var(--primary);
}
.category-option input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.category-option:has(input:disabled) { cursor: default; }
.category-option input:disabled + span {
  border-color: var(--line-field);
  color: var(--ink-60);
  opacity: 0.45;
}
.category-count { margin-top: 6px; font-size: 12px; color: var(--ink-60); }

.image-guidance {
  margin: -1px 0 8px;
  color: var(--ink-50);
  font-size: 12px;
  line-height: 1.5;
}
.image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.image-picker {
  position: relative;
  display: flex;
  min-height: 116px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
  border: 1px dashed var(--line-field);
  border-radius: 9px;
  background: var(--surface-alt);
  color: var(--ink-50);
  cursor: pointer;
}
.image-picker:hover { border-color: var(--primary); background: var(--primary-05); }
.image-input:focus-visible ~ .image-picker-action {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.image-field.is-invalid .image-picker { border-color: var(--accent); }
.image-picker-icon { color: var(--primary); font-size: 28px; line-height: 1; }
.image-picker-action { color: var(--primary); font-size: 13px; font-weight: 700; }
.image-picker-hint,
.image-file-name {
  max-width: calc(100% - 28px);
  overflow: hidden;
  color: var(--ink-45);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.image-preview + .image-picker-action { margin-top: 5px; }
.image-picker:has(.image-preview) { padding-bottom: 10px; }

.submit-btn { width: 100%; padding: 12px; font-size: 14px; }
.publish-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.publish-fields:disabled .submit-btn { opacity: 0.6; cursor: wait; }

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid var(--line-field);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.google-btn:hover { background: var(--surface-alt); }
.google-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #5A5344;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1020px) {
  :root { --topbar-h: 60px; }
  .baypick-page { --topbar-h: 72px; }
  .topbar.topbar-home { grid-template-rows: 36px 20px; column-gap: 16px; row-gap: 4px; padding: 6px 0; }
  .topbar-home .brand { display: contents; }
  .topbar-home .brand-mark { grid-column: 1; grid-row: 1; width: max-content; margin-left: 16px; }
  .topbar-home .brand-tagline { grid-column: 1 / -1; grid-row: 2; margin: 0 16px; font-size: 14px; line-height: 20px; }
  .topbar-home .topbar-actions { grid-column: 2; grid-row: 1; margin-right: 16px; }
  .topbar-home .account-btn { padding: 2px 10px 2px 4px; max-width: min(190px, calc(100vw - 156px)); }
  .topbar-with-ad {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 36px 20px 50px;
    column-gap: 16px;
    row-gap: 5px;
    padding: 4px 0;
  }
  .topbar-with-ad .brand { display: contents; }
  .topbar-with-ad .brand-mark { grid-column: 1; grid-row: 1; width: max-content; margin-left: 16px; }
  .topbar-with-ad .brand-tagline { grid-column: 1 / -1; grid-row: 2; margin: 0 16px; font-size: 14px; line-height: 20px; }
  .topbar-with-ad .topbar-actions { grid-column: 2; grid-row: 1; margin-right: 16px; }
  .topbar-with-ad .account-btn { padding: 2px 10px 2px 4px; max-width: min(190px, calc(100vw - 156px)); }
  .header-ad { grid-column: 1 / -1; grid-row: 3; width: 320px; }
  .header-ad-slot { height: 50px; }
  .header-ad-label { display: none; }

  body { overflow: auto; }
  body.has-modal { overflow: hidden; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 0 16px;
    background: var(--bg);
  }
  .topbar.topbar-with-ad { padding: 4px 0; }
  .account-btn { max-width: 190px; }
  .account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .main { height: auto; min-height: calc(100vh - var(--topbar-h)); }
  .view-home { flex-direction: column; min-width: 0; height: auto; overflow: visible; }
  .region-nav {
    position: sticky;
    top: var(--topbar-h);
    z-index: 20;
    width: 100%;
    flex-direction: row;
    padding: 10px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .region-btn { width: auto; flex-shrink: 0; padding: 10px 14px; white-space: nowrap; }

  .map-pane {
    flex: none;
    width: 100%;
    height: clamp(220px, 36vh, 340px);
    height: clamp(220px, 36svh, 340px);
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .list-pane { flex: none; width: 100%; min-width: 0; }
  .list-head { padding: 14px 16px; }
  .list-scroll { flex: none; overflow: visible; }
  #place-list { padding: 12px; gap: 16px 12px; }
  .card-feed .card-header { padding: 10px 10px 6px; }
  .card-caption { padding: 0 10px 10px; }

  .view-profile { height: auto; overflow: visible; padding: 24px 16px; }
  .profile-head { flex-wrap: wrap; }
  .profile-id { min-width: 0; max-width: 100%; }
  .profile-id > div:last-child { min-width: 0; }
  .profile-name-row, .nickname-form { flex-wrap: wrap; }
  .profile-name, .profile-email { overflow-wrap: anywhere; }
  .nickname-input { width: min(190px, 100%); }

  .modal-place { padding: 0 12px 12px; max-height: 88svh; }
  .modal-publish { padding: 28px 20px 20px; max-height: 88svh; }
  .modal-login { max-height: 88svh; overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

#place-list > .empty-state { grid-column: 1 / -1; }

.story-editor { margin-top: 22px; }
.story-editor .field-label-form span { font-weight: 400; }
.story-help { margin: 8px 0 12px; font-size: 12px; line-height: 1.6; color: var(--ink-60); }
.story-input { min-height: 210px; padding: 14px; resize: vertical; font-size: 13px; line-height: 1.8; border-color: #b6c9ac; background: #fcfefb; }
.story-footer { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-60); font-size: 10px; line-height: 1.5; margin-top: 8px; }
#pf-story-count { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.place-story { border-bottom: 1px solid var(--line); margin-bottom: 20px; padding-bottom: 20px; }
.place-story-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.85; }

.publish-location-section { padding: 14px; border: 1px solid var(--line-field); border-radius: 10px; background: var(--surface-alt); }
.location-help { margin: 8px 0 12px; font-size: 12px; line-height: 1.65; color: var(--ink-60); }
.location-picker-frame { display: block; width: 100%; height: 280px; border: 1px solid var(--line); border-radius: 8px; }
.location-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.location-actions button, .location-open { padding: 9px 12px; font-size: 12px; }
.location-actions button:disabled, .location-open:disabled { opacity: .55; cursor: default; }
@media (max-width: 420px) { .location-picker-frame { height: 240px; } }
