/* Monde — l'habillage. Des panneaux bleu nuit sur la scène, de jour comme de
   nuit : le texte reste lisible quelle que soit la lumière du monde. */
:root {
  --ink: #eef3ff; --ink2: #a9b8dd; --ink3: #7f8fb8; --line: rgba(238, 242, 255, .13);
  --glass: rgba(12, 19, 44, .92); --glass2: rgba(26, 36, 74, .7);
  --red: #ff6b6b; --amber: #ffb347; --gold: #ffd778; --ice: #8fdcff; --blue: #3d6bff; --green: #47d6b0;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a1230; color: var(--ink); font: 500 14px/1.42 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, select { font: inherit; color: inherit; }
a { color: var(--ice); }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
body.is-loading #top, body.is-loading #chips, body.is-loading #panel { opacity: 0; }
#loading { position: fixed; inset: 0; display: none; place-items: center; margin: 0; color: var(--ink2); font-weight: 600; }
body.is-loading #loading { display: grid; }

/* ── barre du haut ── */
#top { position: fixed; left: 16px; top: 16px; right: 428px; display: flex; align-items: center; gap: 12px; pointer-events: none; transition: opacity .3s; }
#top > * { pointer-events: auto; }
.back-app { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 14px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700; }
.top-title { display: flex; flex-direction: column; padding: 4px 14px; min-height: 40px; justify-content: center; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); min-width: 0; }
.top-title b { font-weight: 800; font-size: 14px; white-space: nowrap; }
.top-title span { font-size: 11.5px; color: var(--ink2); white-space: nowrap; }
.mode { margin-left: auto; display: flex; padding: 3px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); }
.mode button { border: 0; background: none; padding: 7px 11px; border-radius: 9px; font-weight: 700; font-size: 12.5px; color: var(--ink2); cursor: pointer; }
.mode button.on { background: var(--blue); color: #fff; }

#chips { position: fixed; left: 16px; top: 66px; right: 428px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; transition: opacity .3s; }
#chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--glass); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px; color: var(--ink2); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: #0c132c; border-color: var(--ink); }
.chip.beacon::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 0 3px rgba(255, 107, 107, .25); }

