/* THE VILLAGE — Dark Gothic Theme */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cinzel+Decorative:wght@400;700&family=Crimson+Pro:ital,wght@0,400;0,600;1,400&display=swap');

/* ===== VARIABLES ===== */
:root {
  --bg:         #080604;
  --bg2:        #0f0b07;
  --bg-card:    #17120d;
  --bg-input:   #100d08;
  --border:     #3a2415;
  --border2:    #6b3a1a;
  --red:        #8b0000;
  --red2:       #bb1111;
  --red-glow:   rgba(139,0,0,0.4);
  --gold:       #b8860b;
  --gold2:      #d4aa1a;
  --gold-glow:  rgba(184,134,11,0.35);
  --text:       #d0a870;
  --text-dim:   #8a6642;
  --text2:      #eeddb8;
  --white:      #f5ede0;
  --green:      #2d6a2d;
  --green2:     #3a8a3a;
}

/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Crimson Pro', Georgia, serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 50%, rgba(60,10,10,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(20,10,5,.25) 0%, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

h1,h2,h3,h4 {
  font-family: 'Cinzel', serif;
  color: var(--text2);
  letter-spacing: .05em;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold2); }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ===== AUTH SCREEN ===== */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image: radial-gradient(ellipse at center, rgba(70,10,10,.12) 0%, transparent 65%);
}

.auth-container { width: 100%; max-width: 450px; }

.auth-title { text-align: center; margin-bottom: 6px; }
.auth-title h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  color: var(--gold2);
  text-shadow: 0 0 30px var(--gold-glow), 0 0 60px rgba(184,134,11,.15);
  letter-spacing: .18em;
}
.auth-title .subtitle {
  font-style: italic;
  color: var(--text-dim);
  font-size: .9rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-top: 4px;
}

.auth-ornament {
  text-align: center;
  margin: 14px 0;
  color: var(--red);
  font-size: 1rem;
  letter-spacing: .6em;
  opacity: .65;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 30px;
  position: relative;
  box-shadow: 0 0 50px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.025);
}
.auth-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, var(--border2) 0%, transparent 40%, transparent 60%, var(--border2) 100%);
  z-index: -1;
  opacity: .25;
}

.auth-tabs { display: flex; margin-bottom: 26px; border-bottom: 1px solid var(--border); }
.auth-tab-btn {
  flex: 1; background: none; border: none;
  color: var(--text-dim);
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  letter-spacing: .12em;
  padding: 10px;
  cursor: pointer;
  transition: all .22s ease;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tab-btn.active { color: var(--gold2); border-bottom-color: var(--gold); }
.auth-tab-btn:hover:not(.active) { color: var(--text); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 9px 13px;
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  border-radius: 1px;
  -webkit-appearance: none;
}
.form-control:focus { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-glow); }
.form-control::placeholder { color: var(--text-dim); opacity: .55; }

.form-row { display: grid; gap: 14px; margin-bottom: 14px; }
.form-row.c2 { grid-template-columns: 1fr 1fr; }
.form-row.c3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) {
  .form-row.c2, .form-row.c3 { grid-template-columns: 1fr; }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent;
  padding: 9px 18px;
  font-family: 'Cinzel', serif;
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .22s ease;
  text-decoration: none;
  border-radius: 1px;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--red); border-color: var(--red2); color: var(--white);
  width: 100%; padding: 11px;
}
.btn-primary:hover:not(:disabled) { background: var(--red2); box-shadow: 0 0 22px var(--red-glow); }

.btn-gold { background: transparent; border-color: var(--gold); color: var(--gold2); }
.btn-gold:hover { background: rgba(184,134,11,.1); box-shadow: 0 0 16px var(--gold-glow); }

.btn-ghost { background: transparent; border-color: var(--border2); color: var(--text); }
.btn-ghost:hover { border-color: var(--red); color: var(--text2); }

