:root {
  --c1: #a3adb6;
  --c2: #3fbf6f;
  --c3: #3d93ef;
  --c4: #b45cf0;
  --c5: #f0be36;
  --panel: rgba(14, 18, 30, 0.88);
  --panel2: rgba(24, 30, 48, 0.92);
  --line: rgba(214, 178, 100, 0.55);
  --gold: #f3c652;
  --text: #eef0f6;
  --muted: #9aa3b8;
  --red: #e2493b;
  --orange: #f08a24;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0f18; color: var(--text); font-family: Inter, system-ui, sans-serif; user-select: none; }
canvas#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#overlay { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ menu */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; gap: 28px; background: radial-gradient(ellipse at 50% 30%, rgba(240, 138, 36, 0.18), transparent 60%), linear-gradient(180deg, rgba(8, 10, 18, 0.05), rgba(8, 10, 18, 0.6)); flex-wrap: wrap; padding: 16px; }
.menu-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px 26px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.logo { font-family: Bangers, Inter, sans-serif; font-size: clamp(38px, 8vw, 64px); letter-spacing: 2px; margin: 0; line-height: 1; color: var(--orange); text-shadow: 0 3px 0 #7a2f00, 0 6px 18px rgba(240, 138, 36, 0.45); text-align: center; }
.logo span { color: #fff; text-shadow: 0 3px 0 #1d3f8a, 0 6px 18px rgba(80, 140, 255, 0.4); }
.tagline { text-align: center; color: var(--muted); margin: 6px 0 20px; letter-spacing: 1px; }
.field { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
input { width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.06); color: var(--text); font: inherit; font-size: 15px; outline: none; }
input:focus { border-color: var(--gold); }
.btn { padding: 10px 14px; border-radius: 9px; border: 1px solid var(--line); background: linear-gradient(180deg, #2a3350, #1a2036); color: var(--text); font-weight: 600; cursor: pointer; transition: transform 0.08s, filter 0.15s; }
.btn:hover { filter: brightness(1.25); }
.btn:active { transform: translateY(1px); }
.btn.big { width: 100%; padding: 14px; font-size: 17px; background: linear-gradient(180deg, #f39a3a, #c4621a); border-color: #ffcf86; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn.big small { display: block; font-weight: 400; font-size: 12px; opacity: 0.9; }
.seg { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.seg span { margin-right: auto; }
.seg button { width: 44px; padding: 6px 0; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.05); color: var(--text); font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--gold); color: #2a1a00; border-color: var(--gold); }
.row { display: flex; gap: 8px; align-items: center; }
.row input { margin: 0; width: 84px; text-align: center; text-transform: uppercase; letter-spacing: 3px; }
.row .btn { flex: 1; }
.sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 18px 0 12px; }
.sep::before, .sep::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, 0.12); }
.error { color: #ff8a7a; min-height: 18px; font-size: 13px; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 13px; }
#lobby h2 { margin: 0 0 6px; font-family: Bangers, Inter; letter-spacing: 1px; font-size: 32px; }
#lobby-code { color: var(--gold); letter-spacing: 4px; }
#lobby-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 6px; }
#lobby-list li { padding: 8px 12px; background: rgba(255, 255, 255, 0.05); border-radius: 8px; display: flex; justify-content: space-between; }
#lobby-list li.bot { color: var(--muted); font-style: italic; }

/* ------------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud > #feed, #hud > #banner, #hud > #viewing { pointer-events: none; }

#top { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
#round { display: flex; gap: 4px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; font-weight: 800; font-size: 13px; }
#round .stage { color: var(--gold); margin-right: 6px; }
#round .r { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: rgba(255, 255, 255, 0.08); color: var(--muted); border: 1px solid transparent; }
#round .r.pvp { color: #ffb4a8; }
#round .r.pve { color: #b6f0a5; }
#round .r.carousel { color: #a8d0ff; }
#round .r.cur { border-color: var(--gold); background: rgba(243, 198, 82, 0.2); color: #fff; }
#round .r.done { opacity: 0.4; }
#phase { display: flex; flex-direction: column; align-items: center; gap: 3px; }
#phase-name { font-family: Bangers, Inter; letter-spacing: 1.5px; font-size: 20px; text-shadow: 0 2px 6px #000; }
#timer { width: 240px; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
#phase .ready { margin-top: 4px; padding: 3px 14px; border-radius: 12px; border: 1px solid #9be26a; background: rgba(40, 110, 50, 0.85); color: #fff; font-weight: 700; font-size: 12px; cursor: pointer; }
#phase .ready.on { background: rgba(40, 110, 50, 0.35); border-color: rgba(155, 226, 106, 0.4); cursor: default; }
#timer-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--gold)); width: 100%; transition: width 0.2s linear; }

/* synergies */
#traits { position: absolute; left: 10px; top: 70px; width: 210px; max-height: calc(100vh - 330px); overflow-y: auto; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.trait { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 8px; padding: 4px 8px 4px 4px; border: 1px solid rgba(255, 255, 255, 0.06); cursor: default; }
.trait.off { opacity: 0.55; }
.trait .hex { width: 34px; height: 38px; flex: none; display: grid; place-items: center; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: #2b3043; font-size: 17px; font-weight: 800; color: #9aa3b8; font-family: 'Yu Gothic', 'MS Gothic', 'Noto Sans JP', sans-serif; }
.trait.l1 .hex { background: linear-gradient(160deg, #c58a52, #7c4a22); color: #fff; }
.trait.l2 .hex { background: linear-gradient(160deg, #d8dee8, #8790a0); color: #1d2333; }
.trait.l3 .hex, .trait.l4 .hex { background: linear-gradient(160deg, #ffe08a, #c99316); color: #3a2600; }
.trait.unique .hex { background: linear-gradient(160deg, #ff9de0, #9a3dd0); color: #fff; }
.trait .tname { font-weight: 700; font-size: 13px; }
.trait .tsteps { font-size: 11px; color: var(--muted); letter-spacing: 0.5px; }
.trait .tsteps b { color: #fff; }
.trait .tcount { margin-left: auto; font-weight: 800; font-size: 14px; color: var(--muted); }
.trait:not(.off) .tcount { color: #fff; }

/* joueurs */
#players { position: absolute; right: 10px; top: 70px; display: flex; flex-direction: column; gap: 6px; width: 236px; }
.pl { display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 30px 10px 10px 30px; padding: 5px 10px 5px 5px; cursor: pointer; transition: transform 0.12s, border-color 0.12s; position: relative; }
.pl:hover { transform: translateX(-4px); border-color: var(--line); }
.pl.me { border-color: rgba(243, 198, 82, 0.7); }
.pl.viewed { box-shadow: 0 0 0 2px #6fb6ff inset; }
.pl.dead { opacity: 0.35; filter: grayscale(1); }
.pl .av { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 16px; background: radial-gradient(circle at 35% 30%, #ffb35c, #d06414); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); border: 2px solid rgba(255, 255, 255, 0.35); overflow: hidden; }
.pl .av img { width: 100%; height: 100%; object-fit: cover; }
.pl .info { flex: 1; min-width: 0; }
.pl .pname { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .pname small { color: var(--muted); font-weight: 400; }
.pl .hpbar { height: 11px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.18); overflow: hidden; margin-top: 4px; }
.pl .hpbar div { height: 100%; background: linear-gradient(180deg, #8af08a, #3cb455); box-shadow: 0 0 6px rgba(110, 230, 120, 0.5); transition: width 0.6s ease-out; }
.pl .hpbar.mid div { background: linear-gradient(180deg, #ffe07a, #e0a92a); box-shadow: 0 0 6px rgba(255, 210, 90, 0.5); }
.pl .hpbar.low div { background: linear-gradient(180deg, #ff8a7a, #d8392c); box-shadow: 0 0 6px rgba(255, 90, 70, 0.6); }
.pl .hpn { font-weight: 900; font-size: 19px; width: 34px; text-align: right; text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6); }
/* carrousel : rang de libération (vert quand le joueur est libre) */
.pl .ordre { position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 14px; color: #1a1d2a; background: linear-gradient(180deg, #ffe7a0, #f0b030); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); z-index: 2; }
.pl .ordre.libre { background: linear-gradient(180deg, #a8f0b0, #3cb455); }
.pl .res { position: absolute; left: -8px; top: -4px; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 6px; }
.pl .res.win { background: #2f9e55; }
.pl .res.loss { background: #b3392c; }
.pl .lvl { position: absolute; left: 32px; bottom: -2px; font-size: 10px; background: #1d2440; border: 1px solid var(--line); border-radius: 6px; padding: 0 4px; }

/* objets */
#itembench { position: absolute; left: 10px; bottom: 150px; display: grid; grid-template-columns: repeat(2, 40px); gap: 5px; }
.item { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: 17px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; border: 2px solid rgba(255, 255, 255, 0.35); cursor: grab; font-family: 'Yu Gothic', 'MS Gothic', sans-serif; position: relative; }
.item.combined { border-color: var(--gold); font-size: 13px; }
.item:active { cursor: grabbing; }
.item.ghost { position: fixed; pointer-events: none; z-index: 50; transform: translate(-50%, -50%) scale(1.1); }

/* feed */
#feed { position: absolute; left: 230px; bottom: 150px; width: 300px; display: flex; flex-direction: column-reverse; gap: 3px; font-size: 12px; }
#feed div { background: rgba(0, 0, 0, 0.45); padding: 3px 8px; border-radius: 6px; animation: fadeout 7s forwards; width: fit-content; }
@keyframes fadeout { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* barre du bas */
#bottom { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
#econ { display: flex; gap: 10px; align-items: center; margin-bottom: -2px; }
#gold { background: var(--panel); border: 1px solid var(--line); border-bottom: none; border-radius: 12px 12px 0 0; padding: 4px 16px 2px; display: flex; align-items: center; gap: 6px; font-size: 20px; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #e3a417 60%, #9a6a05); box-shadow: 0 0 6px rgba(243, 198, 82, 0.6); display: inline-block; }
/* bulle de l'économie */
.eco { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.eco small { display: block; color: #9aa4b8; font-size: 11px; }
.eco b { color: #ffd24a; }
.eco.total { border-bottom: none; font-weight: 800; margin-top: 3px; }
#gold { cursor: help; }
/* compteur de persos au centre du plateau (préparation) */
.capcentre { position: absolute; transform: translate(-50%, -50%); pointer-events: none; font-family: Bangers, Inter; font-size: 30px; letter-spacing: 1px; color: rgba(255, 255, 255, 0.75); text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7); }
.capcentre b { font-size: 38px; color: #fff; }
.capcentre.manque { color: rgba(255, 190, 90, 0.9); animation: capPulse2 1.2s ease-in-out infinite; }
.capcentre.manque b { color: #ffc35a; }
@keyframes capPulse2 { 50% { transform: translate(-50%, -50%) scale(1.08); } }
/* persos sur le plateau / maximum */
#cap { background: var(--panel); border: 1px solid var(--line); border-bottom: none; border-radius: 12px 12px 0 0; padding: 4px 12px 2px; display: flex; align-items: center; gap: 4px; font-size: 18px; color: #cfd6e6; }
#cap b { color: #fff; font-size: 20px; }
#cap .ninja { width: 14px; height: 14px; margin-right: 3px; border-radius: 50% 50% 3px 3px; background: currentColor; opacity: 0.8; }
#cap.manque { color: #ffb347; border-color: rgba(255, 179, 71, 0.7); animation: capPulse 1.2s ease-in-out infinite; }
#cap.manque b { color: #ffcf7a; }
@keyframes capPulse { 50% { box-shadow: 0 0 12px rgba(255, 170, 60, 0.6); } }
#streak { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 8px; }
#streak.win { background: rgba(240, 120, 40, 0.85); }
#streak.loss { background: rgba(70, 120, 220, 0.85); }
#shopbar { display: flex; background: var(--panel); border: 1px solid var(--line); border-bottom: none; border-radius: 12px 12px 0 0; padding: 8px 8px 10px; gap: 8px; }
#shop-left { width: 132px; display: flex; flex-direction: column; gap: 5px; }
#level { font-size: 13px; color: var(--muted); }
#level b { color: #fff; font-size: 16px; }
#xp-t { float: right; font-size: 11px; }
#xpbar { height: 5px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
#xp-fill { height: 100%; background: #5ec3ff; width: 0; transition: width 0.25s; }
.sbtn { flex: 1; display: flex; justify-content: space-between; align-items: center; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.15); background: linear-gradient(180deg, #2b3555, #1c2238); color: #fff; font-weight: 700; font-size: 12px; cursor: pointer; }
.sbtn em { font-style: normal; color: var(--gold); display: flex; align-items: center; gap: 3px; }
.sbtn em::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #e3a417 60%, #9a6a05); }
.sbtn:hover { filter: brightness(1.3); }
.sbtn:disabled { opacity: 0.4; cursor: default; filter: none; }
#shop { display: flex; gap: 6px; }
.card { width: 128px; height: 112px; border-radius: 8px; position: relative; overflow: hidden; cursor: pointer; border: 2px solid var(--cc, #888); background: #121624; transition: transform 0.1s, filter 0.1s; }
.card:hover { transform: translateY(-3px); filter: brightness(1.15); }
.card.empty { border-color: rgba(255, 255, 255, 0.06); cursor: default; background: rgba(255, 255, 255, 0.02); }
.card.poor { filter: grayscale(0.7) brightness(0.7); }
/* l'achat améliore le perso : 2★ (argent bleuté) ou 3★ (or), lueur qui pulse et étoiles en badge */
.card.up2, .card.up3 { overflow: visible; }
.card.up2 { border-color: #cfe6ff; animation: up2 1.1s ease-in-out infinite alternate; }
.card.up3 { border-color: #ffd84a; animation: up3 0.9s ease-in-out infinite alternate; }
@keyframes up2 { from { box-shadow: 0 0 0 2px rgba(207, 230, 255, 0.9) inset, 0 0 10px 2px rgba(140, 200, 255, 0.6); } to { box-shadow: 0 0 0 3px #fff inset, 0 0 26px 7px rgba(140, 200, 255, 0.95); } }
@keyframes up3 { from { box-shadow: 0 0 0 2px rgba(255, 216, 74, 0.9) inset, 0 0 12px 3px rgba(255, 190, 40, 0.7); } to { box-shadow: 0 0 0 3px #fff6c0 inset, 0 0 32px 10px rgba(255, 200, 40, 1); } }
.card.up2 .portrait, .card.up3 .portrait { filter: brightness(1.18) saturate(1.15); border-radius: 6px 6px 0 0; }
.card .cup { position: absolute; left: 50%; top: -11px; transform: translateX(-50%); z-index: 2; padding: 1px 8px; border-radius: 10px; font-size: 13px; letter-spacing: 1px; font-weight: 900; color: #1a1d2a; background: linear-gradient(180deg, #ffffff, #b9d8ff); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.card.up3 .cup { background: linear-gradient(180deg, #fff6c0, #ffc21a); }
.card .portrait { position: absolute; inset: 0 0 26px 0; background-size: cover; background-position: center 18%; }
.card .portrait::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, transparent 35%, transparent 70%, rgba(0, 0, 0, 0.45) 100%); }
.card .crole { position: absolute; left: 4px; top: 4px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); z-index: 1; }
.card .crole.r-tireur { background: rgba(160, 90, 20, 0.85); }
.card .crole.r-mage { background: rgba(50, 90, 190, 0.85); }
.card .crole.r-tank { background: rgba(70, 90, 110, 0.85); }
.card .crole.r-support { background: rgba(40, 140, 90, 0.85); }
.card .crole.r-assassin { background: rgba(110, 40, 130, 0.85); }
.card .crole.r-combattant { background: rgba(150, 50, 40, 0.85); }
.card .ctraits { position: absolute; right: 4px; bottom: 30px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; z-index: 1; }
.card .ctraits span { font-size: 10px; background: rgba(0, 0, 0, 0.6); border-radius: 4px; padding: 1px 4px; font-weight: 600; }
.card .ctraits span i { font-style: normal; font-family: 'Yu Gothic', 'MS Gothic', sans-serif; margin-right: 3px; color: var(--gold); }
.card .cfoot { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; background: linear-gradient(90deg, var(--cc), rgba(0, 0, 0, 0.6)); font-weight: 800; font-size: 13px; }
.card .cfoot em { font-style: normal; display: flex; align-items: center; gap: 3px; }
.card .cfoot em::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #e3a417 60%, #9a6a05); }
#shop-right { width: 64px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.lock { width: 36px; height: 36px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.15); background: #1d2238 center/20px no-repeat; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cfd6e6' stroke-width='2'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0'/%3E%3C/svg%3E"); }
.lock.on { background-color: #7a4b10; border-color: var(--gold); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffd77a' stroke-width='2'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E"); }
#odds { display: grid; gap: 1px; font-size: 10px; font-weight: 700; text-align: center; }
#odds span { padding: 0 3px; }

#sell-zone { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 760px; height: 130px; border-radius: 14px 14px 0 0; background: rgba(160, 30, 20, 0.85); border: 2px dashed #ffb3a8; display: none; align-items: center; justify-content: center; font-family: Bangers, Inter; font-size: 34px; letter-spacing: 2px; pointer-events: none; }
#sell-zone.on { display: flex; }
#sell-zone.hot { background: rgba(210, 50, 30, 0.95); }

/* carrousel */
#carousel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
#carousel h3 { margin: 0 0 4px; font-family: Bangers, Inter; letter-spacing: 1.5px; font-size: 28px; }
#carousel .sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
#carousel .opts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
#carousel .opt { position: relative; }
#carousel .opt .card { width: 112px; }
#carousel .opt .item { position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; font-size: 13px; }
#carousel .opt.taken .card { filter: grayscale(1) brightness(0.45); cursor: default; }
#carousel .opt .by { position: absolute; bottom: 30px; left: 0; right: 0; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; }
#carousel .order { margin-top: 10px; font-size: 12px; color: var(--muted); }
#carousel .order b { color: var(--gold); }

/* bulle d'info */
#tooltip { position: fixed; z-index: 60; width: 290px; background: rgba(12, 15, 26, 0.97); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; pointer-events: none; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
#tooltip h4 { margin: 0 0 2px; font-size: 16px; display: flex; justify-content: space-between; align-items: baseline; }
#tooltip h4 .stars { color: var(--gold); font-size: 14px; }
#tooltip .role { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
#tooltip .tt-traits { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
#tooltip .tt-traits span { background: rgba(255, 255, 255, 0.08); border-radius: 5px; padding: 1px 6px; font-weight: 600; }
#tooltip .tt-traits span i { font-style: normal; color: var(--gold); margin-right: 3px; font-family: 'Yu Gothic', 'MS Gothic', sans-serif; }
#tooltip .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px 6px; margin: 6px 0; color: #cdd3e1; }
#tooltip .stats b { color: #fff; }
#tooltip .spell { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.1); line-height: 1.4; }
#tooltip .spell strong { color: #7fd0ff; }
#tooltip .tt-items { display: flex; gap: 4px; margin-top: 6px; }
#tooltip .tt-items .item { width: 26px; height: 26px; font-size: 11px; }
#tooltip .tdesc { line-height: 1.4; color: #d8dcea; }
#tooltip .tlv { margin-top: 4px; color: var(--muted); line-height: 1.35; }
#tooltip .tlv.on { color: #fff; }
#tooltip .tlv b { color: var(--gold); }
#tooltip .members { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 6px; }
#tooltip .members span { font-size: 10px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--cc); color: #fff; }
#tooltip .members span.have { background: var(--cc); }

#banner { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); font-family: Bangers, Inter; font-size: 64px; letter-spacing: 3px; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 0, 0, 0.5); animation: banner 1.8s forwards; white-space: nowrap; }
#banner.win { color: #ffd36b; }
#banner.loss { color: #ff7d6b; }
#banner.pve { color: #b6f0a5; font-size: 52px; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

#viewing { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); background: rgba(40, 90, 170, 0.85); padding: 4px 14px; border-radius: 12px; font-size: 13px; font-weight: 700; }

#endscreen { position: absolute; inset: 0; background: rgba(5, 8, 15, 0.8); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
#endscreen h2 { font-family: Bangers, Inter; font-size: 72px; margin: 0; letter-spacing: 3px; color: var(--gold); text-shadow: 0 4px 0 #6a4700; }
#endscreen ol { list-style: none; padding: 0; margin: 0; min-width: 300px; }
#endscreen li { display: flex; gap: 12px; padding: 6px 12px; background: var(--panel); border-radius: 8px; margin-bottom: 4px; }
#endscreen li b { color: var(--gold); width: 28px; }

.round-btn { position: absolute; right: 12px; bottom: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: #fff; font-weight: 800; cursor: pointer; }
#volume { position: absolute; right: 54px; bottom: 54px; width: 220px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: grid; gap: 8px; font-size: 13px; }
#volume label { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; color: var(--muted); }
#volume input { margin: 0; padding: 0; accent-color: var(--gold); }
#help { position: absolute; right: 96px; bottom: 12px; width: 300px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 12px; line-height: 1.6; }
#help kbd { background: #2a3150; border-radius: 4px; padding: 0 5px; border: 1px solid rgba(255, 255, 255, 0.2); }

/* barres de vie au-dessus des persos */
.ubar { position: absolute; width: 64px; transform: translate(-50%, -100%); pointer-events: none; }
.ubar .st { text-align: center; font-size: 11px; line-height: 10px; letter-spacing: -1px; text-shadow: 0 1px 2px #000; height: 11px; }
.ubar .st.s1 { color: #e2b06b; }
.ubar .st.s2 { color: #dfe6f0; }
.ubar .st.s3 { color: #ffd84d; }
.ubar .hp { height: 7px; background: rgba(0, 0, 0, 0.75); border: 1px solid rgba(0, 0, 0, 0.9); border-radius: 2px; position: relative; overflow: hidden; }
.ubar .hp i { position: absolute; left: 0; top: 0; bottom: 0; background: #47c95c; }
.ubar.foe .hp i { background: #e0473a; }
.ubar .hp u { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.85); }
.ubar .hp s { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 9px, rgba(0, 0, 0, 0.55) 9px 10px); }
.ubar .ck { height: 3px; background: rgba(0, 0, 0, 0.75); margin-top: 1px; border-radius: 1px; overflow: hidden; }
.ubar .ck i { display: block; height: 100%; background: #46b6ff; }
.ubar .its { display: flex; justify-content: center; gap: 1px; margin-top: 1px; }
.ubar .its span { width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.5); }
.ubar.summon { width: 44px; }
.ubar.summon .st { display: none; }
.dmg { position: absolute; font-weight: 800; font-size: 16px; transform: translate(-50%, -50%); text-shadow: 0 2px 2px rgba(0, 0, 0, 0.8); animation: dmgup 0.9s ease-out forwards; pointer-events: none; white-space: nowrap; }
.dmg.p { color: #ffb070; }
.dmg.m { color: #6fc3ff; }
.dmg.t, .dmg.dot { color: #fff; font-size: 13px; }
.dmg.c { font-size: 22px; color: #ffdf4d; }
.dmg.h { color: #6dff8a; }
.dmg.dodge { color: #ccc; font-size: 13px; }
/* dégâts de technique : plus gros, comme TfT */
.dmg.pv { font-size: 30px; color: #ff4a3a; -webkit-text-stroke: 1.5px rgba(0, 0, 0, 0.7); }
.dmg.sp { font-size: 21px; -webkit-text-stroke: 1px rgba(0, 0, 0, 0.6); }
.dmg.c.sp { font-size: 25px; }
@keyframes dmgup { 0% { opacity: 0; margin-top: 0; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -40px; } }
.spellname { position: absolute; transform: translate(-50%, -100%); font-family: Bangers, Inter; font-size: 18px; letter-spacing: 1px; color: #fff; text-shadow: 0 0 6px #1e6fff, 0 2px 2px #000; animation: dmgup 1.3s ease-out forwards; pointer-events: none; white-space: nowrap; }

/* petits écrans (720p) : interface plus compacte */
@media (max-height: 820px) {
  .card { width: 112px; height: 96px; }
  #shop-left { width: 120px; }
  #shopbar { padding: 6px 6px 8px; }
  #traits { top: 62px; width: 190px; }
  .trait .hex { width: 28px; height: 32px; font-size: 14px; }
  .trait .tname { font-size: 12px; }
  #players { top: 62px; width: 200px; }
  .pl .av { width: 36px; height: 36px; }
  #feed { bottom: 128px; }
  #itembench { bottom: 128px; }
  #phase-name { font-size: 17px; }
}

/* ------------------------------------------------------------------ v2 de l'interface */
/* tout le HUD grandit avec l'écran (--ui calculé dans main.js) */
#top, #traits, #players, #itembench, #bottom, #feed, #carousel, #viewing { zoom: var(--ui, 1); }

/* frise des rounds */
#round { padding: 6px 12px; gap: 6px; border-radius: 14px; }
#round .stage { font-size: 14px; }
#round .r { width: auto; height: auto; min-width: 46px; border-radius: 8px; padding: 3px 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 15px; line-height: 1; }
#round .r small { font-size: 9px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; }
#round .r.pvp { background: rgba(200, 60, 50, 0.25); }
#round .r.pve { background: rgba(80, 170, 70, 0.25); }
#round .r.carousel { background: rgba(70, 120, 220, 0.25); }
#round .r.start { background: rgba(240, 180, 60, 0.25); color: #ffe08a; }
#round .r.cur { border-color: var(--gold); background: rgba(243, 198, 82, 0.35); color: #fff; transform: scale(1.12); }
#round .next { color: var(--muted); font-size: 11px; margin-left: 4px; }

/* synergies : panneau opaque, lisible */
#traits { left: 10px; top: 74px; width: 232px; max-height: calc((100vh / var(--ui, 1)) - 420px); gap: 5px; }
.trait { background: rgba(12, 15, 26, 0.94); border: 1px solid rgba(255, 255, 255, 0.1); border-left: 4px solid #3a3f52; padding: 5px 9px 5px 5px; }
.trait.l1 { border-left-color: #c58a52; }
.trait.l2 { border-left-color: #d8dee8; }
.trait.l3, .trait.l4 { border-left-color: #ffd04a; box-shadow: 0 0 12px rgba(255, 208, 74, 0.25); }
.trait.off { opacity: 0.8; }
.trait.off .tname { color: #b8bfd0; }
.trait .tname { font-size: 14px; }
.trait .tsteps { font-size: 12px; }
.trait .tcount { font-size: 16px; min-width: 18px; text-align: right; }
.trait.off .tcount { color: #8b93a8; }

/* colonne d'objets (10 places, comme TfT) */
#itembench { left: 10px; bottom: 150px; top: auto; display: grid; grid-template-columns: repeat(2, 48px); gap: 6px; padding: 8px; background: rgba(12, 15, 26, 0.9); border: 1px solid var(--line); border-radius: 12px; }
#itembench::before { content: 'Objets'; grid-column: 1 / -1; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; text-align: center; }
#itembench .item, #itembench .slot { width: 48px; height: 48px; font-size: 19px; }
#itembench .item.combined { font-size: 15px; }
#itembench .slot { border-radius: 8px; border: 2px dashed rgba(255, 255, 255, 0.12); }

/* journal à droite, au-dessus des boutons */
#feed { left: auto; right: 12px; bottom: 60px; align-items: flex-end; width: 320px; }

/* cartes plus grandes */
.card { width: 150px; height: 128px; }
.card .cfoot { height: 30px; font-size: 14px; }
.card .portrait { inset: 0 0 30px 0; }
.card .ctraits { bottom: 34px; }
.card .crole { font-size: 11px; }
.card .ctraits span { font-size: 11px; }
#shop-left { width: 148px; }
.sbtn { font-size: 13px; }

/* frise et phase sur une seule ligne, compacte */
#top { flex-direction: row; align-items: center; gap: 10px; top: 6px; }
#phase { align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px; }
#phase-name { font-size: 15px; }
#timer { width: 170px; }

/* objets en bas à gauche (2 rangées de 5 sur grand écran, 2 colonnes sinon) ; synergies au-dessus */
#itembench { bottom: 10px; grid-template-columns: repeat(5, 48px); }
#traits { max-height: calc((100vh / var(--ui, 1)) - 74px - 175px); }
@media (max-width: 1650px) {
  #itembench { grid-template-columns: repeat(2, 48px); }
  #traits { max-height: calc((100vh / var(--ui, 1)) - 74px - 365px); }
}

/* bulle d'info : bandeau du haut aux couleurs du coût */
#tooltip { border-width: 2px; background: linear-gradient(180deg, color-mix(in srgb, var(--cc, transparent) 28%, rgba(12, 15, 26, 0.97)) 0, rgba(12, 15, 26, 0.97) 70px); }

/* objets dessinés */
.item { background-size: cover; background-position: center; font-size: 0; border: 2px solid rgba(255, 255, 255, 0.25); }
.item.combined { border-color: var(--gold); }
.item.special { border-color: #e0473a; }
.item.target { outline: 3px solid #7fffb0; outline-offset: 1px; transform: scale(1.08); }
#tooltip .ico { width: 20px; height: 20px; border-radius: 4px; vertical-align: middle; }
#tooltip h4 .ico { width: 26px; height: 26px; margin-right: 4px; }
#tooltip .rcps { display: grid; gap: 2px; margin-top: 3px; }
#tooltip .rcp { color: #d8dcea; font-size: 11px; }

/* carrousel 3D : bandeau en haut, noms des crapauds, composants au-dessus des persos */
#carousel { top: 70px; left: 50%; transform: translateX(-50%); padding: 8px 16px; pointer-events: none; }
#carousel h3 { font-size: 22px; }
.cartag { position: absolute; transform: translate(-50%, -100%); font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; white-space: nowrap; }
.cartag.me { color: var(--gold); }
.caritem { position: absolute; width: 30px; height: 30px; transform: translate(-50%, -100%); border-radius: 7px; border: 2px solid #fff; background-size: cover; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); pointer-events: none; }
.caritem.taken { opacity: 0.4; }

/* objets empilés */
.item .stack { position: absolute; right: -4px; bottom: -4px; font-size: 11px; font-weight: 800; color: #fff; background: #1d2440; border: 1px solid var(--gold); border-radius: 8px; padding: 0 4px; line-height: 15px; }

/* boutique fermée (1-1 et 1-2, comme TfT) */
.shop-closed { flex: 1; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #e9dcc0; opacity: 0.75; letter-spacing: 0.02em; }

/* objets portés : plus grands, cadre doré, ombre pour les détacher du décor */
.ubar .its { gap: 2px; margin-top: 2px; }
.ubar .its span { width: 22px; height: 22px; border-radius: 4px; border: 1.5px solid #e8c46a; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }

/* écran de chargement */
#chargement { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(ellipse at 50% 40%, #2c2e4a 0%, #121320 70%); transition: opacity 0.5s ease; }
#chargement.fini { opacity: 0; pointer-events: none; }
#chargement .logo { margin: 0; }
.ch-barre { width: min(420px, 70vw); height: 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); overflow: hidden; }
.ch-barre i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, #f07a1e, #ffc35a); box-shadow: 0 0 12px rgba(255, 170, 60, 0.6); transition: width 0.25s ease; }
#ch-texte { margin: 0; color: #c8cfe0; font-size: 14px; }

/* ------------------------------------------------------------------ mode test */
.test-btn { width: 100%; margin-top: 8px; }
.test-btn small { display: block; font-weight: 400; font-size: 11px; opacity: 0.8; }
#test-panel { position: fixed; left: 10px; top: 10px; bottom: 10px; width: 340px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; z-index: 20; color: var(--text); }
#test-panel h2 { margin: 0 0 8px; font-family: Bangers, Inter, sans-serif; letter-spacing: 1px; color: var(--orange); font-size: 28px; }
#test-panel h3 { margin: 14px 0 6px; font-size: 14px; color: var(--gold); }
#test-panel h3 small { color: var(--muted); font-weight: 400; }
.t-actions .btn { width: 100%; }
.t-stop { background: linear-gradient(180deg, #d8463a, #9a2a20); border-color: #ff9a8a; color: #fff; font-size: 16px; padding: 12px; }
.t-ligne { display: flex; align-items: center; gap: 5px; margin-top: 8px; flex-wrap: wrap; font-size: 12px; }
.t-ligne > span { width: 100%; color: var(--muted); }
.t-seg { padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line); background: #1a2036; color: var(--text); cursor: pointer; font-size: 12px; }
.t-seg.on, .t-stars button.on { background: linear-gradient(180deg, #f39a3a, #c4621a); color: #fff; border-color: #ffcf86; }
.t-unit { background: var(--panel2); border-radius: 9px; padding: 7px 8px; margin-bottom: 6px; }
.t-nom { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; border-left: 4px solid; padding-left: 6px; }
.t-nom small { color: var(--muted); font-weight: 400; }
.t-icones { display: flex; gap: 2px; margin-left: auto; }
.t-icones img { width: 20px; height: 20px; border-radius: 4px; }
.t-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.t-stars { display: flex; gap: 4px; margin: 5px 0; }
.t-stars button { flex: 1; padding: 3px 0; border-radius: 6px; border: 1px solid var(--line); background: #1a2036; color: #ffd84a; cursor: pointer; font-size: 11px; }
.t-objets { display: flex; gap: 4px; }
.t-objets select { flex: 1; min-width: 0; background: #12172a; color: var(--text); border: 1px solid var(--line); border-radius: 6px; font-size: 11px; padding: 3px; }
.t-vide { color: var(--muted); font-size: 12px; }
.t-grille { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.t-perso { position: relative; border: 2px solid; border-radius: 7px; padding: 0; overflow: hidden; background: #12172a; cursor: pointer; height: 62px; }
.t-perso img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; display: block; }
.t-perso span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.65); padding: 1px 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-perso:hover { filter: brightness(1.2); }
.t-menu { width: 100%; margin-top: 12px; }
#test-meter { position: fixed; right: 10px; top: 10px; width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; z-index: 20; color: var(--text); }
#test-meter h3 { margin: 0 0 8px; font-size: 14px; color: var(--gold); }
#test-meter h3 small { color: var(--muted); font-weight: 400; }
.m-row { position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 6px; margin-bottom: 3px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); font-size: 12px; overflow: hidden; }
.m-bar { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(240, 138, 36, 0.45), rgba(240, 138, 36, 0.15)); }
.m-row span, .m-row b, .m-row em { position: relative; }
.m-row span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row em { color: var(--muted); font-style: normal; width: 58px; text-align: right; }
.m-tot { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: right; }
@media (max-width: 760px) { #test-panel { width: auto; right: 10px; bottom: auto; max-height: 55vh; } #test-meter { top: auto; bottom: 10px; width: auto; left: 10px; } }
