/* Noël · Station Polaire
   Règles de perf : aucune backdrop-filter (elle recalculerait un flou à chaque image du canvas),
   animations limitées à transform / opacity / clip-path, fonds semi-opaques à la place. */

@font-face { font-family: 'Unbounded'; src: url('fonts/unbounded.woff2') format('woff2'); font-weight: 300 800; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('fonts/grotesk.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('fonts/mono.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #02030a;
  --ink: #eaf3ff;
  --mute: rgba(214, 228, 255, 0.62);
  --faint: rgba(214, 228, 255, 0.36);
  --line: rgba(150, 200, 255, 0.13);
  --line2: rgba(150, 200, 255, 0.26);
  --ice: #7ff0ff;
  --gold: #ffd27a;
  --rose: #ff5fae;
  --red: #ff4d6d;
  --card: rgba(8, 13, 30, 0.6);
  --f-display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --f-body: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --c: var(--ice);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--ice); color: var(--bg); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- fond */
#sky {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
  touch-action: pan-y;
  cursor: grab;
}
#sky:active { cursor: grabbing; }
.scanlines {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}
body.no-gl {
  background:
    radial-gradient(ellipse at 72% 18%, rgba(60, 242, 255, 0.16), transparent 50%),
    radial-gradient(ellipse at 20% 85%, rgba(255, 79, 216, 0.12), transparent 55%),
    radial-gradient(ellipse at 60% 60%, rgba(140, 255, 107, 0.06), transparent 40%),
    var(--bg);
  background-attachment: fixed;
}
body.no-gl #sky { display: none; }

#app { position: relative; z-index: 10; pointer-events: none; }
#app .gate-card, #app .who-head, #app .who-grid, #app .who-foot,
#app .topbar > *, #app .crew, #app .drawer { pointer-events: auto; }
/* écran principal : le canvas plein écran est l'application, rien ne défile hors du tiroir (§2.1) */
body[data-screen="main"] { overflow: hidden; height: 100dvh; overscroll-behavior: none; }
body[data-screen="main"] #sky { touch-action: none; }

/* ------------------------------------------------------------- boot */
.boot {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 0.9s var(--ease), visibility 0.9s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-inner { width: min(380px, calc(100% - 48px)); }
.boot-mark {
  font-size: 34px; color: var(--ice); line-height: 1; margin-bottom: 26px;
  animation: spin 3s linear infinite;
  display: inline-block;
  text-shadow: 0 0 18px var(--ice);
}
.boot-lines { list-style: none; margin: 0 0 22px; padding: 0; font: 500 12px/2 var(--f-mono); letter-spacing: 0.06em; color: var(--mute); }
.boot-lines li { opacity: 0; animation: boot-line 0.35s var(--ease) forwards; display: flex; gap: 10px; }
.boot-lines li::before { content: '›'; color: var(--ice); }
.boot-lines li::after { content: 'OK'; margin-left: auto; color: var(--ice); opacity: 0; animation: fade 0.2s forwards; animation-delay: inherit; }
.boot-lines li:nth-child(1) { animation-delay: 0.1s; }
.boot-lines li:nth-child(2) { animation-delay: 0.5s; }
.boot-lines li:nth-child(3) { animation-delay: 0.9s; }
.boot-lines li:nth-child(4) { animation-delay: 1.3s; }
.boot-lines li.fail { animation-delay: 0s; color: var(--red); }
.boot-lines li.fail::after { content: '!'; color: var(--red); }
.boot-bar { height: 2px; background: var(--line); overflow: hidden; }
.boot-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ice), var(--rose)); transform-origin: left; animation: fill 1.8s var(--ease) forwards; transform: scaleX(0); }

/* ------------------------------------------------------------- cadre HUD */
.frame {
  position: relative;
  background:
    linear-gradient(135deg, transparent 10.4px, var(--line2) 10.4px 11.6px, transparent 11.6px) top left / 18px 18px no-repeat,
    linear-gradient(-45deg, transparent 10.4px, var(--line2) 10.4px 11.6px, transparent 11.6px) bottom right / 18px 18px no-repeat,
    linear-gradient(180deg, rgba(9, 15, 34, 0.84), rgba(4, 7, 18, 0.9));
  border: 1px solid var(--line);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
}
.frame::before, .frame::after {
  content: ''; position: absolute; width: 22px; height: 22px; pointer-events: none;
  border: 0 solid var(--c);
  transition: border-color 0.4s;
}
.frame::before { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.frame::after { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }

.kicker {
  display: flex; justify-content: space-between; gap: 16px;
  font: 500 11px/1 var(--f-mono); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--c); margin-bottom: 14px;
}
.kicker span:last-child { color: var(--faint); }
.kicker.center { justify-content: center; }
.kicker.center span + span::before { content: '//'; margin-right: 16px; color: var(--faint); }

.title {
  margin: 0;
  font: 700 clamp(34px, 4.4vw, 58px)/1 var(--f-display);
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #fff 10%, var(--c) 70%, #fff 130%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  overflow-wrap: anywhere;
}
.sub { margin: 12px 0 0; color: var(--mute); font-size: 15px; }

