/* ============================================================
   거지맵 (Poor Map) Styles
   ============================================================ */

* { box-sizing: border-box; }

/* Screen-reader-only utility for SEO H1 and other accessibility text */
.poor-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #222;
  background: #f4f6f8;
  overflow: hidden;
}

/* ---------- Header ---------- */
.poor-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #e3e6ea;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.poor-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #222;
  font-weight: 700;
  font-size: 18px;
}

.poor-logo img { width: 28px; height: 28px; }

.poor-nav {
  display: flex;
  gap: 16px;
}

.poor-nav a {
  text-decoration: none;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.poor-nav a:hover { background: #eef0f3; color: #222; }

/* Header report button */
.poor-report-btn {
  padding: 8px 14px;
  font-size: 13px;
  margin-left: 4px;
}

/* Language picker */
.poor-lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: #f0f2f5 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23666' d='M0 0l5 6 5-6z'/></svg>") no-repeat right 8px center;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  padding: 6px 24px 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #444;
  cursor: pointer;
  margin-left: 4px;
}

.poor-lang-select:hover { background-color: #e3e6ea; }
.poor-lang-select:focus { outline: none; border-color: #667eea; }

@media (max-width: 768px) {
  .poor-nav a { padding: 6px 6px; font-size: 13px; }
  .poor-report-btn { padding: 7px 10px; font-size: 12px; }
  .poor-lang-select { padding: 5px 22px 5px 8px; font-size: 12px; }
}

/* ---------- Map ---------- */
#map {
  position: fixed;
  top: 56px;
  left: 300px;     /* leave room for sidebar on desktop */
  right: 0;
  bottom: 0;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- Sidebar ---------- */
.poor-sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 300px;
  background: #fff;
  border-right: 1px solid #e3e6ea;
  display: flex;
  flex-direction: column;
  z-index: 6;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

.poor-sidebar-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.poor-sidebar-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

.poor-sidebar-count {
  color: #888;
  font-weight: 500;
  font-size: 13px;
}

.poor-sidebar-close {
  display: none;
  background: #f4f6f8;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #888;
}

/* Intro card — visible at top of sidebar, dismissible. Doubles as SEO body content. */
.poor-intro {
  position: relative;
  margin: 12px 14px 6px;
  padding: 12px 14px 14px;
  background: linear-gradient(135deg, #fff8e1 0%, #ffe6d5 100%);
  border-radius: 10px;
  border: 1px solid #f5d7a8;
  flex-shrink: 0;
}

.poor-intro[hidden] { display: none; }

.poor-intro-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  color: #888;
  cursor: pointer;
}
.poor-intro-close:hover { background: rgba(0, 0, 0, 0.12); color: #444; }

.poor-intro-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: #c0392b;
  padding-right: 24px;
}

.poor-intro-body {
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.5;
  color: #5a3a1a;
}

.poor-intro-body strong { color: #2c1a00; }

.poor-intro-en {
  color: #7a5a3a;
  font-style: italic;
  margin-bottom: 0;
}

.poor-sidebar-search {
  padding: 10px 16px;
  flex-shrink: 0;
}

.poor-sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #f7f8fa;
}

.poor-sidebar-search input:focus {
  outline: none;
  border-color: #667eea;
  background: #fff;
}

.poor-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 16px;
}

.poor-sidebar-empty {
  font-size: 13px;
  color: #999;
  text-align: center;
  padding: 30px 16px;
  line-height: 1.6;
}

.poor-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-left: 3px solid transparent;
}

.poor-sidebar-item:hover {
  background: #f7f8fa;
  border-left-color: #667eea;
}

.poor-sidebar-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--marker-color, #34495e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.poor-sidebar-item-body {
  flex: 1;
  min-width: 0;
}

.poor-sidebar-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.poor-sidebar-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #222;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.poor-sidebar-item-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  background: #fff8e1;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #f39c12;
  line-height: 1.2;
}

.poor-sidebar-item-rating .poor-sb-star { font-size: 12px; }
.poor-sidebar-item-rating .poor-sb-avg { font-size: 11px; }
.poor-sidebar-item-rating .poor-sb-count {
  font-size: 10px;
  color: #b88a1d;
  font-weight: 500;
  margin-left: 1px;
}