/* ── étiquettes sur la scène ── */
#tags { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 5px 11px 5px 5px; border-radius: 11px; background: var(--glass); border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: 12.5px; white-space: nowrap; pointer-events: auto; cursor: pointer; will-change: transform; }
.tag i { font-style: normal; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #1a0d0d; background: var(--amber); }
.tag.p1 i { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 107, 107, .25); }
.tag.g i { background: var(--gold); } .tag.b i { background: var(--ice); }
.tag .shortt { display: none; }
.tag.num { flex-direction: column; gap: 0; padding: 5px 12px 6px; background: #fff; color: #1b2440; border: 2.5px solid var(--blue); border-radius: 12px; line-height: 1.05; }
.tag.num b { font-size: 24px; font-weight: 800; }
.tag.num span { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tag.num.green { border-color: #1f9d6b; } .tag.num.green b { color: #1f9d6b; }
.tag.num.orange { border-color: #e07a1a; } .tag.num.orange b { color: #e07a1a; }
.tag.num.red { border-color: #d83a3a; } .tag.num.red b { color: #d83a3a; }
.tag.num.blue b { color: var(--blue); }

/* ── panneau ── */
#panel { position: fixed; right: 16px; top: 16px; bottom: 16px; width: 396px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; transition: opacity .3s, height .25s; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#grip { display: none; }
#panel-body { flex: 1; overflow-y: auto; padding: 18px 18px 26px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.back { border: 0; background: none; color: var(--ink2); font-weight: 700; font-size: 12.5px; padding: 0 0 10px; cursor: pointer; }
.kicker { margin: 0; display: flex; justify-content: space-between; align-items: baseline; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.kicker b { color: var(--ice); letter-spacing: 0; font-size: 12.5px; }
.p-head h2 { margin: 3px 0 9px; font-size: 23px; font-weight: 800; letter-spacing: -.01em; }
.p-head h2 em { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 7px; background: rgba(255, 215, 120, .16); color: var(--gold); vertical-align: 4px; margin-left: 6px; white-space: nowrap; }
.sub { margin: 7px 0 0; color: var(--ink2); font-size: 13px; }
.bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--amber), var(--gold)); }
section { margin-top: 20px; }
h4 { margin: 0 0 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); }
.card { margin-top: 16px; padding: 14px; border-radius: 14px; background: var(--glass2); border: 1px solid var(--line); }
.card.beacon { border-color: rgba(255, 107, 107, .5); background: linear-gradient(180deg, rgba(255, 107, 107, .12), rgba(26, 36, 74, .7)); }
.card.soft { border-color: rgba(143, 220, 255, .25); }
.card h3 { margin: 7px 0 2px; font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.card .sub { margin-top: 0; font-size: 13.5px; color: var(--ink); opacity: .86; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--ink); padding: 8px 13px; border-radius: 10px; font-weight: 700; font-size: 13px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.ghost { background: none; color: var(--ink2); }
.btn.small { padding: 6px 10px; font-size: 12px; flex: 0 0 auto; }
.btn:disabled { opacity: .5; }
.rank { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 8px; display: inline-grid; place-items: center; font-weight: 800; font-size: 12.5px; background: rgba(255, 179, 71, .18); color: var(--amber); }
.rank.hot { background: var(--red); color: #1a0d0d; box-shadow: 0 0 0 4px rgba(255, 107, 107, .22); }
.row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row.locked { opacity: .5; } .row.done .row-title { color: var(--ink2); }
.row-main { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.row-title { display: block; font-weight: 700; }
.row-sub { display: block; font-size: 12.5px; color: var(--ink2); margin-top: 1px; }
.row.flash { animation: flash 1.2s; }
@keyframes flash { 0%, 60% { background: rgba(143, 220, 255, .16); } 100% { background: transparent; } }
.tick { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--ink3); background: none; color: transparent; font-size: 13px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.tick.on { background: var(--gold); border-color: var(--gold); color: #1a0d0d; }
.xp { color: var(--ice); font-weight: 800; font-size: 12.5px; }
.meta { font-size: 12px; color: var(--ink3); white-space: nowrap; } .warn { color: var(--amber); }
.pips { display: flex; gap: 4px; margin-top: 6px; }
.pips i { width: 15px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .16); } .pips i.on { background: var(--gold); }
.hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink3); }
.place { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 0; cursor: pointer; }
.place .bar { grid-column: 1 / -1; }
.place-name { font-weight: 700; } .place-lvl { font-size: 12.5px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.place-note { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink3); }
.place.is-beacon .place-name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 7px; vertical-align: 1px; }

/* Esprit */
.ci { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.ci label { width: 62px; font-size: 12.5px; color: var(--ink2); font-weight: 700; }
.seg { display: flex; gap: 5px; flex: 1; }
.seg button { flex: 1; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); font-weight: 800; cursor: pointer; }
.seg button.on { background: var(--gold); border-color: var(--gold); color: #1a0d0d; }
.ci select { flex: 1; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #1a244a; padding: 0 8px; }
.pillar { display: grid; grid-template-columns: 92px 1fr auto; gap: 3px 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pillar-name { font-weight: 700; }
.pillar-adj { display: flex; gap: 4px; }
.pillar-adj button { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line); background: none; font-weight: 800; cursor: pointer; padding: 0; color: var(--ink2); }
.pillar-text { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink2); }
.link { border: 0; background: none; padding: 0; color: var(--ice); text-decoration: underline; cursor: pointer; font-size: inherit; }
.chart { width: 100%; height: auto; display: block; color: var(--ink); margin-top: 6px; }
.legend { margin: 4px 0 0; font-size: 12px; color: var(--ink2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 8px; } .legend i:first-child { margin-left: 0; }
.legend i.hollow { border: 1.5px solid var(--ink3); }
.advice { margin: 7px 0 0; font-size: 15px; line-height: 1.45; }
.report { border-bottom: 1px solid var(--line); padding: 10px 0; }
.report summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; font-weight: 700; list-style: none; }
.report summary::-webkit-details-marker { display: none; }
.report summary em { font-style: normal; font-size: 12px; color: var(--ink3); white-space: nowrap; }
.report-body { margin-top: 8px; font-size: 13.5px; color: var(--ink2); }

/* Scalix */
.nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.num { background: #fff; color: #1b2440; border-radius: 13px; padding: 10px 12px; border-top: 4px solid var(--blue); }
.num b { display: block; font-size: 27px; font-weight: 800; line-height: 1.1; } .num b small { font-size: 15px; opacity: .6; }
.num span { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #5a6687; }
.num.green { border-color: #1f9d6b; } .num.green b { color: #1f9d6b; }
.num.orange { border-color: #e07a1a; } .num.orange b { color: #e07a1a; }
.num.red { border-color: #d83a3a; } .num.red b { color: #d83a3a; }
.num.blue b { color: var(--blue); }

#toast { position: fixed; left: 50%; top: 112px; transform: translate(-50%, -12px); background: var(--gold); color: #1a0d0d; padding: 10px 18px; border-radius: 999px; font-weight: 800; font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 10; max-width: calc(100vw - 32px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* les points gagnés, qui montent du lieu où ils sont tombés */
.float { position: fixed; transform: translate(-50%, -50%); padding: 4px 12px; border-radius: 999px; background: var(--ice); color: #0c132c; font-weight: 800; font-size: 15px; pointer-events: none; z-index: 9; animation: rise 2.3s ease-out forwards; white-space: nowrap; }
.float.big { background: var(--gold); font-size: 18px; padding: 6px 16px; box-shadow: 0 0 0 6px rgba(255, 215, 120, .25); }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
@media (prefers-reduced-motion: reduce) { .float { animation-duration: .01s; } }

/* ── téléphone : le panneau devient une feuille en bas ── */
@media (max-width: 899px) {
  #top { left: 10px; right: 10px; top: max(10px, env(safe-area-inset-top)); gap: 8px; }
  .back-app span { display: none; } .back-app { padding: 0 12px; }
  .mode button { padding: 7px 8px; font-size: 12px; }
  #chips { left: 10px; right: 0; top: calc(max(10px, env(safe-area-inset-top)) + 50px); padding-right: 10px; }
  #panel { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 286px; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  body[data-sheet="half"] #panel { height: 47vh; } body[data-sheet="full"] #panel { height: 86vh; }
  body[data-sheet="peek"] #panel-body { overflow: hidden; }
  body[data-sheet="peek"] .p-head .sub, body[data-sheet="peek"] .p-head .kicker { display: none; }
  body[data-sheet="peek"] .card.beacon { margin-top: 8px; }
  #grip { display: grid; place-items: center; width: 100%; height: 22px; border: 0; background: none; flex: 0 0 auto; cursor: pointer; }
  #grip i { width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .3); }
  #panel-body { padding: 2px 16px 22px; }
  .p-head h2 { font-size: 20px; }
  .tag { font-size: 11.5px; padding: 4px 9px 4px 4px; gap: 6px; }
  .tag .long { display: none; } .tag .shortt { display: inline; }
  #toast { top: calc(max(10px, env(safe-area-inset-top)) + 100px); }
}
