:root {
  color-scheme: dark;
  --ease: steps(3, end);
  --display: var(--font-display);
  --body: var(--font-body);
  font-family: var(--font-body);
  font-synthesis: none;
  color: var(--ivory);
  background: var(--ink);
  scrollbar-color: var(--gold) var(--navy);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-underline-offset: .2em; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--ivory); outline-offset: 5px; }
[hidden] { display: none !important; }
::selection { background: var(--gold); color: var(--ink); }
input { caret-color: var(--gold); accent-color: var(--gold); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; display: block; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: fixed; top: 8px; left: 8px; z-index: 20; background: var(--ivory); color: var(--ink); padding: 12px; transform: translateY(-180%); }
.skip:focus { transform: none; }
.palace { position: fixed; inset: 0; background: linear-gradient(180deg, #050c1899, #050c18cc 55%, #050c18f2), url("../assets/pixel/salon.webp") center/cover no-repeat; image-rendering: pixelated; pointer-events: none; }
.scene { position: relative; isolation: isolate; width: min(100%, 1800px); height: 100dvh; margin: auto; padding: 8px clamp(12px, 2.5vw, 44px) 24px; display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 20px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: block; width: clamp(240px, 29vw, 420px); height: 100%; line-height: 0; }
.brand img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.brand-fallback { font: 600 36px/1 var(--display); color: var(--gold); }
.tools { display: flex; align-items: center; gap: 8px; }
.tool-button { position: relative; min-width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: 3px; color: var(--gold); background: #071a2ae6; transition: background 120ms var(--ease); }
.tool-button:hover { background: #1e405a; }
.tool-button:active { transform: translateY(1px); }
.music-button { padding: 0 12px; }
.music-copy { text-align: left; font-size: 14px; }
.music-copy small { display: block; margin-top: 3px; font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.equalizer { height: 20px; display: flex; align-items: end; gap: 3px; }
.equalizer i { display: block; height: 16px; width: 2px; background: var(--gold); transform: scaleY(.25); transform-origin: bottom; }
.music-button.is-playing .equalizer i { animation: equalize 900ms ease-in-out infinite alternate; }
.equalizer i:nth-child(2) { animation-delay: -650ms !important; }
.equalizer i:nth-child(3) { animation-delay: -200ms !important; }
.equalizer i:nth-child(4) { animation-delay: -450ms !important; }
@keyframes equalize { to { transform: scaleY(1); } }
.sound-slash { display: none; position: absolute; width: 25px; height: 2px; background: var(--gold); transform: rotate(-45deg); }
#sound-button[aria-pressed="false"] .sound-slash { display: block; }
#main { min-height: 0; }
.selection-layout { display: grid; height: 100%; grid-template-columns: minmax(0,1fr) minmax(290px, 34%); gap: clamp(28px, 5vw, 80px); }
.council { min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); gap: 28px; }
#page-title { margin: 0; font: 600 clamp(28px, 2.8vw, 44px)/1.15 var(--display); text-wrap: balance; }
#page-title span { display: block; margin-top: 8px; font: 400 clamp(17px, 1.5vw, 22px)/1.3 var(--body); color: var(--muted); }
.roster-stage { min-height: 0; display: grid; align-items: center; }
.advisor-grid { --grid-columns: 5; display: grid; grid-template-columns: repeat(var(--grid-columns),minmax(0,1fr)); grid-template-rows: repeat(3,minmax(0,1fr)); gap: clamp(10px, 1.3vw, 22px); align-items: center; justify-items: center; max-height: 100%; padding: 5px; }
.advisor-card { position: relative; display: block; padding: 0; width: min(100%, calc((100dvh - 290px) / 3)); aspect-ratio: 1; border: 1px solid #e4bc7399; background: var(--navy); border-radius: 3px; }
.advisor-card .portrait { display: block; width: 100%; height: 100%; overflow: hidden; border-radius: 3px; }
.advisor-card .portrait img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; transition: transform 160ms var(--ease), filter 160ms var(--ease); }
.advisor-card.is-selected { outline: 2px solid var(--gold); outline-offset: 4px; }
.selected-mark { position: absolute; right: 5px; bottom: 5px; display: grid; place-items: center; width: 24px; height: 24px; background: var(--gold); color: var(--ink); opacity: 0; transform: scale(.6); transition: opacity 120ms var(--ease), transform 160ms var(--ease); border-radius: 3px; }
.selected-mark svg { width: 18px; height: 18px; }
.is-selected .selected-mark { opacity: 1; transform: scale(1); }
.advisor-card:active .portrait img { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) {
  .advisor-card:hover { border-color: var(--ivory); }
  .advisor-card:hover .portrait img { transform: scale(1.045); filter: brightness(1.08); }
  .primary-action:hover { background: #f5d491; }
  .primary-action:hover svg:last-child { transform: translateX(3px); }
}
.advisor-detail { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.profile-portrait { display: flex; flex: 1 1 0; min-height: 0; width: 100%; justify-content: center; align-items: center; container-type: size; }
.profile-portrait .portrait { display: block; width: min(100cqw, calc(100cqh * 2 / 3)); height: auto; aspect-ratio: 2/3; border: 1px solid var(--gold); padding: 5px; background: var(--navy); }
.profile-portrait img { display: block; width: 100%; height: 100%; object-fit: contain; }
.portrait-missing { display: grid !important; place-items: center; padding: 12px; font-size: 14px; color: var(--muted); background: var(--navy); }
.profile-heading { flex: none; text-align: center; width: 100%; }
.profile-heading h2 { margin: 0; font: 600 clamp(30px, 2.9vw, 46px)/1.07 var(--display); text-wrap: balance; }
.profile-party { color: var(--gold); margin: 8px 0 0; font: 500 clamp(17px, 1.5vw, 22px)/1.2 var(--body); text-wrap: balance; }
.primary-action { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; max-width: 390px; flex: none; min-height: 56px; padding: 12px 18px; border-radius: 3px; background: var(--gold); color: var(--ink); font: 600 clamp(20px, 1.8vw, 27px)/1.1 var(--display); transition: background 120ms var(--ease), transform 80ms var(--ease); }
.primary-action svg:last-child { width: 20px; transition: transform 120ms var(--ease); }
.primary-action:active { transform: translateY(1px); }
.home-status { margin: 0; max-width: 75ch; font-size: 14px; color: var(--ivory); }
.home-status:empty { display: none; }
/* Settings and save protection occupy the preview column, never an overlay. */
.advisor-detail:has(.panel-body) { align-items: stretch; justify-content: start; padding: 20px; background: #071a2af2; overflow-y: auto; }
.panel-back, .text-button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 0; color: var(--gold); text-align: left; }
.panel-back { align-self: start; flex: none; }
.panel-back svg, .text-button svg { width: 18px; }
.panel-heading h2 { margin: 8px 0; font: 600 32px/1.15 var(--display); }
.panel-heading p { margin: 8px 0; color: var(--muted); }
.panel-body { display: flex; flex-direction: column; gap: 24px; }
.panel-body p { margin: 0; line-height: 1.5; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; }
.setting-row strong { display: block; font-weight: 500; }
.setting-row small { display: block; color: var(--muted); line-height: 1.3; margin-top: 5px; }
.setting-row input { width: 24px; height: 24px; flex: none; cursor: pointer; }
.volume-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; }
.volume-row input { width: 100%; min-height: 44px; }
.volume-row output { font-variant-numeric: tabular-nums; }
.panel-note { color: var(--muted); font-size: 13px; }
.save-warning { display: grid; gap: 16px; }
.inline-actions { display: grid; gap: 12px; }
.inline-actions button { min-height: 44px; padding: 12px; border-radius: 3px; }
.gold-button { color: var(--ink); background: var(--gold); }
.subtle-button { color: var(--ivory); background: #18384c; }
.launch-error { color: var(--ivory); }
.noscript { position: fixed; inset: auto 10px 10px; padding: 16px; background: var(--navy); }
@media (max-width: 900px) {
  .scene { padding-inline: 24px; gap: 16px; }
  .selection-layout { grid-template-columns: minmax(0,1fr) 31%; gap: 24px; }
  .council { gap: 20px; }
  .advisor-grid { gap: 12px; }
  .profile-heading h2 { font-size: 30px; }
  .primary-action { gap: 8px; padding-inline: 10px; font-size: 21px; }
}
@media (max-width: 700px) {
  .scene { padding: 12px 16px 20px; grid-template-rows: auto minmax(0,1fr) auto; gap: 20px; }
  .masthead { gap: 8px; }
  .brand { width: min(47%, 245px); }
  .tools { gap: 4px; }
  .music-copy, .equalizer { display: none; }
  .music-button { padding: 0; }
  .resume-button { font-size: 12px; gap: 4px; }
  .resume-button svg { display: none; }
  .selection-layout { grid-template-columns: minmax(0,1fr) minmax(132px, 43%); gap: 16px; }
  .council { gap: 16px; }
  #page-title { font-size: clamp(22px, 4.8vw, 32px); }
  #page-title span { font-size: 15px; margin-top: 8px; }
  .advisor-grid { --grid-columns: 3; grid-template-rows: repeat(5,minmax(0,1fr)); gap: 10px; padding: 5px; }
  .advisor-card { width: min(100%, calc((100dvh - 255px) / 5)); min-width: 44px; }
  .selected-mark { width: 18px; height: 18px; right: 2px; bottom: 2px; }
  .selected-mark svg { width: 14px; height: 14px; }
  .advisor-detail { gap: 16px; }
  .profile-portrait { flex: 1 1 0; width: 100%; height: auto; }
  .profile-portrait .portrait { width: min(100cqw, calc(100cqh * 2 / 3)); height: auto; padding: 3px; }
  .profile-heading h2 { font-size: clamp(24px, 5vw, 32px); }
  .profile-party { font-size: 16px; margin-top: 8px; }
  .primary-action { min-height: 56px; font-size: 21px; }
  .primary-action svg { display: none; }
  .selection-layout.show-panel .council { display: none; }
  .selection-layout.show-panel .advisor-detail { grid-column: 1/-1; }
}
@media (max-width: 380px) {
  .scene { padding-inline: 12px; }
  .selection-layout { gap: 12px; grid-template-columns: minmax(0,1fr) 43%; }
  .advisor-grid { gap: 7px; }
  .advisor-card { min-width: 44px; }
  #page-title { font-size: 23px; }
  .profile-heading h2 { font-size: 24px; }
  .profile-party { font-size: 14px; }
  .primary-action { font-size: 19px; }
  .brand { width: 42%; }
}
/* At extreme zoom, access to every face and control takes priority over no scroll. */
@media (max-height: 480px) {
  html, body { height: auto; overflow: auto; }
  .scene { height: auto; min-height: 100dvh; grid-template-rows: auto minmax(440px,1fr) auto; }
  .advisor-card { width: min(100%, 110px); }
  .advisor-detail { min-height: 400px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; }

@media (max-height: 700px) and (max-width: 700px) {
  .scene { gap: 12px; padding-block: 6px 12px; }
  .advisor-detail { gap: 8px; }
  .profile-heading h2 { font-size: 22px; }
  .profile-party { font-size: 14px; margin-top: 4px; }
  .primary-action { min-height: 44px; font-size: 18px; padding-block: 8px; }
  .council { gap: 10px; }
  #page-title { font-size: 21px; }
  #page-title span { margin-top: 4px; font-size: 14px; }
  .advisor-grid { gap: 7px; }
}

/* ——— Sélection 16 bits : écran « choisissez votre candidat » d'un jeu de salon. ——— */
svg { stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; shape-rendering: crispEdges; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: var(--px) solid var(--ivory); outline-offset: var(--px); }
.brand img { image-rendering: pixelated; }
.tool-button { border-radius: 0; border: calc(var(--px) * 3) solid transparent; border-image: var(--button-navy) 3 fill / calc(var(--px) * 3) stretch; background: none; min-width: 48px; height: 48px; transition: none; }
.tool-button:hover { background: none; filter: brightness(1.25); }
.music-copy { font: 400 20px/1 var(--font-display); letter-spacing: .03em; }
.music-copy small { margin-top: 2px; font: 400 15px/1 var(--font-display); letter-spacing: .08em; }
.equalizer i { width: var(--px); }
.music-button.is-playing .equalizer i { animation-timing-function: steps(4, end); }
#page-title { font: 400 clamp(36px, 4vw, 64px)/.9 var(--font-display); letter-spacing: .03em; text-transform: uppercase; color: var(--gold); text-shadow: 0 var(--px) 0 var(--gold-lo), var(--px) calc(var(--px) * 2) 0 var(--ink); }
#page-title span { margin-top: 10px; font: 400 clamp(20px, 1.7vw, 26px)/1 var(--font-display); letter-spacing: .08em; color: var(--ivory); text-shadow: var(--px) var(--px) 0 var(--ink); }
.advisor-grid { gap: clamp(12px, 1.4vw, 22px); padding: calc(var(--px) * 3); }
.advisor-card { border: calc(var(--px) * 3) solid transparent; border-image: var(--frame-steel) 3 / calc(var(--px) * 3) stretch; border-radius: 0; background: var(--night) padding-box; filter: drop-shadow(0 calc(var(--px) * 2) 0 #02060e); }
.advisor-card .portrait { border-radius: 0; }
.advisor-card .portrait img { image-rendering: pixelated; filter: brightness(.72) saturate(.85); transition: none; }
.advisor-card.is-selected { outline: 0; border-image-source: var(--frame-gold); transform: translateY(calc(var(--px) * -2)); }
.advisor-card.is-selected .portrait img { filter: none; }
.advisor-card.is-selected::before { content: ""; position: absolute; left: 50%; top: calc(var(--px) * -9); width: calc(var(--px) * 7); height: calc(var(--px) * 4); margin-left: calc(var(--px) * -3.5); background: var(--gold-hi); clip-path: polygon(0 0, 100% 0, 100% 25%, 85.7% 25%, 85.7% 50%, 71.4% 50%, 71.4% 75%, 57.1% 75%, 57.1% 100%, 42.9% 100%, 42.9% 75%, 28.6% 75%, 28.6% 50%, 14.3% 50%, 14.3% 25%, 0 25%); animation: pick-hop 600ms steps(2, end) infinite alternate; }
@keyframes pick-hop { to { transform: translateY(calc(var(--px) * -2)); } }
.selected-mark { display: none; }
@media (hover: hover) and (pointer: fine) {
  .advisor-card:hover { border-image-source: var(--frame-gold); }
  .advisor-card:hover .portrait img { transform: none; filter: brightness(1.05); }
  .primary-action:hover { background: none; filter: drop-shadow(0 calc(var(--px) * 2) 0 #02060e) brightness(1.15); }
}
.profile-portrait .portrait { border: calc(var(--px) * 3) solid transparent; border-image: var(--frame-gold) 3 / calc(var(--px) * 3) stretch; padding: 0; background: var(--night) padding-box; filter: drop-shadow(0 calc(var(--px) * 3) 0 #02060e); }
.profile-portrait img { image-rendering: pixelated; }
.profile-heading h2 { font: 400 clamp(36px, 3.6vw, 58px)/.9 var(--font-display); letter-spacing: .03em; text-transform: uppercase; color: var(--ivory); text-shadow: var(--px) calc(var(--px) * 2) 0 var(--ink); }
.profile-party { font: 400 clamp(20px, 1.7vw, 26px)/1 var(--font-display); letter-spacing: .06em; text-shadow: var(--px) var(--px) 0 var(--ink); }
.primary-action { border-radius: 0; border: calc(var(--px) * 3) solid transparent; border-image: var(--button-gold) 3 fill / calc(var(--px) * 3) stretch; background: none; min-height: 60px; font: 400 clamp(26px, 2.2vw, 34px)/1 var(--font-display); letter-spacing: .05em; text-transform: uppercase; filter: drop-shadow(0 calc(var(--px) * 2) 0 #02060e); transition: none; animation: cta-pulse 1.2s steps(2, end) infinite; }
.primary-action:active { transform: translateY(calc(var(--px) * 2)); filter: none; }
@keyframes cta-pulse { 50% { filter: drop-shadow(0 calc(var(--px) * 2) 0 #02060e) brightness(1.14); } }
.home-status { font: var(--font-small); letter-spacing: .03em; }
.advisor-detail:has(.panel-body) { border: calc(var(--px) * 3) solid transparent; border-image: var(--frame-gold) 3 / calc(var(--px) * 3) stretch; background: var(--night) padding-box; }
.panel-back, .text-button { font: 400 20px/1 var(--font-display); letter-spacing: .04em; }
.panel-heading h2 { font: 400 40px/.95 var(--font-display); letter-spacing: .03em; text-transform: uppercase; color: var(--gold); }
.panel-heading p, .panel-body p { font-size: 16px; }
.setting-row strong { font: 400 22px/1 var(--font-display); letter-spacing: .03em; }
.setting-row small, .panel-note { font: var(--font-small); letter-spacing: .03em; }
.inline-actions button { border-radius: 0; border: calc(var(--px) * 3) solid transparent; border-image: var(--button-navy) 3 fill / calc(var(--px) * 3) stretch; background: none; font: 400 24px/1 var(--font-display); letter-spacing: .04em; text-transform: uppercase; min-height: 52px; }
.inline-actions .gold-button { border-image-source: var(--button-gold); }
@media (max-width: 700px) {
  #page-title { font-size: clamp(28px, 7vw, 38px); }
  #page-title span { font-size: 18px; margin-top: 6px; }
  .profile-heading h2 { font-size: clamp(28px, 7vw, 38px); }
  .profile-party { font-size: 18px; }
  .primary-action { font-size: 24px; min-height: 52px; }
  .advisor-card.is-selected { transform: none; }
  .advisor-card.is-selected::before { display: none; }
}
@media (max-height: 700px) and (max-width: 700px) { #page-title { font-size: 26px; } .profile-heading h2 { font-size: 26px; } .primary-action { font-size: 22px; min-height: 46px; } }
/* Bandeau pleine largeur, comme pendant la partie : plus de marge autour. */
.scene { padding-top: 0; }
.scene > .game-hud { margin-inline: calc(50% - 50vw); padding-inline: max(12px, calc(50vw - 50% + 12px)); }
/* Une partie vous attend : le président en place face au nouveau candidat. */
.face-off { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; margin: 0 0 14px; }
.face-off figure { margin: 0; display: grid; gap: 6px; justify-items: center; text-align: center; }
.face-off .portrait { display: block; width: 100%; max-width: 150px; aspect-ratio: 2 / 3; overflow: hidden; border: calc(var(--px) * 3) solid transparent; border-image: var(--frame-steel) 3 / calc(var(--px) * 3) stretch; background: var(--ink) padding-box; }
.face-off figure:last-child .portrait { border-image-source: var(--frame-gold); }
.face-off .portrait img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.face-off figcaption { font: 400 22px/1 var(--font-display); text-transform: uppercase; color: var(--ivory); }
.face-off figcaption small { display: block; margin-bottom: 2px; font-size: 15px; letter-spacing: .1em; color: var(--muted); }
.face-off-vs { font: 400 44px/1 var(--font-display); color: var(--red); text-shadow: 0 var(--px) 0 #7d1d18; }
@media (max-width: 700px) { .face-off .portrait { max-width: 96px; } .face-off figcaption { font-size: 18px; } .face-off-vs { font-size: 32px; } }
.face-off .portrait { max-width: 112px; }
.face-off { margin-bottom: 8px; }
.panel-body:has(.face-off) .save-warning { gap: 8px; }
/* Une partie vous attend : tout tient sans défiler. */
.panel-body:has(.face-off) { gap: 10px; }
.face-off .portrait { max-width: 96px; }
.face-off figcaption { font-size: 19px; }
.panel-body:has(.face-off) .save-warning p { margin: 0; }
.panel-body:has(.face-off) .inline-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
.panel-body:has(.face-off) .inline-actions button { font-size: 20px; line-height: 1.05; padding: 8px 6px; }
@media (max-height: 760px) { .panel-body:has(.face-off) + *, .panel-heading:has(+ .panel-body .face-off) h2 { font-size: 32px; } .face-off .portrait { max-width: 84px; } }
@media (max-height: 640px) {
  .panel-heading:has(+ .panel-body .face-off) h2 { font-size: 26px; }
  .panel-heading:has(+ .panel-body .face-off) p { display: none; }
  .face-off .portrait { max-width: 52px; }
  .face-off figcaption { font-size: 16px; }
  .face-off figcaption small { display: none; }
  .panel-body:has(.face-off) .save-warning p { display: none; }
}