.btn-danger { background: #5a0000; border-color: var(--red); color: var(--white); }
.btn-danger:hover { background: var(--red); box-shadow: 0 0 16px var(--red-glow); }

.btn-success { background: var(--green); border-color: var(--green2); color: var(--white); }
.btn-success:hover { background: var(--green2); }

.btn-sm { padding: 5px 13px; font-size: .68rem; }
.btn-xs { padding: 3px 9px; font-size: .62rem; }

/* ===== NAVBAR ===== */
.app-navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; height: 58px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 2px 20px rgba(0,0,0,.55);
}
.navbar-brand {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.2rem; color: var(--gold2);
  text-shadow: 0 0 14px var(--gold-glow);
  letter-spacing: .12em;
}
.navbar-right { display: flex; align-items: center; gap: 14px; }

.mqtt-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Cinzel', serif; font-size: .62rem;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 1px; border: 1px solid;
}
.mqtt-badge.on  { color: #6db86d; border-color: #2d6a2d; background: rgba(45,106,45,.1); }
.mqtt-badge.off { color: #cc5555; border-color: var(--red); background: rgba(139,0,0,.1); }

.mqtt-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity:1 } 50% { opacity:.25 } }

.user-menu-btn {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text2); font-family: 'Cinzel', serif; font-size: .75rem;
  padding: 6px 12px; cursor: pointer; transition: all .2s; border-radius: 1px;
}
.user-menu-btn:hover { border-color: var(--red); color: var(--white); }

.sidebar-toggle {
  background: none; border: none;
  color: var(--text2); font-size: 1.4rem; cursor: pointer; padding: 4px 8px;
  display: none;
}
@media (max-width: 640px) { .sidebar-toggle { display: block; } }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: calc(100vh - 58px); }

.sidebar {
  width: 210px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky; top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  transition: left .3s ease;
}

.sidebar-section { margin-bottom: 6px; }
.sidebar-lbl {
  font-family: 'Cinzel', serif; font-size: .58rem;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-dim); padding: 8px 18px 4px;
}
.sidebar-btn {
  display: flex; align-items: center; gap: 11px;
  width: 100%; background: none; border: none;
  color: var(--text);
  font-family: 'Crimson Pro', serif; font-size: .98rem;
  padding: 9px 18px; cursor: pointer;
  transition: all .18s ease; text-align: left;
  border-left: 2px solid transparent;
}
.sidebar-btn:hover { color: var(--text2); background: rgba(255,255,255,.015); }
.sidebar-btn.active { color: var(--gold2); border-left-color: var(--gold); background: rgba(184,134,11,.05); }
.sidebar-btn .sico { font-size: 1rem; width: 18px; text-align: center; }

@media (max-width: 640px) {
  .sidebar {
    position: fixed; left: -100%; top: 58px;
    height: calc(100vh - 58px); z-index: 190; width: 230px;
    box-shadow: none;
  }
  .sidebar.open { left: 0; box-shadow: 6px 0 24px rgba(0,0,0,.6); }
}

.content {
  flex: 1; padding: 28px 32px; min-width: 0;
}
@media (max-width: 640px) { .content { padding: 16px; } }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 22px; margin-bottom: 18px;
  position: relative; overflow: hidden;
}
.card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border2), transparent);
}
.card-title {
  font-family: 'Cinzel', serif; font-size: .68rem;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--text); margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 1.45rem; color: var(--gold2); margin-bottom: 4px;
  display: flex; align-items: center; gap: 10px;
}
.page-sub {
  font-style: italic; color: var(--text); margin-bottom: 26px; font-size: .92rem;
}

/* ===== GRIDS ===== */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .g2 { grid-template-columns: 1fr; } }
@media (max-width: 1000px) { .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 650px) { .g3 { grid-template-columns: 1fr; } }

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 18px;
}
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  padding: 18px 12px; text-align: center;
  transition: all .22s ease;
}
.stat-card:hover { border-color: var(--border2); box-shadow: 0 0 18px rgba(0,0,0,.4); }

