/* =========================================================
   Agora Explorer — feuille de style commune
   ========================================================= */

/* ---------- Couleurs : thème clair ---------- */
:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --pixel-font: "Pixelify Sans", ui-monospace, "Courier New", monospace;
  --frame: #2f2c45;

  --bg: linear-gradient(135deg, #e6f5ff 0%, #f6eaff 46%, #fff1df 100%);
  --surface: #ffffff;
  --surface-2: #f5f3fc;
  --glass: rgba(255, 255, 255, .95);
  --card: rgba(255, 255, 255, .85);
  --ink: #2f2c45;
  --muted: #6e6987;
  --line: #e6e1f2;

  --accent: #6c5ad6;
  --accent-hover: #5b49c4;
  --accent-soft: #eeeaff;
  --accent-ink: #4b3d9e;
  --on-accent: #ffffff;

  --ok: #256b48;
  --ok-bg: #e7f7ee;
  --ok-line: #b5e2c8;
  --bad: #9c3340;
  --bad-bg: #fdecee;
  --bad-line: #f2c3c9;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 10px 30px rgba(68, 58, 120, .12);
  --shadow-lg: 0 22px 60px rgba(68, 58, 120, .18);
  --backdrop: rgba(47, 44, 69, .45);
  --glow-opacity: .7;

  --sc-sky-top: #ffb98a;
  --sc-sky-bottom: #c9a6f0;
  --sc-city: #8b78b8;
  --sc-city-light: #ffe7a8;
  --sc-city-light-opacity: .55;
  --sc-wall: #f3e6dc;
  --sc-wall-low: #e8d4c6;
  --sc-panel: #ecdfe8;
  --sc-wood: #8a5a44;
  --sc-wood-dark: #6d4535;
  --sc-counter: #7b4f3d;
  --sc-counter-top: #a7745a;
  --sc-floor: #c99f7f;
  --sc-floor-line: #b88c6c;
  --sc-rail: #d6a85c;
  --sc-metal: #9a93a8;
  --sc-lamp: #ffcf7a;
  --sc-glow-opacity: .28;
  --sc-plant: #6fb38a;
  --sc-pot: #d98b6a;
  --sc-glass: rgba(255, 255, 255, .45);
  --sc-glass-line: rgba(255, 255, 255, .95);
  --sc-stain: rgba(110, 60, 40, .35);
  --sc-puddle: rgba(140, 200, 230, .6);
  --sc-shine: rgba(255, 255, 255, .45);
  --sc-board: #fbfaff;
}

