/* ============================================================
   OneMillionSouls — Global Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:        #C9A84C;
  --gold-light:  #E8CC7A;
  --gold-dark:   #9A7B2F;
  --dark-bg:     #141414;
  --dark-card:   #1E1E1E;
  --dark-border: #2E2E2E;
  --text-light:  #F5F2EA;
  --text-muted:  #9A9080;
  --off-white:   #F8F5F0;
  --radius:      8px;
  --shadow:      0 8px 32px rgba(0,0,0,0.22);
  --transition:  0.18s ease;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  color: #1a1a1a;
  background: var(--dark-bg);
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────── */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--dark-bg);
  border-bottom: 1px solid var(--dark-border);
  height: 80px;
}

/* 3-column grid: brand | counter | right */
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  gap: 12px;
}

/* Left: brand */
.header-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.site-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
  line-height: 1.15;
  white-space: nowrap;
}

.site-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Center: counter */
.header-counter {
  text-align: center;
  flex-shrink: 0;
}

.counter-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
}

.counter-number {
  font-family: 'Cormorant Garamond', serif;
  font-size: 46px;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1;
  letter-spacing: -0.01em;
  min-width: 2ch;
  text-align: right;
}

.counter-sep {
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  color: var(--text-muted);
  line-height: 1;
}

.counter-total {
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  color: var(--text-muted);
  line-height: 1;
}

.counter-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 3px;
}

/* Right: search + auth */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

#header-search-wrap {
  position: relative;
  width: 220px;
}

#search-input {
  width: 100%;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--dark-border);
  background: var(--dark-card);
  color: var(--text-light);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
#search-input::placeholder { color: var(--text-muted); }
#search-input:focus { border-color: var(--gold); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 200;
  box-shadow: var(--shadow);
}

.search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 13px;
  cursor: pointer;
  transition: background var(--transition);
}
.search-item:hover { background: #2A2A2A; }
.search-name  { color: var(--text-light); font-size: 13.5px; }
.search-years { color: var(--text-muted); font-size: 11.5px; }

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
  padding: 9px 20px;
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s;
}
.btn-primary:hover  { background: var(--gold-light); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  padding: 7px 16px;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-ghost:hover { background: rgba(201,168,76,0.1); }

.btn-full { width: 100%; }

.btn-pay { margin-top: 12px; font-size: 16px; padding: 14px; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  background: white;
  border: 1.5px solid #DDD;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 4px;
}
.btn-google:hover { background: #F5F5F5; border-color: #BBB; }

.btn-claim-free {
  font-size: 15px;
  padding: 12px;
  letter-spacing: 0.02em;
}

/* ── Map ──────────────────────────────────────────────── */
#map-container {
  position: fixed;
  top: 80px; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  background: #EDE8DF;
}

#map-canvas {
  display: block;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transform-origin: 50% 50%;
  transition: transform 0.35s ease-out;
}

@media (hover: none) {
  #map-canvas {
    transform: none !important;
    transition: none !important;
  }
}

/* Map loading overlay */
#map-loading {
  position: absolute;
  inset: 0;
  background: #EDE8DF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 50;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #999;
  transition: opacity 0.3s;
}
#map-loading.hidden { display: none; }
.map-loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid #ddd;
  border-top-color: #C9A84C;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Vignette overlay — darkens edges, intensifies during fast pan */
#map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.32) 100%);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.tile-tooltip {
  position: fixed;
  background: rgba(20,20,20,0.92);
  color: var(--text-light);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12.5px;
  pointer-events: none;
  z-index: 50;
  border: 1px solid var(--dark-border);
  white-space: nowrap;
  backdrop-filter: blur(4px);
}


/* ── Modal ────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}

.modal {
  background: var(--off-white);
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  animation: modalIn 0.22s ease;
}

#modal-content {
  padding: 16px 28px 14px;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 13px; right: 15px;
  background: none; border: none;
  font-size: 22px; line-height: 1;
  color: #999; cursor: pointer; z-index: 10;
  transition: color var(--transition);
}
.modal-close:hover { color: #333; }


/* All inputs/textareas inside the modal must have dark text */
.modal input,
.modal textarea,
.modal select {
  color: #1a1a1a !important;
}