.poor-sidebar-item-rating-empty {
  background: #f4f6f8;
  color: #bbb;
}
.poor-sidebar-item-rating-empty .poor-sb-count { color: #ccc; }

.poor-sidebar-item-meta {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar backdrop (mobile only) */
.poor-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.poor-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  color: #444;
}

/* ---------- Marker ---------- */
.poor-marker {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--marker-color, #34495e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.poor-marker:hover { transform: scale(1.1); }

/* Pill variant — shown when store has a price. Wider rounded rectangle that
   fits an emoji on the left and the price label on the right (Google Maps
   restaurant pill style). */
.poor-marker.poor-marker-pill {
  width: auto;
  min-width: 0;
  height: 32px;
  padding: 0 10px 0 8px;
  border-radius: 18px;
  gap: 5px;
  font-size: 13px;
  background: #fff;
  white-space: nowrap;
}

.poor-marker-pill .poor-marker-icon {
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
}

.poor-marker-pill .poor-marker-price {
  color: #222;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  pointer-events: none;
  letter-spacing: 0.2px;
}

@media (max-width: 768px) {
  .poor-marker.poor-marker-pill {
    height: 30px;
    padding: 0 9px 0 7px;
    border-radius: 16px;
  }
  .poor-marker-pill .poor-marker-icon { font-size: 14px; }
  .poor-marker-pill .poor-marker-price { font-size: 12px; }
}


/* ---------- Legend ---------- */
.poor-legend {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid #e3e6ea;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  max-width: 180px;
}

.poor-legend-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-bottom: 6px;
}

.poor-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.poor-legend-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: #444;
}

.poor-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--marker-color, #34495e);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  flex-shrink: 0;
}

/* ---------- Hint banner ---------- */
.poor-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(34, 34, 34, 0.92);
  color: #fff;
  padding: 10px 16px 10px 18px;
  border-radius: 24px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  max-width: calc(100% - 32px);
}

.poor-hint-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}

.poor-hint-close:hover { opacity: 1; }

/* ---------- Modal ---------- */
.poor-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: poorFadeIn 0.18s ease;
}

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

@keyframes poorFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.poor-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);   /* dvh handles iOS Safari address bar collapse */
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: poorSlideUp 0.22s ease;
}

@keyframes poorSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.poor-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f4f6f8;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #888;
}