/* ---------- Couleurs : thème sombre ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: linear-gradient(135deg, #12111f 0%, #1b1530 50%, #221726 100%);
  --surface: #1d1b2c;
  --surface-2: #26233a;
  --glass: rgba(29, 27, 44, .94);
  --card: rgba(36, 33, 54, .9);
  --ink: #ecebf5;
  --muted: #a9a5c0;
  --line: #36324d;

  --accent: #8f7ff0;
  --accent-hover: #a497f5;
  --accent-soft: #2e2954;
  --accent-ink: #d2cbff;
  --on-accent: #17132e;

  --ok: #8fe0b4;
  --ok-bg: #173326;
  --ok-line: #2c5c43;
  --bad: #ffa3ae;
  --bad-bg: #3a1d25;
  --bad-line: #6b2f3b;

  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, .45);
  --backdrop: rgba(8, 7, 15, .65);
  --frame: #4a4370;
  --glow-opacity: .18;

  --sc-sky-top: #1c2350;
  --sc-sky-bottom: #3d2a66;
  --sc-city: #141229;
  --sc-city-light: #ffd27a;
  --sc-city-light-opacity: 1;
  --sc-wall: #2d2642;
  --sc-wall-low: #251f38;
  --sc-panel: #352d4f;
  --sc-wood: #5c3f3b;
  --sc-wood-dark: #43302f;
  --sc-counter: #4a3233;
  --sc-counter-top: #6b4a45;
  --sc-floor: #3b2e3b;
  --sc-floor-line: #302531;
  --sc-rail: #b98d4a;
  --sc-metal: #6f6884;
  --sc-glow-opacity: .45;
  --sc-plant: #4f8a6a;
  --sc-pot: #9c5f4b;
  --sc-glass: rgba(200, 220, 255, .18);
  --sc-glass-line: rgba(220, 230, 255, .7);
  --sc-stain: rgba(0, 0, 0, .35);
  --sc-puddle: rgba(110, 160, 210, .45);
  --sc-shine: rgba(255, 255, 255, .15);
  --sc-board: #c9c6dc;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { height: 100%; overflow: hidden; overscroll-behavior: none; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px;
  touch-action: manipulation;
  background: var(--bg) fixed;
  color: var(--ink);
  font-family: var(--font);
}

button, input, select { font: inherit; color: inherit; }
input { caret-color: var(--accent); }
::selection { background: var(--accent-soft); color: var(--accent-ink); }
.dialog, .chatLog, .summary, .screen { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.hidden { display: none !important; }

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 750;
  background: var(--accent-soft);
  color: var(--accent-ink);
  transition: background .15s;
}
.btn.primary { background: var(--accent); color: var(--on-accent); }

.control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 2px 8px rgba(68, 58, 120, .08);
}
.control:disabled { opacity: .5; cursor: default; }

.themeToggle { padding: 8px; }
.themeToggle .icon { width: 18px; height: 18px; }
:root[data-theme="dark"] .themeToggle .i-moon,
:root:not([data-theme="dark"]) .themeToggle .i-sun { display: none; }

/* ---------- Bandeau du hackathon ---------- */
/* le script du hackathon le rend « sticky », ce qui l'empêche de remonter jusqu'au bord ; la page ne défile pas */
#c4s-bandeau { flex: none; position: relative !important; margin: -16px -16px 16px; }
#intro, #guide, #sectorSelect, #jobInfo, #ending { top: var(--bandeau, 0px) !important; }

/* =========================================================
   Jeu
   ========================================================= */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 14px;
  width: min(1480px, 100%);
  margin: 0 auto;
}

