/* Panell d'usuari — estil "Perfil de jugador" (maqueta del client, especificació 06/10).
   Només es carrega a /panel; retoca barra lateral, capçalera i targetes del perfil. */

:root {
  --pf-gold: #b98a3e;
  --pf-gold2: #e0c88f;
  --pf-line: rgba(185, 138, 62, .45);
  --pf-card: rgba(12, 8, 6, .82);
  --pf-red: #8a1020;
}

#app-screen { background: radial-gradient(ellipse at 80% -10%, rgba(120, 30, 20, .22), transparent 55%), #070504; }

/* ───── Barra lateral ───── */
#app-screen .sidebar {
  width: 248px; padding: 18px 0 0;
  background:
    linear-gradient(180deg, rgba(7, 5, 4, .97) 0%, rgba(7, 5, 4, .92) 55%, rgba(7, 5, 4, .55) 100%),
    url('/static/img/panel/lampada.webp?v=1') left bottom / auto 300px no-repeat,
    #090604;
  border-right: 1px solid var(--pf-line);
  box-shadow: inset -6px 0 14px rgba(0, 0, 0, .5);
}
#app-screen .sidebar-section:first-child { padding: 0 12px; display: flex; flex-direction: column; gap: 4px; }
#app-screen .sidebar-lbl { display: none; }
#app-screen .sidebar-btn {
  border: 1px solid transparent; border-left-width: 1px; border-radius: 3px;
  padding: 12px 14px; font-size: 1.02rem; color: var(--pf-gold2); gap: 13px;
  background: rgba(255, 255, 255, .01);
  border-bottom: 1px solid rgba(185, 138, 62, .12);
}
#app-screen .sidebar-btn .sico { width: 24px; font-size: 1.15rem; filter: sepia(.6) saturate(1.6) hue-rotate(-10deg) brightness(1.05); }
#app-screen .sidebar-btn:hover { background: rgba(185, 138, 62, .08); color: var(--white); }
#app-screen .sidebar-btn.active {
  color: var(--white); border-color: rgba(185, 138, 62, .55);
  background: linear-gradient(90deg, rgba(138, 16, 32, .55), rgba(60, 10, 14, .35));
  box-shadow: 0 0 14px rgba(138, 16, 32, .35), inset 0 0 0 1px rgba(0, 0, 0, .4);
}
#app-screen .sidebar #sidebar-admin-btn { padding: 0 12px; margin-top: 10px; }

