/* Wikiclash — Profil (README §5.4). */
.lnk { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--link); cursor: pointer; white-space: nowrap; }
.lnk:hover { text-decoration: underline; }
.lnk.err { color: var(--err); }
.lnk:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.pf-main { display: grid; grid-template-rows: auto auto minmax(0, 1fr); padding: clamp(14px, 3vh, 28px) var(--pad-x) 0; position: relative; }
.pf-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--ln); }
.pf-top .wc-tabs { border-bottom: 0; }
.pf-top .wc-tabs button { font-size: 14px; padding: 7px 16px; }
.pf-top .lnk { padding: 7px 0; }
.pf-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; background: var(--sel); border: 1px solid var(--sel2); padding: 8px 12px; font-size: 13px; color: var(--ink); }
.pf-banner[hidden] { display: none; }
.pf-pane { min-height: 0; transition: opacity 160ms ease; }
.pf-pane.out { opacity: 0; }
.pf-toast { position: absolute; left: var(--pad-x); bottom: 8px; pointer-events: none; }

/* vitrines */
.pf-vits { display: grid; grid-template-columns: minmax(0, 1fr) clamp(210px, 22vw, 290px); gap: clamp(24px, 3vw, 48px); height: 100%; min-height: 0; }
.pf-scroll { display: flex; flex-direction: column; gap: clamp(12px, 2.6vh, 24px); min-height: 0; padding: clamp(12px, 2.6vh, 24px) 0 16px; }
.pf-scroll > div { display: flex; flex-direction: column; gap: clamp(14px, 3vh, 28px); }
.pf-h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 4.6vh, 40px); line-height: 1.1; border-bottom: 1px solid var(--ln); padding-bottom: 6px; overflow-wrap: anywhere; }
.pf-h1 span { color: var(--mut); }
.pf-vit { display: flex; flex-direction: column; gap: 10px; }
.pf-vit .hd { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--bg3); padding-bottom: 4px; }
.pf-ttl { font-family: var(--serif); font-size: clamp(18px, 3vh, 24px); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; border: 0; background: none; padding: 0; text-align: left; }
button.pf-ttl { cursor: pointer; }
button.pf-ttl:hover { color: var(--link); }
button.pf-ttl:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.pf-ttl-in { flex: 1; min-width: 0; font-family: var(--serif); font-size: 22px; padding: 2px 6px; }
.pf-vit .mt { display: flex; gap: 14px; align-items: baseline; font-size: 12px; color: var(--mut); white-space: nowrap; }
.pf-vit .mt button { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; }
.pf-vit .mt button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.pf-vit .mt .del { color: var(--err); }
.pf-grid { --sw: clamp(72px, 13.5vh, 128px); display: grid; grid-template-columns: repeat(auto-fill, var(--sw)); gap: clamp(8px, 1vw, 14px); }
.pf-slot { position: relative; width: var(--sw); aspect-ratio: 5 / 7; transition: transform 200ms ease; }
.pf-slot .wcard { width: 100%; }
.pf-slot.ed { cursor: pointer; }
.pf-slot.ed:hover, .pf-slot.ed:focus-visible { transform: translateY(-2px); outline: none; }
.pf-slot.ed:focus-visible .wc-in { outline: 2px solid var(--link); outline-offset: 2px; }
.pf-slot .x { position: absolute; top: -7px; right: -7px; z-index: 4; width: 18px; height: 18px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--err); color: var(--err); font-size: 13px; line-height: 1; opacity: 0; transition: opacity 140ms ease; }
.pf-slot.ed:hover .x, .pf-slot.ed:focus-visible .x { opacity: 1; }
.pf-add { display: grid; place-items: center; background: var(--bg2); border: 1px dashed var(--ln2); cursor: pointer; color: var(--ln); font-size: 24px; }
.pf-add:hover { border-color: var(--link); color: var(--link); transform: translateY(-2px); }
.pf-add:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.pf-empty, .pf-none { font-size: 14px; color: var(--sub); font-style: italic; margin: 0; grid-column: 1 / -1; }
.pf-new { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border: 1px dashed var(--ln); padding: 12px 16px; }
.pf-new .nw { border: 0; background: none; padding: 0; font-family: var(--serif); font-size: 20px; color: var(--link); cursor: pointer; }
.pf-new .sg { display: flex; gap: 12px; align-items: baseline; font-size: 13px; color: var(--mut); flex-wrap: wrap; }
.pf-new .sg button { border: 0; background: none; padding: 0; font: inherit; color: var(--link); cursor: pointer; }
.pf-new button:hover { text-decoration: underline; }
.pf-new button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* infobox du joueur */
.pf-box { display: flex; flex-direction: column; gap: 8px; align-self: start; max-height: 100%; margin: clamp(12px, 2.6vh, 24px) 0 16px; border: 1px solid var(--ln); background: var(--bg2); padding: 10px; font-size: 13px; }
.pf-box .nm { font-family: var(--serif); font-size: 20px; text-align: center; font-weight: 600; overflow-wrap: anywhere; }
.pf-box .av, .pf-photo .av { display: flex; align-items: center; justify-content: center; overflow: hidden; background: repeating-linear-gradient(135deg, var(--bg) 0 10px, var(--bg3) 10px 11px); border: 1px solid var(--bg3); }
.pf-box .av { aspect-ratio: 1 / 1; width: 100%; max-height: clamp(90px, 24vh, 240px); align-self: center; max-width: clamp(90px, 24vh, 240px); }
.pf-box .av img, .pf-photo .av img { width: 100%; height: 100%; object-fit: cover; }
.pf-box .av span { font-family: var(--serif); font-size: 56px; color: var(--ln); }
.pf-box .since { font-size: 12px; color: var(--sub); text-align: center; }

