:root {
  --ink: #0d0807;
  --panel: rgba(22, 10, 9, 0.72);
  --panel-solid: #1a0c0b;
  --line: rgba(214, 165, 74, 0.35);
  --gold: #e0b35a;
  --gold-2: #f6d58c;
  --red: #b3202a;
  --red-2: #e04a3a;
  --jade: #2a8a66;
  --jade-2: #43c28f;
  --text: #f6ecd9;
  --muted: #bba78a;
  --radius: 16px;
  --title: 'Shippori Mincho B1', 'Yu Mincho', 'Times New Roman', serif;
  --ui: 'Zen Kaku Gothic New', 'Segoe UI', system-ui, sans-serif;
  --cjk: 'Noto Serif SC', 'Microsoft YaHei', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050203; color: var(--text); font-family: var(--ui); -webkit-font-smoothing: antialiased; user-select: none; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%); }

/* --------------------------------------------------------- loader */
#loader { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 22px; background: radial-gradient(circle at 50% 40%, #2a0a0c, #050203 70%); z-index: 50; transition: opacity 0.8s; }
#loader.fade { opacity: 0; pointer-events: none; }
.loader-glyph { font-family: var(--cjk); font-size: 84px; color: var(--gold); text-shadow: 0 0 40px rgba(224, 179, 90, 0.5); animation: breathe 2s ease-in-out infinite; }
.loader-bar { width: 220px; height: 3px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, var(--gold), transparent); animation: slide 1.2s linear infinite; }
#loader p { color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-size: 12px; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes breathe { 50% { transform: scale(1.05); text-shadow: 0 0 70px rgba(224, 179, 90, 0.8); } }