/* ------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; min-height: 40px;
  font: 600 11.5px/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line2);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-solid { background: var(--c); color: var(--bg); border-color: transparent; font-weight: 700; }
.btn-solid:hover { background: #fff; }
.btn-ghost { color: var(--mute); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn-claim { color: var(--c); border-color: color-mix(in srgb, var(--c) 55%, transparent); min-width: 118px; }
@media (hover: hover) { .btn-claim:not(.is-on):hover { background: var(--c); color: var(--bg); } }
.btn-claim.is-on { color: var(--gold); border-color: var(--gold); background: rgba(255, 210, 122, 0.1); }
.btn-claim.is-on .off-txt { display: none; }
@media (hover: hover) {
  .btn-claim.is-on:hover { background: var(--red); border-color: var(--red); color: #fff; }
  .btn-claim.is-on:hover .on-txt { display: none; }
  .btn-claim.is-on:hover .off-txt { display: inline; }
}
/* sur écran tactile, pas de survol : l'annulation reste accessible par un libellé explicite */
@media (hover: none) {
  .btn-claim.is-on .on-txt::after { content: ' · annuler'; opacity: 0.6; }
}
.btn-danger { color: #ff9fb1; border-color: rgba(255, 77, 109, 0.5); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn.armed { background: var(--red); border-color: var(--red); color: #fff; animation: armed 0.6s ease-in-out infinite alternate; }
kbd { font: 500 10px/1 var(--f-mono); padding: 3px 5px; border: 1px solid currentColor; opacity: 0.6; }

/* ------------------------------------------------------------- verrou */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.gate-card { width: min(460px, 100%); padding: 34px 30px 26px; animation: rise 0.7s var(--ease) both; }
.gate-card .title { font-size: clamp(28px, 6vw, 40px); }
.field { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.field input {
  flex: 1 1 180px; min-width: 0; min-height: 44px;
  padding: 10px 14px;
  background: rgba(2, 4, 12, 0.7);
  border: 1px solid var(--line2);
  font-size: 16px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.err { min-height: 1.4em; margin: 12px 0 0; color: #ff9fb1; font: 500 12px/1.4 var(--f-mono); letter-spacing: 0.04em; }
.shake { animation: shake 0.4s; }

/* ------------------------------------------------------------- qui es-tu */
.who {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: clamp(28px, 7vh, 72px) 16px max(20px, env(safe-area-inset-bottom));
  text-align: center;
}
.who-head { animation: rise 0.9s var(--ease) both; }
.who-title {
  margin: 0;
  font: 800 clamp(46px, 9vw, 124px)/0.92 var(--f-display);
  letter-spacing: -0.035em;
}
.who-title span {
  display: inline-block;
  background: linear-gradient(95deg, #fff 0%, var(--ice) 45%, var(--rose) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.who-title .w1 { margin-right: 0.22em; }
.who-sub { margin: 18px 0 0; color: var(--mute); font-size: 16px; }
.who-grid {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  max-width: 1000px;
}
.who-tile {
  --chamfer: 14px;
  position: relative; overflow: hidden;
  width: 132px; height: 176px;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  padding: 14px;
  text-align: left;
  background: rgba(5, 9, 22, 0.72);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
  clip-path: polygon(var(--chamfer) 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%, 0 var(--chamfer));
  transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, color 0.15s;
  animation: tile-in 0.6s var(--ease) both;
  animation-delay: calc(var(--i) * 70ms + 250ms);
}
.who-av {
  position: absolute; left: 50%; top: 8px; width: 92px; height: 110px;
  transform: translateX(-50%);
  transition: transform 0.35s var(--ease);
  filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--c) 45%, transparent));
}
.who-av .av { width: 100%; height: 100%; }
.who-idx { position: absolute; top: 12px; left: 14px; font: 500 11px/1 var(--f-mono); color: var(--c); letter-spacing: 0.15em; }
.who-name { position: relative; font: 600 16px/1.2 var(--f-display); letter-spacing: -0.01em; }
.who-tile::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 8px; height: 2px;
  background: var(--c); transform: scaleX(0.15); transform-origin: left;
  transition: transform 0.35s var(--ease);
  box-shadow: 0 0 12px var(--c);
}
.who-tile:focus-visible, .who-tile:hover {
  transform: translateY(-8px);
  border-color: var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, rgba(5, 9, 22, 0.8)), rgba(5, 9, 22, 0.85));
}
.who-tile:hover .who-av { transform: translateX(-50%) translateY(-6px) scale(1.08) rotate(-4deg); }
.who-tile:hover::after { transform: scaleX(1); }
.who-tile.is-picked { background: var(--c); color: var(--bg); }
.who-tile.is-picked .who-idx { color: var(--bg); }
.who-foot { animation: fade 1s 0.8s both; }
/* 8e place (egg « huitième ») : pointillé très discret, la tuile Bip y glisse */
.who-ghost {
  position: relative; width: 132px; height: 176px; padding: 14px;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  background: none; border: 1px dashed rgba(150, 200, 255, 0.09); color: var(--ink);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  animation: tile-in 0.6s var(--ease) both; animation-delay: calc(var(--i, 7) * 70ms + 250ms);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.who-ghost.is-bip { --c: #ff4fd8; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: rgba(255, 79, 216, 0.08); animation: bip-in 0.6s var(--ease) both; }
.who-ghost.is-bip .who-av .pet { width: 100%; height: 100%; }
.who-ghost.jump { animation: jump 0.55s var(--ease); }
@keyframes bip-in { from { opacity: 0; transform: translateX(40px) scale(0.9); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- compte à rebours */
.countdown { display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--f-mono); }
.cd-label { font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--faint); }
.cd-val { font-size: 14px; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.cd-val b { color: var(--ice); font-weight: 600; margin-right: 6px; }
.cd-val i { font-style: normal; animation: blink-caret 1s steps(2, start) infinite; color: var(--faint); }
.cd-live { color: var(--gold); }
.who-foot .cd-val { font-size: clamp(18px, 2.4vw, 24px); }

/* ------------------------------------------------------------- application */
.shell { position: relative; }
.topbar {
  position: fixed; z-index: 10; top: 0; left: 0; right: 0;
  height: 64px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 16px 0 10px;
  background: linear-gradient(180deg, rgba(2, 3, 10, 0.78), rgba(2, 3, 10, 0));
  pointer-events: none;
  animation: fade 0.6s both;
}
.brand { display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); text-decoration: none; justify-self: start; min-width: 44px; min-height: 44px; font-size: 20px; }
.brand-name, .brand-yr { display: none; }
.topbar .countdown { cursor: pointer; padding: 14px 16px; margin: -6px 0; -webkit-tap-highlight-color: transparent; }
.sound-slot { display: inline-flex; }
.sound-slot:empty { display: none; }
.brand-star { color: var(--ice); display: inline-block; animation: spin 14s linear infinite; text-shadow: 0 0 12px var(--ice); }
.brand-name { font: 700 17px/1 var(--f-display); letter-spacing: 0.24em; text-transform: uppercase; }
.brand-yr { font: 500 12px/1 var(--f-mono); color: var(--faint); letter-spacing: 0.1em; }
.top-right { justify-self: end; display: flex; align-items: center; gap: 14px; }
.me { position: relative; }
.online { display: flex; align-items: center; gap: 10px; }
.online-stack { display: flex; }
.online-av {
  width: 30px; height: 34px; margin-left: -8px; padding: 0;
  background: none; border: 0;
  transition: transform 0.2s var(--ease);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 60%, transparent));
}
.online-av:first-child { margin-left: 0; }
.online-av:hover { transform: translateY(-3px) scale(1.12); }
.online-av .av { width: 100%; height: 100%; }
.online-txt { display: inline-flex; align-items: center; gap: 7px; font: 500 11px/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: #8dffbe; white-space: nowrap; }
.online-txt i { width: 7px; height: 7px; border-radius: 50%; background: #5cff9d; box-shadow: 0 0 10px #5cff9d; animation: led 1.6s ease-in-out infinite; }
.online-txt.is-alone { color: var(--faint); }
.online-txt.is-alone i { background: var(--faint); box-shadow: none; animation: none; }
.me-av { width: 24px; height: 28px; margin: -6px 0; }
.me-av .av { width: 100%; height: 100%; }
.me-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; min-height: 44px;
  background: rgba(6, 10, 24, 0.7);
  border: 1px solid var(--line2);
  font: 600 14px/1 var(--f-body);
  transition: border-color 0.15s;
}
.me-btn:hover { border-color: var(--c); }
.dot, .crew-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex: none; }
.chev { color: var(--faint); font-size: 10px; }
.me-name { display: none; }
.me-ico .ico { width: 18px; height: 18px; color: var(--mute); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 230px; padding: 8px; z-index: 20;
  display: flex; flex-direction: column;
  animation: rise 0.2s var(--ease) both;
}
.menu button {
  text-align: left; padding: 11px 12px;
  background: none; border: 0;
  font: 500 14px/1.2 var(--f-body); color: var(--mute);
}
.menu button:hover { color: var(--ink); background: rgba(127, 240, 255, 0.08); }

