/* Démo jouable — Kilomètre Zéro */
.stage {
  position: relative;
  margin-top: 28px;
  aspect-ratio: 16 / 9;
  max-height: 80vh;
  min-height: 380px;
  width: 100%;
  background: #1b2f25;
  border: 1px solid #334d3f;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#game { display: block; width: 100%; height: 100%; outline: none; }

.hud { position: absolute; pointer-events: none; color: #fff5dc; font: 700 12px/1.4 "Courier New", monospace; letter-spacing: .06em; text-transform: uppercase; }

.hud-bars { top: 12px; left: 12px; display: grid; gap: 6px; width: min(210px, 36%); }
.bar { position: relative; height: 18px; background: rgba(10, 20, 15, .68); border: 1px solid rgba(255, 245, 220, .3); }
.bar span { position: absolute; left: 6px; top: 0; z-index: 1; line-height: 16px; font-size: 10px; text-shadow: 0 1px 2px #000; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 100%; transition: width .15s linear; }
#b-hp { background: #b8584b; }
#b-food { background: #c28a3d; }
#b-water { background: #4f8f9a; }
#b-stam { background: #7da060; }
.bar.low { border-color: #ff8d7a; animation: pulse 1s infinite; }
.bar.thin { height: 10px; }
.bar.thin span { display: none; }

.hud-time { top: 12px; right: 12px; padding: 6px 10px; background: rgba(10, 20, 15, .68); border: 1px solid rgba(255, 245, 220, .3); }

.bag-wrap { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: grid; gap: 6px; justify-items: center; max-width: 96%; }
.bag { --cell: 46px; display: flex; gap: 4px; padding: 6px; background: rgba(10, 20, 15, .78); border: 1px solid rgba(255, 245, 220, .3); }
#bag-count { font: 700 11px/1 "Courier New", monospace; letter-spacing: .08em; text-transform: uppercase; color: #e9ecdc; text-shadow: 0 1px 2px #000; }

.slot { position: relative; width: var(--cell); height: var(--cell); border: 1px dashed rgba(255, 245, 220, .25); background: rgba(255, 255, 255, .04); }
.slot.item {
  width: calc(var(--cell) * var(--n) + 4px * (var(--n) - 1));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border: 1px solid #eaa05c; background: rgba(234, 160, 92, .18); color: #fff5dc; cursor: pointer; padding: 0;
  font: 700 10px/1.1 "Courier New", monospace;
}
.slot.item:hover { background: rgba(234, 160, 92, .38); }
.slot.item.vide { border-color: #7da0a8; background: rgba(111, 148, 143, .16); }
.slot .ic { font-size: 20px; line-height: 1.1; }
.slot .nm { font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.slot kbd { position: absolute; left: 3px; top: 1px; font: 700 9px/1 "Courier New", monospace; opacity: .7; }

.prompt {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  --p: 0%; display: none; padding: 8px 14px 10px; max-width: 92%; text-align: center;
  background: rgba(10, 20, 15, .85); border: 1px solid #eaa05c; color: #fff5dc; font-size: 14px; pointer-events: none;
  background-image: linear-gradient(#eaa05c, #eaa05c); background-repeat: no-repeat; background-size: var(--p) 3px; background-position: left bottom;
}
.prompt.on { display: block; }

.toasts { position: absolute; left: 12px; bottom: 96px; display: grid; gap: 6px; width: min(300px, 40%); pointer-events: none; }
.toast { padding: 7px 10px; font-size: 13px; line-height: 1.3; color: #fff5dc; background: rgba(10, 20, 15, .82); border-left: 3px solid #eaa05c; animation: pop .2s ease-out; }
.toast.good { border-color: #7da060; }
.toast.warn { border-color: #eaa05c; }
.toast.bad { border-color: #ff8d7a; }

#hurt { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px 30px rgba(200, 40, 30, .75); }
#hurt.on { animation: hurt .45s ease-out; }

.overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 16px; background: rgba(12, 22, 17, .88); overflow: auto; }
.overlay[hidden] { display: none !important; }
.panel { width: min(640px, 100%); padding: clamp(18px, 3vw, 30px); background: #fcfcf6; color: #18271f; border-left: 4px solid #ac5729; }
.panel h2 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 10px; }
.panel p { color: #4d5b51; }
.panel p + p { margin-top: 8px; }
.panel .button { margin-top: 16px; }
.panel .button + .button { margin-left: 10px; }
.panel .button.alt { background: transparent; color: #233e32; border: 2px solid #233e32; }
.panel .button:disabled { opacity: .45; cursor: not-allowed; }

.keys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 15px; }
.keys kbd, .howto kbd { font: 700 12px "Courier New", monospace; padding: 1px 6px; border: 1px solid #829180; border-bottom-width: 2px; background: #f2f1e9; }

.choice { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.choice label { flex: 1 1 200px; padding: 10px 12px; border: 1px solid #c5ccbe; cursor: pointer; background: #fff; font-weight: 650; }
.choice label small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; font-family: inherit; color: #4d5b51; font-size: 13px; }
.choice input { width: auto; margin: 0 6px 0 0; }
.choice label:has(input:checked) { border-color: #233e32; background: #edf0e6; }

#over-score { font-size: clamp(30px, 5vw, 46px); font-weight: 800; letter-spacing: -.04em; color: #ac5729; margin-top: 8px; }
#over-best { font-weight: 700; color: #233e32; margin-top: 4px; }

.abri-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.abri-grid h3 { font-size: 15px; margin: 0 0 8px; display: flex; justify-content: space-between; font-family: "Courier New", monospace; text-transform: uppercase; letter-spacing: .05em; }
.col { min-height: 90px; max-height: 210px; overflow: auto; display: grid; gap: 4px; align-content: start; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid #c5ccbe; background: #fff; color: #18271f; cursor: pointer; font: inherit; font-size: 14px; text-align: left; }
.row:hover:not(:disabled) { border-color: #233e32; background: #edf0e6; }
.row em { font-style: normal; font-size: 12px; color: #67512e; white-space: nowrap; }
.empty-note { font-size: 13px; }
.abri-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.panel .abri-actions .button, .panel .abri-actions .button + .button { margin: 0; }

.howto { margin-top: 36px; }
.howto .cards { margin-top: 18px; }

@keyframes pulse { 50% { border-color: rgba(255, 141, 122, .3); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
@keyframes hurt { from { opacity: 1; } to { opacity: 0; } }

@media (max-width: 760px) {
  .stage { min-height: 320px; aspect-ratio: 4 / 3; }
  .bag { --cell: 34px; }
  .slot .ic { font-size: 16px; }
  .hud-bars { width: 44%; }
  .toasts { display: none; }
  .abri-grid { grid-template-columns: 1fr; }
  .keys { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .bar.low, #hurt.on, .toast { animation: none; }
}
