/* Tours & Events Madrid — mobile-first, dark, warm accent */
:root {
  --bg: #15161c;
  --bg2: #1c1e26;
  --card: #21232e;
  --card2: #282b38;
  --line: #313442;
  --text: #eceef4;
  --muted: #9aa0b4;
  --accent: #ff6b4a;
  --accent2: #d9304f;
  --grad: linear-gradient(135deg, #ff7a4a, #d9304f);
  --tour: #4a90d9;
  --event: #d94f70;
  --plan: #3aa87a;
  --place: #d9a03a;
  --deal: #8e6cc9;
  --radius: 16px;
  --maxw: 780px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.hidden { display: none !important; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(21, 22, 28, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand em { color: var(--accent); font-style: normal; }
.brand b { color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.iconbtn { position: relative; font-size: 19px; padding: 7px 9px; border-radius: 12px; }
.iconbtn:hover { background: var(--card); }
.avatar-btn { padding: 3px; }
.badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent2); color: #fff; border-radius: 9px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---- layout ---- */
.view { max-width: var(--maxw); margin: 0 auto; padding: 14px; }
.section { margin: 20px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { margin: 0; font-size: 17px; }
.section-head .more { color: var(--muted); font-size: 13px; }
h1.page { font-size: 22px; margin: 4px 0 14px; }

/* ---- bottom tabs ---- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: rgba(21, 22, 28, .95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; color: var(--muted); padding: 3px 12px; border-radius: 12px; min-width: 56px;
}
.tabbar a .ico { font-size: 20px; filter: grayscale(1) opacity(.7); }
.tabbar a.active { color: var(--text); }
.tabbar a.active .ico { filter: none; }

/* ---- cards ---- */
.cards { display: grid; gap: 12px; }
.hscroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .card { min-width: 240px; max-width: 240px; scroll-snap-align: start; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: block; transition: transform .1s ease;
}
.card:active { transform: scale(.98); }
.card-hero {
  height: 92px; display: flex; align-items: center; justify-content: center;
  font-size: 44px; position: relative;
}
.card-hero .kind-pill {
  position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; color: #fff;
  padding: 3px 8px; border-radius: 8px; background: rgba(0,0,0,.35);
}
.card-hero .price-pill {
  position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 8px; background: rgba(0,0,0,.45); color: #ffd166;
}
.card-hero .price-pill.free { color: #7ee2a8; }
.card-body { padding: 10px 12px 12px; }
.card-title { font-weight: 650; font-size: 14.5px; line-height: 1.3; margin: 0 0 4px; }
.card-meta { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.hero-tour  { background: linear-gradient(135deg, #2b4a6d, #4a90d9); }
.hero-event { background: linear-gradient(135deg, #6d2b40, #d94f70); }
.hero-plan  { background: linear-gradient(135deg, #1f5c44, #3aa87a); }
.hero-place { background: linear-gradient(135deg, #6d552b, #d9a03a); }
.hero-deal  { background: linear-gradient(135deg, #4a3a6d, #8e6cc9); }
.hero-guide { background: linear-gradient(135deg, #1f4e54, #3a9ea8); }
.hero-quest { background: linear-gradient(135deg, #5c4a1f, #b8912f); }

/* row style (lists) */
.rowcard {
  display: flex; gap: 12px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.rowcard .emoji {
  width: 48px; height: 48px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.rowcard .grow { flex: 1; min-width: 0; }
.rowcard .title { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowcard .sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- chips & filters ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.chip.active { background: var(--grad); border-color: transparent; color: #fff; }

.searchbar { display: flex; gap: 8px; margin-bottom: 10px; }
.searchbar input { flex: 1; }

/* ---- stats strip ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 4px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 10.5px; color: var(--muted); }

/* ---- avatars & users ---- */
.avatar {
  position: relative; width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; overflow: hidden;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 76px; height: 76px; font-size: 28px; }
.avatar .init { font-style: normal; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatars-stack { display: flex; }
.avatars-stack .avatar { margin-right: -8px; border: 2px solid var(--card); }

.userrow {
  display: flex; gap: 12px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px;
}
.userrow .grow { flex: 1; min-width: 0; }
.userrow .name { font-weight: 650; font-size: 14.5px; }
.userrow .sub { color: var(--muted); font-size: 12.5px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #7ee2a8; margin-right: 4px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; font-weight: 650; font-size: 14px;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8080; border-color: #5c3038; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btnrow { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }

/* ---- detail page ---- */
.detail-hero {
  border-radius: var(--radius); height: 150px; display: flex; align-items: center; justify-content: center;
  font-size: 64px; position: relative; margin-bottom: 14px;
}
.meta-list { display: grid; gap: 8px; margin: 12px 0; }
.meta-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.meta-row .mico { width: 22px; text-align: center; flex: none; }
.meta-row .muted { color: var(--muted); }
.desc { color: #c9cdda; white-space: pre-wrap; }
.stars { color: #ffd166; letter-spacing: 1px; }
.review { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.review .rhead { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.review .rhead .muted { color: var(--muted); margin-left: auto; font-size: 11.5px; }
.review p { margin: 2px 0 0; font-size: 13.5px; color: #c9cdda; }
.star-input { display: flex; gap: 6px; font-size: 26px; margin: 6px 0; cursor: pointer; }
.star-input span { filter: grayscale(1) opacity(.45); }
.star-input span.on { filter: none; }

.minimap { height: 170px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin: 12px 0; z-index: 0; }

/* ---- full map ---- */
.fullmap-wrap { position: relative; margin: -14px; }
#bigmap { height: calc(100vh - 210px); min-height: 380px; z-index: 0; }
.map-chips { position: absolute; top: 10px; left: 56px; right: 10px; z-index: 20; }
.map-popcard { font-size: 13px; }
.leaflet-container { background: #23242c; }
.emoji-pin { display: flex; flex-direction: column; align-items: center; }
.emoji-pin .pin-emoji {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(0deg);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
.emoji-pin.me .pin-emoji { border-color: #ffd166; }

/* ---- chat ---- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 195px); }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.msg { display: flex; gap: 9px; max-width: 88%; }
.msg .bubble { background: var(--card); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 8px 11px; font-size: 14px; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .bubble { background: #33415c; border-radius: 14px 4px 14px 14px; }
.chat-input { display: flex; gap: 8px; padding-top: 10px; }
.chat-input input { flex: 1; }

/* ---- overlay / modal / notif drawer ---- */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--bg2); width: 100%; max-width: var(--maxw);
  border-radius: 22px 22px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto; border: 1px solid var(--line); border-bottom: 0;
}
.sheet h3 { margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; }
.sheet h3 .close { font-size: 20px; color: var(--muted); padding: 2px 8px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.notif { display: flex; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.notif.unread { background: rgba(255,107,74,.06); }
.notif .nico { font-size: 18px; }
.notif .when { color: var(--muted); font-size: 11px; }

/* ---- profile ---- */
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.profile-head .info { flex: 1; min-width: 0; }
.profile-head h1 { margin: 0; font-size: 20px; }
.profile-head .sub { color: var(--muted); font-size: 13px; }
.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.photos .ph { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph .del {
  position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.6); color: #fff;
  border-radius: 50%; width: 22px; height: 22px; font-size: 12px;
}
.photos .add {
  aspect-ratio: 1; border: 1.5px dashed var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--muted);
}
.pill-note {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 13px; color: var(--muted); margin: 10px 0;
}

/* ---- toasts ---- */
.toasts { position: fixed; top: 64px; left: 0; right: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: #2c2f3c; border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 16px; font-size: 13.5px; max-width: 90%;
  box-shadow: 0 6px 24px rgba(0,0,0,.4); animation: toast-in .2s ease;
}
.toast.err { border-color: #7a3040; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---- guide route stops ---- */
.stops { display: grid; gap: 10px; }
.stop { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stop-n {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--grad);
  color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
}

/* ---- ads / promo banner ---- */
.ad-banner {
  position: fixed; left: 0; right: 0; z-index: 45;
  display: flex; align-items: center; gap: 10px;
  background: var(--card2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 8px 12px; max-width: var(--maxw); margin: 0 auto;
}
.ad-banner.bottom { bottom: calc(58px + env(safe-area-inset-bottom)); }
.ad-banner.top { top: calc(54px + env(safe-area-inset-top)); }
.ad-banner .ad-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); }
.ad-banner .ad-content { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; }
.ad-banner .ad-content img { max-height: 52px; border-radius: 8px; }
.ad-banner .ad-x { flex: none; color: var(--muted); font-size: 15px; padding: 6px 8px; border-radius: 8px; }
.ad-banner .ad-x:hover { background: var(--bg2); }
body.has-ad-bottom { padding-bottom: calc(134px + env(safe-area-inset-bottom)); }
body.has-ad-top .view { padding-top: 74px; }

input[type="range"] { accent-color: var(--accent); border: 0; background: transparent; }

/* ---- wallet ---- */
.wallet-card {
  background: linear-gradient(135deg, #2a1f24, #23202b); border: 1px solid #4a3540;
  border-radius: var(--radius); padding: 14px; margin: 14px 0;
}
.wallet-tx {
  display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.wallet-tx:last-child { border-bottom: 0; }

/* ---- Madrid Quest (mini-game) ---- */
.char-card {
  display: flex; gap: 14px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
}
.char-card .grow { flex: 1; min-width: 0; }
.char-emoji { font-size: 40px; flex: none; }
.hpbar {
  height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); margin: 5px 0 3px;
}
.hpbar i { display: block; height: 100%; background: linear-gradient(90deg, #3aa87a, #7ee2a8); transition: width .4s ease; }
.hpbar.xp i { background: var(--grad); }
.minimap.fantasy .leaflet-tile { filter: sepia(.55) saturate(1.5) hue-rotate(40deg) brightness(.92); }
.battlefield { display: flex; gap: 10px; align-items: stretch; margin: 8px 0 14px; }
.battlefield .vs { align-self: center; font-weight: 800; color: var(--muted); font-size: 15px; }
.fighter {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; text-align: center; display: flex; flex-direction: column; gap: 2px; align-items: center;
}
.fighter.turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fighter .char-emoji { font-size: 46px; }
.battle-log {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-top: 14px; font-size: 13px; color: #c9cdda;
  display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow-y: auto;
}
.battle-log div:last-child { color: var(--text); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 34px 20px; font-size: 14px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }
.muted { color: var(--muted); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

@media (min-width: 700px) {
  .cards.grid2 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  body { font-size: 15.5px; }
}
