:root {
  --glass: rgba(22, 25, 30, .84);
  --line: rgba(255, 255, 255, .09);
  --txt: #f3ece0;
  --muted: #a59d92;
  --gold: #e9b04a;
  --chip: rgba(255, 255, 255, .055);
  --top-h: 140px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bfe0ea; color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 18px; height: 18px; flex: none; }

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#stage canvas:active { cursor: grabbing; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: #16191e; font: 600 22px Georgia, serif; z-index: 50; }

.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }

/* ---------- barra superior ---------- */
.topbar { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 10; border-radius: 18px; padding: 10px 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand .logo { font-size: 22px; line-height: 1; }
.brand b { font: 700 20px Georgia, "Times New Roman", serif; }
.brand em, .tag em { color: var(--gold); font-style: italic; }
.tag { font: 600 19px Georgia, "Times New Roman", serif; margin-left: 8px; padding-left: 18px; border-left: 1px solid var(--line); }

.search { position: relative; flex: 1 1 340px; max-width: 640px; min-width: 0; display: flex; align-items: center;
  background: var(--chip); border: 1px solid var(--line); border-radius: 999px; padding: 4px 4px 4px 14px; }
.search:focus-within { border-color: rgba(233, 176, 74, .6); }
.search .at { color: var(--gold); font-weight: 700; margin-right: 6px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--txt); font-size: 16px; padding: 8px 0; }
.search input::placeholder { color: var(--muted); }
.search > button { background: var(--txt); color: #1b1d21; font-weight: 600; border-radius: 999px; padding: 8px 18px; }
.suggest { position: absolute; top: calc(100% + 8px); left: 0; right: 0; list-style: none; margin: 0; padding: 6px; border-radius: 14px; z-index: 20; }
.suggest button { width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; }
.suggest button:hover, .suggest button:focus { background: var(--chip); outline: 0; }

.chips { flex: 1 1 100%; display: flex; gap: 6px; justify-content: flex-end; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; text-align: left; padding: 6px 12px; border-radius: 12px; }
.chip[tabindex="-1"] { cursor: default; }
.chip:not([tabindex="-1"]):hover { background: var(--chip); }
.chip small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chip b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip b em { font: italic 700 16px Georgia, serif; color: var(--gold); }

/* ---------- botones flotantes ---------- */
.actions { position: fixed; top: var(--top-h); right: 12px; z-index: 9; display: flex; gap: 8px; }
.pill { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; color: var(--txt);
  text-decoration: none; font-weight: 600; font-size: 14px; }
.pill:hover { border-color: rgba(233, 176, 74, .5); }
.zoom { position: fixed; right: 12px; bottom: 96px; z-index: 9; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; }
.zoom button { width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; }
.zoom button + button { border-top: 1px solid var(--line); }
.zoom button:hover { background: var(--chip); }

/* ---------- menú inferior ---------- */
.tabs { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 11; display: flex; gap: 4px; padding: 6px; border-radius: 999px; }
.tabs button { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs button:hover { color: var(--txt); }
.tabs button.on { background: var(--txt); color: #1b1d21; }

/* ---------- paneles ---------- */
.sheet { position: fixed; left: 12px; top: var(--top-h); bottom: 84px; width: 380px; z-index: 10; border-radius: 18px;
  display: flex; flex-direction: column; }
.sheet[hidden], .toast[hidden], .suggest[hidden] { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet h2 { margin: 0; font: 700 21px Georgia, "Times New Roman", serif; }
.sheet-head button { font-size: 26px; line-height: 1; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); }
.sheet-head button:hover { background: var(--chip); color: var(--txt); }
#sheetBody { overflow: auto; padding: 6px 12px 16px; }
.sheet h3 { margin: 18px 4px 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-align: left; }
.item:hover { background: var(--chip); }
.item .n { width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item span:not(.n) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item small { color: var(--gold); font-weight: 700; white-space: nowrap; }
.note { margin: 6px 4px 10px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.note.small { font-size: 12px; margin-top: 18px; }
.cta { margin-top: 16px; padding: 14px; border-radius: 14px; background: var(--chip); }
.cta .note { margin: 6px 0 12px; }
.btn-gold { display: inline-block; flex: none; background: var(--gold); color: #1b1d21; font-weight: 700; font-size: 14px;
  border-radius: 999px; padding: 9px 16px; text-decoration: none; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 12; width: max-content;
  max-width: min(560px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 14px; display: flex; gap: 12px; align-items: center;
  font-size: 14px; line-height: 1.4; }

/* ---------- ficha de un vecino ---------- */
.card { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 12; width: min(380px, calc(100vw - 24px));
  border-radius: 18px; padding: 14px 16px 16px; }
.card[hidden] { display: none; }
.card-head { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font: 700 20px Georgia, serif; color: #fffaf0; border: 3px solid rgba(255, 255, 255, .25); }
.card-head div { flex: 1; min-width: 0; }
.card-head b { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head small { color: var(--muted); font-size: 13px; }
.card-head button { font-size: 26px; line-height: 1; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); }
.card-head button:hover { background: var(--chip); color: var(--txt); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 14px 0 10px; }
.stats div { background: var(--chip); border-radius: 12px; padding: 8px 4px; text-align: center; }
.stats small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stats b { font: italic 700 21px Georgia, serif; color: var(--gold); }
.facts { list-style: none; margin: 0 0 14px; padding: 0; font-size: 14px; }
.facts li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 2px; border-top: 1px solid var(--line); }
.facts span { color: var(--muted); }
.facts b { font-weight: 600; text-align: right; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions > * { flex: 1; text-align: center; }
.card-actions .wide { flex-basis: 100%; padding: 11px 16px; }
.btn-ghost { border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; font-weight: 600; font-size: 14px; color: var(--txt); text-decoration: none; }
.btn-ghost:hover { background: var(--chip); }

.biz-msg { margin: 12px 2px 4px; font: italic 600 17px Georgia, serif; color: var(--gold); }

/* ---------- negocios: planes, extras y formularios ---------- */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 4px; }
.plan { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; background: var(--chip); border: 1px solid var(--line); }
.plan.gold { border-color: rgba(233, 176, 74, .55); }
.plan > b { font: 700 17px Georgia, serif; }
.plan .price em { font: italic 700 26px Georgia, serif; color: var(--gold); }
.plan .price small { color: var(--muted); font-size: 12px; }
.plan ul { margin: 0 0 6px; padding-left: 16px; color: var(--muted); font-size: 12.5px; line-height: 1.45; flex: 1; }
.plan button { text-align: center; }
.extras { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.extra { display: flex; flex-direction: column; gap: 3px; padding: 11px; border-radius: 14px; background: var(--chip); border: 1px solid var(--line); text-align: left; }
.extra:hover { border-color: rgba(233, 176, 74, .5); }
.extra .ico { font-size: 24px; }
.extra b { font-size: 14px; }
.extra small { color: var(--muted); font-size: 12px; line-height: 1.4; flex: 1; }
.extra em { font: italic 700 15px Georgia, serif; color: var(--gold); margin-top: 4px; }
.back { color: var(--muted); font-size: 14px; padding: 8px 4px 0; }
.back:hover { color: var(--txt); }
.form { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 8px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-weight: 400; font-size: 12px; }
.field input:not([type=color]), .field select, .field textarea { width: 100%; background: var(--chip); color: var(--txt); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-weight: 400; font-size: 15px; outline: 0; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(233, 176, 74, .6); }
.field select option { color: #1b1d21; }
.field input[type=color] { width: 64px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--chip); }
.preview { border-radius: 14px; overflow: hidden; background: linear-gradient(#8fc9e0, #f3e6cf); }
.preview canvas { display: block; width: 100%; height: auto; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.45; }
.check input { margin-top: 3px; accent-color: var(--gold); }
.btn-gold.wide { width: 100%; text-align: center; padding: 12px; }
.btn-gold:disabled { opacity: .6; }
.form-msg:empty { display: none; }
.form-msg { color: #f0a58a; }

/* ---------- móvil ---------- */
@media (max-width: 720px) {
  .topbar { top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; padding: 8px; gap: 8px; border-radius: 16px; }
  .tag { display: none; }
  .brand b { font-size: 18px; }
  .search { flex-basis: 100%; max-width: none; }
  .chips { justify-content: flex-start; margin: 0 -2px; }
  .chip { padding: 5px 10px; background: var(--chip); }
  .actions { top: auto; right: 8px; bottom: 88px; flex-direction: column; }
  .pill { padding: 11px; }
  .pill span { display: none; }
  .zoom { display: none; }
  .tabs { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); transform: none; border-radius: 18px; padding: 5px; }
  .tabs button { flex: 1; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 10.5px; border-radius: 12px; }
  .sheet { left: 8px; right: 8px; width: auto; top: auto; bottom: 80px; max-height: 60vh; }
  .toast { bottom: 84px; }
  .card { bottom: 80px; }
}