/* --------------------------------------------------------- panels */
.screen { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; pointer-events: none; }
.menu-card, .modal-card {
  pointer-events: auto;
  position: relative;
  background: linear-gradient(160deg, rgba(40, 14, 12, 0.86), rgba(14, 7, 7, 0.9));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 220, 150, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.menu-card::before, .modal-card::before {
  content: ''; position: absolute; inset: 7px; border: 1px solid rgba(214, 165, 74, 0.14); border-radius: 16px; pointer-events: none;
}
.menu-card { width: min(440px, 92vw); padding: 30px 32px 24px; display: flex; flex-direction: column; gap: 18px; animation: rise 0.8s cubic-bezier(.2, .8, .2, 1); max-height: 96vh; overflow: auto; }
@keyframes rise { from { opacity: 0; transform: translateY(30px) scale(0.97); } }

.brand { text-align: center; }
.brand-glyph { font-family: var(--cjk); font-size: 54px; line-height: 1; color: var(--red-2); text-shadow: 0 0 24px rgba(224, 74, 58, 0.55); }
.brand h1 { font-family: var(--title); font-weight: 900; font-size: 46px; letter-spacing: 0.12em; margin: 6px 0 0; background: linear-gradient(180deg, var(--gold-2), #b07a2a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 2px 0 0; color: var(--muted); letter-spacing: 0.35em; text-transform: uppercase; font-size: 11px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
input[type='text'], #d-code {
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 13px 15px; font-size: 16px; font-family: var(--ui); outline: none; transition: border 0.2s, box-shadow 0.2s; user-select: text;
}
input[type='text']:focus, #d-code:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224, 179, 90, 0.18); }
input.invalid { border-color: var(--red-2) !important; animation: shakeX 0.35s; }
@keyframes shakeX { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented button { background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(214, 165, 74, 0.2); border-radius: 12px; color: var(--text); padding: 10px; display: flex; flex-direction: column; gap: 2px; transition: all 0.2s; }
.segmented button b { font-family: var(--title); font-size: 15px; letter-spacing: 0.06em; }
.segmented button small { color: var(--muted); font-size: 11px; }
.segmented button.active { border-color: var(--gold); background: linear-gradient(180deg, rgba(224, 179, 90, 0.18), rgba(224, 179, 90, 0.05)); box-shadow: 0 0 20px rgba(224, 179, 90, 0.15); }

.menu-actions { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row.center { justify-content: center; flex-wrap: wrap; }
.row.center > * { flex: 0 1 auto; }

.btn { border: 1px solid transparent; border-radius: 12px; padding: 12px 18px; font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: 0.03em; transition: transform 0.12s, box-shadow 0.2s, background 0.2s, filter 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.big { padding: 15px 20px; font-size: 16px; font-family: var(--title); letter-spacing: 0.08em; }
.btn.small { padding: 8px 12px; font-size: 12px; }
.btn.primary { background: linear-gradient(180deg, #d23a32, #8e1820); border-color: rgba(255, 150, 120, 0.35); box-shadow: 0 8px 24px rgba(179, 32, 42, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn.jade { background: linear-gradient(180deg, #2f9c73, #17604a); border-color: rgba(120, 255, 200, 0.3); box-shadow: 0 8px 24px rgba(42, 138, 102, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn.ghost { background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.btn.gold { background: linear-gradient(180deg, #f0c76a, #b07a2a); color: #2a1406; border-color: rgba(255, 230, 160, 0.6); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.ico { font-size: 0.9em; }

.settings { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px solid rgba(214, 165, 74, 0.14); }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { display: none; }
.toggle span { width: 34px; height: 19px; border-radius: 20px; background: rgba(255, 255, 255, 0.12); position: relative; transition: background 0.2s; flex: none; }
.toggle span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #ddd; transition: transform 0.2s; }
.toggle input:checked + span { background: var(--jade); }
.toggle input:checked + span::after { transform: translateX(15px); background: #fff; }
.menu-error { color: var(--red-2); font-size: 13px; text-align: center; margin: 0; min-height: 1em; }

/* --------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stats { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; backdrop-filter: blur(10px); }
.stat { padding: 2px 12px; display: flex; flex-direction: column; min-width: 70px; }
.stat + .stat { border-left: 1px solid rgba(214, 165, 74, 0.16); }
.stat small, .score-box small { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; font-weight: 700; }
#h-pairs.zero { color: var(--red-2); }
.score-box { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 26px; backdrop-filter: blur(10px); }
.score-box b { display: block; font-family: var(--title); font-size: 30px; color: var(--gold-2); font-variant-numeric: tabular-nums; line-height: 1.1; }
.combo { font-weight: 800; font-size: 13px; color: var(--red-2); height: 16px; letter-spacing: 0.08em; }
.combo.pop { animation: pop 0.4s; }
@keyframes pop { 40% { transform: scale(1.5); } }

.duel-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 280px; backdrop-filter: blur(10px); display: grid; gap: 6px; pointer-events: auto; }
.duelist .name { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.duelist .name em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; transition: width 0.4s cubic-bezier(.2, .8, .2, 1); }
.me .bar span { background: linear-gradient(90deg, #8e1820, var(--red-2)); }
.opp .bar span { background: linear-gradient(90deg, #17604a, var(--jade-2)); }
.vs { text-align: center; font-family: var(--title); font-size: 11px; color: var(--gold); letter-spacing: 0.3em; }
.emotes { display: flex; gap: 4px; justify-content: center; margin-top: 2px; }
.emotes button { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(214, 165, 74, 0.2); border-radius: 8px; font-size: 15px; padding: 2px 7px; }
.emotes button:hover { background: rgba(255, 255, 255, 0.14); }

.toolbar { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 7px; pointer-events: auto; backdrop-filter: blur(10px); }
.tool { background: transparent; border: 1px solid transparent; color: var(--text); border-radius: 12px; padding: 7px 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; transition: background 0.15s, border 0.15s, transform 0.1s; }
.tool span { font-size: 19px; line-height: 1.2; }
.tool small { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }
.tool:hover { background: rgba(224, 179, 90, 0.12); border-color: var(--line); }
.tool:active { transform: scale(0.95); }
.tool.danger:hover { background: rgba(224, 74, 58, 0.18); }
.tool:disabled { opacity: 0.35; pointer-events: none; }
.tool .cd { font-size: 10px; color: var(--gold); }
.controls-help { position: absolute; bottom: 92px; width: 100%; text-align: center; font-size: 11px; color: rgba(246, 236, 217, 0.4); margin: 0; letter-spacing: 0.04em; }
.selected-info { position: absolute; bottom: 112px; width: 100%; text-align: center; font-family: var(--title); color: var(--gold-2); font-size: 15px; letter-spacing: 0.08em; text-shadow: 0 2px 10px #000; min-height: 20px; }

/* --------------------------------------------------------- modals */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(5, 2, 2, 0.55); backdrop-filter: blur(3px); animation: fadeIn 0.25s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card { width: min(520px, 94vw); padding: 30px 30px 26px; text-align: center; animation: rise 0.45s cubic-bezier(.2, .8, .2, 1); max-height: 92vh; overflow: auto; }
.modal-card.wide { width: min(720px, 96vw); }
.modal-card h2 { font-family: var(--title); font-size: 26px; margin: 0 0 6px; color: var(--gold-2); letter-spacing: 0.05em; }
.modal-card .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; line-height: 1.5; }
.close { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--text); width: 32px; height: 32px; border-radius: 50%; z-index: 2; }

.duel-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.duel-opt { background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(214, 165, 74, 0.18); border-radius: 14px; padding: 16px 12px; display: flex; flex-direction: column; gap: 10px; justify-content: space-between; }
.duel-opt h3 { margin: 0; font-family: var(--title); font-size: 15px; color: var(--gold-2); }
.duel-opt p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
#d-code { text-align: center; font-family: var(--title); font-size: 20px; letter-spacing: 0.3em; text-transform: uppercase; padding: 9px; width: 100%; }
.duel-wait { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 0; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(224, 179, 90, 0.2); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.room-code { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.room-code small { color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-size: 11px; }
.room-code b { font-family: var(--title); font-size: 46px; letter-spacing: 0.3em; color: var(--gold-2); text-shadow: 0 0 24px rgba(224, 179, 90, 0.5); padding-left: 0.3em; user-select: text; }

.tabs { display: inline-flex; gap: 4px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 6px 0 16px; }
.tabs button { background: transparent; border: none; color: var(--muted); padding: 8px 16px; border-radius: 9px; font-weight: 700; font-size: 13px; }
.tabs button.active { background: linear-gradient(180deg, rgba(224, 179, 90, 0.25), rgba(224, 179, 90, 0.08)); color: var(--gold-2); }
.board-wrap { max-height: 56vh; overflow: auto; border-radius: 12px; border: 1px solid rgba(214, 165, 74, 0.14); }
table.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { position: sticky; top: 0; background: #1e0d0c; color: var(--muted); font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; padding: 10px 8px; text-align: left; }
.board td { padding: 10px 8px; border-top: 1px solid rgba(214, 165, 74, 0.08); text-align: left; font-variant-numeric: tabular-nums; }
.board tr.me td { background: rgba(224, 179, 90, 0.12); }
.board td.rank { width: 44px; font-family: var(--title); font-weight: 900; color: var(--muted); text-align: center; }
.board tr:nth-child(2) td.rank { color: #ffd76a; }
.board tr:nth-child(3) td.rank { color: #d9dde6; }
.board tr:nth-child(4) td.rank { color: #d99a5a; }
.board td.pseudo { font-weight: 700; }
.board td.score { color: var(--gold-2); font-weight: 800; }
.board .empty { text-align: center; color: var(--muted); padding: 30px; }

.rules { text-align: left; line-height: 1.6; font-size: 14px; color: #e8dcc5; padding-left: 18px; }
.rules li { margin-bottom: 6px; }
.rules b { color: var(--gold-2); }
.keys { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font-size: 12px; color: var(--muted); }
kbd { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; font-family: var(--ui); color: var(--text); }

.end-glyph { font-family: var(--cjk); font-size: 72px; color: var(--gold); text-shadow: 0 0 40px rgba(224, 179, 90, 0.6); line-height: 1; margin-bottom: 8px; }
.end-glyph.lose { color: #8a7a6a; text-shadow: none; }
.end-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin-bottom: 14px; }
.end-stats div { background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(214, 165, 74, 0.16); border-radius: 12px; padding: 10px; }
.end-stats small { display: block; font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }
.end-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.end-stats .hl b { color: var(--gold-2); font-family: var(--title); font-size: 24px; }
.end-rank { color: var(--jade-2); font-weight: 700; min-height: 1.2em; margin: 0 0 16px; }

/* --------------------------------------------------------- countdown / toasts */
#countdown { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; font-family: var(--title); font-weight: 900; font-size: 180px; color: var(--gold-2); text-shadow: 0 0 60px rgba(224, 179, 90, 0.8), 0 8px 0 #5a2a08; }
#countdown span { animation: count 1s ease-out forwards; }
#countdown .vs-intro { font-size: 34px; letter-spacing: 0.1em; text-align: center; display: block; animation: none; color: var(--text); text-shadow: 0 4px 20px #000; }
@keyframes count { from { transform: scale(2.2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } to { transform: scale(0.8); opacity: 0; } }

#toasts { position: fixed; top: 96px; left: 50%; transform: translateX(-50%); z-index: 25; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--panel-solid); border: 1px solid var(--line); color: var(--text); padding: 10px 18px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: toastIn 0.3s cubic-bezier(.2, .8, .2, 1), toastOut 0.4s 2.6s forwards; }
.toast.big { font-size: 22px; padding: 14px 26px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.floater { position: absolute; transform: translate(-50%, -50%); font-family: var(--title); font-weight: 900; font-size: 26px; color: var(--gold-2); text-shadow: 0 0 14px rgba(224, 140, 40, 0.9), 0 3px 0 #4a1a04; animation: floatUp 1.1s ease-out forwards; white-space: nowrap; }
.floater.combo-big { font-size: 34px; color: #ff8a5a; }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, -20%) scale(0.6); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } to { opacity: 0; transform: translate(-50%, -180%) scale(1); } }

/* --------------------------------------------------------- responsive */
@media (max-width: 760px) {
  .hud-top { flex-wrap: wrap; top: 8px; left: 8px; right: 8px; }
  .stats { padding: 6px; gap: 0; }
  .stat { min-width: 0; padding: 2px 8px; }
  .stat b { font-size: 16px; }
  .score-box { position: static; transform: none; padding: 6px 14px; }
  .score-box b { font-size: 20px; }
  .duel-panel { width: 100%; min-width: 0; }
  .toolbar { bottom: 8px; gap: 0; padding: 4px; }
  .tool { min-width: 0; padding: 6px 8px; }
  .tool small { display: none; }
  .controls-help { display: none; }
  .selected-info { bottom: 70px; }
  .duel-options { grid-template-columns: 1fr; }
  .brand h1 { font-size: 36px; }
  #countdown { font-size: 120px; }
}

/* --------------------------------------------------------- icônes Lucide */
svg.lucide { width: 1.15em; height: 1.15em; stroke-width: 2; flex: none; vertical-align: -0.2em; }
.tool span { display: grid; place-items: center; height: 24px; }
.tool svg.lucide { width: 21px; height: 21px; stroke-width: 1.8; color: var(--gold-2); }
.tool.danger svg.lucide { color: #ff9a8a; }
.btn svg.lucide { width: 18px; height: 18px; }
.btn.big svg.lucide { width: 20px; height: 20px; }
.close { display: grid; place-items: center; padding: 0; }
.close svg.lucide { width: 16px; height: 16px; }
.modal-card h2 { display: flex; align-items: center; justify-content: center; gap: 10px; }
.modal-card h2 svg.lucide { color: var(--gold); width: 24px; height: 24px; }
.emotes button { display: grid; place-items: center; color: var(--gold-2); padding: 4px 8px; }
.emotes svg.lucide { width: 17px; height: 17px; }
.toast { display: flex; align-items: center; gap: 9px; }
.toast svg.lucide { color: var(--gold); width: 18px; height: 18px; }
.toast.big svg.lucide { width: 26px; height: 26px; }
.toast.music { font-family: var(--title); letter-spacing: 0.06em; color: var(--gold-2); font-size: 13px; }
.end-rank { display: flex; align-items: center; justify-content: center; gap: 8px; }
.end-rank svg.lucide { width: 20px; height: 20px; }

/* --------------------------------------------------------- crédits musique */
.credits-title { font-family: var(--title); color: var(--gold-2); font-size: 15px; margin: 20px 0 8px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.credits { list-style: none; padding: 0; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.7; }
.credits a { color: var(--gold); text-decoration: none; }
.credits a:hover { text-decoration: underline; }

/* --------------------------------------------------------- choix du plateau */
.layout-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.layout-grid button { background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(214, 165, 74, 0.2); border-radius: 10px; color: var(--muted); padding: 5px 3px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; transition: all 0.18s; font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; }
.layout-grid button canvas { width: 100%; height: auto; aspect-ratio: 120 / 78; display: block; }
.layout-grid button:hover { border-color: rgba(224, 179, 90, 0.6); color: var(--text); transform: translateY(-1px); }
.layout-grid button.active { border-color: var(--gold); color: var(--gold-2); background: linear-gradient(180deg, rgba(224, 179, 90, 0.2), rgba(224, 179, 90, 0.05)); box-shadow: 0 0 16px rgba(224, 179, 90, 0.18); }
.layout-info { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; min-height: 18px; }
.layout-info b { color: var(--gold-2); font-family: var(--title); letter-spacing: 0.04em; }
.layout-info svg.lucide { color: var(--gold); width: 16px; height: 16px; }
.tabs { flex-wrap: wrap; justify-content: center; max-width: 100%; }
.tabs button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 11px; font-size: 12px; }
.tabs svg.lucide { width: 14px; height: 14px; }
@media (max-width: 760px) { .layout-grid { grid-template-columns: repeat(4, 1fr); } }

#now-playing { position: fixed; left: 16px; bottom: 16px; z-index: 25; pointer-events: none; display: flex; flex-direction: column; gap: 6px; }
#now-playing .toast { animation: toastIn 0.4s cubic-bezier(.2, .8, .2, 1), toastOut 0.6s 4.4s forwards; background: rgba(26, 12, 11, 0.85); }
@media (max-width: 760px) { #now-playing { bottom: 70px; } }

/* --------------------------------------------------------- volumes */
.volume-row { display: grid; grid-template-columns: 18px 64px 1fr 42px; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.volume-row svg.lucide { color: var(--gold); width: 16px; height: 16px; }
.volume-row em { font-style: normal; font-variant-numeric: tabular-nums; text-align: right; color: var(--text); font-size: 12px; }
.volume-row input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 6px; cursor: pointer; background: linear-gradient(90deg, var(--gold) 0 var(--p, 50%), rgba(255, 255, 255, 0.12) var(--p, 50%) 100%); outline: none; }
.volume-row input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--gold-2); border: 2px solid #5a2a08; box-shadow: 0 0 10px rgba(224, 179, 90, 0.6); }
.volume-row input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--gold-2); border: 2px solid #5a2a08; }
.sound-pop { position: absolute; bottom: calc(100% + 10px); right: 60px; width: 290px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); animation: rise 0.25s; }
.toolbar { position: absolute; }

/* --------------------------------------------------------- hardcore */
.menu-card.hc { border-color: rgba(224, 74, 58, 0.55); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(224, 74, 58, 0.18); }
.hardcore-tag { position: absolute; top: 112px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-family: var(--title); font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase; color: #ffb0a0; background: rgba(120, 16, 16, 0.75); border: 1px solid rgba(255, 120, 100, 0.5); }
.hardcore-tag svg.lucide { width: 14px; height: 14px; }
.tool span { position: relative; }
.badge { position: absolute; top: -6px; right: -12px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #c0262d; color: #fff; font-size: 11px; line-height: 17px; font-weight: 800; }
.tool:disabled .badge { background: #555; }

/* --------------------------------------------------------- classement par catégories */
.modal-card.wide { width: min(960px, 96vw); }
.board-layout { display: grid; grid-template-columns: 200px 1fr; gap: 16px; text-align: left; margin-top: 10px; }
.board-cats { display: flex; flex-direction: column; gap: 3px; max-height: 64vh; overflow: auto; padding-right: 4px; }
.cat-group { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 10px 8px 4px; }
.cat { display: flex; align-items: center; gap: 9px; background: transparent; border: 1px solid transparent; color: var(--text); padding: 8px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; text-align: left; transition: background 0.15s; }
.cat span { flex: 1; }
.cat em { font-style: normal; font-size: 11px; color: var(--muted); background: rgba(255, 255, 255, 0.06); border-radius: 8px; padding: 1px 7px; }
.cat svg.lucide { color: var(--gold); width: 16px; height: 16px; }
.cat:hover { background: rgba(224, 179, 90, 0.08); }
.cat.active { background: linear-gradient(90deg, rgba(224, 179, 90, 0.22), rgba(224, 179, 90, 0.04)); border-color: var(--line); color: var(--gold-2); }
.board-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.board-head h3 { margin: 0; font-family: var(--title); color: var(--gold-2); font-size: 20px; display: flex; align-items: center; gap: 8px; }
.board-head h3 small { font-family: var(--ui); font-size: 12px; color: var(--muted); font-weight: 500; }
.tabs.small { margin: 0; }
.board-wrap { max-height: 56vh; }
.board-overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; max-height: 58vh; overflow: auto; padding: 2px; }
.ov-card { background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(214, 165, 74, 0.18); border-radius: 12px; padding: 10px; color: var(--text); display: flex; flex-direction: column; gap: 6px; text-align: left; transition: border 0.15s, transform 0.15s; }
.ov-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.ov-head { font-family: var(--title); font-size: 13px; color: var(--gold-2); display: flex; align-items: center; gap: 6px; }
.ov-head svg.lucide { width: 15px; height: 15px; }
.ov-card canvas { width: 100%; height: 50px; object-fit: contain; opacity: 0.85; }
.ov-card ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.ov-card li { display: flex; justify-content: space-between; gap: 6px; padding: 3px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.03); }
.ov-card li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-card li b { font-variant-numeric: tabular-nums; color: var(--gold-2); }
.ov-card li.p1 span::before { content: '1. '; color: #ffd76a; font-weight: 800; }
.ov-card li.p2 span::before { content: '2. '; color: #d9dde6; font-weight: 800; }
.ov-card li.p3 span::before { content: '3. '; color: #d99a5a; font-weight: 800; }
.ov-card li.none { color: var(--muted); font-style: italic; justify-content: center; }
@media (max-width: 760px) {
  .board-layout { grid-template-columns: 1fr; }
  .board-cats { flex-direction: row; overflow-x: auto; max-height: none; }
  .cat-group { display: none; }
  .cat { flex: none; }
  .sound-pop { right: 0; width: 260px; }
}

/* --------------------------------------------------------- transition de début de partie
   Deux mises en scène :
   - solo (« le rituel ») : portes shoji en papier qui coulissent, trait d'encre, ensō vermillon, kanji à l'encre ;
   - duel (« l'affrontement ») : deux moitiés laquées (vermillon / jade) qui s'écrasent en diagonale,
     choc des lames sur la ligne de rencontre, gerbe d'étincelles, sceau 戰 qui fait trembler l'écran. */
#transition { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; }
.tr-defs { position: absolute; width: 0; height: 0; }
.tr-panel { position: absolute; top: 0; bottom: 0; display: flex; }
.tr-name { position: relative; opacity: 0; }
.tr-flash { position: absolute; inset: 0; opacity: 0; }
.tr-clash { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.tr-content { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.tr-mark { position: relative; display: grid; place-items: center; }
.tr-enso { position: absolute; width: 150%; height: 150%; overflow: visible; display: none; }
.tr-seal { position: relative; font-family: var(--cjk); font-weight: 900; line-height: 1; display: grid; place-items: center; opacity: 0; }
.tr-title { position: relative; font-family: var(--title); font-weight: 800; opacity: 0; }
.tr-sub { font-size: 14px; letter-spacing: 0.06em; opacity: 0; }
#transition.out .tr-content { transition: opacity 0.25s; opacity: 0; }
@keyframes trText { to { opacity: 1; transform: none; } }

/* ================================================================ SOLO : le rituel des shoji */
#transition:not(.duel) .tr-panel {
  width: 50.5%;
  transition: transform 0.42s cubic-bezier(0.65, 0, 0.25, 1);
  /* treillis de bois (kumiko) sur papier washi éclairé par derrière */
  background:
    repeating-linear-gradient(90deg, #4a2e1a 0 5px, transparent 5px 16.66%),
    repeating-linear-gradient(180deg, #4a2e1a 0 5px, transparent 5px 12.5vh),
    radial-gradient(ellipse at 50% 45%, #fbf3df, #eadcbc 60%, #d7c398);
  box-shadow: inset 0 0 0 10px #3b2414, inset 0 0 0 12px #6b4426, 0 0 50px rgba(0, 0, 0, 0.55);
}
#transition:not(.duel) .tr-panel::before { /* fibres du papier */
  content: ''; position: absolute; inset: 0; opacity: 0.5; mix-blend-mode: multiply;
  background: repeating-linear-gradient(17deg, rgba(150, 115, 70, 0.07) 0 2px, transparent 2px 9px),
              repeating-linear-gradient(-23deg, rgba(150, 115, 70, 0.05) 0 1px, transparent 1px 13px);
}
#transition:not(.duel) .tr-panel.left { left: 0; transform: translateX(-101%); }
#transition:not(.duel) .tr-panel.right { right: 0; transform: translateX(101%); }
/* poignée creuse (hikite) au bord de chaque porte */
#transition:not(.duel) .tr-panel::after {
  content: ''; position: absolute; top: calc(50% - 34px); width: 14px; height: 68px; border-radius: 7px;
  background: linear-gradient(90deg, #2a170c, #5a3820); box-shadow: inset 0 0 0 2px #8e6420;
}
#transition:not(.duel) .tr-panel.left::after { right: 30px; }
#transition:not(.duel) .tr-panel.right::after { left: 30px; }
#transition:not(.duel).closed .tr-panel { transform: translateX(0); }
#transition:not(.duel).out .tr-panel { transition-duration: 0.6s; }
#transition:not(.duel) .tr-name, #transition:not(.duel) .tr-slash, #transition:not(.duel) .tr-flash, #transition:not(.duel) .tr-clash { display: none; }

/* kanji écrit à l'encre, entouré d'un ensō vermillon tracé au pinceau */
#transition:not(.duel) .tr-enso { display: block; }
#transition:not(.duel) .tr-enso path { fill: none; stroke: #c8372d; stroke-width: 7; stroke-linecap: round; filter: url(#tr-ink); stroke-dasharray: 100; stroke-dashoffset: 100; }
#transition:not(.duel).stamp .tr-enso path { animation: trEnso 0.75s cubic-bezier(0.5, 0, 0.3, 1) forwards; }
@keyframes trEnso { to { stroke-dashoffset: 0; } }
#transition:not(.duel) .tr-seal { font-size: clamp(84px, 14vw, 160px); width: 1.3em; height: 1.3em; color: #1a120c; filter: url(#tr-ink); }
#transition:not(.duel).stamp .tr-seal { animation: inkBleed 0.55s ease-out 0.12s forwards; }
@keyframes inkBleed { 0% { opacity: 0; transform: scale(1.12); filter: blur(10px); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; filter: url(#tr-ink); } }
/* le titre s'écrit sur un trait d'encre peint d'un seul geste (au moment du son de lame) */
#transition:not(.duel) .tr-title {
  isolation: isolate; font-size: clamp(26px, 4.4vw, 48px); color: transparent; padding: 10px 46px 12px; letter-spacing: 0.04em; transition: color 0.35s 0.1s;
}
#transition:not(.duel) .tr-title::before {
  content: ''; position: absolute; inset: 0 -12px; z-index: -1; background: #17110d; filter: url(#tr-ink);
  border-radius: 46% 54% 40% 60% / 62% 44% 56% 38%; transform: scaleX(0); transform-origin: left center;
}
#transition:not(.duel).slash .tr-title { opacity: 1; }
#transition:not(.duel).slash .tr-title::before { animation: brush 0.38s cubic-bezier(0.6, 0, 0.2, 1) forwards; }
@keyframes brush { to { transform: scaleX(1); } }
#transition:not(.duel).stamp .tr-title { color: #f6ecd9; }
#transition:not(.duel) .tr-sub { color: #6b4426; font-weight: 700; transform: translateY(8px); }
#transition:not(.duel).stamp .tr-sub { animation: trText 0.4s 0.35s ease-out forwards; }
#transition:not(.duel).hc .tr-sub { color: #a3201d; }
#transition:not(.duel).hc .tr-title::before { background: #5e1412; }

/* ================================================================ DUEL : l'affrontement en diagonale */
#transition.duel .tr-panel {
  left: 0; width: 100%;
  transition: transform 0.34s cubic-bezier(0.8, 0, 0.2, 1);
}
#transition.duel .tr-panel.left {
  clip-path: polygon(0 0, 62% 0, 38% 100%, 0 100%); transform: translate(-70%, -45%);
  align-items: flex-start; justify-content: flex-start; padding: 15vh 0 0 7vw;
  background: radial-gradient(circle at 30% 35%, #b8261f 0, #6e1210 45%, #1c0404 100%);
}
#transition.duel .tr-panel.right {
  clip-path: polygon(62% 0, 100% 0, 100% 100%, 38% 100%); transform: translate(70%, 45%);
  align-items: flex-end; justify-content: flex-end; padding: 0 7vw 15vh 0;
  background: radial-gradient(circle at 70% 65%, #1f8a63 0, #0f4a36 45%, #021009 100%);
}
#transition.duel .tr-panel::before { /* vagues seigaiha dorées sur la laque */
  content: ''; position: absolute; inset: 0; opacity: 0.13;
  background:
    radial-gradient(circle at 50% 100%, transparent 9px, #e0b35a 10px 11px, transparent 12px 17px, #e0b35a 18px 19px, transparent 20px) 0 0 / 40px 20px,
    radial-gradient(circle at 50% 100%, transparent 9px, #e0b35a 10px 11px, transparent 12px 17px, #e0b35a 18px 19px, transparent 20px) 20px 10px / 40px 20px;
}
#transition.duel.closed .tr-panel { transform: none; }
#transition.duel.out .tr-panel { transition: transform 0.5s cubic-bezier(0.6, 0, 0.4, 1); }
#transition.duel.out .tr-panel.left { transform: translate(-70%, -45%); }
#transition.duel.out .tr-panel.right { transform: translate(70%, 45%); }
#transition.duel .tr-name {
  font-family: var(--title); font-weight: 800; font-size: clamp(30px, 5.6vw, 72px); line-height: 1; color: #fff3e0;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45), 0 0 34px rgba(0, 0, 0, 0.5);
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transform: skewX(-8deg) translateX(-40px);
  transition: opacity 0.2s 0.3s, transform 0.45s 0.3s cubic-bezier(0.2, 0.9, 0.2, 1);
}
#transition.duel .tr-panel.right .tr-name { transform: skewX(-8deg) translateX(40px); text-align: right; }
#transition.duel .tr-name::before { display: block; font-family: var(--ui); font-size: 0.24em; font-weight: 700; letter-spacing: 0.04em; margin-bottom: 0.25em; opacity: 0.8; }
#transition.duel .tr-panel.left .tr-name::before { content: 'Toi'; color: #ffb3a0; }
#transition.duel .tr-panel.right .tr-name::before { content: 'Adversaire'; color: #9ff0c8; }
#transition.duel.closed .tr-name { opacity: 1; transform: skewX(-8deg); }

/* la ligne de rencontre : les deux lames se croisent, la lumière gagne toute la diagonale */
#transition.duel .tr-slash { position: absolute; inset: 0; filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 28px #ffb04a); }
#transition.duel .tr-slash::before {
  content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, #fff, #ffe3a0 50%, #fff);
  clip-path: polygon(61.7% 0, 62.3% 0, 62.3% 0, 61.7% 0);
}
#transition.duel.slash .tr-slash::before { animation: seam 0.26s cubic-bezier(0.7, 0, 0.3, 1) forwards; }
@keyframes seam { to { clip-path: polygon(61.5% 0, 62.5% 0, 38.5% 100%, 37.5% 100%); } }
#transition.duel.out .tr-slash { transition: opacity 0.2s; opacity: 0; }
/* gerbe d'étincelles au point de choc */
#transition.duel .tr-clash::before {
  content: ''; position: absolute; left: -45vmin; top: -45vmin; width: 90vmin; height: 90vmin; border-radius: 50%;
  background: repeating-conic-gradient(from 7deg, rgba(255, 230, 170, 0.95) 0 1.6deg, transparent 1.6deg 13deg);
  -webkit-mask-image: radial-gradient(circle, transparent 14%, #000 22%, transparent 68%);
  mask-image: radial-gradient(circle, transparent 14%, #000 22%, transparent 68%);
  opacity: 0; transform: scale(0.2) rotate(0deg);
}
#transition.duel.slash .tr-clash::before { animation: sparks 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) 0.2s forwards; }
@keyframes sparks { 0% { opacity: 1; transform: scale(0.2) rotate(0deg); } 100% { opacity: 0; transform: scale(1.25) rotate(18deg); } }
#transition.duel .tr-flash { background: #fff3d6; }
#transition.duel.slash .tr-flash { animation: flash 0.4s ease-out 0.18s; }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 0.8; } 100% { opacity: 0; } }

/* le sceau 戰 tombe sur la ligne et fait trembler l'écran */
#transition.duel .tr-seal {
  font-size: clamp(64px, 11vw, 128px); width: 1.4em; height: 1.4em; border-radius: 8%; color: #fff6e0;
  background: radial-gradient(circle at 35% 30%, #2a1a12, #0c0705 75%); border: 3px solid #e0b35a;
  box-shadow: 0 0 0 6px rgba(12, 7, 5, 0.85), 0 0 0 8px #c8372d, 0 0 70px rgba(255, 140, 60, 0.55);
  text-shadow: 0 0 22px rgba(255, 90, 60, 0.9); transform: scale(3) rotate(-20deg);
}
#transition.duel.stamp .tr-seal { animation: slam 0.38s cubic-bezier(0.5, 0, 0.75, 0) forwards; }
@keyframes slam { 0% { opacity: 0; transform: scale(3) rotate(-20deg); } 80% { opacity: 1; transform: scale(0.94) rotate(2deg); } 100% { opacity: 1; transform: none; } }
#transition.duel.stamp .tr-content { animation: quake 0.42s linear 0.3s; }
@keyframes quake { 0%, 100% { transform: none; } 15% { transform: translate(-9px, 5px); } 30% { transform: translate(8px, -6px); } 45% { transform: translate(-6px, -3px); } 60% { transform: translate(5px, 4px); } 75% { transform: translate(-3px, 2px); } }
#transition.duel .tr-title {
  font-size: clamp(30px, 5vw, 56px); letter-spacing: 0.08em; color: #fff3e0; margin-top: 10px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 120, 60, 0.6); transform: scale(1.3);
}
#transition.duel.stamp .tr-title { animation: trText 0.3s 0.32s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
#transition.duel .tr-sub { color: #f2d9b0; font-weight: 700; padding: 5px 14px; border-radius: 3px; background: rgba(8, 4, 3, 0.75); transform: translateY(8px); }
#transition.duel.stamp .tr-sub { animation: trText 0.35s 0.45s ease-out forwards; }
#transition.duel.hc .tr-sub { color: #ff9a8a; }

@media (max-width: 760px) {
  #transition.duel .tr-panel.left { padding: 12vh 0 0 5vw; }
  #transition.duel .tr-panel.right { padding: 0 5vw 12vh 0; }
}
@media (prefers-reduced-motion: reduce) {
  #transition.duel.stamp .tr-content { animation: none; }
  #transition.duel.slash .tr-clash::before { animation: none; }
}

/* --------------------------------------------------------- copie du code de salon */
.room-code b { cursor: pointer; }
.room-code b:hover { filter: brightness(1.15); }
.btn.copied { background: linear-gradient(180deg, #2f9c73, #17604a) !important; color: #fff !important; border-color: rgba(120, 255, 200, 0.5) !important; }

/* --------------------------------------------------------- fin de duel */
#m-duel-end { background: radial-gradient(ellipse at center, rgba(40, 8, 8, 0.55), rgba(5, 2, 2, 0.85)); }
.duel-end { width: min(860px, 96vw); display: flex; flex-direction: column; align-items: center; gap: 18px; pointer-events: auto; }
.de-banner { display: flex; flex-direction: column; align-items: center; animation: deBanner 0.7s cubic-bezier(.2, 1.4, .4, 1) both; }
.de-banner span { font-family: var(--title); font-weight: 900; font-size: clamp(38px, 7vw, 76px); letter-spacing: 0.08em; color: var(--gold-2); text-shadow: 0 0 40px rgba(224, 179, 90, 0.7), 0 5px 0 #4a1a04; }
.de-banner.lose span { color: #d9c3a8; text-shadow: 0 0 20px rgba(0, 0, 0, 0.6), 0 4px 0 #2a1208; }
.de-banner small { font-size: 13px; letter-spacing: 0.35em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
@keyframes deBanner { from { opacity: 0; transform: scale(2.2); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.de-cards { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; width: 100%; }
.de-vs { font-family: var(--cjk); font-size: 48px; color: #fff6e0; width: 84px; height: 84px; display: grid; place-items: center; border-radius: 18px; background: radial-gradient(circle at 35% 30%, #e03a30, #a3141c 60%, #6e0a10); border: 3px solid var(--gold); box-shadow: 0 0 40px rgba(224, 74, 58, 0.6); animation: stamp 0.5s 0.55s cubic-bezier(.3, 1.6, .5, 1) both; }
.de-card { position: relative; border-radius: 20px; padding: 26px 20px 18px; border: 2px solid rgba(214, 165, 74, 0.35); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); transition: transform 0.4s, filter 0.4s; }
.de-card.me { background: linear-gradient(160deg, #6e1218, #2a0709); animation: deLeft 0.6s 0.25s cubic-bezier(.2, .9, .3, 1) both; }
.de-card.opp { background: linear-gradient(200deg, #17604a, #062018); animation: deRight 0.6s 0.25s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes deLeft { from { opacity: 0; transform: translateX(-120px) rotate(-6deg); } }
@keyframes deRight { from { opacity: 0; transform: translateX(120px) rotate(6deg); } }
.de-card.winner { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224, 179, 90, 0.25), 0 0 60px rgba(224, 179, 90, 0.45), 0 20px 60px rgba(0, 0, 0, 0.55); transform: scale(1.04); }
.de-card.loser { filter: saturate(0.55) brightness(0.8); }
.de-crown { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); color: #ffd76a; filter: drop-shadow(0 0 14px rgba(255, 200, 80, 0.9)); animation: crown 0.7s 1s cubic-bezier(.3, 1.7, .5, 1) both; }
.de-crown svg.lucide { width: 54px; height: 54px; stroke-width: 1.8; fill: rgba(255, 215, 106, 0.35); }
@keyframes crown { from { opacity: 0; transform: translate(-50%, -80px) rotate(-25deg) scale(0.4); } to { opacity: 1; transform: translate(-50%, 0) rotate(0) scale(1); } }
.de-name { font-family: var(--title); font-weight: 900; font-size: 24px; color: #fff3d6; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.de-tag { text-align: center; font-size: 11px; letter-spacing: 0.25em; text-transform: uppercase; color: rgba(255, 240, 210, 0.6); margin-bottom: 12px; }
.de-score { text-align: center; font-family: var(--title); font-weight: 900; font-size: 46px; color: var(--gold-2); text-shadow: 0 0 24px rgba(224, 179, 90, 0.5); font-variant-numeric: tabular-nums; line-height: 1; }
.de-score small { display: block; font-family: var(--ui); font-size: 10px; letter-spacing: 0.2em; color: rgba(255, 240, 210, 0.6); margin-top: 4px; font-weight: 600; }
.de-progress { height: 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.35); overflow: hidden; margin: 14px 0 12px; }
.de-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #fff1c2); transition: width 1.2s 0.9s cubic-bezier(.2, .8, .2, 1); }
.de-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.de-stats div { background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 7px 9px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: rgba(255, 240, 210, 0.75); }
.de-stats b { color: #fff; font-size: 15px; font-variant-numeric: tabular-nums; }
.de-reason { color: var(--muted); margin: 0; font-size: 14px; animation: fadeIn 0.5s 1.2s both; }
#de-actions { animation: fadeIn 0.5s 1.4s both; }
@media (max-width: 760px) { .de-cards { grid-template-columns: 1fr; } .de-vs { margin: 0 auto; width: 60px; height: 60px; font-size: 34px; } }

/* --------------------------------------------------------- porte d'entrée */
#enter-btn { display: none; margin-top: 6px; animation: rise 0.6s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 40px rgba(224, 74, 58, 0.5), 0 8px 24px rgba(179, 32, 42, 0.4); }
#enter-btn:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 4px; }
.enter-hint { display: none; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-size: 10px; }
#loader.ready #enter-btn { display: inline-flex; }
#loader.ready .enter-hint { display: block; }
#loader.ready .loader-bar, #loader.ready #loader-text { display: none; }
/* le temple se devine déjà derrière l'écran d'entrée */
#loader.ready { background: radial-gradient(circle at 50% 40%, rgba(42, 10, 12, 0.55), rgba(5, 2, 3, 0.88) 70%); backdrop-filter: blur(3px); }

/* --------------------------------------------------------- mode samouraï */
.menu-card.sm { border-color: rgba(255, 255, 255, 0.5); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 40px rgba(255, 255, 255, 0.12), inset 0 0 0 1px rgba(224, 74, 58, 0.35); }
.hardcore-tag.samurai { color: #ffffff; background: linear-gradient(90deg, rgba(10, 10, 10, 0.85), rgba(110, 10, 14, 0.85)); border-color: rgba(255, 255, 255, 0.55); }

/* --------------------------------------------------------- incrustation de l'adversaire (duel) */
.pip { position: absolute; right: 16px; bottom: 96px; width: min(300px, 30vw); aspect-ratio: 16 / 10; border-radius: 14px; border: 2px solid rgba(214, 165, 74, 0.7); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(0, 0, 0, 0.35); pointer-events: none; overflow: hidden; }
.pip-label { position: absolute; left: 8px; top: 7px; font-family: var(--title); font-size: 12px; color: var(--gold-2); background: rgba(10, 20, 16, 0.75); padding: 3px 9px; border-radius: 8px; letter-spacing: 0.06em; }
.pip-hint { position: absolute; right: 8px; bottom: 6px; font-size: 10px; color: rgba(255, 255, 255, 0.6); background: rgba(0, 0, 0, 0.4); padding: 2px 7px; border-radius: 6px; }
@media (max-width: 760px) { .pip { bottom: 64px; width: 42vw; } }

/* ---------------------------------------------------------------- modes : contre la montre, aveugle, zen, défi du jour */
.hardcore-tag.mode { color: #f6dfa6; background: rgba(60, 40, 10, 0.75); border-color: rgba(224, 179, 90, 0.5); }
#h-time.low { color: #ff6a5a; animation: lowTime 1s ease-in-out infinite; }
@keyframes lowTime { 50% { transform: scale(1.12); text-shadow: 0 0 18px rgba(255, 90, 70, 0.8); } }
.board-head { flex-wrap: wrap; gap: 8px; }
.board-select { background: rgba(0, 0, 0, 0.35); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font: 600 13px var(--ui); }
.board-select option { background: #1a1410; }
