[hidden] { display: none !important; }
:root {
  --bg: #0c0d11; --card: #15171d; --card2: #1b1e26; --line: #262a34; --text: #f2f4f8; --muted: #8d94a3;
  --yellow: #ffcc3d; --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { overflow-x: hidden; }
#app { min-height: 100vh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: radial-gradient(90% 50% at 15% -10%, rgba(124,156,255,.10), transparent 60%), radial-gradient(70% 40% at 100% 0%, rgba(62,230,180,.07), transparent 60%), var(--bg); }
button { font: inherit; color: inherit; }

/* ---------- en-tête ---------- */
#bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: rgba(12,13,17,.72); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); }
.home { color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -.02em; font-size: 17px; padding: 8px 4px; }
.home span { color: #3ee6b4; }
.stbtn { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; transition: transform .15s, background .2s; }
.stbtn:active { transform: scale(.98); background: var(--card2); }
#st-name { font-weight: 700; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#st-name::after { content: " ▾"; color: var(--muted); font-size: 13px; }
#st-sub { font-size: 12.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#st-sub:empty { display: none; }
#clock { font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--yellow); padding: 0 6px; letter-spacing: .01em; }
#clock .colon { animation: colon 1s steps(1) infinite; }
@keyframes colon { 50% { opacity: .2; } }
.ib { position: relative; width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); cursor: pointer; transition: transform .15s, opacity .2s, background .2s, color .2s; }
.ib svg { width: 22px; height: 22px; }
.ib:active { transform: scale(.92); }
.ib:disabled { opacity: .3; }
#voice-btn .v-on, #voice-btn .vauto { display: none; }
#voice-btn[data-mode="demande"] .v-on, #voice-btn[data-mode="auto"] .v-on { display: block; }
#voice-btn[data-mode="demande"] .v-off, #voice-btn[data-mode="auto"] .v-off { display: none; }
#voice-btn[data-mode="demande"], #voice-btn[data-mode="auto"] { color: #3ee6b4; border-color: #22574a; background: #12241f; }
#voice-btn[data-mode="auto"] .vauto { display: grid; place-items: center; position: absolute; right: -4px; top: -4px; width: 18px; height: 18px; border-radius: 9px;
  background: #3ee6b4; color: #04261c; font-size: 11px; font-weight: 800; }
body.is-speaking #voice-btn .w1 { animation: wave 1s ease-in-out infinite; }
body.is-speaking #voice-btn .w2 { animation: wave 1s ease-in-out .2s infinite; }
@keyframes wave { 50% { opacity: .15; } }
#progress { height: 2px; background: transparent; }
#progress i { display: block; height: 100%; background: linear-gradient(90deg, #3ee6b4, #7c9cff); transform-origin: left; opacity: .7; }

#voice-hint { margin: 12px 14px 0; padding: 12px 16px; border-radius: 14px; border: 1px dashed #2c7a63; background: #10221d; color: #9ff3d6; font-weight: 600;
  cursor: pointer; animation: hintPulse 2s ease-in-out infinite; }
@keyframes hintPulse { 50% { border-color: #3ee6b4; box-shadow: 0 0 0 4px rgba(62,230,180,.08); } }

/* ---------- cartes ---------- */
#boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; padding: 14px; align-content: start; }
.board { --lc: #005ca9; --lt: #fff; position: relative; border-radius: 20px; overflow: hidden; background: linear-gradient(180deg, rgba(255,255,255,.035), transparent 40%), var(--card);
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: border-color .4s, box-shadow .4s; }
.board::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--lc); }
.board.enter { animation: boardIn .55s cubic-bezier(.2,.9,.25,1.05) both; }
.board.leave { animation: boardOut .35s ease-in forwards; }
.board.soon { border-color: color-mix(in srgb, var(--yellow) 45%, var(--line)); }
.board.speaking { border-color: #3ee6b4; box-shadow: 0 0 0 3px rgba(62,230,180,.18), 0 10px 30px rgba(0,0,0,.35); }
@keyframes boardIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes boardOut { to { opacity: 0; transform: scale(.95); } }

.bhead { display: flex; align-items: center; gap: 12px; padding: 14px 12px 4px 20px; min-width: 0; }
.lbadge { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--lc); color: var(--lt);
  font-weight: 800; font-size: 21px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc) 25%, transparent); }