/* choix de carte */
.pf-ovl .wc-box { width: min(820px, 90vw); max-width: none; max-height: 84vh; padding: 18px 20px; }
.pf-pk { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.pf-pk .hd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ln); padding-bottom: 8px; }
.pf-pk .hd h2 { border: 0; padding: 0; font-size: 24px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; overflow-y: auto; min-height: 0; max-height: calc(84vh - 140px); padding: 6px 4px; }
.pf-pc { cursor: pointer; transition: transform 160ms ease; outline: none; }
.pf-pc .wcard { width: 100%; }
.pf-pc:hover, .pf-pc:focus-visible { transform: translateY(-3px); }
.pf-pc:hover .wc-in, .pf-pc:focus-visible .wc-in { outline: 2px solid var(--link); outline-offset: 2px; }

/* compte */
.pf-acc { display: flex; flex-direction: column; gap: clamp(12px, 2.4vh, 22px); height: 100%; overflow-y: auto; scrollbar-width: none; padding: clamp(12px, 2.6vh, 24px) 0 16px; }
.pf-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: clamp(20px, 3vw, 48px); max-width: 960px; }
.pf-col { display: flex; flex-direction: column; gap: clamp(8px, 1.8vh, 14px); }
.pf-h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 24px; border-bottom: 1px solid var(--ln); padding-bottom: 4px; }
.pf-photo { display: flex; align-items: center; gap: 16px; }
.pf-photo .av { width: clamp(56px, 10vh, 72px); height: clamp(56px, 10vh, 72px); flex: none; border-color: var(--ln); }
.pf-photo .av span { font-family: var(--serif); font-size: 32px; color: var(--ln); }
.pf-photo .pc { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pf-photo label.btn { font-size: 13px; padding: 5px 12px; cursor: pointer; }
.pf-photo label.btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.pf-f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
.pf-f[hidden] { display: none; }
.pf-f .wc-input { font-weight: 400; padding: 6px 8px; }
.pf-f .wc-input:disabled { background: var(--bg2); color: var(--mut); }
.pf-f .wc-input.bad { border-color: var(--err); }
.pf-f .hl { font-weight: 400; font-size: 12px; color: var(--mut); }
.pf-pw { display: flex; flex-direction: column; gap: 6px; }
.pf-pw[hidden] { display: none; }
.pf-pw .bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.pf-pw .bars i { height: 3px; background: var(--bg3); transition: background 200ms ease; }
.pf-pw .rl { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; flex-wrap: wrap; }
.pf-pw .rl div { display: flex; gap: 12px; }
.pf-save { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 960px; border-top: 1px solid var(--bg3); padding-top: 14px; }
.pf-save .btn { padding: 7px 16px; }
.pf-save .sp { flex: 1; }
.pf-save .lnk[hidden] { display: none; }
.nt { font-size: 12px; color: var(--mut); }
.pf-save .nt { font-size: 13px; }
.nt.ok { color: var(--ok); }
.nt.err { color: var(--err); }

/* petites hauteurs : la barre d'enregistrement passe sous la colonne Profil pour rester visible */
@media (max-height: 640px) and (min-width: 700px) {
  .pf-acc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto 1fr; column-gap: clamp(20px, 3vw, 48px); row-gap: 14px; align-content: start; max-width: 960px; }
  .pf-cols { display: contents; }
  .pf-col:first-child { grid-column: 1; grid-row: 1; }
  .pf-col:last-child { grid-column: 2; grid-row: 1 / 3; }
  .pf-save { grid-column: 1; grid-row: 2; align-self: start; }
  .pf-save .sp { flex-basis: 100%; height: 0; }
  .pf-col { gap: 8px; }
}

/* recadrage de la photo */
.pf-cropovl .wc-box { max-width: min(640px, 100%); }
.pf-crop { display: flex; gap: 20px; align-items: flex-start; }
.pf-crop .stage { position: relative; flex: none; width: min(var(--v), 52vh); aspect-ratio: 1; overflow: hidden; cursor: grab; touch-action: none; background: repeating-linear-gradient(135deg, var(--bg) 0 10px, var(--bg3) 10px 11px); outline: 1px solid var(--ln); }
.pf-crop .stage.drag { cursor: grabbing; }
.pf-crop .stage:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* l'image est placée en pixels du cadre de 300 px ; le cadre affiché peut être plus petit : on met à l'échelle */
.pf-crop .stage img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; user-select: none; pointer-events: none; scale: calc(min(var(--v), 52vh) / var(--v)); translate: 0 0; }
.pf-crop .stage .grid { position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(to right, transparent calc(33.33% - .5px), rgba(var(--ovr), .55) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(var(--ovr), .55) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
  linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(var(--ovr), .55) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(var(--ovr), .55) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px));
  box-shadow: inset 0 0 0 2px var(--link); opacity: 0; transition: opacity 160ms ease; }
.pf-crop .stage:hover .grid, .pf-crop .stage.drag .grid, .pf-crop .stage:focus-visible .grid { opacity: 1; }
.pf-crop .side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pf-crop .pv { width: 96px; height: 96px; border: 1px solid var(--ln); overflow: hidden; }
.pf-crop .pv canvas { width: 100%; height: 100%; display: block; }
.pf-crop .zm { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--sub); }
.pf-crop .zm input { width: 100%; accent-color: var(--link); }
.pf-crop p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--mut); }
.pf-crop .lnk { align-self: flex-start; }

/* profil d'un autre joueur */
.jr-main { grid-template-rows: minmax(0, 1fr); }
.jr-pres { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--sub); }
.jr-pres i { width: 8px; height: 8px; border-radius: 50%; }
.jr-act { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.jr-act .btn { font-size: 13px; padding: 5px 12px; }
.jr-err { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding-top: 24px; }