/* Progress */
.modal-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
  position: relative;
}
.modal-progress::before {
  content: '';
  position: absolute;
  top: 11px; left: 12px; right: 12px;
  height: 2px; background: #DDD; z-index: 0;
}
.prog-step {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  z-index: 1; font-size: 9.5px; color: #AAA;
  min-width: 40px; text-align: center;
}
.prog-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: #DDD; display: flex;
  align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: #999;
  transition: all 0.2s;
}
.prog-step.active .prog-dot {
  background: var(--gold); color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(201,168,76,0.2);
}
.prog-step.done .prog-dot { background: #4CAF50; color: white; }

/* Modal header */
.modal-header { margin-bottom: 18px; }
.modal-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 25px; font-weight: 600; color: #1a1a1a;
}
.modal-header p { color: #777; font-size: 13px; margin-top: 3px; }

/* Nav */
/* .modal-nav defined in Balance section below */

/* ── Option cards (headstones / decor) ────────────────── */
.options-grid { display: grid; gap: 6px; margin-bottom: 8px; }
.options-hs   { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
.options-dc   { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }

.option-card {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 7px 4px 6px;
  border: 2px solid #E0DBD0;
  border-radius: 9px;
  cursor: pointer;
  background: white;
  transition: border-color 0.15s, background 0.15s,
              transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease;
  will-change: transform;
  position: relative;
  z-index: 1;
}
.option-card:hover {
  border-color: var(--gold-dark);
  background: #FEFBF0;
  transform: scale(1.28) rotate(3deg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
  z-index: 10;
}
.option-card:nth-child(even):hover {
  transform: scale(1.28) rotate(-3deg);
}
.option-card.selected {
  border-color: var(--gold);
  background: #FFF9E6;
  box-shadow: 0 0 0 2px rgba(201,168,76,0.35);
}
.option-card.selected:hover {
  transform: scale(1.22) rotate(2deg);
}
.option-card.selected:nth-child(even):hover {
  transform: scale(1.22) rotate(-2deg);
}

/* Icon sizes */
.option-sprite {
  width: 34px; height: 34px;
  border-radius: 5px; overflow: hidden;
}

.option-sprite-sm {
  width: 28px; height: 28px;
  border-radius: 4px; overflow: hidden;
}

.sprite-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit; overflow: hidden;
}
.sprite-ph img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.option-label { font-size: 10px; font-weight: 500; color: #333; text-align: center; line-height: 1.2; }
.option-price { font-size: 10px; color: var(--gold-dark); font-weight: 600; }

.option-sm { padding: 6px 3px 5px; }

/* ── Color grid ───────────────────────────────────────── */
.color-grid { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 14px; }

.color-chip {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.15s ease;
  padding: 0;
}
.color-chip:hover {
  transform: scale(1.25);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.color-chip.selected {
  border-color: var(--gold) !important;
  transform: scale(1.22);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.4);
}

.color-preview {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #666; margin-bottom: 8px;
}

/* ── Form fields ──────────────────────────────────────── */
.form-fields { display: flex; flex-direction: column; gap: 13px; }

.field-wrap {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12.5px; color: #555; font-weight: 500;
}

.field-wrap input,
.field-wrap textarea {
  padding: 8px 11px;
  border: 1.5px solid #DDD;
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; color: #1a1a1a;
  background: white; outline: none;
  transition: border-color var(--transition);
  resize: vertical;
}
.field-wrap input:focus,
.field-wrap textarea:focus { border-color: var(--gold); }

.required   { color: #E53935; margin-left: 2px; }
.char-count { float: right; font-weight: 400; color: #AAA; font-size: 10.5px; }

/* Photo */
.photo-upload {
  border: 2px dashed #DDD; border-radius: 8px;
  padding: 18px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; cursor: pointer;
  transition: all 0.15s; color: #AAA; font-size: 12.5px;
  background: #FAFAFA; min-height: 80px; justify-content: center;
}
.photo-upload:hover, .photo-upload.drag-over {
  border-color: var(--gold); background: #FEFBF0; color: #888;
}
.photo-preview {
  max-width: 100px; max-height: 100px;
  border-radius: 6px; object-fit: cover;
}
.photo-name { font-size: 11px; color: #888; }

/* ── Auth ─────────────────────────────────────────────── */
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0; color: #CCC; font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: #E5E0D8;
}

.auth-tabs {
  display: flex; border-bottom: 2px solid #EEE; margin-bottom: 16px;
}
.auth-tab {
  padding: 9px 18px; background: none; border: none;
  font-family: 'DM Sans', sans-serif; font-size: 13.5px;
  font-weight: 500; color: #888; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.15s;
}
.auth-tab.active { color: var(--gold-dark); border-bottom-color: var(--gold); }

.auth-form { display: flex; flex-direction: column; gap: 13px; }

.auth-error {
  color: #E53935; font-size: 12.5px;
  padding: 7px 11px; background: #FFF5F5;
  border-radius: 6px; border: 1px solid #FFCDD2;
}

.auth-ok {
  text-align: center; padding: 22px;
  background: #F0FFF4; border-radius: 10px; border: 1px solid #C8E6C9;
}
.auth-ok-icon { font-size: 30px; color: #4CAF50; margin-bottom: 6px; }
.auth-ok p    { color: #333; font-size: 13.5px; margin: 4px 0; }

/* ── Quick claim bar ──────────────────────────────────── */
.quick-claim-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #666;
}
.btn-quick-claim {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 12.5px;
}

/* ── Demo box ─────────────────────────────────────────── */
.demo-box {
  background: linear-gradient(135deg, #FFF8E6, #FFF4D4);
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
  text-align: center;
}
.demo-badge {
  display: inline-block;
  padding: 2px 10px;
  background: var(--gold);
  color: #1a1a1a;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
}
.demo-box p {
  font-size: 13.5px; color: #555; margin-bottom: 14px; line-height: 1.5;
}

.divider-label {
  text-align: center; font-size: 12px; color: #AAA;
  margin: 12px 0; position: relative;
}
.divider-label::before, .divider-label::after {
  content: ''; position: absolute; top: 50%;
  width: 40%; height: 1px; background: #E5E0D8;
}
.divider-label::before { left: 0; }
.divider-label::after  { right: 0; }

/* ── Order summary ────────────────────────────────────── */
.order-summary {
  background: white; border: 1px solid #EEE;
  border-radius: 10px; overflow: hidden; margin-bottom: 16px;
}
.order-row {
  display: flex; justify-content: space-between;
  padding: 11px 15px; font-size: 13.5px; color: #555;
  border-bottom: 1px solid #F0EDE8;
}
.order-row:last-child { border-bottom: none; }
.order-total { background: #FAFAF5; font-weight: 600; font-size: 15px; color: #1a1a1a; }

/* LiqPay */
.liqpay-loading {
  display: flex; align-items: center; gap: 12px;
  padding: 20px; color: #888; font-size: 13.5px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid #DDD; border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tile view ────────────────────────────────────────── */
.tile-view { display: flex; flex-direction: column; gap: 0; }

.tile-view-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 10px;
}
.tile-view-head {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tile-view-photo-hero {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  border: 3px solid #eee;
}
.tile-view-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px; font-weight: 600; color: #1a1a1a;
  line-height: 1.2; margin-bottom: 6px;
}
.tile-view-years {
  font-family: 'DM Sans', sans-serif;
  color: #aaa; font-size: 13px; font-weight: 400;
}
.tile-view-divider {
  border: none; border-top: 1px solid #eee;
  margin: 0 0 10px;
}
.tile-view-msg {
  color: #333; font-size: 15px; line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  max-height: 280px;
  overflow-x: hidden;
  overflow-y: auto;
  margin-bottom: 4px;
}
.tile-view-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.badge {
  padding: 2px 9px; background: #F0EDE8; border-radius: 100px;
  font-size: 11px; color: #666;
}
.badge-pos { background: #EDF3FF; color: #3557A7; }

.tile-view-actions {
  display: flex;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #EAE5DC;
  margin-top: 6px;
}

/* ── Gallery (view) ───────────────────────────────────── */
.tile-view-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.gallery-thumb {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  border: 2px solid transparent;
}
.gallery-thumb:hover { transform: scale(1.07); opacity: 0.9; border-color: #C9A84C; }

/* ── Gallery lightbox ─────────────────────────────────── */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.gallery-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
  cursor: default;
}
.gallery-lightbox-close {
  position: absolute;
  top: 18px; right: 22px;
  font-size: 34px;
  line-height: 1;
  color: rgba(255,255,255,0.85);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: sans-serif;
}
.gallery-lightbox-close:hover { color: #fff; }

/* ── Gallery (edit) ───────────────────────────────────── */
.mem-gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mem-gallery-cell {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 8px;
  border: 2px dashed #d0d0d0;
  background: #f9f9f7;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}
.mem-gallery-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mem-gallery-cell-del {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  padding: 0;
}
.mem-gallery-cell-del:hover { background: rgba(180,0,0,0.85); }
.mem-gallery-cell-add {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #ccc;
  cursor: pointer;
  border: 2px dashed #d0d0d0;
  background: #f9f9f7;
  transition: border-color 0.15s, color 0.15s;
  user-select: none;
}
.mem-gallery-cell-add:hover { border-color: #C9A84C; color: #C9A84C; background: #fdf8ee; }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed; top: 96px; left: 50%;
  transform: translateX(-50%);
  padding: 11px 22px; background: #1a1a1a; color: white;
  border-radius: 100px; font-size: 13.5px; z-index: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.28);
  animation: toastIn 0.2s ease; white-space: nowrap;
}
.toast--error { background: #C62828; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Balance (header) ─────────────────────────────────── */
.header-balance {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-light);
  background: rgba(201,168,76,0.12);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 6px;
  padding: 4px 10px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s;
}
.header-balance:hover { background: rgba(201,168,76,0.22); }

.header-territory {
  font-size: 12px;
  opacity: 0.7;
  padding: 4px 10px;
}


/* Territory name popover */
.territory-popover {
  position: fixed;
  top: 90px;
  right: 16px;
  z-index: 400;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 14px 16px;
  width: 240px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.territory-popover-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 6px;
  padding: 6px 10px;
}
.territory-popover-stat-label { font-size: 13px; color: #aaa; }
.territory-popover-stat-value { font-size: 20px; font-weight: 700; color: #C9A84C; }
.territory-popover-label { font-size: 15px; font-weight: 600; color: #f0ebe0; }
.territory-popover-hint  { font-size: 13px; color: #888; margin-top: -4px; }
.territory-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1.5px solid #333;
  background: #111;
  color: #f0ebe0;
  font-size: 15px;
}
.territory-input:focus { outline: none; border-color: #C9A84C; }

/* Memorial form (in modal) */
.memorial-form .modal-header { margin-bottom: 16px; }
.memorial-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.memorial-fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
}
.memorial-fields input {
  padding: 9px 12px;
  border-radius: 7px;
  border: 1.5px solid #e0e0e0;
  font-size: 14px;
  font-family: inherit;
  color: #222;
}
.memorial-fields input:focus { outline: none; border-color: #C9A84C; }

/* ── Modal: running total in nav ──────────────────────── */
.modal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid #eee;
  margin-top: 16px;
  gap: 10px;
}
.step-total {
  font-size: 14px;
  font-weight: 600;
  color: #444;
  background: #F5F0E8;
  border-radius: 6px;
  padding: 5px 12px;
  white-space: nowrap;
}
.step-total--free {
  color: #2e7d32;
  background: #E8F5E9;
}

/* ── Modal: balance row ───────────────────────────────── */
.balance-row-modal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #F8F5F0;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #555;
}
.modal-balance-val {
  font-weight: 700;
  font-size: 16px;
  color: #2e7d32;
}
.modal-balance-val.balance-low { color: #c62828; }

.balance-low-msg {
  text-align: center;
  font-size: 13px;
  color: #c62828;
  margin-bottom: 12px;
}
.btn-link {
  background: none;
  border: none;
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.free-label { color: #2e7d32; font-weight: 600; }

/* ── Top-up packages ──────────────────────────────────── */
.topup-packages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.topup-pkg {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: #F8F5F0;
  border: 1.5px solid #E0D8CC;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
}
.topup-pkg:hover { border-color: var(--gold); background: #FFF8EC; }
.topup-pay { font-size: 14px; color: #666; }
.topup-get { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.topup-bonus {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #2e7d32;
  border-radius: 100px;
  padding: 2px 7px;
  margin-left: 6px;
}
.balance-terms {
  font-size: 11px;
  color: #aaa;
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ── Delete tile ──────────────────────────────────────── */
.btn-delete {
  padding: 7px 14px;
  background: transparent;
  color: #c62828;
  border: 1px solid #e57373;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-delete:hover { background: #fdecea; }

.delete-info {
  background: #FFF8EC;
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.delete-info-icon { font-size: 28px; margin-bottom: 10px; }
.delete-info p { font-size: 13.5px; color: #444; margin-bottom: 8px; line-height: 1.5; }
.delete-items-list {
  list-style: none;
  margin: 8px 0 10px 0;
  padding: 0;
}
.delete-items-list li {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-dark);
  margin-bottom: 4px;
}
.delete-hint { font-size: 12px !important; color: #888 !important; }

.btn-delete-confirm {
  padding: 8px 20px;
  background: #c62828;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-delete-confirm:hover    { background: #b71c1c; }
.btn-delete-confirm:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Inventory badges on option cards ────────────────── */
.option-price.inv-owned {
  color: #2e7d32;
  font-weight: 700;
  font-size: 10px;
}
.option-card.has-inv {
  border-color: rgba(46,125,50,0.4);
  background: linear-gradient(135deg, #fff, #f0faf0);
}
.option-card.has-inv::after {
  content: '✓';
  position: absolute;
  top: 3px; right: 4px;
  font-size: 9px;
  color: #2e7d32;
  font-weight: 700;
}
.option-card { position: relative; }

/* ── Utility ──────────────────────────────────────────── */
.hidden { display: none !important; }
.text-sm    { font-size: 12px; }
.text-error { color: #E53935; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 700px) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    padding: 0 10px; gap: 8px;
  }
  .site-subtitle  { display: none; }
  .site-title     { font-size: 16px; }
  .counter-number { font-size: 24px; }
  .counter-sep, .counter-total { font-size: 16px; }
  .counter-label  { display: none; }
  #header-search-wrap { width: 130px; }

  #modal-content { padding: 18px 16px 14px; }
  .modal-header h2 { font-size: 21px; }
  .modal-progress  { display: none; }
  .options-hs { grid-template-columns: repeat(3, 1fr); }
  .options-dc { grid-template-columns: repeat(4, 1fr); }
  .tile-view-name { font-size: 21px; }
}

/* ── Paint Tool ───────────────────────────────────────── */
.paint-panel {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  background: rgba(28, 28, 28, 0.97);
  border-radius: 16px;
  box-shadow: 0 8px 36px rgba(0,0,0,0.5);
  padding: 0 6px 18px;
  width: 320px;
  font-size: 14px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  color: #f0ebe0;
}

.paint-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin: 0 -6px 12px;
}

.paint-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 6px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 22px;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  transition: all 0.15s;
}
.paint-tab span { font-size: 13px; font-weight: 600; font-family: 'DM Sans', sans-serif; }
.paint-tab.active { color: #fff; background: rgba(255,255,255,0.1); }
.paint-tab.inactive { opacity: 0.35; pointer-events: none; cursor: default; }
.paint-tab:not(.inactive):not(.active):hover { color: rgba(255,255,255,0.9); }

.paint-tab-content.hidden { display: none; }
.paint-tab-content { padding: 6px 10px 0; }

.paint-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: rgba(255,255,255,0.4);
  line-height: 1;
  padding: 0 3px;
  z-index: 1;
}
.paint-close-btn:hover { color: rgba(255,255,255,0.9); }

.paint-section {
  margin-bottom: 12px;
}
.paint-section > label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
}

/* ── Item grid (shared: Land / Headstone / Decor) ─────── */
.item-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 2px 0 8px;
}

.item-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
  transition: border-color 0.12s, background 0.12s;
  padding: 0;
  aspect-ratio: 1;
}
.item-btn:hover { background: rgba(255,255,255,0.12); }
.item-btn.selected {
  border-color: var(--item-accent, #C9A84C);
  background: color-mix(in srgb, var(--item-accent, #C9A84C) 18%, transparent);
}
.item-btn-preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
  min-height: 0;
}
.item-btn-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.item-btn-foot {
  height: 32px;
  background: rgba(0,0,0,0.40);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
  gap: 4px;
  flex-shrink: 0;
}
.item-btn-name {
  font-size: 12px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  text-align: left;
}
.item-btn-price {
  font-size: 12px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  flex-shrink: 0;
}
.item-btn-stock {
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  color: #5ec962;
  white-space: nowrap;
  flex-shrink: 0;
}

.paint-select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1.5px solid #e0e0e0;
  font-size: 13px;
  background: #fafafa;
}
.paint-name-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,0.15);
  font-size: 14px;
  box-sizing: border-box;
  background: rgba(255,255,255,0.07);
  color: #f0ebe0;
}
.paint-name-input::placeholder { color: rgba(255,255,255,0.3); }
.paint-name-input:focus { outline: none; border-color: #C9A84C; }

.paint-hint {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  text-align: center;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  line-height: 1.5;
}


/* ── Paint Checkout Bar ───────────────────────────────── */
.paint-checkout-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: #1a1a1a;
  color: #fff;
  border-radius: 40px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.35);
  font-size: 15px;
  white-space: nowrap;
}
/* Delete sits on the far-left, separated from Place by the info text */
#paint-delete-btn { margin-right: 4px; }
.paint-checkout-bar.hidden { display: none; }
#paint-checkout-info { color: #ccc; }
.paint-checkout-actions { display: flex; gap: 10px; }
.btn-sm { padding: 8px 18px; font-size: 14px; border-radius: 20px; }

/* ── Delete confirm dialog ────────────────────────────── */
.delete-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.delete-confirm-overlay.hidden { display: none; }
.delete-confirm-dialog {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 32px 28px;
  width: 340px;
  max-width: calc(100vw - 32px);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.delete-confirm-icon { font-size: 36px; }
.delete-confirm-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  color: #f0ebe0;
  margin: 0;
}
.delete-confirm-text {
  font-size: 14px;
  color: #aaa;
  line-height: 1.6;
  margin: 0;
}
.delete-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}
.delete-confirm-actions .btn-ghost {
  flex: 1;
}
.delete-confirm-actions .btn-delete-confirm {
  flex: 1;
}

/* ── Territory popover ────────────────────────────────── */
.header-territory { font-size: 12px; padding: 6px 12px; }

.territory-popover {
  position: fixed;
  top: 68px;
  right: 80px;
  z-index: 600;
  background: #1c1c1c;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 16px;
  width: 240px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.territory-popover.hidden { display: none; }
.territory-popover-label { font-size: 15px; font-weight: 600; color: #fff; margin: 0; }
.territory-popover-hint  { font-size: 13px; color: rgba(255,255,255,0.5); margin: 0; }
.territory-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  padding: 9px 12px;
  outline: none;
}
.territory-input:focus { border-color: rgba(255,255,255,0.4); }

/* ── Balance button (header) ─────────────────────────── */
.header-balance {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.header-balance:hover { background: rgba(255,255,255,0.15); }

/* ── Top-up modal ─────────────────────────────────────── */
.topup-packages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 10px;
}
.topup-pkg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.topup-pkg:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); }
.topup-pkg:disabled { opacity: 0.5; cursor: default; }
.topup-pay { font-size: 13px; color: rgba(255,255,255,0.6); }
.topup-get { font-size: 16px; font-weight: 700; }
.topup-bonus {
  font-size: 11px;
  font-weight: 500;
  color: #7CB87A;
  background: rgba(124,184,122,0.15);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 4px;
}
.topup-custom {
  margin: 4px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.topup-custom-label { font-size: 12px; color: rgba(255,255,255,0.55); }
.topup-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.topup-custom-prefix { font-size: 16px; font-weight: 600; color: rgba(255,255,255,0.6); }
.topup-custom-input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 7px 10px;
  outline: none;
  font-family: 'DM Sans', sans-serif;
}
.topup-custom-input:focus { border-color: rgba(255,255,255,0.4); }
.topup-custom-input::-webkit-inner-spin-button,
.topup-custom-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.balance-terms {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-align: center;
  margin: 4px 0 16px;
}

.mem-fmt-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 5px;
}
.mem-fmt-btn {
  padding: 3px 10px;
  border: 1.5px solid #ddd;
  border-radius: 5px;
  background: #f5f5f5;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.4;
  font-family: inherit;
}
.mem-fmt-btn:hover { background: #eee; border-color: #bbb; }

.memorial-fields textarea {
  padding: 10px 12px;
  border-radius: 7px;
  border: 1.5px solid #e0e0e0;
  font-size: 14px;
  font-family: inherit;
  color: #222;
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}
.memorial-fields textarea:focus { outline: none; border-color: #C9A84C; }

.memorial-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.memorial-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
}

.mem-photo-zone {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 10px;
  border: 2px dashed #d0d0d0;
  background: #f9f9f7;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.mem-photo-zone:hover { border-color: #C9A84C; background: #fdf8ee; }
.mem-photo-zone.uploading { opacity: 0.6; pointer-events: none; }

.mem-photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  border-radius: 8px;
}
.mem-photo-img.visible { display: block; }

.mem-photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.mem-photo-icon { font-size: 26px; line-height: 1; }
.mem-photo-hint { font-size: 10px; color: #aaa; font-family: 'DM Sans', sans-serif; }

.mem-photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.mem-photo-zone:hover .mem-photo-overlay { opacity: 1; }
/* only show overlay when there's already a photo */
.mem-photo-zone:not(:has(.mem-photo-img.visible)) .mem-photo-overlay { display: none; }

.mem-photo-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #666;
  background: rgba(255,255,255,0.85);
  text-align: center;
  padding: 6px;
  font-family: 'DM Sans', sans-serif;
}
.mem-photo-status.hidden { display: none; }

.memorial-change-btn {
  font-size: 12px;
  color: #999;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.memorial-change-btn:hover { color: #333; }


/* ── Footer ───────────────────────────────────────────── */
#site-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 24px;
  background: transparent;
  font-size: 11px;
  color: #000;
}
#site-footer a {
  color: #000;
  text-decoration: none;
}
#site-footer a:hover { color: var(--gold); }

/* ── Auth ToS checkbox ─────────────────────────────────── */
.auth-tos {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  cursor: pointer;
}
.auth-tos input { margin-top: 2px; flex-shrink: 0; }
.auth-tos a { color: var(--gold); }

/* ── Withdrawal consent checkbox ──────────────────────── */
.withdrawal-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  cursor: pointer;
  line-height: 1.4;
}
.withdrawal-check input { margin-top: 2px; flex-shrink: 0; }