.dest { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; font-weight: 750; font-size: 22px; letter-spacing: -.01em; }
.arrow { color: var(--muted); font-weight: 500; }
.dwrap { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
.dtext { display: inline-block; }
.dtext.pop { animation: pop .5s ease; }
.dtext.marquee { animation: marquee var(--dur, 8s) ease-in-out 1.2s infinite; }
@keyframes marquee { 0%, 15% { transform: none; } 50%, 65% { transform: translateX(var(--shift)); } 100% { transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.say { display: none; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); color: var(--muted); cursor: pointer; place-items: center; transition: color .2s, transform .15s; }
.say svg { width: 20px; height: 20px; }
.say:active { transform: scale(.9); }
body.voice-on .say { display: grid; }
.board.speaking .say { color: #3ee6b4; }

.bbody { display: grid; grid-template-columns: 1.25fr 1fr; gap: 6px; padding: 4px 18px 16px 20px; }
.slot { display: flex; flex-direction: column; min-width: 0; }
.lab { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.valrow { display: flex; align-items: baseline; gap: 6px; }
.val { display: inline-grid; align-items: end; justify-items: start; height: 76px; overflow: hidden; }
.s1 .val { height: 54px; }
.num { grid-area: 1 / 1; color: var(--yellow); font-weight: 800; font-size: 72px; line-height: .95; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.s1 .num { font-size: 48px; color: color-mix(in srgb, var(--yellow) 75%, #fff); }
.num.hour { font-size: 44px; }
.s1 .num.hour { font-size: 34px; }
.num.none { color: #3d414c; }
.num.out { position: relative; }
.unit { color: var(--muted); font-weight: 600; font-size: 17px; }
.slot.nounit .unit { display: none; }
.num.in { animation: rollIn .55s cubic-bezier(.2,.9,.3,1.2) both; }
.num.out { animation: rollOut .4s ease-in forwards; }
@keyframes rollIn { from { transform: translateY(70%); opacity: 0; filter: blur(4px); } to { transform: none; opacity: 1; filter: none; } }
@keyframes rollOut { to { transform: translateY(-70%); opacity: 0; filter: blur(4px); } }
.num.approach { animation: blinkNum 1.1s ease-in-out infinite; }
.num.approach.in { animation: rollIn .55s cubic-bezier(.2,.9,.3,1.2) both, blinkNum 1.1s ease-in-out .55s infinite; }
@keyframes blinkNum { 50% { opacity: .25; } }
.note { min-height: 18px; font-size: 13.5px; font-weight: 600; color: #c4c9d3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.approaching .note { color: var(--yellow); animation: blinkNum 1.1s ease-in-out infinite; }

.stripe { height: 4px; background: color-mix(in srgb, var(--lc) 22%, transparent); position: relative; overflow: hidden; }
.stripe i { position: absolute; inset: 0; background: var(--lc); transform-origin: left; transform: scaleX(0); transition: transform 1s linear; }
.stripe::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent); animation: shine 3.5s ease-in-out infinite; }
@keyframes shine { from { transform: translateX(-120%); } to { transform: translateX(420%); } }

/* une seule direction (raccourci) : carte en grand */
#boards.solo { grid-template-columns: 1fr; max-width: 760px; width: 100%; margin: 0 auto; }
#boards.solo .bhead { padding: 22px 18px 6px 28px; }
#boards.solo .lbadge { width: 52px; height: 52px; font-size: 28px; }
#boards.solo .dest { font-size: clamp(26px, 6vw, 38px); }
#boards.solo .bbody { padding: 8px 24px 26px 28px; }
#boards.solo .s0 .val { height: 120px; } #boards.solo .s1 .val { height: 80px; }
#boards.solo .s0 .num { font-size: 116px; }
#boards.solo .s1 .num { font-size: 74px; }
#boards.solo .unit { font-size: 22px; }

/* ---------- vide ---------- */
.empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 70px 20px; text-align: center; color: var(--muted); animation: pop .5s ease; }
.empty b { color: #fff; font-size: 20px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--yellow); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- infos trafic ---------- */
.info { margin: 0 14px 14px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid #f59e0b; border-radius: 16px; padding: 12px 16px 14px; animation: boardIn .5s ease both; }
.ihead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ibadge { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: #f59e0b; }
.spacer { flex: 1; }
#info-count { color: var(--muted); font-size: 13px; }
#info-text { font-size: 15.5px; line-height: 1.4; transition: opacity .35s, transform .35s; }
#info-text.fade { opacity: 0; transform: translateY(6px); }
#info-text b { display: block; margin-bottom: 3px; }
#info-text span { color: #b9bfcb; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.mini { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; background: var(--lc); color: var(--lt); font-weight: 800; font-size: 13.5px; }

#foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; padding: 6px 16px 14px; font-size: 12px; color: #646b7a; }
#status.ok::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3ee6b4; margin-right: 6px; vertical-align: 1px; animation: blinkNum 2s infinite; }
#status.warn { color: var(--yellow); }

/* ---------- menu ---------- */
.menu { position: fixed; z-index: 60; min-width: 230px; padding: 6px; background: #1a1d24; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(-6px) scale(.97); transform-origin: top right; transition: opacity .18s, transform .18s; }
.menu.open { opacity: 1; transform: none; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 11px 12px; border-radius: 10px; font-size: 15px; cursor: pointer; }
.menu button:active, .menu button:hover { background: #252933; }
.menu button:disabled { opacity: .4; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- feuilles ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0); display: flex; align-items: flex-end; justify-content: center; transition: background .25s; }
.sheet.open { background: rgba(0,0,0,.55); }
.panel { width: min(620px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: #15171d; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.9,.25,1); }
.sheet.open .panel { transform: none; }
@media (min-width: 700px) and (min-height: 600px) {
  .sheet { align-items: center; }
  .panel { border-radius: 22px; border-bottom: 1px solid var(--line); transform: translateY(30px) scale(.96); opacity: 0; transition: transform .3s cubic-bezier(.2,.9,.25,1), opacity .25s; }
  .sheet.open .panel { opacity: 1; }
}
.phd { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.phd b { flex: 1; font-size: 18px; }
.scroll { overflow: auto; padding: 0 14px 16px; }
.sect { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin: 12px 2px 8px; }
#search { flex: 1; min-width: 0; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: #0d0f13; color: #fff; padding: 0 14px; font: inherit; font-size: 17px; outline: none; }
#search:focus { border-color: #4b5cff; }
#plist { list-style: none; margin: 0; padding: 0 8px 12px; overflow: auto; -webkit-overflow-scrolling: touch; }
#plist li { display: flex; align-items: center; gap: 10px; padding: 13px 12px; border-radius: 12px; cursor: pointer; animation: pop .35s ease both; }
#plist li:active, #plist li:hover { background: #1f232b; }
#plist li.phead { cursor: default; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 6px; animation: none; background: none; }
#plist li.recent .pname::before { content: "↺ "; color: var(--muted); }
.pname { flex: 1; font-size: 17px; }
.plines { display: flex; gap: 4px; }
#chips { display: flex; flex-direction: column; gap: 8px; }
.chip { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #1b1e25; cursor: pointer; text-align: left;
  font-size: 16px; animation: pop .35s ease both; transition: background .2s, border-color .2s, transform .15s; }
.chip:active { transform: scale(.98); }
.chip.all { flex-direction: column; align-items: flex-start; gap: 2px; }
.chip.all span { color: var(--muted); font-size: 13px; }
.chip > span:nth-child(2) { flex: 1; }
.chip .tick { font-style: normal; opacity: 0; transform: scale(.4); transition: .2s; color: #3ee6b4; font-weight: 800; }
.chip.on { background: #16302a; border-color: #2c7a63; }
.chip.on .tick { opacity: 1; transform: none; }
.chip.all.on { background: #1d2440; border-color: #4b5cff; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: #0d0f13; border: 1px solid var(--line); }
.seg button { border: 0; background: none; border-radius: 10px; padding: 10px 6px; font-weight: 600; font-size: 14.5px; color: var(--muted); cursor: pointer; transition: background .2s, color .2s; }
.seg button.on { background: #1d3a32; color: #9ff3d6; }
.hint { margin: 8px 2px 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.lrow { display: flex; gap: 8px; }
#link { flex: 1; min-width: 0; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: #0d0f13; color: #cfd3da; padding: 0 12px; font: inherit; font-size: 13.5px; }
.pbtn { height: 42px; padding: 0 16px; border: 0; border-radius: 12px; background: #3ee6b4; color: #04261c; font-weight: 700; cursor: pointer; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; z-index: 70;
  background: #f4f5f7; color: #111; font-weight: 700; padding: 10px 18px; border-radius: 99px; transition: .3s cubic-bezier(.2,.9,.25,1.2); pointer-events: none; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 520px) {
  #bar { gap: 6px; padding: 8px 10px; }
  .home { display: none; }
  #clock { font-size: 18px; padding: 0 2px; }
  .ib { width: 40px; height: 40px; flex-basis: 40px; border-radius: 12px; }
  #share-btn { display: none; }
  #boards { padding: 10px; gap: 10px; }
  .dest { font-size: 19px; }
  .lbadge { width: 34px; height: 34px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