.stat-icon { font-size: 1.6rem; margin-bottom: 6px; display: block; }
.stat-value { font-family: 'Cinzel', serif; font-size: 1.8rem; color: var(--text2); line-height:1; margin-bottom: 3px; }
.stat-label { font-family: 'Cinzel', serif; font-size: .6rem; letter-spacing: .15em; text-transform: uppercase; color: var(--text); }

.stat-card.sv .stat-value { color: #e05555; }
.stat-card.sh .stat-value { color: var(--gold2); }
.stat-card.st .stat-value { color: #aa77ee; }
.stat-card.si .stat-value { color: #5599dd; }

/* ===== PROFILE ===== */
.profile-hdr {
  display: flex; align-items: flex-start; gap: 20px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.avatar-circle {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red) 0%, #3a0808 100%);
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; flex-shrink: 0;
  box-shadow: 0 0 18px var(--red-glow);
  overflow: hidden;
}
.profile-info h2 { font-size: 1.3rem; margin-bottom: 3px; }
.profile-info .alias { color: var(--gold); font-style: italic; font-size: .95rem; margin-bottom: 6px; }
.badge-admin {
  display: inline-block;
  font-family: 'Cinzel', serif; font-size: .58rem;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold2); border: 1px solid var(--gold);
  padding: 2px 7px; background: rgba(184,134,11,.08);
}

.qr-wrap { text-align: center; }
.qr-wrap img {
  max-width: 170px; width: 100%;
  border: 2px solid var(--border); background: white; padding: 6px;
}
.qr-lbl {
  font-family: 'Cinzel', serif; font-size: .62rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); margin-top: 7px;
}

/* ===== TABLE ===== */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
thead th {
  font-family: 'Cinzel', serif; font-size: .62rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); padding: 9px 12px;
  border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
tbody tr { border-bottom: 1px solid rgba(58,36,21,.45); transition: background .14s; }
tbody tr:hover { background: rgba(255,255,255,.018); }
tbody td { padding: 11px 12px; color: var(--text); vertical-align: middle; }

/* ===== FOTO UPLOAD ===== */
.foto-upload-label {
  display: flex; align-items: center; gap: 0;
  cursor: pointer; overflow: hidden;
  border: 1px solid var(--border2); border-radius: 6px;
  background: #1a1220;
}
.foto-upload-label span {
  flex: 1; padding: 8px 12px;
  font-size: .87rem; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.foto-upload-label::before {
  content: 'Explorar';
  flex-shrink: 0; padding: 8px 14px;
  background: #2a1f35; color: var(--gold);
  font-size: .82rem; letter-spacing: .05em;
  border-right: 1px solid var(--border2);
}
.foto-upload-input { display: none; }

/* ===== AVATAR UNIFICAT ===== */
.avatar-unified-wrap { background: #110e16; border: 1px solid var(--border2); border-radius: 8px; padding: 14px; }
.avatar-sect-lbl { font-size: .72rem; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 8px; }
.avatar-opts-grid { display: flex; flex-wrap: wrap; gap: 8px; min-height: 44px; }
.avatar-opt-btn {
  width: 44px; height: 44px; border-radius: 8px;
  border: 2px solid var(--border2); background: #1a1220;
  font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, transform .1s; overflow: hidden; padding: 0;
}
.avatar-opt-btn:hover { border-color: var(--gold); transform: scale(1.08); }
.avatar-opt-btn.selected { border-color: var(--gold); box-shadow: 0 0 8px rgba(184,134,11,.5); }
.avatar-opt-btn img { width: 100%; height: 100%; object-fit: cover; }
.avatar-photo-wrap { position: relative; display: inline-flex; }
.btn-del-photo {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #8b0000; border: none; color: #fff;
  font-size: .65rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  line-height: 1; padding: 0;
}
.btn-del-photo:hover { background: #c62828; }

/* ===== FRIENDS ===== */
.friend-item {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 0; border-bottom: 1px solid rgba(58,36,21,.45);
}
.friend-ava {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #280808 0%, #3d1414 100%);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.friend-name { color: var(--text2); font-size: .98rem; }
.friend-alias { color: var(--text-dim); font-size: .84rem; font-style: italic; }

/* ===== TRANSACTIONS ===== */
.tx-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid rgba(58,36,21,.45);
  gap: 12px;
}
.tx-amount { font-family: 'Cinzel', serif; font-size: 1rem; font-weight: 700; white-space: nowrap; }
.tx-amount.pos { color: #6db86d; }
.tx-amount.neg { color: #cc4444; }
.tx-desc { color: var(--text); font-size: .92rem; }
.tx-date { color: var(--text-dim); font-size: .78rem; font-style: italic; }

/* ===== EXPERIENCE CARD ===== */
.exp-card {
  background: var(--bg2); border: 1px solid var(--border);
  padding: 16px; transition: all .22s ease;
}
.exp-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.45); }
.exp-name { font-family: 'Cinzel', serif; font-size: .95rem; color: var(--text2); margin-bottom: 5px; }
.exp-desc { font-style: italic; color: var(--text-dim); font-size: .86rem; margin-bottom: 10px; line-height: 1.5; }
.exp-meta { display: flex; gap: 12px; font-size: .78rem; flex-wrap: wrap; }
.exp-terror { color: #aa44aa; }
.exp-dif { color: var(--gold); }

/* ===== BADGES ===== */
.rfid-badge {
  font-family: 'Courier New', monospace; font-size: .8rem;
  color: var(--gold); background: rgba(184,134,11,.06);
  border: 1px solid rgba(184,134,11,.22); padding: 1px 7px;
}
.valid-badge {
  font-family: 'Cinzel', serif; font-size: .6rem;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 1px; border: 1px solid;
}
.valid-badge.yes { color: #6db86d; border-color: #2d6a2d; background: rgba(45,106,45,.1); }
.valid-badge.no  { color: #cc5555; border-color: var(--red); background: rgba(139,0,0,.08); }
.tipus-badge {
  font-family: 'Cinzel', serif; font-size: .68rem;
  letter-spacing: .05em; color: #7aa5cc;
  background: rgba(58,110,150,.1); border: 1px solid rgba(58,110,150,.3);
  padding: 2px 8px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 10px 14px; border-left: 3px solid;
  margin-bottom: 14px; font-size: .92rem; border-radius: 1px;
}
.alert-err { background: rgba(139,0,0,.1); border-left-color: var(--red2); color: #cc6666; }
.alert-ok  { background: rgba(45,106,45,.1); border-left-color: #6db86d; color: #6db86d; }

/* ===== TOAST ===== */
#toast-container {
  /* z-index per sobre de tots els modals (900) perquè un toast d'error
     disparat mentre hi ha un modal obert (p.ex. modal-user + modal-reserva-tokens)
     no quedi amagat darrere del fons fosc del modal */
  position: fixed; bottom: 22px; right: 22px; z-index: 9500;
  display: flex; flex-direction: column; gap: 9px; pointer-events: none;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border2);
  color: var(--text2); padding: 11px 16px; max-width: 300px;
  box-shadow: 0 4px 20px rgba(0,0,0,.55); font-size: .92rem;
  display: flex; align-items: center; gap: 9px;
  pointer-events: all; animation: tsin .28s ease;
}
.toast.success { border-left: 3px solid #6db86d; }
.toast.error   { border-left: 3px solid var(--red2); }
.toast.info    { border-left: 3px solid var(--gold); }
@keyframes tsin  { from { transform: translateX(100%); opacity:0 } to { transform:none; opacity:1 } }
@keyframes tsout { from { transform:none; opacity:1 } to { transform: translateX(110%); opacity:0 } }

/* ===== RESPONSE LOG ===== */
.rlog {
  background: var(--bg2); border: 1px solid var(--border);
  padding: 10px; max-height: 220px; overflow-y: auto;
  font-family: 'Courier New', monospace; font-size: .76rem; color: var(--text-dim);
}
.rlog .le { padding: 2px 0; border-bottom: 1px solid rgba(58,36,21,.25); }
.rlog .ok { color: #6db86d; }
.rlog .err { color: #cc4444; }
.rlog .inf { color: var(--gold); }

/* ===== GAMES CALENDAR ===== */
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.cal-nav .cal-month-lbl {
  font-family: 'Cinzel', serif; font-size: 1rem; color: var(--gold2);
  text-transform: capitalize; min-width: 160px; text-align: center;
}
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; font-size: .82rem; color: var(--text-dim); }
.cal-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.cal-legend .dot.game { background: #6db86d; }
.cal-legend .dot.nogame { background: var(--red2, #8b0000); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.cal-dow {
  text-align: center; font-family: 'Cinzel', serif; font-size: .6rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim);
  padding-bottom: 6px;
}
.cal-day {
  aspect-ratio: 1 / 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  border: 1px solid var(--border); background: var(--bg2);
  cursor: pointer; font-size: .88rem; color: var(--text2);
  transition: all .15s ease; position: relative;
}
.cal-day:hover { border-color: var(--gold); }
.cal-day.empty { visibility: hidden; cursor: default; }
.cal-day.game { background: rgba(45,106,45,.18); border-color: #2d6a2d; }
.cal-day.nogame { background: rgba(139,0,0,.12); border-color: var(--red); }
.cal-day.override::after {
  content: ''; position: absolute; top: 3px; right: 3px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--gold2);
}
.cal-day.today { box-shadow: inset 0 0 0 2px var(--gold); }
.cal-day .cd-num { font-family: 'Cinzel', serif; }
.cal-day .cd-lbl { font-size: .6rem; color: var(--text-dim); }

/* ===== ADMIN SUBTABS ===== */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }

/* ===== MISC ===== */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--text-dim); }
.empty-state .ico { font-size: 2.8rem; margin-bottom: 10px; opacity: .4; }
.empty-state p { font-style: italic; font-size: .95rem; }
.loading { text-align: center; padding: 28px; color: var(--text-dim); font-style: italic; }
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.tab-section { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity:0; transform: translateY(4px) } to { opacity:1; transform:none } }

/* ===== AVATAR PICKER (registration) ===== */
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}
.avatar-pick-btn {
  font-size: 1.4rem;
  padding: 8px 0;
  border-radius: 3px;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--bg-input);
  transition: all .15s;
  line-height: 1;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.avatar-pick-btn:hover { border-color: var(--border2); background: var(--bg2); }
.avatar-pick-btn.selected { border-color: var(--red); background: rgba(139,0,0,.18); box-shadow: 0 0 10px var(--red-glow); }

/* ===== CHAR CARD (collectible card) ===== */
.char-card {
  position: relative;
  margin-bottom: 18px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 2px;
  height: 10px;
  overflow: hidden;
  margin: 8px 0 6px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  border-radius: 2px;
  transition: width .7s ease;
}

/* ===== MAP ===== */
.map-svg-wrap {
  border: 1px solid var(--border);
  background: var(--bg2);
  margin-bottom: 14px;
  overflow: hidden;
}
.map-svg { width: 100%; display: block; }
.map-dot:hover > circle:nth-child(1) { fill-opacity: .45; }

.map-locked {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.map-locked-icon { font-size: 3rem; margin-bottom: 14px; }
.map-locked p { font-style: italic; color: var(--text); margin-bottom: 6px; }
.map-locked-sub { font-size: .85rem; color: var(--text-dim) !important; }

.map-legend {
  display: flex;
  gap: 20px;
  padding: 4px 0 12px;
}
.map-leg-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .85rem;
  color: var(--text-dim);
}
.map-leg-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.map-leg-dot.pend { background: var(--red); }
.map-leg-dot.comp { background: var(--gold); }

.map-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 14px;
  animation: fadeIn .2s ease;
}

/* ===== ACCÉS TAB ===== */
.qr-large img { max-width: 230px; }
.acces-date-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  font-size: .95rem;
  color: var(--text2);
}

/* ===== FAQs ===== */
.faq-list { display: flex; flex-direction: column; }
.faq-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(58,36,21,.4);
}
.faq-item:last-child { border-bottom: none; }
.faq-q {
  font-family: 'Cinzel', serif;
  font-size: .75rem;
  letter-spacing: .08em;
  color: var(--gold);
  margin-bottom: 5px;
  text-transform: uppercase;
}
.faq-a {
  font-style: italic;
  color: var(--text);
  font-size: .9rem;
  line-height: 1.55;
}

/* ===== LANDING PAGE — barra superior + menú lateral (off-canvas, a l'estil "hamburguesa") ===== */
.landing-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 600;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 16px 28px;
  background: linear-gradient(to bottom, rgba(8,6,4,.92), rgba(8,6,4,0));
  transition: background .3s ease;
}
.landing-nav.scrolled { background: rgba(8,6,4,.95); border-bottom: 1px solid var(--border); }
.landing-brand {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.15rem; letter-spacing: .14em; color: var(--gold2);
  justify-self: center;
}
.landing-nav-side { display: flex; align-items: center; gap: 16px; justify-self: start; }
.landing-nav-side.right { justify-self: end; }
.landing-nav .btn { padding: 8px 18px; font-size: .78rem; }

/* Botó hamburguesa / tancar (sempre visible, substitueix icona en obrir) */
.landing-menu-toggle {
  background: none; border: none; color: var(--gold2); cursor: pointer;
  width: 34px; height: 34px; padding: 0; position: relative; z-index: 720;
}
.landing-menu-toggle span {
  display: block; position: absolute; left: 6px; right: 6px; height: 2px;
  background: var(--gold2); transition: transform .25s ease, opacity .2s ease;
}
.landing-menu-toggle span:nth-child(1) { top: 11px; }
.landing-menu-toggle span:nth-child(2) { top: 17px; }
.landing-menu-toggle span:nth-child(3) { top: 23px; }
.landing-menu-toggle.open span:nth-child(1) { top: 17px; transform: rotate(45deg); }
.landing-menu-toggle.open span:nth-child(2) { opacity: 0; }
.landing-menu-toggle.open span:nth-child(3) { top: 17px; transform: rotate(-45deg); }

/* Fons fosc que cobreix la resta de la pàgina mentre el menú està obert */
.landing-menu-backdrop {
  position: fixed; inset: 0; background: rgba(4,3,2,.72); z-index: 610;
  opacity: 0; visibility: hidden; transition: opacity .3s ease;
}
.landing-menu-backdrop.open { opacity: 1; visibility: visible; }

/* Panell lateral (off-canvas) amb els apartats de la web */
.landing-menu {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 700;
  width: min(320px, 84vw);
  background: var(--bg-card); border-right: 1px solid var(--border2);
  box-shadow: 30px 0 60px rgba(0,0,0,.6);
  padding: 90px 30px 30px;
  display: flex; flex-direction: column; gap: 4px;
  transform: translateX(-100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.landing-menu.open { transform: translateX(0); }
.landing-menu a {
  font-family: 'Cinzel', serif; font-size: .9rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text2);
  padding: 13px 4px; border-bottom: 1px solid rgba(58,36,21,.4);
}
.landing-menu a:hover, .landing-menu a.active { color: var(--gold2); }
.landing-menu a.btn { text-align: center; margin-top: 14px; border-bottom: none; }

.landing-hero {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 100px 20px 60px;
  background:
    radial-gradient(ellipse at center 30%, rgba(139,0,0,.22) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(184,134,11,.10) 0%, transparent 55%),
    linear-gradient(180deg, #0b0805 0%, var(--bg) 60%);
  position: relative; overflow: hidden;
}
.landing-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(184,134,11,.06) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .5; pointer-events: none;
}
.landing-hero-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  color: var(--gold2);
  letter-spacing: .16em;
  text-shadow: 0 0 40px var(--gold-glow), 0 0 90px rgba(184,134,11,.2);
  position: relative;
}
.landing-hero-sub {
  font-style: italic; color: var(--text-dim); font-size: clamp(1rem,2.4vw,1.3rem);
  letter-spacing: .18em; text-transform: uppercase; margin-top: 10px; position: relative;
}
.landing-hero-tag {
  max-width: 640px; margin: 28px auto 0; color: var(--text); font-size: 1.05rem;
  line-height: 1.7; position: relative;
}
.landing-hero-cta { display: flex; gap: 16px; margin-top: 38px; flex-wrap: wrap; justify-content: center; position: relative; }
.landing-hero-cta .btn { padding: 14px 34px; font-size: .9rem; }
.landing-ornament { margin: 22px 0; color: var(--gold); letter-spacing: .5em; opacity: .6; position: relative; }

.landing-section { padding: 90px 24px; max-width: 980px; margin: 0 auto; }
.landing-section-title {
  font-family: 'Cinzel Decorative', serif; text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--gold2); margin-bottom: 10px;
}
.landing-section-sub {
  text-align: center; font-style: italic; color: var(--text-dim);
  margin-bottom: 40px; letter-spacing: .05em;
}
.landing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 22px; margin-top: 30px; }
.landing-card {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 24px 20px; text-align: center; transition: border-color .25s, transform .25s;
}
.landing-card:hover { border-color: var(--border2); transform: translateY(-4px); }
.landing-card .ico { font-size: 2rem; margin-bottom: 10px; display: block; }
.landing-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.landing-card p { color: var(--text-dim); font-size: .88rem; line-height: 1.55; }