.sidebar {
  flex: none;
  width: 132px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar .control, .sidebar .pill { justify-content: flex-start; }
.sidebar .pill b { font-weight: 700; line-height: 1.25; }

.shell {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
}
.pill .icon { color: var(--accent); }

.gauges { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; padding: 10px 18px; border-bottom: 3px solid var(--frame); }
.gauge { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.gaugeBar { height: 12px; border: 2px solid var(--frame); background: var(--surface-2); }
.gaugeBar div { height: 100%; background: var(--ok); }
.gauge.low .gaugeBar div { background: var(--bad); }
.gauge.low b { color: var(--bad); }
.gauge b { white-space: nowrap; font-variant-numeric: tabular-nums; }

.progress { flex: none; height: 4px; background: var(--line); }
.progress div { height: 100%; background: var(--accent); transition: width .4s ease-out; }

.world {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
  isolation: isolate;
  background: var(--sc-wall);
}
.sceneArt { position: absolute; inset: 0; z-index: -1; }
.sceneArt svg { display: block; width: 100%; height: 100%; }

.titlebar, .dialog, .notice {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.titlebar {
  align-self: flex-start;
  max-width: min(62%, 620px);
  padding: 12px 16px;
  border-radius: var(--radius);
}
.titlebar h1 { margin: 0 0 6px; font-size: clamp(19px, 2.1vw, 27px); letter-spacing: -.02em; }
.titlebar p { margin: 0; font-size: clamp(13px, 1.1vw, 15px); line-height: 1.45; color: var(--muted); }

.dialogHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sideControls { display: flex; gap: 6px; }
.sideControls .control { padding: 6px 9px; font-size: 12px; }

.notice {
  align-self: flex-start;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ok);
  background: var(--ok-bg);
  border-color: var(--ok-line);
}
.notice.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }

.dialog {
  margin-top: auto;
  width: min(930px, 100%);
  min-height: 0;
  overflow: auto;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
}
.speaker { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.speech { margin: 6px 0 14px; font-size: clamp(16px, 1.5vw, 19px); font-weight: 600; line-height: 1.45; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; }
.choice {
  min-height: 68px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: clamp(14px, 1.2vw, 16px);
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  transition: border-color .15s, background .15s, transform .15s;
}
.choice:active { transform: none; }
.shell .choice:disabled, .shell .choice:disabled:hover { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; background: var(--surface); text-decoration: line-through; }
.choices:has(.withImage) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice.withImage { display: flex; flex-direction: column; gap: 8px; }
.choiceArt { display: block; aspect-ratio: 16 / 9; overflow: hidden; border: 2px solid var(--frame); background: var(--surface-2); }
.choiceArt canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.choices:has(> :nth-child(5)) { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* =========================================================
   Écrans plein écran
   ========================================================= */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}

/* ---------- Accueil ---------- */
#intro { z-index: 999; padding: 64px 20px 24px; }

.introTools { position: absolute; top: 17px; right: 22px; z-index: 4; }

.welcomeGlow {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  opacity: var(--glow-opacity);
  pointer-events: none;
  animation: drift 12s ease-in-out infinite alternate;
}
.glowOne { width: min(58vw, 650px); height: min(58vw, 650px); left: -16%; top: -25%; background: radial-gradient(circle, #9ed9ff, #c0e7ff99 50%, transparent 72%); }
.glowTwo { width: min(53vw, 580px); height: min(53vw, 580px); right: -15%; bottom: -35%; background: radial-gradient(circle, #e4b7ff, #edd4ff99 52%, transparent 73%); animation-delay: -5s; }
.glowThree { width: min(35vw, 420px); height: min(35vw, 420px); right: 20%; top: -16%; background: radial-gradient(circle, #ffe1aa, #ffeed099 50%, transparent 70%); animation-delay: -9s; }
@keyframes drift { to { transform: translate(30px, 25px); } }

.welcomeContent {
  position: relative;
  width: min(960px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.welcomeBrand {
  margin: 0 0 26px;
  text-align: center;
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -.055em;
}
.welcomeBrand span { color: var(--accent); }

.welcomeSearch {
  width: min(440px, 100%);
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 5px 5px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.welcomeSearch:focus-within { box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.welcomeSearch > .icon { width: 18px; height: 18px; color: var(--muted); }
.welcomeSearch input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 550;
}
.welcomeSearch input::placeholder { color: var(--muted); }
.welcomeSearch button {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}
.welcomeSearch button .icon { width: 18px; height: 18px; }

.introError {
  margin: 14px 0 0;
  padding: 10px 15px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.popPanel { width: min(720px, calc(100% - 32px)); padding: 36px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); max-height: calc(100dvh - 48px); overflow-y: auto; }
.popPanel::backdrop { background: var(--backdrop); backdrop-filter: blur(8px); }
.popPanel h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.02em; text-align: center; }
.popPanel h3 { margin: 24px 0 10px; font-size: 17px; }
.popPanel p, .popPanel ul { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.popPanel ul { padding-left: 18px; }
.popPanel li + li { margin-top: 6px; }
.popPanel a:not(.partnerLogo) { color: var(--accent-ink); text-underline-offset: 2px; }
.howToPanel { width: min(560px, calc(100% - 32px)); }
.howToPanel ol { margin: 16px 0 0; padding-left: 22px; font-size: 15px; line-height: 1.55; }
.howToPanel li + li { margin-top: 8px; }
kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); font: inherit; font-size: .9em; font-weight: 700; }
.howToActions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.partners { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.partners .partnerLogo { width: 100%; height: 120px; padding: 18px; border-radius: 18px; }
.partnerLogo {
  width: 112px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: transform .2s ease-out, border-color .2s, box-shadow .2s;
}
.partnerLogo.dark { background: #1b1438; }
.partnerLogo img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* ---------- Cartes (secteurs et métiers) ---------- */
.sectorGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; }

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: left;
  font: inherit;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card.available { border-color: var(--ok-line); background: var(--ok-bg); }
.card.future { opacity: .55; box-shadow: none; }

.cardIcon {
  flex: none;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.cardIcon .icon { width: 26px; height: 26px; }
.available .cardIcon { color: var(--ok); background: var(--surface); }

.cardTitle { display: block; font-size: 14px; font-weight: 800; line-height: 1.3; }
.cardHint { display: block; margin-top: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.available .cardHint { color: var(--ok); }
.cardArrow { margin-left: auto; color: var(--ok); }
.sectorCard { min-height: 104px; }

/* ---------- Choix du métier ---------- */
#guide { z-index: 1001; padding: 24px; }
.guidePage { display: flex; flex-direction: column; height: min(720px, 100%); }
.guidePage .chat { min-height: 0; }
.guideChoices { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 12px 0; border-top: 1px solid var(--line); background: var(--surface); }
.guideChoices:empty { display: none; }
.guideResults { display: grid; gap: 8px; }
.guideResult { display: grid; grid-template-columns: minmax(0, 1fr) 120px 3.5em; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: inherit; font: inherit; text-align: left; }
.guideResultName { font-weight: 700; }
a.guideResult { text-decoration: none; }
.guideResultRow { display: grid; gap: 6px; }
.guidePlay { justify-self: start; padding: 6px 12px; font-size: 13px; }
.guideWhy { margin: 0 4px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.guideBar { height: 8px; overflow: hidden; border-radius: 4px; background: var(--line); }
.guideBar span { display: block; height: 100%; background: var(--accent); }
.guideResult b { text-align: right; color: var(--accent-ink); font-variant-numeric: tabular-nums; }

#sectorSelect { z-index: 1002; padding: 24px; }

.sectorPage {
  position: relative;
  width: min(790px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--glass);
  box-shadow: var(--shadow-lg);
}
.sectorPage h2 { margin: 18px 0 4px; text-align: center; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.03em; }
.sectorSubtitle { margin: 0 0 24px; text-align: center; font-weight: 600; color: var(--muted); }

.jobTiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.jobTile { min-height: 100px; }
.jobTile .cardTitle { font-size: 18px; }

/* ---------- Infos sur le métier ---------- */
#jobInfo { z-index: 1003; padding: 24px; }

.infoPage { width: min(900px, 100%); }
.infoHeader { display: flex; gap: 16px; align-items: flex-start; margin: 22px 0 20px; }
.infoHeader .cardIcon { width: 56px; height: 56px; }
.infoHeader h2 { margin: 0 0 6px; text-align: left; }
.infoHeader p { margin: 0; max-width: 68ch; line-height: 1.55; color: var(--muted); }

.infoSalary { display: grid; gap: 4px; margin: 0 0 20px; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); }
.infoSalary strong { font-size: 17px; color: var(--accent-ink); }
.infoSalary span { font-size: 13px; color: var(--accent-ink); }
.infoSalary a { color: var(--accent-ink); text-underline-offset: 2px; }

.infoGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
.infoGrid h3 { margin: 0 0 8px; font-size: 15px; color: var(--accent-ink); }
.infoGrid ul { margin: 0; padding-left: 18px; line-height: 1.5; font-size: 14px; }
.infoGrid li + li { margin-top: 4px; }
.infoSummaryTab { display: none; }
.infoSummaryTab p { margin: 0; line-height: 1.5; font-size: 14px; }

.infoTabs { display: none; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.infoTabs button { border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: var(--surface); font-size: 13px; font-weight: 700; }
.infoTabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.playBtn { margin: 24px auto 0; display: flex; padding: 14px 24px; font-size: 16px; }

/* ---------- Fin de partie et chat ---------- */
#ending { z-index: 1004; padding: 16px; background: var(--backdrop); backdrop-filter: blur(4px); }

.modal {
  width: min(1000px, 96vw);
  height: min(100%, 760px);
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.modal h2 { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 0 0 4px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.03em; }
.modal h2 .icon { color: var(--accent); }
.modal p { margin: 8px 0; line-height: 1.5; color: var(--muted); }
.endingTitle { font-size: 22px; font-weight: 850; color: var(--accent-ink); }

.summary {
  max-height: 90px;
  overflow-y: auto;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
  text-align: left;
}
.summary ul { margin: 6px 0 0; padding-left: 18px; }
.summary li { margin: 3px 0; }
.recapLists { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-top: 8px; }
.recapLists h3 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.recapLists h3 .icon { width: 18px; height: 18px; flex: none; }
.recapGood .icon { color: var(--ok); }
.recapBad .icon { color: var(--bad); }

.chat {
  flex: 1;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-align: left;
}
.chatHead { padding: 13px 18px; background: var(--accent-soft); }
.chatHead strong { display: flex; align-items: center; gap: 8px; font-size: 19px; color: var(--accent-ink); }
.chatHead .small { font-size: 13px; color: var(--accent-ink); }
.chatLog {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 70px;
  overflow: auto;
  padding: 16px;
  background: var(--surface);
}
.bubble {
  max-width: 82%;
  align-self: flex-start;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 15px;
  line-height: 1.45;
}
.bubble.you { align-self: flex-end; background: var(--accent-soft); color: var(--accent-ink); }
.chatForm { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); }
.chatForm input {
  flex: 1;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 16px;
}
.chatForm button { display: grid; place-items: center; padding: 0 20px; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent); }

.finishActions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }

/* ---------- Fin de partie : d'abord le bilan, puis le chat ---------- */
.modal[data-view="recap"] .chat, .modal[data-view="recap"] .chatOnly,
.modal[data-view="chat"] .summary, .modal[data-view="chat"] .endGauges,
.modal[data-view="chat"] #endDesc, .modal[data-view="chat"] .recapOnly { display: none !important; }
.modal[data-view="recap"] { height: auto; max-height: 100%; }
.modal[data-view="recap"] .summary { flex: 1 1 auto; min-height: 0; max-height: none; margin-top: 12px; padding: 14px 18px; font-size: 15px; }
.modal[data-view="recap"] .summary li { margin: 5px 0; }
.endGauges { margin: 10px 0 0; padding: 0; border: 0; text-align: left; }

/* =========================================================
   Style rétro pixel art des écrans de jeu
   ========================================================= */
.titlebar h1, .speaker, .gauge span, #ending .modal h2, .endingTitle, .chatHead strong { font-family: var(--pixel-font); }

.sceneArt canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.shell .titlebar, .shell .dialog, .shell .notice, .shell .choice, .stage .control, .sidebar .pill,
#ending .modal, #ending .summary, #ending .chat, #ending .btn, #ending .chatForm input, #ending .chatForm button {
  border: 3px solid var(--frame);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--frame);
  backdrop-filter: none;
}

.shell .titlebar, .shell .dialog { background: var(--surface); }
.shell .notice { border-color: var(--frame); }

.titlebar h1 { letter-spacing: 0; font-weight: 700; }
.speaker { letter-spacing: .06em; }


.choice { font-weight: 600; transition: none; }
.choice:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--frame); }

#ending .modal { box-shadow: 10px 10px 0 var(--frame); }
#ending .modal h2 { letter-spacing: 0; }
#ending .chatHead { border-bottom: 3px solid var(--frame); }
#ending .chatForm { border-top: 3px solid var(--frame); }
#ending .bubble { border: 2px solid var(--frame); border-radius: 0; }

/* =========================================================
   Survol (souris uniquement)
   ========================================================= */
@media (hover: hover) {
  .btn:hover { filter: brightness(.97); }
  .btn.primary:hover, .welcomeSearch button:hover, .chatForm button:hover { background: var(--accent-hover); }
  .control:hover { border-color: var(--accent); }
  .guideResult:hover { border-color: var(--accent); }
  .partnerLogo:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
  button.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
  .choice:hover { border-color: var(--accent); background: var(--accent-soft); }
  .shell .choice:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--frame); }
  .stage .control:hover { border-color: var(--frame); background: var(--accent-soft); }
  #ending .btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--frame); filter: none; }
}

/* =========================================================
   Petits écrans
   ========================================================= */
@media (max-width: 850px), (max-height: 820px) {
  .infoTabs { display: flex; }
  .infoGrid { display: block; }
  .infoGrid section { display: none; }
  .infoGrid section.active { display: block; }
  .infoGrid h3, .infoHeader p { display: none; }
  .infoHeader { margin: 14px 0 12px; }
  .playBtn { margin-top: 14px; }
}

@media (max-width: 850px) {
  .stage { flex-direction: column; gap: 10px; }
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .titlebar, .notice { align-self: stretch; max-width: none; }
  .choices { grid-template-columns: 1fr 1fr; }
  .gauges { grid-template-columns: 1fr 1fr; }
  .sectorPage { padding: 22px; }
}

@media (max-width: 750px) {
  .sectorGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .welcomeSearch { margin-top: 14px; }
  #intro { flex-direction: column; align-items: stretch; padding: 16px; }
  .welcomeContent { width: 100%; margin: 0; }
  .popPanel { padding: 22px; }
  .popPanel h2 { font-size: 22px; }
  .partners { gap: 10px; }
  .partners .partnerLogo { height: 84px; padding: 10px; }
  .guideResult { grid-template-columns: minmax(0, 1fr) 3.5em; }
  .guideBar { grid-column: 1 / -1; grid-row: 2; }
  .introTools { top: 16px; right: 16px; }
  .welcomeBrand { margin-bottom: 14px; font-size: 36px; }
  .sectorCard { min-height: 0; padding: 10px; gap: 10px; }
  .sectorCard .cardIcon { width: 34px; height: 34px; }
  .sectorCard .cardIcon .icon { width: 20px; height: 20px; }
  .sectorCard .cardTitle { font-size: 12.5px; }
  .sectorCard .cardHint { font-size: 12px; margin-top: 3px; }
}

@media (max-width: 550px) {
  body { padding: 8px; }
  #c4s-bandeau { margin: -8px -8px 8px; padding: 5px 12px !important; font-size: 12.5px !important; }
  .gauges { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 6px 12px; }
  .gauge { grid-template-columns: 1fr auto; gap: 2px 4px; font-size: 12px; }
  .endGauges { grid-template-columns: 1fr 1fr; gap: 6px 16px; }
  .gaugeBar { grid-column: 1 / -1; grid-row: 2; height: 7px; border-width: 1.5px; }
  .titlebar { padding: 9px 12px; }
  .titlebar h1 { font-size: 18px; margin-bottom: 4px; }
  .titlebar p { font-size: 13px; line-height: 1.4; }
  .notice { padding: 8px 12px; font-size: 12.5px; }
  .speech { margin: 4px 0 8px; font-size: 15px; line-height: 1.35; }
  .choice { padding: 8px 10px; font-size: 13.5px; line-height: 1.3; }
  .notice { font-size: 12px; line-height: 1.35; }
  #infoBack { padding: 8px 12px; font-size: 13px; }
  .infoHeader { margin: 10px 0 8px; }
  .infoHeader .cardIcon { display: none; }
  .infoSummaryTab p { font-size: 13px; line-height: 1.4; }
  .infoHeader p { font-size: 13px; line-height: 1.4; }
  .infoSalary { gap: 2px; padding: 8px 10px; margin-bottom: 10px; }
  .infoTabs { gap: 4px; margin-bottom: 8px; }
  .infoTabs button { padding: 6px 9px; font-size: 12.5px; }
  .infoGrid ul { font-size: 13px; line-height: 1.35; }
  .infoGrid li + li { margin-top: 3px; }
  .playBtn { margin-top: 10px; padding: 11px 20px; }
  .pill, .control { padding: 6px 8px; }
  .world { padding: 10px; gap: 8px; }
  .sideControls .label, .sidebar .label, #musicLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .dialog { padding: 12px; }
  .choices, .jobTiles { grid-template-columns: 1fr; gap: 8px; }
  .choices:has(.withImage) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choices:has(> :nth-child(5)) { grid-template-columns: 1fr 1fr; }
  .choices:has(> :nth-child(5)) { gap: 5px; }
  .choices:has(> :nth-child(5)) .choice { padding: 6px 8px; font-size: 12px; line-height: 1.25; }
  .choice.withImage { gap: 5px; padding: 5px; font-size: 12px; }
  .choice { min-height: 0; padding: 10px 12px; }
  .jobTile { min-height: 0; padding: 12px 14px; }
  .cardIcon { width: 42px; height: 42px; }
  .sectorPage { padding: 16px; }
  .infoHeader { flex-direction: row; gap: 12px; }
  .infoHeader .cardIcon { width: 42px; height: 42px; }
  .infoHeader h2 { font-size: 22px; }
  .infoHeader p, .infoGrid ul { font-size: 13.5px; line-height: 1.45; }
  .infoSalary { padding: 10px 12px; margin-bottom: 12px; }
  .infoSalary strong { font-size: 15px; }
  .infoSalary span { font-size: 12px; }
  .modal { padding: 14px; }
  .modal h2 { font-size: 22px; }
  .endingTitle { font-size: 18px; }
  .summary { max-height: 70px; }
  .recapLists { grid-template-columns: 1fr; }
  .chatHead { padding: 10px 14px; }
  .chatHead strong { font-size: 16px; }
  .chatLog { padding: 10px; }
  .finishActions { gap: 6px; }
  .finishActions .btn { padding: 9px 11px; font-size: 13px; }
}

@media (max-height: 760px) {
  .gauges { padding-top: 6px; padding-bottom: 6px; }
  .titlebar { padding: 10px 14px; }
  .titlebar h1 { font-size: 19px; }
  .titlebar p { font-size: 13px; }
  .speech { margin: 4px 0 10px; font-size: 15.5px; }
  .choice { min-height: 0; padding: 10px 12px; }
  .welcomeBrand { margin-bottom: 14px; }
  .sectorCard { min-height: 84px; }
  .modal { padding: 16px 20px; }
  .modal h2 { font-size: 24px; }
  .modal p { margin: 4px 0; }
  .endingTitle { font-size: 19px; }
  .summary { max-height: 58px; padding: 6px 12px; }
  .chat { margin-top: 10px; }
  .chatHead { padding: 8px 14px; }
  .chatHead strong { font-size: 16px; }
  .chatLog { padding: 10px; }
  .chatForm { padding: 8px; }
  .chatForm input { padding: 10px; }
  .finishActions { margin-top: 10px; }
  .finishActions .btn { padding: 9px 14px; }
}

@media (max-width: 550px) and (max-height: 700px) {
  .world { gap: 6px; padding: 8px; }
  .titlebar { padding: 8px 10px; }
  .titlebar h1 { font-size: 17px; }
  .titlebar p { font-size: 12.5px; line-height: 1.35; }
  .notice { padding: 6px 10px; }
  .dialog { padding: 10px; }
  .speech { font-size: 14px; margin-bottom: 6px; }
  .choices { gap: 6px; }
  .choice { padding: 7px 10px; font-size: 13px; }
}

@media (max-height: 560px) {
  .screen { overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .welcomeGlow { animation: none; }
  * { transition: none !important; }
}
