/* Egypte2/style.css — @license AGPL-3.0-or-later */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: system-ui, -apple-system, sans-serif;
  user-select: none; -webkit-user-select: none;
  background: #1a1a2e; color: #f4e0b2;
}
body { touch-action: none; }

/* Écrans plein page, bascule via .hidden */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }

/* MENU */
#menu-screen {
  padding-top: calc(env(safe-area-inset-top, 44px) + 8px);
  padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 8px);
  padding-left: calc(env(safe-area-inset-left, 0px) + 16px);
  padding-right: calc(env(safe-area-inset-right, 0px) + 16px);
  background: linear-gradient(180deg, #2a2040 0%, #1a1a2e 100%);
  align-items: center; justify-content: center; gap: 24px;
}
.menu-top { text-align: center; }
.menu-top h1 {
  font-size: 32px; font-weight: 800; letter-spacing: 1px; color: #f4e0b2;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.menu-top .subtitle { font-size: 13px; opacity: 0.7; margin-top: 8px; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 280px; }
.menu-btn {
  min-height: 48px; padding: 12px 20px;
  background: linear-gradient(180deg, #f4e0b2, #d9b380);
  color: #4b2e10; font-size: 16px; font-weight: 700;
  border: 2px solid #8d6a3a; border-radius: 12px;
  cursor: pointer; font-family: inherit;
}
.menu-btn:disabled { opacity: 0.4; cursor: default; }
.menu-btn.secondary {
  background: transparent; color: #f4e0b2;
  border-color: rgba(244,224,178,0.4);
}
.menu-footer { font-size: 10px; opacity: 0.5; text-align: center; }

/* SLOTS modale */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top, 44px) + 8px) 16px calc(env(safe-area-inset-bottom, 20px) + 8px);
  z-index: 100;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: #2a2040; border: 2px solid #8d6a3a; border-radius: 14px;
  padding: 20px; width: 100%; max-width: 320px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal h2 { font-size: 18px; margin-bottom: 4px; text-align: center; }
.slot-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px; background: rgba(244,224,178,0.08);
  border: 1px solid rgba(244,224,178,0.2);
  border-radius: 10px; min-height: 48px;
}
.slot-row .slot-label { font-weight: 700; font-size: 14px; }
.slot-row .slot-sub { font-size: 11px; opacity: 0.65; }
.slot-row button {
  padding: 8px 14px; font-size: 13px; font-weight: 700;
  background: #f4e0b2; color: #4b2e10;
  border: 1px solid #8d6a3a; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  min-height: 44px; min-width: 44px;
}

/* JEU */
#game-screen { background: #d9b380; }
#game-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block; touch-action: none;
  background: #d9b380;
}
#game-hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding-top: calc(env(safe-area-inset-top, 44px) + 8px);
  padding-left: calc(env(safe-area-inset-left, 0px) + 10px);
  padding-right: calc(env(safe-area-inset-right, 0px) + 10px);
  z-index: 10;
  display: flex; gap: 8px; align-items: flex-start;
  pointer-events: none;
}
/* Bottom HUD (speed bar, action buttons) added in Task 7+.
   Remember safe-area-inset-bottom there: calc(env(safe-area-inset-bottom, 20px) + 8px). */
#game-hud > * { pointer-events: auto; }
.back-btn {
  min-width: 44px; min-height: 44px;
  background: rgba(58,42,26,0.85);
  color: #f4e0b2; border: 1.5px solid rgba(244,224,178,0.5);
  border-radius: 50%; font-size: 20px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.hud-chip {
  padding: 8px 12px; background: rgba(58,42,26,0.85);
  color: #f4e0b2; border: 1.5px solid rgba(244,224,178,0.5);
  border-radius: 10px; font-size: 12px; font-weight: 700;
  min-height: 36px; display: flex; align-items: center; gap: 6px;
}

/* === Bottom bar === */
#game-bottombar {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 8px);
  padding-left: calc(env(safe-area-inset-left, 0px) + 10px);
  padding-right: calc(env(safe-area-inset-right, 0px) + 10px);
  padding-top: 8px;
  display: flex; gap: 8px; justify-content: space-between;
  pointer-events: none;
  z-index: 10;
  background: linear-gradient(0deg, rgba(26,26,46,0.9) 0%, rgba(26,26,46,0) 100%);
}
.bottombar-btn {
  pointer-events: auto;
  min-height: 48px; padding: 10px 18px;
  background: linear-gradient(180deg, #f4e0b2, #d9b380);
  color: #4b2e10; font-size: 14px; font-weight: 700;
  border: 2px solid #8d6a3a; border-radius: 12px;
  cursor: pointer; font-family: inherit;
}
.bottombar-btn.active {
  background: linear-gradient(180deg, #b94a26, #8d3616);
  color: #f4e0b2;
}
.bottombar-btn-demolish {
  background: linear-gradient(180deg, #8a5050, #6a3030);
  color: #f4e0b2; border-color: #4b2020;
}
.bottombar-btn-demolish.active {
  background: linear-gradient(180deg, #c94040, #a02020);
}

/* === Drawer === */
#build-drawer {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 8px);
  padding-left: calc(env(safe-area-inset-left, 0px) + 12px);
  padding-right: calc(env(safe-area-inset-right, 0px) + 12px);
  padding-top: 12px;
  background: #2a2040;
  border-top: 2px solid #8d6a3a;
  border-top-left-radius: 16px; border-top-right-radius: 16px;
  transform: translateY(0);
  transition: transform 0.2s ease-out;
  z-index: 20;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.5);
}
#build-drawer.hidden {
  transform: translateY(100%);
  display: block;  /* on ne cache pas le display — on translate hors-écran */
  pointer-events: none;
}
.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px;
}
.drawer-title { font-size: 16px; font-weight: 700; color: #f4e0b2; }
.drawer-close {
  min-width: 44px; min-height: 44px;
  background: transparent; color: #f4e0b2;
  border: 1.5px solid rgba(244,224,178,0.5);
  border-radius: 10px; font-size: 16px;
  cursor: pointer;
}
.drawer-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding-bottom: 12px;
}
.drawer-cell {
  min-height: 72px; padding: 8px;
  background: rgba(244,224,178,0.08);
  border: 1.5px solid rgba(244,224,178,0.25);
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: #f4e0b2;
  font-family: inherit; font-size: 11px;
}
.drawer-cell .cell-icon { font-size: 22px; }
.drawer-cell:disabled,
.drawer-cell.locked {
  opacity: 0.35; cursor: not-allowed;
}
.drawer-cell.active {
  background: rgba(185,74,38,0.3);
  border-color: #b94a26;
}

/* === Chip mode actif === */
.hud-chip-mode { background: rgba(185,74,38,0.85); }
.hud-chip-mode.hidden { display: none; }
