:root {
  --terra: #C8643E; --terra-d: #A94E2E; --mustard: #E1A640; --sage: #8FA37E; --sage-d: #6F8660;
  --cream: #F6EEE2; --cream2: #FBF6EE; --greige: #A69A8C; --ink: #3B2E2A; --ink2: #6B5A50;
  --coral: #EE7B6A; --rose: #F2A89A; --teal: #2F7E80;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #EFE4D4; color: var(--ink); font-family: 'Nunito', system-ui, sans-serif; font-weight: 700; overscroll-behavior: none; }
body { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.hidden { display: none !important; }
h1, h2, h3, .baloo { font-family: 'Baloo 2', 'Nunito', sans-serif; margin: 0; line-height: 1.05; }

#app { position: relative; max-width: 480px; height: 100dvh; margin: 0 auto; background: var(--cream); overflow: hidden; box-shadow: 0 0 40px rgba(60, 40, 30, .15); }
#game { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- HUD ---------- */
#hud { padding: calc(var(--safe-t) + 6px) 10px 6px; background: var(--cream2); border-bottom: 2px solid #EADCC8; z-index: 2; }
.row1 { display: flex; align-items: center; gap: 8px; }
#face { width: 46px; height: 46px; border-radius: 50%; background: #F3E3CE; border: 2px solid #E6D2B8; flex: none; }
.clockbox { flex: 1; min-width: 0; }
#clock { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 26px; line-height: 1; color: var(--ink); }
#clock.late { color: #D2452C; animation: pulse .6s infinite alternate; }
#goal { font-size: 12px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { background: #fff; border: 2px solid #E6D2B8; border-radius: 99px; padding: 7px 11px; font-size: 13px; font-weight: 800; }
.round { width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 2px solid #E6D2B8; font-size: 12px; font-weight: 900; }
.gauges { display: grid; grid-template-columns: 1.25fr 1fr; gap: 8px; margin-top: 6px; }
.gauge .lbl { font-size: 11px; font-weight: 800; color: var(--ink2); }
.bar { height: 11px; border-radius: 99px; background: #E9DDCB; overflow: hidden; margin-top: 2px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .25s linear, background .4s; }
#gLoad { background: linear-gradient(90deg, var(--sage), var(--mustard)); }
#gLoad.hot { background: linear-gradient(90deg, var(--mustard), var(--coral)); }
#gLoad.fire { background: linear-gradient(90deg, var(--coral), #D2452C); animation: pulse .35s infinite alternate; }
#gMe { background: linear-gradient(90deg, #9DC4C5, var(--teal)); }
#gMe.full { animation: pulse .6s infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .55; } }

/* ---------- scène ---------- */
#stage { position: relative; flex: 1; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#calls { position: absolute; left: 8px; right: 8px; top: 6px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.call { pointer-events: auto; display: flex; align-items: center; gap: 8px; background: #FFF1EC; border: 2px solid var(--coral); border-radius: 14px; padding: 6px 8px 6px 10px; font-size: 13px; line-height: 1.2; box-shadow: 0 3px 10px rgba(200, 90, 60, .2); text-align: left; width: 100%; animation: pop .25s ease-out; }
.call.l1 { border-color: #E8603C; animation: shake .3s infinite; }
.call.l2 { border-color: #D2452C; background: #FFE3DA; font-weight: 900; animation: shake .18s infinite; }
.call .who { font-weight: 900; color: var(--terra-d); }
.call .txt { flex: 1; }
.call .go { flex: none; background: var(--terra); color: #fff; border-radius: 10px; padding: 6px 9px; font-size: 12px; font-weight: 900; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#toasts { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.toast { background: rgba(59, 46, 42, .88); color: #FFF8EC; padding: 6px 12px; border-radius: 99px; font-size: 13px; animation: pop .2s ease-out; max-width: 92%; text-align: center; }
#banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; }
#banner .b { display: inline-block; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 26px; color: #fff; background: var(--mustard); padding: 6px 18px; border-radius: 18px; box-shadow: 0 6px 0 #C08A2C, 0 10px 24px rgba(0, 0, 0, .18); animation: bannerIn 1.8s ease-out forwards; }
#banner .b.big { font-size: 34px; background: var(--terra); box-shadow: 0 6px 0 var(--terra-d), 0 10px 24px rgba(0, 0, 0, .2); }
@keyframes bannerIn { 0% { transform: scale(.3) rotate(-8deg); opacity: 0; } 15% { transform: scale(1.12) rotate(2deg); opacity: 1; } 25% { transform: scale(1) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }

/* ---------- barre du bas ---------- */
#bar { background: var(--cream2); border-top: 2px solid #EADCC8; padding: 6px 0 calc(var(--safe-b) + 6px); z-index: 2; }
#chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 8px 6px; scrollbar-width: none; }
#chips::-webkit-scrollbar { display: none; }
.chip { flex: none; position: relative; display: flex; align-items: center; gap: 6px; background: #fff; border: 2px solid #E6D2B8; border-radius: 14px; padding: 5px 9px 5px 6px; min-height: 46px; max-width: 170px; text-align: left; }
.chip b { font-size: 20px; line-height: 1; }
.chip span { display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.15; font-weight: 800; }
.chip small { font-size: 10.5px; font-weight: 700; color: var(--ink2); }
.chip.req { border-color: #E8C3AE; }
.chip.q { border-color: var(--teal); background: #EAF4F3; }
.chip.ally { border-color: var(--mustard); background: #FFF6E0; }
.chip.blk { opacity: .55; }
.chip i { position: absolute; top: -6px; right: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--teal); color: #fff; font-style: normal; font-size: 11px; font-weight: 900; display: grid; place-items: center; }
.chip.new { animation: pop .3s ease-out; }
.chips-empty { font-size: 13px; color: var(--ink2); padding: 12px 6px; }
.actions { display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 62px; height: 52px; background: #fff; border: 2px solid #E6D2B8; border-radius: 14px; font-size: 11.5px; font-weight: 800; padding: 0 6px; }
.act b { font-size: 21px; line-height: 1.05; }
.act em { font-style: normal; color: var(--ink2); }
.act:disabled { opacity: .4; }
.act.glow { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47, 126, 128, .22); animation: pulse .7s infinite alternate; }
.act.need { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(238, 123, 106, .3); }
.counters { margin-left: auto; text-align: right; font-size: 12px; line-height: 1.35; color: var(--ink2); }
.counters b { color: var(--ink); font-size: 15px; }
.counters .inv { font-size: 11px; opacity: .85; }

/* ---------- écrans ---------- */
#ov { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.scr { position: absolute; inset: 0; pointer-events: auto; overflow-y: auto; padding: calc(var(--safe-t) + 20px) 18px calc(var(--safe-b) + 20px); display: flex; flex-direction: column; align-items: center; animation: fade .25s ease-out; }
.scr.dim { background: rgba(59, 46, 42, .45); justify-content: center; }
.scr.full { background: radial-gradient(120% 80% at 50% 0%, #FBF3E6 0%, #F3E4CF 60%, #EDD9BF 100%); }
.scr.sheet { background: rgba(59, 46, 42, .35); justify-content: flex-end; padding: 0; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.card { width: 100%; max-width: 400px; background: var(--cream2); border-radius: 22px; padding: 18px; box-shadow: 0 10px 30px rgba(60, 40, 30, .25); }
.sheet .card { border-radius: 22px 22px 0 0; max-width: 480px; padding-bottom: calc(var(--safe-b) + 18px); max-height: 80%; overflow-y: auto; }
.btn { display: block; width: 100%; background: var(--terra); color: #fff; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 20px; border-radius: 16px; padding: 12px 16px; margin-top: 10px; box-shadow: 0 4px 0 var(--terra-d); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--terra-d); }
.btn.alt { background: #fff; color: var(--ink); box-shadow: 0 4px 0 #E0CDB3; border: 2px solid #E6D2B8; }
.btn.sage { background: var(--sage); box-shadow: 0 4px 0 var(--sage-d); }
.btn.small { font-size: 16px; padding: 9px 12px; }
.logo { text-align: center; margin: 12px 0 4px; }
.logo .l1 { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 50px; line-height: .9; color: var(--ink); }
.logo .l2 { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 62px; line-height: .9; color: var(--terra); transform: rotate(-3deg); display: inline-block; }
.logo .l3 { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 50px; line-height: .9; color: var(--ink); }
.tag { font-size: 15px; color: var(--ink2); text-align: center; margin: 6px 0 10px; }
#family { width: 300px; max-width: 90%; height: auto; margin: 6px auto 8px; display: block; }
.menu { width: 100%; max-width: 330px; margin-top: auto; }
.foot { font-size: 11px; color: var(--greige); margin-top: 14px; text-align: center; }
.h { font-size: 30px; font-weight: 800; text-align: center; margin: 6px 0 4px; }
.sub { font-size: 14px; color: var(--ink2); text-align: center; margin-bottom: 14px; }
.who2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 380px; }
.whoC { background: #fff; border: 3px solid #E6D2B8; border-radius: 20px; padding: 12px 8px 14px; text-align: center; box-shadow: 0 4px 0 #E0CDB3; }
.whoC canvas { width: 100%; max-width: 140px; aspect-ratio: 1; }
.whoC h3 { font-size: 26px; margin-top: 4px; }
.whoC small { display: block; font-size: 12px; color: var(--ink2); margin-top: 2px; min-height: 16px; }
.whoC:active { transform: translateY(2px); }
.lvl { font-size: 13px; font-weight: 900; letter-spacing: .08em; color: var(--mustard); text-transform: uppercase; text-align: center; }
.tips { list-style: none; padding: 0; margin: 12px 0 4px; font-size: 14px; line-height: 1.4; }
.tips li { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.tips li b { font-size: 20px; line-height: 1.1; flex: none; width: 26px; text-align: center; }
.stars { text-align: center; font-size: 40px; letter-spacing: 4px; margin: 4px 0; }
.stars .off { filter: grayscale(1); opacity: .3; }
.big { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 56px; line-height: 1; text-align: center; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 6px; }
.vsC { border-radius: 18px; padding: 12px 8px; text-align: center; background: #fff; border: 2px solid #E6D2B8; }
.vsC canvas { width: 76px; height: 76px; }
.vsC .n { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 44px; line-height: 1; margin-top: 4px; }
.vsC .u { font-size: 13px; color: var(--ink2); }
.vsC .badge { margin-top: 8px; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; }
.vsC .badge .tro { font-size: 38px; line-height: 1; }
.vsC .badge .none { width: 46px; height: 46px; border-radius: 50%; border: 2px dashed #D8C8B2; }
.vsC.maman { background: #FFF4EE; border-color: #F0C8B4; }
.vsC.papa { background: #EEF6F3; border-color: #BFD8CF; }
.label { font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.meta { text-align: center; font-size: 13px; color: var(--ink2); margin-top: 4px; }
.obj { list-style: none; padding: 0; margin: 8px 0 0; }
.obj li { padding: 8px 0; border-bottom: 1px dashed #E6D2B8; font-size: 15px; }
.obj li .s { display: block; font-size: 12.5px; color: var(--ink2); margin-top: 2px; }
.obj li .s em { font-style: normal; margin-right: 8px; white-space: nowrap; }
.obj li .s em.ok { color: var(--sage-d); }
.bagg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.it { background: #fff; border: 2px solid #E6D2B8; border-radius: 16px; padding: 8px 4px; text-align: center; position: relative; }
.it b { display: block; font-size: 30px; line-height: 1.1; }
.it span { font-size: 12px; }
.it .n { position: absolute; top: 4px; right: 6px; background: var(--ink); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; }
.it.zero { opacity: .35; }
.it.want { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(238, 123, 106, .25); }
.it .drop { display: block; margin: 6px auto 0; font-size: 11px; color: var(--ink2); border: 1px solid #E6D2B8; border-radius: 8px; padding: 2px 8px; }
.weight { font-size: 13px; color: var(--ink2); margin-top: 6px; }
.levels { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 8px; }
.lv { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid #E6D2B8; border-radius: 16px; padding: 10px 12px; text-align: left; }
.lv .num { width: 38px; height: 38px; border-radius: 12px; background: var(--terra); color: #fff; display: grid; place-items: center; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 20px; flex: none; }
.lv .t { flex: 1; font-size: 16px; font-weight: 800; }
.lv .t small { display: block; font-size: 12px; font-weight: 700; color: var(--ink2); }
.lv.lock { opacity: .55; }
.lv.lock .num { background: var(--greige); }
.lv.spa .num { background: var(--teal); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px dashed #E6D2B8; font-size: 16px; }
.opt small { display: block; font-size: 12px; color: var(--ink2); }
.tog { width: 54px; height: 32px; border-radius: 99px; background: #D8CBB8; position: relative; flex: none; transition: background .2s; }
.tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.tog.on { background: var(--sage); }
.tog.on::after { left: 25px; }

/* ---------- la révélation ---------- */
.reveal { background: #2E2522; color: #F6EEE2; padding: 0; justify-content: flex-start; overflow: hidden; }
.reveal .roll { position: absolute; left: 0; right: 0; top: 100%; padding: 0 26px; animation: roll linear forwards; }
.reveal .roll .ti { font-family: 'Baloo 2', sans-serif; font-size: 22px; font-weight: 700; text-align: center; color: var(--mustard); margin-bottom: 30px; }
.reveal .line { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0 0 22px; }
.reveal .line .a { font-size: 17px; font-weight: 800; }
.reveal .line .b { font-size: 13px; color: #C9B8A4; margin-top: 3px; }
@keyframes roll { from { transform: translateY(0); } to { transform: translateY(calc(-100% - 100dvh)); } }
.reveal .q { background: rgba(46, 37, 34, .88); position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 1.2s; }
.reveal .q.on { opacity: 1; pointer-events: auto; }
.reveal .q h2 { font-size: 30px; text-align: center; color: #F6EEE2; margin-bottom: 18px; }
.reveal .skip { position: absolute; right: 14px; top: calc(var(--safe-t) + 12px); color: #9E8E80; font-size: 13px; border: 1px solid #5A4A44; border-radius: 99px; padding: 4px 12px; z-index: 2; }
.boom { font-size: 90px; text-align: center; animation: boomIn .6s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes boomIn { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }

@media (min-height: 780px) { #face { width: 52px; height: 52px; } #clock { font-size: 30px; } }
@media (max-height: 640px) { .chip { min-height: 40px; } .act { height: 46px; } #hud { padding-top: calc(var(--safe-t) + 4px); } .gauges { margin-top: 3px; } }

.act b img { width: 30px; height: 26px; object-fit: contain; display: block; }

/* écrans illustrés */
.scr.title { background: url(../assets/title.jpg) 30% 0 / cover no-repeat, #F3E4CF; }
.scr.title::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(251,243,230,.92) 0%, rgba(251,243,230,.55) 26%, rgba(251,243,230,0) 42%, rgba(251,243,230,0) 62%, rgba(243,228,207,.9) 84%); pointer-events: none; }
.scr.title > * { position: relative; }
.scr.title .logo { margin-top: 0; }
.scr.title .logo .l1, .scr.title .logo .l3 { text-shadow: 0 2px 0 #FBF3E6; }
.scr.title .tag { color: var(--ink); font-weight: 800; }
.whoC img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; object-position: top; border-radius: 14px; display: block; }
.introArt { float: right; height: 150px; margin: -6px -6px 0 8px; }
.bagArt { display: block; height: 64px; margin: -4px auto 2px; }
.it b img { height: 40px; max-width: 58px; object-fit: contain; display: block; margin: 0 auto; }
.papaWin { position: relative; height: 130px; }
.papaWin img { height: 130px; }
.papaWin span { position: absolute; right: 22%; bottom: 0; font-size: 52px; }

/* responsabilités, respiration, équipe */
.act { min-width: 54px; padding: 0 4px; font-size: 11px; }
.act.dim { opacity: .45; }
.counters { font-size: 11px; }
.resp { display: flex; flex-direction: column; gap: 8px; }
.rs { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid #E6D2B8; border-radius: 16px; padding: 10px 12px; text-align: left; }
.rs b { font-size: 26px; }
.rs span { display: flex; flex-direction: column; font-size: 16px; font-weight: 800; }
.rs small { font-size: 12px; color: var(--ink2); font-weight: 700; }
.rs.off { opacity: .45; }
.badgeTeam { margin: 6px auto 4px; width: max-content; background: var(--sage); color: #fff; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 24px; padding: 4px 18px; border-radius: 99px; box-shadow: 0 4px 0 var(--sage-d); }
.papaWin.team { display: flex; justify-content: center; gap: 6px; }
.papaWin.team img { height: 110px; }
.split { height: 12px; border-radius: 99px; background: #F0C8B4; overflow: hidden; margin: 8px 4px 2px; }
.split i { display: block; height: 100%; background: #9FC4B6; }

#banner .b { max-width: 86%; font-size: 21px; line-height: 1.15; }
#banner .b.big { font-size: 28px; }

/* interface compacte (mode d'affichage « compact ») */
#game.compact #hud { padding-top: calc(var(--safe-t) + 3px); padding-bottom: 4px; }
#game.compact #face { width: 38px; height: 38px; }
#game.compact #clock { font-size: 22px; }
#game.compact #goal { display: none; }
#game.compact .pill { padding: 5px 9px; font-size: 12px; }
#game.compact .round { width: 34px; height: 34px; }
#game.compact .gauges { margin-top: 3px; }
#game.compact .gauge .lbl { font-size: 10px; }
#game.compact .bar { height: 8px; }
#game.compact #bar { padding-top: 4px; }
#game.compact .chip { min-height: 40px; padding: 3px 8px 3px 5px; }
#game.compact .chip small { display: none; }
#game.compact .act { height: 44px; }

.opt.col { flex-direction: column; align-items: stretch; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modes .pill.sel { background: var(--sage); color: #fff; border-color: var(--sage-d); }