.landing-empty {
  text-align: center; padding: 40px 20px; color: var(--text-dim);
  font-style: italic; border: 1px dashed var(--border2);
}

.landing-footer {
  padding: 34px 24px 90px; text-align: center; border-top: 1px solid var(--border);
  color: var(--text-dim); font-size: .82rem;
}
.landing-footer a { color: var(--text-dim); margin: 0 10px; }
.landing-footer a:hover { color: var(--gold2); }

/* ===== TERMES / PAGINES LEGALS ===== */
.legal-page { max-width: 820px; margin: 0 auto; padding: 110px 24px 80px; }
.legal-page h1 { font-family: 'Cinzel Decorative', serif; color: var(--gold2); font-size: 2rem; margin-bottom: 6px; }
.legal-page .legal-updated { color: var(--text-dim); font-style: italic; font-size: .85rem; margin-bottom: 34px; }
.legal-page h2 { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.05rem; letter-spacing: .05em; margin: 30px 0 10px; }
.legal-page p, .legal-page li { color: var(--text); line-height: 1.7; font-size: .95rem; }
.legal-page ul { margin-left: 22px; margin-bottom: 12px; }
.legal-page .back-link { display: inline-block; margin-bottom: 20px; }

/* ===== BOTIGA PUBLICA (guest) ===== */
.botiga-public-wrap { max-width: 900px; margin: 0 auto; padding: 110px 24px 80px; }
.botiga-public-header { text-align: center; margin-bottom: 34px; }

/* ===== BANNER DE COOKIES ===== */
#cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9500;
  background: rgba(10,7,5,.97); border-top: 1px solid var(--border2);
  padding: 16px 22px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  justify-content: center; box-shadow: 0 -6px 24px rgba(0,0,0,.5);
}
#cookie-banner p { color: var(--text); font-size: .85rem; line-height: 1.5; max-width: 620px; margin: 0; flex: 1 1 320px; }
#cookie-banner a { color: var(--gold2); }
#cookie-banner .cookie-actions { display: flex; gap: 10px; flex-wrap: wrap; }
#cookie-banner .btn { padding: 8px 20px; font-size: .8rem; }
