:root {
  --pink: #e8508f;
  --pink-l: #ff9cc4;
  --pink-d: #b32466;
  --blue: #2e7fd6;
  --ink: #3a1d2a;
  --card: #fff8fb;
  --ok: #3fcf8e;
  --bad: #ff4d6d;
  --purple: #8e2bd6;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: linear-gradient(#ffd0e4, #f37aae);
  font-family: 'Baloo 2', ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  touch-action: none; overscroll-behavior: none;
}

#stage {
  position: absolute; left: 50%; top: 50%;
  width: 960px; height: 600px;
  transform-origin: 50% 50%; overflow: hidden;
  background: #e98a3f;
}

/* ---------- décor : thèmes ---------- */
#world { position: absolute; left: 0; top: 0; width: 960px; height: 540px; }
.floor { position: absolute; left: 0; right: 0; top: 50px; bottom: 0; }
.wall { position: absolute; left: 0; right: 0; top: 0; height: 62px; }
.decor-layer { position: absolute; inset: 0; pointer-events: none; }
.wall::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 12px; }

.t1 .floor {
  background:
    linear-gradient(90deg, #4f9b3f 0 4px, transparent 4px) 0 0 / 80px 70px,
    linear-gradient(#4f9b3f 0 4px, transparent 4px) 0 0 / 80px 70px,
    radial-gradient(ellipse at 40% 35%, #f6a35a, #e2772e 70%) 0 0 / 80px 70px;
}
.t1 .wall { background: linear-gradient(#f3dcb2, #e6c690); }
.t1 .wall::after { background: #9c3b1e; }

.t2 .floor {
  background:
    linear-gradient(90deg, rgba(110,70,30,.55) 0 3px, transparent 3px) 0 0 / 120px 35px,
    linear-gradient(rgba(110,70,30,.45) 0 2px, transparent 2px) 0 0 / 120px 35px,
    repeating-linear-gradient(90deg, #e9c38a 0 40px, #e2b779 40px 80px, #edca95 80px 120px);
}
.t2 .floor .shift { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(110,70,30,.55) 0 3px, transparent 3px) 60px 35px / 120px 70px; }
.t2 .wall { background: linear-gradient(#bdeac6, #7fcf95); }
.t2 .wall::after { background: #2d7d4a; }

.t3 .floor {
  background:
    linear-gradient(90deg, #d4a231 0 4px, transparent 4px) 0 0 / 70px 70px,
    linear-gradient(#d4a231 0 4px, transparent 4px) 0 0 / 70px 70px,
    radial-gradient(ellipse at 40% 35%, #c2423a, #8f2420 75%) 0 0 / 70px 70px;
}
.t3 .wall { background: linear-gradient(#ffe7c2, #f2c48a); }
.t3 .wall::after { background: #7a1712; }

.t4 .floor {
  background:
    linear-gradient(rgba(60,30,10,.6) 0 3px, transparent 3px) 0 0 / 100% 40px,
    repeating-linear-gradient(90deg, #a8703f 0 160px, #9c6536 160px 320px);
}
.t4 .wall { background: linear-gradient(#d9d3cc, #b7aea4); }
.t4 .wall::after { background: #5a3a22; }

.deco { position: absolute; pointer-events: none; }
.deco svg, .station svg, .chair svg, .crate svg, .bucket svg { width: 100%; height: 100%; display: block; overflow: visible; }
.arch { left: -6px; top: 250px; width: 46px; height: 150px; border-radius: 0 40px 0 0; background: linear-gradient(90deg, #8ccff5, #c9ecff); border: 6px solid #f7e6c6; border-left: 0; }
.t2 .arch { border-color: #c8f0d0; } .t3 .arch { border-color: #f2c48a; } .t4 .arch { border-color: #d9d3cc; background: linear-gradient(90deg,#cfe6ff,#ffffff); }
.window { top: 4px; width: 120px; height: 52px; border: 5px solid #fff; border-radius: 26px 26px 0 0; }
.t1 .window { background: linear-gradient(#9fdcff 0 55%, #3fb3e0 55%); }
.t2 .window { background: linear-gradient(#bff0ff 0 60%, #ffe39a 60%); }
.t3 .window { background: linear-gradient(#ffd7a8, #ff9f6b); border-color: #d4a231; }
.t4 .window { background: linear-gradient(#bfe2ff 0 40%, #ffffff 40% 55%, #8fa5b8 55%); border-color: #6b4628; }

/* ---------- stations ---------- */
.station { position: absolute; }
.station .art { position: absolute; inset: 0; transition: filter .2s; }
.station .need, .station .dirt-ic {
  position: absolute; right: 10px; top: -6px; z-index: 5; width: 44px; height: 44px; display: none;
  border-radius: 50%; background: #fff; border: 3px solid var(--purple);
  box-shadow: 0 3px 6px rgba(0,0,0,.3); animation: pulse 1s infinite; padding: 3px;
}
.station .need svg, .station .dirt-ic svg { width: 100%; height: 100%; }
.station.needs .need { display: block; }
.station.dirty .dirt-ic { display: block; border-color: #8a5a2a; }
.station .grime { position: absolute; inset: 10px 14px; display: none; border-radius: 30px;
  background:
    radial-gradient(circle at 25% 40%, rgba(90,60,20,.7) 0 10px, transparent 11px),
    radial-gradient(circle at 65% 60%, rgba(90,60,20,.65) 0 14px, transparent 15px),
    radial-gradient(circle at 45% 78%, rgba(90,60,20,.6) 0 8px, transparent 9px),
    radial-gradient(circle at 80% 30%, rgba(90,60,20,.55) 0 7px, transparent 8px); }
.station.dirty .grime { display: block; }
.station .prog { position: absolute; left: 30px; right: 30px; bottom: -4px; height: 10px; border-radius: 6px; background: rgba(0,0,0,.35); border: 2px solid #fff; overflow: hidden; display: none; z-index: 6; }
.station .prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7cf0a8, #2fbf6a); }
.station.treating .prog { display: block; }
.station.ok .art { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 10px #7cf0a8); }
.station.hover .art { filter: drop-shadow(0 0 8px #fff) drop-shadow(0 0 16px #2fbf6a); }
.station.cleaning .grime { animation: scrub .3s infinite; }
.station .name { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); white-space: nowrap; font-size: 13px; font-weight: 800; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; opacity: .9; z-index: 4; }
.station.busy .name { opacity: 0; }
.steam path { animation: steam 2s ease-in-out infinite; }

.chair, .crate, .bucket { position: absolute; }
.chair.ok svg { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 8px #7cf0a8); }
.crate:active svg, .bucket:active svg { transform: scale(.95); }

.qb { position: absolute; z-index: 600; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  background: var(--blue); color: #fff; font-size: 14px; font-weight: 800; line-height: 24px; text-align: center;
  border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.35); pointer-events: none; }

/* ---------- personnages ---------- */
.client, #lea { position: absolute; left: 0; top: 0; width: 74px; height: 112px; transform-origin: 50% 100%; }
.client { transition: transform .45s ease, opacity .4s; touch-action: none; }
.client .spr, #lea .spr { position: absolute; inset: 0; }
.client .spr svg, #lea .spr svg { width: 100%; height: 100%; display: block; overflow: visible; }
.client.dragging { transition: none; z-index: 900 !important; filter: drop-shadow(0 14px 8px rgba(0,0,0,.3)); }
.client .hearts { position: absolute; left: 6px; right: 6px; bottom: 30px; height: 13px; }
.client .hearts svg { width: 100%; height: 100%; display: block; }
.client .balloon {
  position: absolute; left: -16px; top: -26px; width: 46px; height: 46px; border-radius: 10px;
  background: linear-gradient(#ffffff, #e9e3f0); border: 2px solid #6b5a7a; box-shadow: 0 2px 5px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
}
.client .balloon::after { content: ''; position: absolute; right: -8px; bottom: 6px; border: 6px solid transparent; border-left-color: #6b5a7a; }
.client .balloon:empty { display: none; }
.client .balloon .more { position: absolute; right: -6px; bottom: -6px; background: var(--pink); color: #fff; font-size: 11px; font-weight: 800; border-radius: 8px; padding: 0 4px; line-height: 15px; border: 1.5px solid #fff; }
.badge-ic { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: radial-gradient(circle at 35% 30%, #c77bff, var(--purple) 60%, #5e138f); border: 2px solid #fff; box-shadow: 0 0 0 1.5px #5e138f; }
.badge-ic.pay { background: radial-gradient(circle at 35% 30%, #9ff5a0, #2fbf4a 60%, #127a2a); box-shadow: 0 0 0 1.5px #127a2a; color: #fff; font-weight: 800; font-size: 22px; }
.client.treat .balloon, .client.treat .hearts { opacity: 0; }
.client.sel .spr { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 8px #2fbf6a); }
.client.zen .spr { filter: drop-shadow(0 0 6px #fff59d); }
.client.shake { animation: shake .35s; }
.client.pay .balloon { animation: pulse .9s infinite; }

#lea { z-index: 700; pointer-events: none; }
#lea.flip .spr { transform: scaleX(-1); }
#lea.walk .spr { animation: bob .3s infinite; }
#lea.act .spr { animation: work .25s infinite; }
#lea .hand { position: absolute; right: -12px; top: 52px; width: 34px; height: 34px; }
#lea .hand svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }

/* ---------- HUD (barre du bas) ---------- */
#hud { position: absolute; left: 0; right: 0; top: 540px; height: 60px; z-index: 800;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: linear-gradient(#ffd0e4, #ff9cc4 40%, #f37aae); border-top: 4px solid #ff5fa2; }
.hbtn { width: 66px; height: 46px; border-radius: 10px; border: 2px solid #fff; cursor: pointer; font-size: 22px;
  background: linear-gradient(#6fc4ff, #2e7fd6); box-shadow: 0 3px 0 #1b5aa0, inset 0 2px 0 rgba(255,255,255,.5); color: #fff; }
.hbtn.off { filter: grayscale(.9); opacity: .7; }
.hud-cash { margin-left: 14px; line-height: 1; }
.hud-cash div { display: flex; align-items: baseline; gap: 8px; }
.hud-cash .lbl { width: 46px; text-align: right; font-weight: 800; font-size: 18px; color: #fff; text-shadow: 0 2px 0 var(--blue), 0 0 2px var(--blue); }
.hud-cash b { font-size: 24px; color: var(--blue); text-shadow: 0 2px 0 #fff; }
.hud-bar { flex: 1; height: 14px; border-radius: 8px; background: rgba(255,255,255,.55); border: 2px solid #fff; overflow: hidden; max-width: 220px; }
.hud-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffe14d, #ffb300); transition: width .4s; }
.hud-bar i.reached { background: linear-gradient(90deg, #9ff5a0, #2fbf4a); }
.hud-left { display: flex; align-items: center; gap: 4px; font-size: 26px; color: var(--blue); }
.hud-left b { text-shadow: 0 2px 0 #fff; }
.hud-lv { margin-left: auto; font-weight: 800; font-size: 18px; color: #fff; text-shadow: 0 2px 0 var(--pink-d); }
.hud-lv b { font-size: 26px; }

/* ---------- textes flottants ---------- */
.float { position: absolute; z-index: 850; font-weight: 800; font-size: 26px; pointer-events: none; white-space: nowrap;
  transform: translate(-50%, 0); animation: floatUp 1.3s ease-out forwards; text-shadow: 0 2px 0 #fff, 0 0 6px #fff; }
.float.money { color: #1a9a3a; font-size: 30px; }
.float.bad { color: var(--bad); }
.float.zen { color: #c99a00; font-size: 20px; }
#hint { position: absolute; left: 50%; top: 486px; transform: translateX(-50%) translateY(10px); z-index: 820;
  background: rgba(58,29,42,.92); color: #fff; padding: 6px 16px; border-radius: 14px; font-size: 18px; font-weight: 700;
  opacity: 0; transition: all .25s; pointer-events: none; white-space: nowrap; }
#hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#tip { position: absolute; left: 50%; top: 10px; width: 560px; margin-left: -280px; z-index: 830;
  background: #fff; border: 4px solid var(--pink); border-radius: 18px; padding: 10px 16px; font-size: 18px; font-weight: 600; line-height: 1.3;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); display: none; }
#tip.show { display: block; animation: pop .3s; }
#tip small { display: block; text-align: right; color: var(--pink); font-weight: 800; font-size: 13px; }

/* ---------- écrans ---------- */
.screen { position: absolute; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.screen.hidden, #modal.hidden { display: none; }
#menu { background: linear-gradient(rgba(255,255,255,.1), rgba(255,140,190,.35)); }
#menu::before { content: ''; position: absolute; inset: 0; background:
  linear-gradient(90deg, #4f9b3f 0 4px, transparent 4px) 0 0 / 80px 70px,
  linear-gradient(#4f9b3f 0 4px, transparent 4px) 0 0 / 80px 70px,
  radial-gradient(ellipse at 40% 35%, #f6a35a, #e2772e 70%) 0 0 / 80px 70px; z-index: -1; }
.menu-art { position: absolute; inset: 0; pointer-events: none; }
.menu-art > div { position: absolute; }
.logo { text-align: center; position: relative; }
.logo h1 { margin: 0; font-size: 92px; line-height: .95; color: #fff; letter-spacing: 1px;
  text-shadow: 0 5px 0 var(--pink-d), 0 0 0 #000, 4px 4px 0 var(--pink-d), -4px 4px 0 var(--pink-d), 0 10px 24px rgba(0,0,0,.35); }
.logo p { margin: 4px 0 18px; font-weight: 800; font-size: 22px; color: #fff; text-shadow: 0 2px 0 var(--pink-d); }
.menu-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; position: relative; }
.menu-score { margin-top: 14px; color: #fff; font-weight: 800; font-size: 18px; text-shadow: 0 2px 0 var(--pink-d); position: relative; }

.btn { font-family: inherit; font-weight: 800; font-size: 24px; color: #fff; cursor: pointer;
  background: linear-gradient(#ff8cc0, var(--pink)); border: 3px solid #fff; border-radius: 18px;
  padding: 8px 26px; min-width: 250px; box-shadow: 0 5px 0 var(--pink-d), 0 8px 16px rgba(0,0,0,.25); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--pink-d); }
.btn.big { font-size: 32px; padding: 10px 30px; }
.btn.ghost { background: linear-gradient(#ffffff, #ffe6f1); color: var(--pink-d); }
.btn.small { font-size: 18px; min-width: 0; padding: 5px 18px; }
.btn.alt { background: linear-gradient(#6fc4ff, #2e7fd6); box-shadow: 0 5px 0 #1b5aa0; }

#modal { position: absolute; inset: 0; z-index: 1100; background: rgba(43,18,30,.5); display: flex; align-items: center; justify-content: center; padding: 18px; }
#modal .card { width: 560px; max-width: 100%; max-height: 100%; overflow: auto; background: var(--card); border: 5px solid var(--pink-l);
  border-radius: 26px; padding: 18px 24px 22px; text-align: center; animation: pop .25s; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
#modal h2 { margin: 0 0 6px; font-size: 34px; line-height: 1.1; color: var(--pink); }
#modal p { margin: 6px 0; font-size: 19px; line-height: 1.35; }
#modal .btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 14px; }
#modal .btns .btn { min-width: 200px; }
.big-emoji { font-size: 60px; line-height: 1.1; }
.portrait { width: 110px; height: 160px; margin: 0 auto; }
.story { display: flex; gap: 16px; align-items: center; text-align: left; }
.story .portrait { flex: none; }
.steps { text-align: left; margin: 6px 0; padding: 0; list-style: none; columns: 2; column-gap: 20px; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 16px; line-height: 1.25; break-inside: avoid; }
.steps li .ic { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.steps li .ic svg { width: 100%; height: 100%; }
.result-row { display: flex; justify-content: space-between; font-size: 20px; padding: 3px 8px; border-bottom: 2px dashed #f7c6dc; }
.stars { font-size: 46px; letter-spacing: 6px; margin: 2px 0; }
.stars .off { filter: grayscale(1); opacity: .3; }
.lv-stage { font-weight: 800; color: var(--pink-d); margin: 8px 0 4px; text-align: left; font-size: 18px; }
.lv-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.lv-btn { font-family: inherit; border: 3px solid #fff; border-radius: 12px; padding: 4px 0 0; font-size: 22px; font-weight: 800; color: #fff;
  background: linear-gradient(#6fc4ff, #2e7fd6); cursor: pointer; box-shadow: 0 3px 0 #1b5aa0; }
.lv-btn small { display: block; font-size: 10px; line-height: 1.3; letter-spacing: -1px; }
.lv-btn.locked { background: #cfc6cc; box-shadow: 0 3px 0 #a99da5; }
.new-st { display: inline-flex; flex-direction: column; align-items: center; margin: 6px 14px; font-weight: 800; font-size: 20px; }
.new-st .art { width: 170px; height: 128px; }
.new-st .art svg { width: 100%; height: 100%; }

@keyframes pulse { 50% { transform: scale(1.1); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes work { 50% { transform: rotate(6deg); } }
@keyframes shake { 20%,60% { margin-left: -8px; } 40%,80% { margin-left: 8px; } }
@keyframes scrub { 50% { opacity: .4; } }
@keyframes steam { 0%,100% { opacity: .2; transform: translateY(4px); } 50% { opacity: .9; transform: translateY(-4px); } }
@keyframes floatUp { 0% { opacity: 0; margin-top: 0; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -60px; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* ---------- disposition portrait (téléphone tenu droit) ---------- */
.port .arch { top: 300px; }
.port #hint { top: auto; bottom: 130px; }
.port #hud { height: 80px; gap: 6px; padding: 0 8px; flex-wrap: nowrap; }
.port .hbtn { width: 52px; height: 52px; font-size: 22px; }
.port .hud-cash { margin-left: 4px; }
.port .hud-cash .lbl { width: 40px; font-size: 16px; }
.port .hud-cash b { font-size: 22px; }
.port .hud-bar { display: none; }
.port .hud-left { font-size: 22px; }
.port .hud-lv { font-size: 14px; text-align: center; line-height: 1; }
.port .hud-lv b { display: block; font-size: 28px; }
.port .logo h1 { font-size: 74px; }
.port #modal .card { padding: 16px 18px 20px; }
.port .steps { columns: 1; }
.port .story { flex-direction: column; text-align: center; }