/* ───── Capçalera ───── */
.pf-head {
  position: relative; margin: -28px -32px 22px; padding: 34px 32px 30px; min-height: 230px;
  display: flex; flex-direction: column; justify-content: center;
  /* la imatge ocupa tot el fons de la part superior i es difumina cap a l'esquerra i cap avall */
  background:
    linear-gradient(90deg, #070504 0%, rgba(7, 5, 4, .82) 30%, rgba(7, 5, 4, .25) 65%, rgba(7, 5, 4, .05) 100%),
    linear-gradient(0deg, #070504 0%, rgba(7, 5, 4, .6) 22%, rgba(7, 5, 4, 0) 55%),
    var(--hb, url('/static/img/panel/bodegon.webp?v=1')) var(--hp, center 40%) / cover no-repeat;
}
@media (max-width: 640px) { .pf-head { margin: -16px -16px 18px; padding: 24px 16px 22px; } }
.pf-head--sm { min-height: 170px; }
.pf-head--sm .page-sub { font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .14em; font-size: clamp(.68rem, 1.7vw, .85rem); color: var(--text2); margin-bottom: 0; text-shadow: 0 1px 8px #000; }
.pf-head--sm .page-title { font-size: clamp(1.5rem, 3.6vw, 2.2rem); }
.pf-head .page-title {
  font-family: 'Cinzel', serif; font-weight: 700; text-transform: uppercase;
  font-size: clamp(1.7rem, 4.4vw, 2.8rem); letter-spacing: .04em; color: var(--pf-gold2); margin-bottom: 2px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .8);
}
.pf-kicker { font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .14em; font-size: clamp(.7rem, 1.8vw, .9rem); color: var(--text2); margin-bottom: 16px; }
.pf-welcome { max-width: 520px; line-height: 1.5; font-size: .95rem; color: var(--text2); text-shadow: 0 1px 8px #000; }
.pf-welcome strong { font-size: 1.1rem; color: var(--white); }

/* ───── Quadrícula de targetes ───── */
.pf-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.pf-member { grid-column: span 7; }
.pf-visit  { grid-column: span 5; }
.pf-exp    { grid-column: span 8; }
.pf-lives  { grid-column: span 4; }
.pf-inv    { grid-column: span 6; }
.pf-friends{ grid-column: span 6; }
.pf-tile   { grid-column: span 4; }
@media (max-width: 1100px) {
  .pf-member, .pf-visit, .pf-exp, .pf-lives, .pf-inv, .pf-friends { grid-column: span 12; }
  .pf-tile { grid-column: span 12; }
}
@media (min-width: 700px) and (max-width: 1100px) { .pf-tile { grid-column: span 4; } .pf-exp { grid-column: span 8; } .pf-lives { grid-column: span 4; } }

.pf-card {
  position: relative; padding: 16px 18px 18px; min-width: 0;
  background: var(--pf-card);
  border: 1px solid rgba(138, 80, 30, .7);
  box-shadow: inset 0 0 0 4px #0a0705, inset 0 0 0 5px rgba(185, 138, 62, .28), 0 10px 28px rgba(0, 0, 0, .5);
}
/* cantonades daurades */
.pf-card::before, .pf-tile::before {
  content: ''; position: absolute; inset: 3px; pointer-events: none;
  --c: var(--pf-gold);
  background:
    linear-gradient(var(--c), var(--c)) top left / 14px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 2px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 14px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 2px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 14px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 2px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 14px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 2px 14px no-repeat;
}
.pf-card-title {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--text2);
}
.pf-ico { color: var(--pf-gold); font-size: 1rem; filter: sepia(.5) saturate(1.5); }

/* Fitxa de membre */
.pf-member-body { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.pf-avatar-wrap { position: relative; flex: none; }
.pf-avatar { width: 112px; height: 112px; font-size: 3.4rem; border: 3px solid var(--pf-gold); box-shadow: 0 0 0 5px #0a0705, 0 0 0 6px rgba(185, 138, 62, .5), 0 0 22px rgba(138, 16, 32, .6); }
.pf-cam {
  position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%;
  background: #120c08; border: 2px solid var(--pf-gold); color: var(--pf-gold2); cursor: pointer; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}
.pf-cam:hover { background: var(--pf-red); }
.pf-member-info { min-width: 0; }
.pf-name { font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .06em; font-size: clamp(1.15rem, 2.6vw, 1.7rem); color: var(--white); margin: 0 0 8px; overflow-wrap: anywhere; }
.pf-lbl { font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .14em; font-size: .6rem; color: var(--text-dim); }
.pf-member-info .alias { color: var(--pf-gold2); font-size: 1.05rem; font-style: normal; margin: 1px 0 8px; }
.pf-mail { color: var(--text-dim); font-size: .82rem; margin-bottom: 8px; overflow-wrap: anywhere; }

/* Dia de visita */
.pf-visit { background-image: linear-gradient(90deg, rgba(8, 5, 4, .92), rgba(8, 5, 4, .35)), url('/static/img/panel/castell.webp?v=1'); background-size: cover; background-position: center; }
.pf-visit-body { text-align: center; padding: 4px 0 2px; margin-left: 38%; }
.pf-visit-wd { font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .26em; font-size: .85rem; color: var(--text2); }
.pf-visit-day { font-family: 'Cinzel', serif; font-size: clamp(3rem, 6vw, 4.4rem); line-height: 1.05; color: var(--white); text-shadow: 0 2px 16px #000; }
.pf-visit-my { font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .2em; font-size: .78rem; color: var(--text2); }
.pf-visit-note { margin-top: 10px; font-size: .74rem; color: var(--text-dim); }
.pf-visit-none { font-family: 'Cinzel', serif; letter-spacing: .08em; color: var(--text2); margin: 14px 0 12px; }
@media (max-width: 600px) { .pf-visit-body { margin-left: 0; } .pf-visit { background-image: linear-gradient(rgba(8, 5, 4, .78), rgba(8, 5, 4, .78)), url('/static/img/panel/castell.webp?v=1'); } }

/* Experiències realitzades */
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.pf-stat { text-align: center; padding: 2px 10px; position: relative; }
.pf-stat + .pf-stat::before { content: ''; position: absolute; left: 0; top: 8%; bottom: 8%; width: 1px; background: linear-gradient(transparent, var(--pf-line), transparent); }
.pf-stat img { display: block; margin: 0 auto 6px; width: 64px; height: 64px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .7)); }
.pf-stat-lbl { font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .14em; font-size: .62rem; color: var(--text2); }
.pf-stat-val { font-family: 'Cinzel', serif; font-size: 1.7rem; line-height: 1.3; color: var(--white); }
.pf-stat.st .pf-stat-val { color: #ff6b6b; }
.pf-stat.si .pf-stat-val { color: #cf9bff; }
.pf-bar { height: 5px; background: rgba(255, 255, 255, .1); margin: 4px auto 0; max-width: 130px; border-radius: 3px; overflow: hidden; }
.pf-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8a6a2c, #f0dca4); transition: width .7s ease; border-radius: 3px; }
.pf-stat.st .pf-bar i { background: linear-gradient(90deg, #8a1020, #ff4d5d); }
.pf-stat.si .pf-bar i { background: linear-gradient(90deg, #6a3ba8, #d9a8ff); }
@media (max-width: 480px) { .pf-stat { padding: 2px 4px; } .pf-stat-lbl { letter-spacing: .06em; font-size: .56rem; } .pf-stat img { width: 42px; height: 42px; } }

/* Vides */
.pf-hearts { display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: center; align-items: center; min-height: 64px; }
.pf-heart { font-size: 2.6rem; line-height: 1; color: #c1121f; text-shadow: 0 0 14px rgba(255, 40, 60, .55), 0 2px 0 #4a0508; }
.pf-heart.off { color: #3a3a3a; text-shadow: none; }
.pf-heart-n { font-family: 'Cinzel', serif; font-size: 1.2rem; color: var(--text2); }

/* Invitacions */
.pf-inv-body { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pf-carta { width: 138px; height: auto; border: 1px solid rgba(185, 138, 62, .4); flex: none; filter: drop-shadow(0 4px 8px #000); }
.pf-inv-text { color: var(--text2); line-height: 1.45; margin-bottom: 2px; }
.pf-inv-share { color: var(--text-dim); font-size: .88rem; margin-bottom: 10px; }
.pf-btn {
  background: rgba(0, 0, 0, .35); border: 1px solid var(--pf-gold); color: var(--pf-gold2); cursor: pointer;
  font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; padding: 10px 16px; transition: all .2s;
}
.pf-btn:hover { background: var(--pf-red); color: var(--white); border-color: var(--pf-gold2); }

/* Amics */
.pf-friends-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.pf-friend { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: none; color: var(--text2); font-family: 'Crimson Pro', serif; font-size: .88rem; max-width: 84px; text-align: center; }
.pf-friend span { overflow-wrap: anywhere; line-height: 1.15; }
.pf-friend .friend-ava { width: 58px; height: 58px; border: 2px solid var(--pf-gold); box-shadow: 0 0 0 3px #0a0705, 0 0 12px rgba(138, 16, 32, .5); }
.pf-add { cursor: pointer; text-transform: uppercase; font-size: .62rem; letter-spacing: .08em; font-family: 'Cinzel', serif; color: var(--text-dim); }
.pf-add .friend-ava { background: transparent; color: var(--pf-gold2); font-size: 1.8rem; display: flex; align-items: center; justify-content: center; }
.pf-add:hover .friend-ava { background: var(--pf-red); }

/* Targetes inferiors (Mapa / Botiga / Configuració) */
.pf-tile {
  position: relative; min-height: 118px; padding: 14px 16px; text-align: left; cursor: pointer; overflow: hidden;
  border: 1px solid rgba(138, 80, 30, .7); color: var(--text2);
  background: linear-gradient(90deg, rgba(7, 5, 4, .9) 10%, rgba(7, 5, 4, .35) 100%), var(--bg) center / cover no-repeat, #0c0805;
  box-shadow: inset 0 0 0 4px #0a0705, inset 0 0 0 5px rgba(185, 138, 62, .28), 0 10px 28px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; justify-content: space-between; transition: transform .2s, box-shadow .2s;
  font-family: 'Crimson Pro', serif;
}
.pf-tile:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 4px #0a0705, inset 0 0 0 5px rgba(224, 200, 143, .5), 0 14px 32px rgba(0, 0, 0, .6); }
.pf-tile-t { display: flex; align-items: center; gap: 10px; font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; }
.pf-tile-t b { font-weight: 600; }
.pf-tile-s { font-size: .95rem; text-shadow: 0 1px 6px #000; max-width: 70%; }

/* Targetes generals del panell: mateix marc daurat */
#app-screen .card { background: var(--pf-card); border-color: rgba(138, 80, 30, .6); box-shadow: inset 0 0 0 3px #0a0705, inset 0 0 0 4px rgba(185, 138, 62, .2); }
#app-screen .card-title { font-family: 'Cinzel', serif; letter-spacing: .12em; color: var(--text2); border-bottom-color: rgba(185, 138, 62, .25); }
#app-screen .page-title { font-family: 'Cinzel', serif; text-transform: uppercase; letter-spacing: .05em; color: var(--pf-gold2); }

.friend-item { flex-wrap: wrap; }
.friend-stats { display: flex; gap: 14px; align-items: center; font-family: 'Cinzel', serif; font-size: .9rem; color: var(--text2); flex-wrap: wrap; justify-content: flex-end; }
.friend-stats .stat-badge { width: 28px; height: 28px; margin-right: 5px; vertical-align: middle; }
.friend-heart { color: #c1121f; margin-right: 5px; font-size: 1.1rem; }

/* Enllaços legals al peu de la barra lateral */
#app-screen .sidebar { display: flex; flex-direction: column; }
.sidebar-legal { margin-top: auto; padding: 22px 16px 16px; display: flex; flex-wrap: wrap; gap: 4px 12px; background: linear-gradient(0deg, rgba(7, 5, 4, .92) 30%, rgba(7, 5, 4, 0)); }
.sidebar-legal a { font-family: 'Cinzel', serif; font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); text-decoration: none; }
.sidebar-legal a:hover { color: var(--pf-gold2); text-decoration: underline; }

/* a dins del panell el botó principal no ocupa tota l'amplada */
#app-screen .btn-primary { width: auto; min-width: 220px; padding: 11px 30px; }
.sidebar-legal { padding-bottom: 28px; }

/* ── Configuració: selector d'avatar (vermell vi + vora daurada) ─────────── */
.avatar-unified-wrap {
  background: linear-gradient(180deg, rgba(20, 12, 16, .9), rgba(12, 8, 10, .95));
  border: 1px solid rgba(185, 138, 62, .45); border-radius: 2px;
  padding: 18px; box-shadow: inset 0 0 0 3px rgba(10, 6, 4, .55);
}
.avatar-sect-lbl {
  display: flex; align-items: baseline; gap: 10px;
  font-size: .7rem; letter-spacing: .2em; color: var(--pf-gold2); margin-bottom: 12px;
}
.avatar-sect-lbl::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(185, 138, 62, .45), transparent); }
.avatar-sect-lbl #photos-count-lbl { order: 2; margin: 0 !important; letter-spacing: .08em; color: var(--text-dim); }
.avatar-opts-grid { gap: 12px; min-height: 56px; }
.avatar-opt-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid rgba(185, 138, 62, .3); background: #120c10;
  transition: border-color .15s, transform .15s, box-shadow .15s, filter .15s;
  filter: saturate(.85) brightness(.9);
}
.avatar-opt-btn:hover { border-color: var(--pf-gold2); transform: translateY(-2px) scale(1.06); filter: none; }
.avatar-opt-btn:focus-visible { outline: 2px solid var(--pf-gold2); outline-offset: 3px; }
.avatar-opt-btn.selected {
  border-color: var(--pf-gold2); filter: none;
  box-shadow: 0 0 0 3px rgba(110, 20, 36, .9), 0 0 14px rgba(185, 138, 62, .55);
}
.btn-del-photo {
  top: -4px; right: -4px; width: 20px; height: 20px; z-index: 1;
  background: linear-gradient(180deg, #8a1a30, #4a0b17); border: 1px solid var(--pf-gold); color: var(--pf-gold2);
}
.btn-del-photo:hover { background: #a3203a; color: #fff; }
.foto-upload-label {
  border: 1px solid rgba(185, 138, 62, .45); border-radius: 2px; background: #120c10; margin-top: 16px !important;
  transition: border-color .15s;
}
.foto-upload-label:hover { border-color: var(--pf-gold2); }
.foto-upload-label::before {
  content: attr(data-browse);
  background: linear-gradient(180deg, #6e1424, #4a0b17); color: var(--pf-gold2);
  border-right: 1px solid rgba(185, 138, 62, .45);
  letter-spacing: .14em; text-transform: uppercase; font-size: .7rem; padding: 10px 16px;
}
.foto-upload-label span { padding: 10px 14px; }
.avatar-unified-wrap .btn-gold { margin-top: 12px !important; letter-spacing: .14em; text-transform: uppercase; }
.avatar-unified-wrap .btn-gold:disabled { opacity: .45; cursor: not-allowed; }
.sidebar-credit { flex-basis: 100%; margin-top: 8px; font-size: .62rem; line-height: 1.5; color: var(--text-dim); }
.sidebar-credit a { color: var(--text2); text-decoration: none; }
.sidebar-credit a:hover { color: var(--pf-gold2); text-decoration: underline; }