/* --- rail d'équipage (fixe, toujours visible : la fonction première reste à 1 clic) */
.crew {
  position: fixed; z-index: 11; left: 16px; top: 84px; width: 216px;
  display: flex; flex-direction: column; gap: 6px;
  max-height: calc(100dvh - 100px); overflow-y: auto; scrollbar-width: none;
  padding: 2px 8px 2px 2px; margin-left: -2px;
  animation: slide-in 0.6s 0.1s var(--ease) both;
}
.crew::-webkit-scrollbar { display: none; }
.crew-label { font: 500 10px/1 var(--f-mono); letter-spacing: 0.28em; text-transform: uppercase; color: var(--faint); margin: 12px 0 6px 2px; }
.crew-label:first-child { margin-top: 0; }
.crew-item {
  position: relative;
  display: grid; grid-template-columns: 34px 1fr auto; grid-template-areas: "av name count" "av status status" "bar bar bar";
  align-items: center; column-gap: 10px; row-gap: 2px;
  padding: 8px 12px 8px 8px;
  text-align: left;
  background: rgba(5, 9, 22, 0.62);
  border: 1px solid var(--line);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.crew-item:hover { transform: translateX(4px); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.crew-item.is-active {
  border-color: var(--c);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 22%, transparent), rgba(5, 9, 22, 0.7) 85%);
}
.crew-name { grid-area: name; font: 600 15px/1.15 var(--f-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crew-av { grid-area: av; position: relative; width: 34px; height: 40px; display: grid; place-items: center; }
.crew-av .av { width: 34px; height: 40px; }
.crew-glyph { font-size: 16px; color: var(--c); text-shadow: 0 0 10px var(--c); }
.crew-led { position: absolute; right: -1px; bottom: 3px; width: 8px; height: 8px; border-radius: 50%; background: #3a4560; border: 2px solid #050916; }
.crew-item.is-online .crew-led { background: #5cff9d; box-shadow: 0 0 8px #5cff9d; }
.crew-status { grid-area: status; display: inline-flex; align-items: center; gap: 4px; height: 18px; color: var(--faint); }
.crew-status .ico { width: 15px; height: 15px; }
.crew-status .st-av { width: 15px; height: 18px; display: inline-block; }
.crew-status .st-av .av { width: 100%; height: 100%; display: block; }
.crew-item.is-online .crew-status { color: color-mix(in srgb, #5cff9d 70%, var(--ink)); }
.crew-item.is-hot .crew-status { color: var(--gold); }
/* hexagone de niveau + anneau de progression (conic-gradient piloté par --p) */
.lvl-hex {
  --c: var(--ice);
  position: absolute; right: -7px; top: -5px; z-index: 2;
  display: inline-grid; place-items: center; width: 18px; height: 20px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: color-mix(in srgb, var(--c) 80%, #000);
  font: 700 9.5px/1 var(--f-display); color: var(--ink);
  pointer-events: none;
}
.lvl-hex::before { content: ''; position: absolute; inset: 1.5px; clip-path: inherit; background: #070b1c; }
.lvl-hex b { position: relative; font-weight: 700; }
.lvl-hex[data-frame="silver"] { background: linear-gradient(135deg, #f4f7ff, #8e9bb5 55%, #f4f7ff); }
.lvl-hex[data-frame="gold"] { background: linear-gradient(135deg, #fff1c2, #ffb938 55%, #fff1c2); }
.lvl-hex[data-frame="aurora"] { background: linear-gradient(135deg, #5cffc8, #3cf2ff 40%, #a98bff 80%); }
.lvl-hex[data-frame="prism"] { background: conic-gradient(#ff4fd8, #ffc94a, #8cff6b, #3cf2ff, #a98bff, #ff4fd8); }
.lvl-hex.mini { width: 14px; height: 16px; font-size: 8px; right: -5px; top: -3px; }
.crew-ring {
  position: absolute; inset: -2px -3px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--c) calc(var(--p, 0) * 360deg), rgba(150, 200, 255, 0.12) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 88%, #000 91%);
  mask: radial-gradient(closest-side, transparent 88%, #000 91%);
  opacity: 0.85;
}
.online-av { position: relative; }
.crew-count { grid-area: count; font: 500 12px/1 var(--f-mono); color: var(--faint); }
.crew-count small { font-size: 10px; opacity: 0.6; }
.crew-item.is-active .crew-count { color: var(--c); }
.crew-bar { grid-area: bar; height: 2px; margin-top: 6px; background: var(--line); overflow: hidden; }
.crew-bar i { display: block; height: 100%; background: var(--c); transform-origin: left; transition: transform 0.6s var(--ease); }

/* --- tiroir (ordinateur) / feuille basse (téléphone) : par-dessus la carte, fond opaque, aucun flou */
.drawer {
  position: fixed; z-index: 10; left: 244px; top: 84px; bottom: 16px;
  width: min(520px, calc(100vw - 268px));
  display: flex; flex-direction: column;
  background:
    linear-gradient(135deg, transparent 10.4px, var(--line2) 10.4px 11.6px, transparent 11.6px) top left / 18px 18px no-repeat,
    linear-gradient(-45deg, transparent 10.4px, var(--line2) 10.4px 11.6px, transparent 11.6px) bottom right / 18px 18px no-repeat,
    rgba(4, 7, 18, 0.92);
  transform: translate3d(-24px, 0, 0); opacity: 0; visibility: hidden;
  transition: transform 0.26s var(--ease), opacity 0.2s ease, visibility 0s linear 0.26s;
}
body.drawer-open .drawer, body.sheet-open .drawer { transform: none; opacity: 1; visibility: visible; transition: transform 0.26s var(--ease), opacity 0.2s ease, visibility 0s; }
.drawer.no-anim { transition: none !important; }
.drawer-x { position: absolute; top: 12px; right: 14px; z-index: 3; width: 44px; height: 44px; --c: var(--mute); background: rgba(4, 7, 18, 0.9); }
.drawer-grip { display: none; }
#hudBubble { left: var(--map-cx, 50%); transition: left 0.26s var(--ease), opacity 0.2s ease, visibility 0s linear 0s; }
.panel {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(22px, 3vw, 36px);
  scrollbar-width: thin; scrollbar-color: var(--line2) transparent;
}
.panel-head { padding-right: 44px; }
.drawer .title { font-size: clamp(28px, 3vw, 46px); overflow-wrap: break-word; }
.panel-head { margin-bottom: 22px; }
.head-row { display: flex; align-items: flex-end; gap: 16px; }
.head-txt { flex: 1; min-width: 0; }
.head-av {
  flex: none; width: 92px; height: 110px; margin: -18px -4px -6px 0; padding: 0;
  background: none; border: 0;
  filter: drop-shadow(0 8px 18px color-mix(in srgb, var(--c) 45%, transparent));
  transition: transform 0.25s var(--ease);
}
.head-av:hover { transform: translateY(-4px) rotate(-3deg); }
.head-av .av { width: 100%; height: 100%; }
.status-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  padding: 5px 10px;
  font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); border: 1px solid var(--line2);
}
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status-chip.on { color: #8dffbe; border-color: rgba(92, 255, 157, 0.35); }
.status-chip.on i { background: #5cff9d; box-shadow: 0 0 10px #5cff9d; animation: led 1.6s ease-in-out infinite; }
.status-chip.hot { color: var(--gold); border-color: rgba(255, 210, 122, 0.4); }
.status-chip.hot i { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.sect {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0 10px;
  font: 600 12px/1 var(--f-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--c);
}
.sect::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 40%, transparent), transparent); }
.sect b { font: 500 11px/1 var(--f-mono); padding: 3px 7px; border: 1px solid currentColor; }
.sect.is-taken { color: var(--gold); margin-top: 26px; }
.wish.has-peer { border-color: var(--peer); box-shadow: inset 0 0 0 1px var(--peer), 0 0 22px -6px var(--peer); }
.panel.enter .glitch { animation: glitch 0.55s linear both; }
.panel.enter .panel-head .kicker, .panel.enter .panel-head .sub { animation: fade-up 0.5s var(--ease) both; }
.panel.enter .panel-head .sub { animation-delay: 0.12s; }

.composer {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 18px;
  padding: 6px 6px 6px 14px;
  background: rgba(2, 4, 12, 0.72);
  border: 1px solid var(--line2);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer:focus-within { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 16%, transparent), 0 0 34px -8px var(--c); }
.composer-prompt { font: 600 18px/1 var(--f-mono); color: var(--c); animation: blink-caret 1.1s steps(2, start) infinite; }
.composer input { flex: 1; min-width: 0; min-height: 40px; background: none; border: 0; outline: none; font-size: 16px; }
.composer input::placeholder, .field input::placeholder { color: var(--faint); }

.wishes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wish {
  position: relative;
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 14px 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s, opacity 0.2s;
}
.wish::before {
  content: ''; position: absolute; left: -1px; top: 14%; bottom: 14%; width: 2px;
  background: var(--c); box-shadow: 0 0 12px var(--c);
  transform: scaleY(0); transition: transform 0.25s var(--ease);
}
.wish:hover { background: rgba(14, 22, 48, 0.75); border-color: color-mix(in srgb, var(--c) 32%, transparent); }
.wish:hover::before { transform: scaleY(1); }
.wish-idx { font: 500 12px/1 var(--f-mono); color: var(--faint); }
.wish-txt { font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.wish-who { margin-top: 6px; font: 500 10.5px/1.4 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.wish-who.is-me { color: var(--gold); }
.wish.is-taken .wish-txt { color: var(--mute); }
.wish.is-mine { border-color: rgba(255, 210, 122, 0.32); background: linear-gradient(90deg, rgba(255, 210, 122, 0.09), var(--card) 70%); }
.wish.is-mine::before { background: var(--gold); box-shadow: 0 0 12px var(--gold); transform: scaleY(1); }
.wish.is-pending { opacity: 0.6; }
.lnk { color: var(--ice); text-decoration: none; border-bottom: 1px dashed color-mix(in srgb, var(--ice) 55%, transparent); margin: 0 2px; white-space: nowrap; }
.lnk span { font-size: 0.8em; margin-left: 2px; }
.lnk:hover { border-bottom-style: solid; }
.empty {
  list-style: none;
  padding: 26px 16px; text-align: center;
  font: 500 12.5px/1.6 var(--f-mono); letter-spacing: 0.03em; color: var(--faint);
  border: 1px dashed var(--line2);
}
.panel.enter .wish { animation: rise 0.45s var(--ease) both; animation-delay: calc(min(var(--i), 14) * 35ms + 120ms); }

.hotte-group + .hotte-group { margin-top: 26px; }
.hotte-av { width: 30px; height: 36px; }
.hotte-av .av { width: 100%; height: 100%; }
.hotte-to { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font: 600 13px/1 var(--f-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--c); }

/* --- console */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { padding: 14px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.stat-val { font: 700 26px/1 var(--f-display); color: var(--ice); font-variant-numeric: tabular-nums; }
.stat-lbl { font: 500 10px/1 var(--f-mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); }
.block { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.block-title { display: flex; align-items: center; gap: 12px; margin: 0; font: 600 14px/1 var(--f-display); letter-spacing: 0.12em; text-transform: uppercase; }
.badge { font: 500 10px/1 var(--f-mono); letter-spacing: 0.15em; padding: 4px 8px; border: 1px solid var(--line2); color: var(--mute); }
.badge.on { color: var(--ice); border-color: var(--ice); }
.block .field { margin-top: 16px; }
.block.danger .block-title { color: #ff9fb1; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.log { list-style: none; margin: 16px 0 0; padding: 0; max-height: 440px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.log-row {
  display: grid; grid-template-columns: 96px 78px 96px minmax(0, 1fr); gap: 4px 12px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.log-time, .log-dev { font: 500 11px/1.4 var(--f-mono); color: var(--faint); }
.log-who { font-weight: 600; color: var(--c); }
.log-act { font: 500 10.5px/1.4 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.log-desc { color: var(--ink); overflow-wrap: anywhere; }
.log-dev { grid-column: 4; }

/* --- atelier */
.atelier { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: center; margin-bottom: 8px; }
.atelier-stage {
  position: relative; height: 210px; display: grid; place-items: end center;
  background: radial-gradient(ellipse 60% 18% at 50% 92%, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%),
              radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--c) 14%, transparent), transparent 65%);
}
.atelier-stage .av { width: 150px; height: 180px; filter: drop-shadow(0 10px 24px color-mix(in srgb, var(--c) 50%, transparent)); }
.atelier-side { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.opts { display: flex; flex-direction: column; gap: 18px; margin-top: 10px; }
.opt-lbl { font: 500 10.5px/1 var(--f-mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches { gap: 10px; }
.swatch {
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  background: var(--sw); border: 2px solid transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 0 14px -2px var(--sw);
  transition: transform 0.15s var(--ease);
}
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: #fff; transform: scale(1.12); }
.chip {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 78px; padding: 6px 4px 8px;
  background: var(--card); border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease);
}
.chip:hover { border-color: color-mix(in srgb, var(--c) 50%, transparent); transform: translateY(-2px); }
.chip.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--card)); }
.chip-av { width: 44px; height: 52px; }
.chip-av .av { width: 100%; height: 100%; }
.chip-lbl { font: 500 10px/1.2 var(--f-mono); letter-spacing: 0.04em; color: var(--mute); text-align: center; }
.chip.on .chip-lbl { color: var(--ink); }
.chip, .swatch { position: relative; }
.chip.is-locked > svg, .swatch.is-locked { opacity: 0.35; }
.chip.is-locked > svg { filter: grayscale(0.8); }
.chip-lock {
  position: absolute; right: 2px; bottom: 2px; display: inline-flex; align-items: center; gap: 1px;
  padding: 2px 3px; background: rgba(2, 4, 12, 0.88); color: var(--gold);
  font: 700 10px/1 var(--f-mono);
}
.chip-lock .ico { width: 11px; height: 11px; stroke-width: 2.2; }
.chip-lock b .ico { width: 10px; height: 10px; }
.swatch .chip-lock { right: -6px; bottom: -6px; padding: 1px 2px; }
.chip.shake { animation: shake 0.35s; }
.atelier-stage[data-aura]:not([data-aura="aucun"])::after {
  content: ''; position: absolute; left: 50%; bottom: 6px; width: 150px; height: 40px; margin-left: -75px; border-radius: 50%;
  border: 3px solid var(--a1, #fff); box-shadow: 0 0 18px var(--a2, #fff); animation: aura-pulse 2.4s ease-in-out infinite;
}
.atelier-pet { position: absolute; right: 4px; bottom: 6px; width: 54px; height: 54px; }
.atelier-pet .pet { width: 100%; height: 100%; }
/* console : XP du jour */
.xp-today { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.xp-today li { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--card); border: 1px solid var(--line); }
.xp-av { position: relative; width: 26px; height: 30px; flex: none; }
.xp-av .av { width: 100%; height: 100%; }
.xp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.xp-val { font: 600 13px/1 var(--f-mono); color: var(--c); }
.reveal-btn { min-width: 120px; --c: var(--gold); }
.reveal-btn .ico { width: 22px; height: 22px; }
/* onboarding (§9.4) : crayon qui gribouille dans le champ vide, bouton cadeau qui frétille une fois */
.composer-pen { display: none; color: var(--c); }
.composer.is-empty .composer-pen { display: block; position: absolute; left: 16px; top: 50%; margin-top: -11px; pointer-events: none; }
.composer.is-empty .composer-pen .ico { width: 22px; height: 22px; animation: scribble 1.4s ease-in-out infinite; }
.composer.is-empty input::placeholder { color: transparent; }
.composer.is-empty input { padding-left: 30px; }
.composer.is-empty:focus-within .composer-pen { opacity: 0.4; }
.composer.is-empty .btn-solid { animation: breathe 1.8s ease-in-out infinite; }
@keyframes scribble { 0%, 100% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(6px, -2px) rotate(-8deg); } 50% { transform: translate(12px, 1px) rotate(4deg); } 75% { transform: translate(5px, 2px) rotate(-4deg); } }
@keyframes breathe { 50% { transform: scale(1.08); } }
.btn-claim.wiggle { animation: wiggle 0.7s 0.6s var(--ease) 2 both; }
@keyframes wiggle { 20% { transform: rotate(-10deg) scale(1.08); } 40% { transform: rotate(9deg) scale(1.08); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(3deg); } }
.wish.flash { animation: flash-row 1.4s var(--ease); }
@keyframes flash-row { 0%, 60% { box-shadow: inset 0 0 0 2px var(--c), 0 0 24px -4px var(--c); } 100% { box-shadow: none; } }

/* ------------------------------------------------------------- personnages autour du sapin */
.stage { position: fixed; inset: 0; z-index: 2; pointer-events: none; display: none; contain: layout style; }
body.stage-on[data-screen="main"] .stage { display: block; }
.char {
  position: absolute; left: -50px; top: -120px;
  width: 100px; height: 120px; padding: 0;
  background: none; border: 0;
  transform-origin: 50% 100%;
  pointer-events: auto;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.char-body { position: absolute; inset: 0; display: block; transform-origin: 50% 100%; }
.char-body .av { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.char.is-online .char-body { animation: bob 2.6s ease-in-out infinite; }
.char.is-me .char-body .av { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--c) 70%, transparent)); }
.char.is-behind-tree { pointer-events: none; }
.char.is-behind-tree > .char-body, .char.is-behind-tree > .char-floor, .char.is-behind-tree > .char-aura { opacity: 0.35; }
#stage.freeze .char-body { animation-play-state: paused; }
/* aura (atelier) : anneaux au sol, transform / opacity seulement */
.char-aura { position: absolute; left: -12px; right: -12px; bottom: -14px; height: 34px; pointer-events: none; display: none; }
.char-aura::before, .char-aura::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--a1, #fff); opacity: 0.8; }
.char-aura::after { inset: 5px 14px; border-width: 2px; border-color: var(--a2, #fff); border-style: dashed; animation: spin 7s linear infinite; }
.char-aura::before { animation: aura-pulse 2.4s ease-in-out infinite; }
.char:not([data-aura="aucun"]):not([data-aura=""]) > .char-aura { display: block; }
[data-aura="givre"] { --a1: #bfe9ff; --a2: #ffffff; }
[data-aura="boreale"] { --a1: #5cffc8; --a2: #3cf2ff; }
[data-aura="prisme"] { --a1: #ff4fd8; --a2: #ffc94a; }
[data-aura="aurore"] { --a1: #5cffc8; --a2: #a98bff; }
[data-aura="famille"] { --a1: #ff4fd8; --a2: #8cff6b; }
@keyframes aura-pulse { 50% { transform: scale(1.12); opacity: 0.4; } }
.char-floor {
  position: absolute; left: 10px; right: 10px; bottom: -6px; height: 14px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c) 70%, transparent), transparent);
  opacity: 0.35;
}
.char.is-online .char-floor { opacity: 0.9; }
.char.is-hot .char-floor { background: radial-gradient(closest-side, var(--gold), transparent); opacity: 1; }
.char:hover .char-body, .char:focus-visible .char-body { animation: none; transform: translateY(-6px) scale(1.06); transition: transform 0.2s var(--ease); }
.char.jump .char-body { animation: jump 0.55s var(--ease); }
.char-tag {
  position: absolute; left: 50%; bottom: calc(100% + 8px);
  min-width: 170px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  background: rgba(3, 6, 16, 0.94); border: 1px solid var(--c);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transform: translateX(-50%) translateY(6px) scale(var(--inv, 1));
  transform-origin: 50% 100%;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s, transform 0.2s var(--ease);
  white-space: nowrap;
}
.char:hover .char-tag, .char:focus-visible .char-tag { opacity: 1; transform: translateX(-50%) translateY(0) scale(var(--inv, 1)); }
.char:hover, .char:focus-visible { opacity: 1 !important; z-index: 200 !important; }
.char-tag b { font: 700 14px/1.1 var(--f-display); color: var(--c); }
.char-status { display: inline-flex; align-items: center; gap: 6px; font: 500 10.5px/1.3 var(--f-mono); letter-spacing: 0.06em; color: var(--faint); }
.char-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.char.is-online .char-status { color: #8dffbe; }
.char.is-online .char-status i { background: #5cff9d; box-shadow: 0 0 8px #5cff9d; }
.char.is-hot .char-status { color: var(--gold); }
.char-count { font: 500 12px/1.3 var(--f-body); color: var(--ink); }
.char-hint { font: 500 9.5px/1.3 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.stage.flat { display: none; }
body.stage-on[data-screen="main"] .stage.flat {
  display: flex; inset: auto 24px 18px auto; gap: 6px; align-items: flex-end;
}
.stage.flat .char { position: relative; left: auto; top: auto; width: 72px; height: 86px; }

/* ------------------------------------------------------------- curseurs des autres */
.cursors { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
.cursor {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: flex-start; gap: 2px;
  will-change: transform;
  transition: opacity 0.4s;
}
.cursor svg { width: 22px; height: 22px; fill: var(--c); stroke: #02030a; stroke-width: 1.4; filter: drop-shadow(0 0 6px var(--c)); margin: -3px 0 0 -4px; }
.cursor span {
  margin-top: 14px; padding: 4px 8px;
  font: 600 11px/1 var(--f-mono); letter-spacing: 0.06em;
  color: #02030a; background: var(--c);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
.cursor.idle { opacity: 0.35; }

/* ------------------------------------------------------------- animations des personnages */
.av.live .av-eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
.av .av-blink { animation: led 1.4s ease-in-out infinite; }
.av.live .av-flame { transform-box: fill-box; transform-origin: 50% 0; animation: flame 0.18s ease-in-out infinite alternate; }
.av.live .av-bulb { animation: led 1.2s ease-in-out infinite; }
.av .av-zz { animation: zz 2.4s ease-in-out infinite; }
.av .av-zz2 { animation-delay: 0.8s; }
.av.live .av-glint { transform-box: fill-box; transform-origin: center; animation: spin 9s linear infinite; }

/* ------------------------------------------------------------- notifications */
.toasts {
  position: fixed; z-index: 60;
  left: 50%; bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: max-content; max-width: calc(100% - 32px);
}
.toast {
  padding: 12px 18px;
  font: 600 11.5px/1.3 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; text-align: center;
  background: rgba(3, 6, 16, 0.94);
  border: 1px solid var(--ice); color: var(--ink);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  animation: toast-in 0.35s var(--ease) both;
  transition: opacity 0.35s, transform 0.35s;
}
.toast.gold { border-color: var(--gold); color: var(--gold); }
.toast.err { border-color: var(--red); color: #ffb3c1; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ------------------------------------------------------------- animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fill { to { transform: scaleX(1); } }
@keyframes blink-caret { to { visibility: hidden; } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
@keyframes led { 50% { opacity: 0.45; } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes jump { 30% { transform: translateY(-26px) scale(1.05, 0.95); } 55% { transform: translateY(0) scale(1.08, 0.92); } 75% { transform: translateY(-6px); } }
@keyframes flame { to { transform: scaleY(1.5); } }
@keyframes zz { 0% { opacity: 0; transform: translateY(4px); } 50% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }
@keyframes boot-line { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes tile-in { from { opacity: 0; transform: translateY(26px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes armed { from { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.0); } to { box-shadow: 0 0 0 4px rgba(255, 77, 109, 0.3); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes glitch {
  0% { clip-path: inset(0 0 100% 0); transform: translateX(-10px); }
  15% { clip-path: inset(42% 0 34% 0); transform: translateX(8px); }
  30% { clip-path: inset(8% 0 62% 0); transform: translateX(-5px); }
  45% { clip-path: inset(66% 0 4% 0); transform: translateX(4px); }
  60% { clip-path: inset(0 0 38% 0); transform: translateX(-2px); }
  80% { clip-path: inset(0 0 0 0); transform: translateX(1px); }
  100% { clip-path: inset(0 0 0 0); transform: none; }
}

/* ------------------------------------------------------------- mobile */
/* ============================================================= interface allégée : icônes, donneurs, auras, déplacement */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.btn-ico {
  display: inline-grid; place-items: center; flex: none;
  width: 42px; height: 42px; padding: 0;
  background: transparent; color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn-ico:active { transform: scale(0.92); }
.btn-ico:disabled { opacity: 0.35; pointer-events: none; }
.btn-ico.btn-solid { background: var(--c); color: var(--bg); border-color: transparent; }
.btn-ico.btn-del { color: var(--faint); border-color: var(--line2); }
.btn-ico.armed { background: var(--red); color: #fff; border-color: var(--red); animation: armed 0.6s ease-in-out infinite alternate; }
.btn-claim.btn-ico { min-width: 0; }
.btn-claim.is-on { color: var(--gold); border-color: var(--gold); background: rgba(255, 210, 122, 0.12); }
.btn-claim .off-ico { display: none; }
@media (hover: hover) {
  .btn-ico:hover { background: var(--c); color: var(--bg); border-color: var(--c); }
  .btn-ico.btn-solid:hover { background: #fff; }
  .btn-ico.btn-del:hover { background: var(--red); color: #fff; border-color: var(--red); }
  .btn-claim.is-on:hover { background: var(--red); border-color: var(--red); color: #fff; }
  .btn-claim.is-on:hover .on-ico { display: none; }
  .btn-claim.is-on:hover .off-ico { display: block; }
}
.wish { grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; padding: 12px 12px 12px 16px; min-height: 66px; }
.givers { display: flex; align-items: center; }
.giver { width: 26px; height: 30px; margin-left: -7px; }
.giver:first-child { margin-left: 0; }
.giver .av { width: 100%; height: 100%; display: block; }
.sect { gap: 8px; }
.sect .ico { width: 18px; height: 18px; }
.empty { display: grid; place-items: center; padding: 22px; color: var(--faint); }
.empty .ico { width: 22px; height: 22px; opacity: 0.6; }
.composer { padding: 6px 6px 6px 16px; }
.composer .btn-ico { width: 44px; height: 44px; }
.crew-glyph .ico { width: 20px; height: 20px; }
.crew-sep { border: 0; height: 1px; margin: 8px 2px; background: linear-gradient(90deg, var(--line2), transparent); }
.gate-card { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 30px 26px 18px; }
.gate-ico { color: var(--ice); }
.gate-ico .ico { width: 44px; height: 44px; stroke-width: 1.4; filter: drop-shadow(0 0 12px var(--ice)); }
.gate-card .field { margin-top: 0; width: 100%; }
.gate-card .err { min-height: 0; margin: 0; }
.chip { width: 66px; padding: 6px 4px; }
.chip .av { width: 44px; height: 52px; display: block; margin: 0 auto; }
.opts { gap: 14px; margin-top: 18px; }
.atelier-side .btn-ico { width: 46px; height: 46px; }
.block-title .ico { width: 18px; height: 18px; }
.head-av.jump { animation: jump 0.55s var(--ease); }
.fab { width: 54px; height: 54px; background: rgba(3, 6, 16, 0.88); }
.char-tag { min-width: 0; gap: 6px; align-items: center; }
.char-count { display: inline-flex; align-items: center; gap: 5px; font: 600 13px/1 var(--f-mono); color: var(--ink); }
.char-count .ico { width: 15px; height: 15px; color: var(--c); }
.char-count i { width: 1px; height: 12px; background: var(--line2); margin: 0 4px; }
.char { touch-action: none; }
.char.is-me { cursor: grab; z-index: 150 !important; opacity: 1 !important; } /* son propre personnage reste attrapable */
.char.dragging { cursor: grabbing; }
.char.walking .char-body { animation: walk 0.32s ease-in-out infinite alternate; }
.char.face-left .char-body .av { transform: scaleX(-1); }
.char.dragging .char-body { animation: none; transform: translateY(-10px) scale(1.08); }
@keyframes walk { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-5px) rotate(4deg); } }
/* aura des personnages connectés */
.aura { isolation: isolate; }
.aura:not(.char-body) { position: relative; }
.aura::before, .aura::after { content: ''; position: absolute; z-index: -1; pointer-events: none; border-radius: 50%; opacity: 0; transition: opacity 0.5s; }
.aura::before { inset: -22% -32%; background: radial-gradient(closest-side, color-mix(in srgb, var(--c) 62%, transparent), color-mix(in srgb, var(--c) 22%, transparent) 55%, transparent 76%); }
.aura::after {
  inset: -4% -14%;
  background: conic-gradient(from 0deg, transparent 0 8%, var(--c) 16%, transparent 30% 52%, color-mix(in srgb, var(--c) 60%, #fff) 64%, transparent 78%);
  -webkit-mask: radial-gradient(closest-side, transparent 86%, #000 89% 95%, transparent 98%);
  mask: radial-gradient(closest-side, transparent 86%, #000 89% 95%, transparent 98%);
}
.aura.on::before { opacity: 1; animation: aura 2.8s ease-in-out infinite; }
.aura.on::after { opacity: 0.9; animation: spin 6s linear infinite; }
@keyframes aura { 50% { opacity: 0.55; transform: scale(1.12); } }

@media (max-width: 900px) {
  .topbar {
    height: 58px;
    grid-template-columns: auto 1fr auto;
    background: rgba(2, 3, 10, 0.92);
    padding: 0 8px 0 4px;
  }
  .topbar .countdown { padding: 14px 6px; }
  .online { display: none; }
  .topbar .countdown { align-items: flex-end; justify-self: end; }
  .topbar .cd-label { display: none; }
  .topbar .cd-val { font-size: 12px; }
  .brand-yr { display: none; }
  .online-txt { display: none; }
  .online-av { width: 24px; height: 28px; }
  .top-right { gap: 8px; }
  .head-av { width: 72px; height: 86px; }
  .atelier { grid-template-columns: 1fr; }
  .chip { width: calc(25% - 6px); }
  .me-btn { padding: 8px 10px; }
  .crew {
    top: 58px; left: 0; right: 0; width: auto; max-height: none;
    flex-direction: row; overflow-x: auto; overflow-y: hidden;
    margin: 0; padding: 8px 12px 10px;
    background: linear-gradient(180deg, rgba(2, 3, 10, 0.92) 70%, rgba(2, 3, 10, 0));
    animation: fade 0.6s both;
  }
  .crew-sep { width: 1px; height: auto; margin: 4px 2px; background: linear-gradient(180deg, var(--line2), transparent); }
  .crew-item { min-height: 44px; }
  .drawer {
    left: 0; right: 0; width: auto; bottom: auto;
    top: var(--rail-bottom, 114px);
    height: calc(var(--vvh, 100dvh) + var(--vvtop, 0px) - var(--rail-bottom, 114px));
    transform: translate3d(0, 100%, 0); opacity: 1;
    background: rgba(4, 7, 18, 0.97);
    transition: transform 0.28s var(--ease), visibility 0s linear 0.28s;
  }
  body.sheet-open .drawer { transition: transform 0.28s var(--ease), visibility 0s; }
  .drawer-grip { display: grid; place-items: center; height: 22px; flex: none; touch-action: none; cursor: grab; }
  .drawer-grip i { width: 36px; height: 4px; border-radius: 2px; background: var(--line2); }
  .drawer-x { top: 16px; right: 10px; }
  .panel-head { padding-right: 58px; }
  body.sheet-open #sky { filter: none; }
  .crew-label { display: none; }
  .crew-item { flex: none; grid-template-columns: 28px auto auto; grid-template-areas: "av name count"; padding: 6px 12px 6px 6px; }
  .crew-av, .crew-av .av { width: 28px; height: 32px; }
  .crew-item.is-hotte .crew-name, .crew-item.is-me .crew-name { display: none; }
  .crew-status { display: none; }
  .crew-item:hover { transform: none; }
  .crew-bar { display: none; }
  .panel { padding: 8px 16px calc(22px + env(safe-area-inset-bottom)); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .log-row { grid-template-columns: 1fr auto; }
  .log-time { grid-column: 2; grid-row: 1; text-align: right; }
  .log-who { grid-column: 1; grid-row: 1; }
  .log-act, .log-desc, .log-dev { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .who-grid { gap: 8px; }
  .who-tile { width: calc(50% - 4px); height: 96px; padding: 12px; }
  .who-ghost { width: calc(50% - 4px); height: 96px; }
  .who-av { width: 64px; height: 76px; top: 6px; left: auto; right: 6px; transform: none; }
  .who-tile:hover .who-av { transform: none; }
  .who-idx { top: 10px; left: 12px; }
  .wish { grid-template-columns: 22px minmax(0, 1fr); gap: 10px 10px; }
  .wish > .btn { grid-column: 2; justify-self: start; min-height: 36px; }
  .composer .btn kbd { display: none; }
  .me-name, .chev { display: none; }
  .me-btn { padding: 6px 8px; }
  .brand-name { letter-spacing: 0.16em; font-size: 15px; }
  .topbar { gap: 10px; padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------- sans WebGL : le tiroir reprend sa place, toujours ouvert (§2.5) */
body.no-gl .drawer { transform: none; opacity: 1; visibility: visible; }
body.no-gl .drawer-x, body.no-gl .drawer-grip { display: none; }
#hudBubble { left: var(--map-cx, 50%); transition: left 0.26s var(--ease), opacity 0.2s ease, visibility 0s linear 0s; }
@media (max-width: 900px) {
  body.no-gl .drawer { height: auto; bottom: 0; }
}
@media (max-width: 560px) {
  .wish { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; padding: 10px 10px 10px 14px; }
  .giver { width: 22px; height: 26px; }
}

/* ------------------------------------------------------------- téléphone paysage (§2.3 : hauteur < 500 px)
   Rail vertical 64 px (icônes seules) à gauche, tiroir comme sur ordinateur (à droite du rail, translateX),
   boutons flottants en colonne à droite (game.css). Même condition que landscape() dans app.js.
   Bloc placé après les règles téléphone (≤ 900 px) qu'il surcharge ; il vaut aussi pour les paysages > 900 px. */
@media (max-height: 499.98px) and (orientation: landscape) {
  .topbar {
    height: 52px;
    grid-template-columns: auto 1fr auto;
    background: linear-gradient(180deg, rgba(2, 3, 10, 0.82), rgba(2, 3, 10, 0));
    padding: 0 calc(8px + env(safe-area-inset-right)) 0 calc(6px + env(safe-area-inset-left));
  }
  .topbar .countdown { padding: 12px 6px; align-items: flex-end; justify-self: end; }
  .topbar .cd-label, .brand-yr, .online-txt { display: none; }
  .topbar .cd-val { font-size: 12px; }
  .online { display: none; }
  .top-right { gap: 8px; }
  .crew {
    top: 56px; bottom: calc(8px + env(safe-area-inset-bottom)); left: calc(6px + env(safe-area-inset-left)); right: auto;
    width: 64px; max-height: none;
    flex-direction: column; align-items: stretch; gap: 4px;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    margin: 0; padding: 0;
    background: none;
    animation: slide-in 0.6s 0.1s var(--ease) both;
  }
  .crew-label, .crew-name, .crew-count, .crew-status, .crew-bar { display: none; }
  .crew-item {
    flex: none; min-height: 48px; width: 64px;
    grid-template-columns: 1fr; grid-template-areas: "av"; justify-items: center;
    padding: 6px 0;
  }
  .crew-item:hover { transform: none; }
  .crew-av, .crew-av .av { width: 30px; height: 36px; }
  .crew-sep { width: auto; height: 1px; flex: none; margin: 2px 8px; background: linear-gradient(90deg, transparent, var(--line2), transparent); }
  .drawer {
    left: var(--rail-right, 78px); right: auto; top: 56px; bottom: auto;
    width: min(420px, calc(100vw - var(--rail-right, 78px) - 84px - env(safe-area-inset-right)));
    height: calc(var(--vvh, 100dvh) + var(--vvtop, 0px) - 64px);
    transform: translate3d(-24px, 0, 0); opacity: 0;
    background:
      linear-gradient(135deg, transparent 10.4px, var(--line2) 10.4px 11.6px, transparent 11.6px) top left / 18px 18px no-repeat,
      linear-gradient(-45deg, transparent 10.4px, var(--line2) 10.4px 11.6px, transparent 11.6px) bottom right / 18px 18px no-repeat,
      rgba(4, 7, 18, 0.94);
    transition: transform 0.26s var(--ease), opacity 0.2s ease, visibility 0s linear 0.26s;
  }
  .drawer-grip { display: none; }
  .drawer-x { top: 8px; right: 8px; }
  .panel { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
  .panel-head { padding-right: 52px; margin-bottom: 14px; }
  .drawer .title { font-size: 26px; }
  .head-av { width: 64px; height: 76px; }
  .atelier { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  #overlay { left: var(--rail-right, 78px); top: 0; }
}