.poor-modal-close:hover { background: #e3e6ea; color: #222; }

.poor-modal-title {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 700;
}

/* Mode visibility */
[data-mode-show] { display: none; }
.poor-modal-overlay[data-mode="add"]  [data-mode-show~="add"]  { display: block; }
.poor-modal-overlay[data-mode="view"] [data-mode-show~="view"] { display: block; }
.poor-modal-overlay[data-mode="edit"] [data-mode-show~="edit"] { display: block; }
/* form is shared between add+edit */
.poor-modal-overlay[data-mode="add"]  form[data-mode-show~="add"],
.poor-modal-overlay[data-mode="edit"] form[data-mode-show~="edit"] { display: flex; flex-direction: column; gap: 12px; }
/* inline elements within title */
.poor-modal-title span[data-mode-show] { display: none; }
.poor-modal-overlay[data-mode="add"]  .poor-modal-title span[data-mode-show="add"]  { display: inline; }
.poor-modal-overlay[data-mode="view"] .poor-modal-title span[data-mode-show="view"] { display: inline; }
.poor-modal-overlay[data-mode="edit"] .poor-modal-title span[data-mode-show="edit"] { display: inline; }

/* ---------- Form ---------- */
.poor-form { display: none; }

.poor-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.poor-field-row {
  display: flex;
  gap: 12px;
}

.poor-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.poor-label em {
  color: #e74c3c;
  font-style: normal;
}

.poor-label small {
  font-size: 10px;
  color: #999;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

.poor-field input,
.poor-field select,
.poor-field textarea {
  padding: 10px 12px;
  border: 1px solid #d4d8de;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #222;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.poor-field input:focus,
.poor-field select:focus,
.poor-field textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.poor-field textarea { resize: vertical; min-height: 56px; }

/* URL parse status under the Google Maps link input */
.poor-field-status {
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
  color: #888;
}
.poor-field-status-ok  { color: #27ae60; font-weight: 600; }
.poor-field-status-err { color: #e74c3c; font-weight: 600; }

/* ---------- View body ---------- */
.poor-view { display: none; }

.poor-view-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.poor-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #f0f2f5;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
}

.poor-chip-price {
  background: #e8f5e8;
  color: #27ae60;
}

.poor-chip-rating {
  background: #fff8e1;
  color: #f39c12;
  font-weight: 700;
}

.poor-view-name {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
}

.poor-view-meta {
  font-size: 12px;
  color: #888;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.poor-translate-btn {
  margin-left: auto;
  background: #f0f2f5;
  border: 1px solid #e3e6ea;
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #667eea;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.poor-translate-btn:hover:not(:disabled) {
  background: #667eea;
  color: #fff;
}

.poor-translate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.poor-translate-btn.is-on {
  background: #667eea;
  color: #fff;
}

.poor-view-fields {
  margin: 0 0 18px;
  padding: 0;
}

.poor-view-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid #f0f2f5;
}

.poor-view-row dt {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.poor-view-row dd {
  margin: 0;
  font-size: 14px;
  color: #333;
  word-break: break-word;
  white-space: pre-wrap;
}

.poor-view-row[hidden] { display: none; }

/* ---------- Buttons ---------- */
.poor-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.poor-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.poor-btn:active { transform: scale(0.97); }
.poor-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.poor-btn-primary {
  background: #667eea;
  color: #fff;
}

.poor-btn-primary:hover:not(:disabled) { background: #5568d3; }

.poor-btn-secondary {
  background: #f0f2f5;
  color: #444;
}

.poor-btn-secondary:hover:not(:disabled) { background: #e3e6ea; }

.poor-btn-danger {
  background: #fdecea;
  color: #e74c3c;
}

.poor-btn-danger:hover:not(:disabled) { background: #fbd5d2; }

/* ---------- Reviews ---------- */
.poor-reviews {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 2px solid #f0f2f5;
}

.poor-reviews-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #222;
}

.poor-reviews-count {
  color: #888;
  font-weight: 500;
  font-size: 13px;
}

.poor-reviews-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.poor-reviews-empty {
  font-size: 13px;
  color: #999;
  text-align: center;
  padding: 16px 8px;
  background: #fafbfc;
  border-radius: 8px;
}

.poor-reviews-error { color: #e74c3c; }

.poor-review-item {
  background: #fafbfc;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #f0f2f5;
}

.poor-review-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.poor-review-stars {
  color: #f39c12;
  font-size: 14px;
  letter-spacing: 1px;
}

.poor-review-meta {
  flex: 1;
  font-size: 12px;
  color: #666;
}

.poor-review-meta strong { color: #222; font-weight: 600; }

.poor-review-del {
  background: none;
  border: none;
  color: #ccc;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}

.poor-review-del:hover { color: #e74c3c; background: #fdecea; }

.poor-review-text {
  margin-top: 6px;
  font-size: 13px;
  color: #333;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Review write form */
.poor-review-form {
  background: #f7f8fa;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.poor-review-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Star input */
.poor-stars-input {
  display: flex;
  gap: 2px;
}

.poor-star-btn {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #d4d8de;
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.1s, transform 0.1s;
}

.poor-star-btn:hover { transform: scale(1.1); }
.poor-star-btn.is-on { color: #f39c12; }

/* ---------- Guestbook (shared with main map) ---------- */
#poor-chat-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  z-index: 8;
  overflow: hidden;
  transition: max-height 0.25s ease;
  max-height: 44px; /* collapsed state — header only */
  display: flex;
  flex-direction: column;
  border: 1px solid #e3e6ea;
}

#poor-chat-container.poor-chat-open {
  max-height: 420px;
}

#poor-chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  user-select: none;
}

#poor-chat-status {
  font-size: 11px;
  opacity: 0.85;
}

#poor-chat-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#poor-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  background: #fafbfc;
  min-height: 0;
}

.poor-chat-empty {
  color: #999;
  font-size: 12px;
  text-align: center;
  padding: 20px 8px;
}

.poor-chat-msg {
  background: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 6px;
  border: 1px solid #f0f2f5;
}

.poor-chat-msg-head {
  font-size: 11px;
  color: #888;
}

.poor-chat-msg-head strong {
  color: #444;
  font-weight: 600;
}

.poor-chat-msg-time {
  color: #aaa;
}

.poor-chat-msg-body {
  margin-top: 3px;
  font-size: 13px;
  color: #222;
  word-break: break-word;
  white-space: pre-wrap;
}

#poor-chat-input-container {
  padding: 8px;
  border-top: 1px solid #f0f2f5;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

#poor-chat-name,
#poor-chat-input {
  padding: 7px 10px;
  border: 1px solid #e3e6ea;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
}

#poor-chat-name:focus,
#poor-chat-input:focus {
  outline: none;
  border-color: #667eea;
}

#poor-chat-send {
  padding: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

#poor-chat-send:hover { filter: brightness(1.08); }
#poor-chat-send:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 768px) {
  #poor-chat-container {
    right: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
    max-width: 320px;
  }
  #poor-chat-container.poor-chat-open {
    max-height: 60vh;
  }
}

/* ---------- Toast ---------- */
.poor-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  background: #222;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  max-width: calc(100% - 32px);
}

.poor-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.poor-toast-error { background: #e74c3c; }
.poor-toast-success { background: #27ae60; }

/* ---------- Password prompt ---------- */
.poor-pw-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.18s;
}

.poor-pw-overlay.show { opacity: 1; }

.poor-pw-modal {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.poor-pw-modal h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.poor-pw-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d4d8de;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
  font-family: inherit;
}

.poor-pw-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.poor-pw-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Floating Action Button (mobile only) ---------- */
.poor-fab {
  display: none;                     /* hidden on desktop, shown via mobile media query */
  position: fixed;
  right: 18px;
  bottom: 22px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f39c12 0%, #e74c3c 100%);
  color: #fff;
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  z-index: 9;
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4), 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  padding: 0;
  align-items: center;
  justify-content: center;
}
.poor-fab:active {
  transform: scale(0.92);
  box-shadow: 0 3px 12px rgba(231, 76, 60, 0.4);
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .poor-header { padding: 0 12px; height: 52px; }

  /* Sidebar becomes a slide-in drawer */
  .poor-sidebar-toggle {
    display: inline-block;
    min-width: 44px;
    min-height: 44px;
    font-size: 24px;
  }
  .poor-sidebar-close { display: inline-flex; align-items: center; justify-content: center; }

  .poor-sidebar {
    top: 52px;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 50;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
  }

  body.poor-sidebar-open .poor-sidebar { transform: translateX(0); }
  body.poor-sidebar-open .poor-sidebar-backdrop { display: block; z-index: 49; }

  /* Map is full-width on mobile (sidebar overlays) */
  #map { top: 52px; left: 0; }

  /* Header tightening: hide the redundant Add Store button — FAB takes over */
  .poor-report-btn { display: none; }

  /* Show the FAB on mobile */
  .poor-fab { display: flex; align-items: center; justify-content: center; }

  /* Mapbox controls clearance — push them above the FAB so they don't overlap */
  .mapboxgl-ctrl-bottom-right { bottom: 90px !important; }
  .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl { margin-right: 12px !important; }

  /* Guestbook moves to bottom-LEFT on mobile to free the right side for FAB + Mapbox controls.
     Both collapsed and open widths are capped to clear the FAB column. */
  #poor-chat-container {
    right: auto;
    left: 12px;
    bottom: 12px;
    width: calc(100% - 100px);   /* leave ~88px clearance for FAB on the right */
    max-width: 260px;
  }
  #poor-chat-container.poor-chat-open {
    width: calc(100% - 100px);
    max-width: 320px;
    max-height: 60dvh;
  }

  /* Hide hint banner on mobile — FAB is self-evident */
  .poor-hint { display: none; }

  .poor-legend { top: 60px; right: 10px; padding: 8px 10px; }
  .poor-legend-list li { font-size: 12px; }

  /* ---------- Bottom-sheet modal on mobile ---------- */
  .poor-modal-overlay {
    align-items: flex-end;          /* stick to bottom */
    padding: 0;
  }

  .poor-modal {
    border-radius: 18px 18px 0 0;   /* rounded top only */
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    padding: 22px 20px 28px;
    animation: poorSheetUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    /* Drag handle visual hint at the top */
    padding-top: 28px;
  }

  .poor-modal::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 2px;
    background: #d4d8de;
    transform: translateX(-50%);
  }

  @keyframes poorSheetUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .poor-field-row { flex-direction: column; gap: 12px; }
  .poor-view-name { font-size: 20px; }
  .poor-view-row { grid-template-columns: 80px 1fr; }

  /* iOS Safari auto-zoom prevention: input font-size must be ≥ 16px */
  .poor-field input,
  .poor-field select,
  .poor-field textarea,
  #poor-chat-name,
  #poor-chat-input,
  .poor-pw-input {
    font-size: 16px;
  }

  /* Bigger touch targets on form action buttons */
  .poor-btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 15px;
  }

  /* Sidebar items: thicker for thumb taps */
  .poor-sidebar-item {
    padding: 14px 16px;
    min-height: 56px;
  }
  .poor-sidebar-item-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .poor-sidebar-item-name { font-size: 14px; }
  .poor-sidebar-item-meta { font-size: 12px; }

  /* Translate button: bigger pill */
  .poor-translate-btn {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }

  /* Modal close button: thumb-friendly */
  .poor-modal-close {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  /* Sidebar search input also needs 16px to dodge iOS zoom */
  .poor-sidebar-search input { font-size: 16px; }

  /* Star input — bigger taps on mobile */
  .poor-star-btn {
    font-size: 34px;
    padding: 6px 8px;
  }

  /* Review delete × bigger */
  .poor-review-del {
    width: 32px;
    height: 32px;
    font-size: 22px;
  }
}

/* ---------- Very small screens (≤ 380px) ---------- */
@media (max-width: 380px) {
  .poor-header { padding: 0 8px; }
  .poor-logo span { font-size: 16px; }
  .poor-nav { gap: 4px; }
  .poor-nav a { padding: 6px 4px; font-size: 12px; }
  .poor-lang-select { padding: 5px 20px 5px 6px; font-size: 11px; }

  .poor-fab { width: 56px; height: 56px; font-size: 32px; right: 14px; bottom: 18px; }
  .mapboxgl-ctrl-bottom-right { bottom: 84px !important; }
}
