:root { --neon: #3ef0c0; --amber: #fbbf24; --bg: #05090d; --panel: #0b141c; --line: #16413a; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; background: var(--bg); color: #d1fae5; font-family: "Courier New", monospace; }

/* ---------- menu ---------- */
#menu { min-height: 100%; display: flex; flex-direction: column; padding: 16px 24px; gap: 14px; }
#menu header h1 { margin: 0; font-size: 34px; letter-spacing: 4px; color: var(--neon); text-shadow: 0 0 14px rgba(62,240,192,.5); }
#menu header p { margin: 4px 0 0; color: #6ee7b7; opacity: .8; }
#menu-body { flex: 1; display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }

#map-col { flex: 1 1 560px; max-width: 1000px; display: flex; flex-direction: column; gap: 12px; }
#map-wrap { position: relative; width: 100%; aspect-ratio: 2 / 1; border: 1px solid var(--line); box-shadow: 0 0 24px rgba(62,240,192,.12) inset; overflow: hidden; }
#map-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px); }
#map { width: 100%; height: 100%; display: block; }
.marker { position: absolute; transform: translate(-50%, -50%); width: 40px; height: 28px; padding: 0; border: 2px solid var(--neon); background: #000; cursor: pointer; border-radius: 3px; z-index: 2; transition: transform .12s, box-shadow .12s; }
.marker img { width: 100%; height: 100%; object-fit: fill; display: block; }
.marker:hover { transform: translate(-50%, -50%) scale(1.25); z-index: 3; }
.marker.locked { border-color: #475569; }
.marker.locked img { filter: grayscale(.9) brightness(.7); }
.marker.selected { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(251,191,36,.35), 0 0 18px var(--amber); animation: pulse 1.2s infinite; z-index: 4; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(251,191,36,.12), 0 0 18px var(--amber); } }
.marker .tip { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 3px; font-size: 10px; white-space: nowrap; color: var(--neon); background: rgba(0,0,0,.7); padding: 1px 4px; pointer-events: none; }

#panel { flex: 1 1 300px; max-width: 420px; background: var(--panel); border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
#panel-head { display: flex; gap: 12px; align-items: center; }
#p-flag { width: 84px; height: 56px; object-fit: fill; border: 2px solid var(--neon); }
#p-country { margin: 0; font-size: 22px; color: #fff; }
#p-role { color: var(--amber); font-size: 13px; }
#p-title { margin: 10px 0 0; color: var(--neon); }
#p-briefing { margin: 0; line-height: 1.5; font-size: 14px; }
#panel h4 { margin: 10px 0 0; color: #6ee7b7; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
#panel ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
#play, #end button { margin-top: 14px; padding: 12px 18px; font: bold 18px "Courier New", monospace; letter-spacing: 3px; color: #021; background: var(--neon); border: 0; cursor: pointer; }
#play:hover:not(:disabled), #end button:hover { background: #7dfbd9; }
#play:disabled { background: #334155; color: #94a3b8; cursor: not-allowed; font-size: 14px; }

/* ---------- jeu ---------- */
#game { position: fixed; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; }
#canvas { width: min(100vw, 100vh * 16 / 9); height: min(100vh, 100vw * 9 / 16); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; background: #000; image-rendering: auto; }
#end { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
#end-box { background: var(--panel); border: 2px solid var(--neon); padding: 26px 34px; text-align: center; max-width: 520px; }
#end-box.lose { border-color: #ef4444; }
#end-title { margin: 0 0 10px; font-size: 28px; letter-spacing: 4px; color: var(--neon); }
#end-box.lose #end-title { color: #f87171; }
#end-text { line-height: 1.5; }
#end-stats { color: var(--amber); font-size: 13px; }
#end-btns { display: flex; gap: 12px; justify-content: center; }

/* ---------- pause / options ---------- */
.opt-btn { position: absolute; top: 18px; right: 24px; padding: 8px 14px; font: bold 14px "Courier New", monospace; letter-spacing: 2px; color: var(--neon); background: transparent; border: 1px solid var(--neon); cursor: pointer; }
.opt-btn:hover { background: rgba(62,240,192,.15); }
#menu header { position: relative; }
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); }
.overlay .box { background: var(--panel); border: 2px solid var(--neon); padding: 26px 34px; min-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.overlay h2 { margin: 0 0 6px; text-align: center; letter-spacing: 4px; color: var(--neon); }
.overlay button { padding: 12px 18px; font: bold 17px "Courier New", monospace; letter-spacing: 3px; color: #021; background: var(--neon); border: 0; cursor: pointer; }
.overlay button:hover { background: #7dfbd9; }
.overlay label { display: grid; grid-template-columns: 1fr 44px; gap: 4px 10px; align-items: center; font-size: 14px; }
.overlay label input { grid-column: 1; width: 100%; accent-color: var(--neon); }
.overlay label output { grid-column: 2; grid-row: 2; text-align: right; color: var(--amber); }

/* ---------- avertissement satire (sous la carte) ---------- */
#disclaimer { margin: 0; padding: 12px 16px; font-size: 14px; line-height: 1.5; text-align: center; color: var(--neon); background: rgba(62,240,192,.07); border: 2px solid var(--neon); box-shadow: 0 0 14px rgba(62,240,192,.35), 0 0 14px rgba(62,240,192,.2) inset; text-shadow: 0 0 8px rgba(62,240,192,.6); }

/* ---------- mobile / tactile ---------- */
#touch-pause { display: none; position: absolute; top: 10px; right: 10px; z-index: 5; width: 48px; height: 48px; font: bold 18px "Courier New", monospace; color: var(--neon); background: rgba(0,0,0,.55); border: 2px solid var(--neon); border-radius: 50%; touch-action: manipulation; }
#end { z-index: 10; }
#rotate { display: none; position: fixed; z-index: 100; inset: 0; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(0,0,0,.95); color: var(--neon); font-size: 20px; letter-spacing: 2px; }
@media (pointer: coarse) {
  #touch-pause { display: block; }
  .marker { width: 54px; height: 38px; }
  .marker .tip { font-size: 12px; }
  #play, #end button, .overlay button { min-height: 52px; }
}
@media (pointer: coarse) and (orientation: portrait) { #rotate { display: flex; } }
@media (max-width: 900px), (pointer: coarse) {
  #menu { padding: 12px; gap: 10px; }
  #menu header h1 { font-size: 22px; letter-spacing: 2px; padding-right: 130px; }
  #menu header p { font-size: 12px; }
  .opt-btn { top: 6px; right: 0; padding: 8px 10px; font-size: 12px; }
  #menu-body { gap: 12px; }
  #map-col, #panel { flex: 1 1 100%; max-width: 100%; }
  #disclaimer { font-size: 12px; padding: 8px 10px; }
  .overlay .box { min-width: 0; width: 88vw; padding: 18px; }
}
@media (pointer: coarse) and (max-height: 520px) { .overlay .box { padding: 12px 20px; gap: 8px; } .overlay h2 { margin: 0; } }

/* mobile portrait : drapeaux plus petits sur la carte, bouton JOUER toujours accessible en bas de l'écran */
@media (max-width: 600px) {
  .marker { width: 34px; height: 24px; }
  .marker .tip { font-size: 10px; }
  #play { position: sticky; bottom: 8px; width: 100%; z-index: 6; box-shadow: 0 0 0 6px rgba(5,13,20,.9); }
}
