@import url('./base.css');

html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: #050506; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }

/* Bannière sous la zone de jeu (ordinateur uniquement, désactivée par défaut) */
.ad-game-bottom { flex: none; height: 100px; border-top: 1px solid var(--line); }
.ad-game-bottom.is-placeholder { border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
body:not(.game-banner) .ad-game-bottom { display: none !important; }
@media (max-width: 899px), (max-height: 700px) { .ad-game-bottom { display: none !important; } }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-score {
  position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left));
  display: flex; align-items: baseline; gap: 8px; padding: 9px 16px; border-radius: 14px;
  background: rgba(8, 8, 10, 0.6); border: 1px solid var(--line); backdrop-filter: blur(6px);
  pointer-events: none;
}
.hud-score .lbl { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.hud-score b { font-family: var(--font-display); font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--gold-hi); }
.hud-score .sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; align-self: center; }

.hud-board {
  position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
  width: 220px; padding: 10px 12px; border-radius: 14px;
  background: rgba(8, 8, 10, 0.6); border: 1px solid var(--line); backdrop-filter: blur(6px);
}
.board-toggle { all: unset; cursor: pointer; display: flex; justify-content: space-between; width: 100%; font-family: var(--font-display); font-size: 0.78rem; font-weight: 700; color: var(--gold); letter-spacing: 0.04em; }
.board-toggle span { color: var(--muted); font-family: var(--font-body); }
#lbList { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: r; font-size: 0.84rem; }
#lbList li { display: flex; gap: 6px; padding: 2px 0; counter-increment: r; color: #d9d6cf; }
#lbList li::before { content: counter(r) '.'; width: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
#lbList li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lbList li .v { color: var(--muted); font-variant-numeric: tabular-nums; }
#lbList li.me { color: var(--gold-hi); font-weight: 700; }
.hud-board.collapsed #lbList { display: none; }

.minimap {
  position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom));
  width: 150px; height: 150px; border-radius: 12px; background: rgba(8, 8, 10, 0.6); border: 1px solid var(--line);
  pointer-events: none;
}
.feed { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.feed div { padding: 6px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; background: rgba(8,8,10,.7); border: 1px solid var(--line-gold); color: var(--gold-hi); animation: feed 2.6s forwards; }
@keyframes feed { 0% { opacity: 0; transform: translateY(-6px); } 10%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.net-info { position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); right: 14px; font-size: 0.7rem; color: #5d5a54; pointer-events: none; }

.dash-btn {
  display: none; position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px));
  width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line-gold); color: var(--gold-hi);
  background: conic-gradient(rgba(217,180,90,.35) calc(var(--cd, 1) * 360deg), rgba(8,8,10,.55) 0);
  backdrop-filter: blur(6px); align-items: center; justify-content: center; touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.dash-btn:active { transform: scale(0.94); }
.dash-btn.ready { box-shadow: 0 0 0 4px rgba(217, 180, 90, 0.15); }
.joystick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 1.5px solid rgba(246, 221, 150, 0.35); background: rgba(255, 255, 255, 0.04); pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.joystick.on { opacity: 1; }
.joystick .knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: var(--gold-grad); opacity: 0.85; }

.touch .dash-btn { display: flex; }
.touch .minimap { width: 104px; height: 104px; bottom: auto; top: calc(max(14px, env(safe-area-inset-top)) + 52px); }
.touch .net-info { display: none; }

/* ---------- Overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 5; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: max(64px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at center, rgba(5, 5, 6, 0.55), rgba(5, 5, 6, 0.88));
  touch-action: pan-y; user-select: text;
}
.overlay[hidden] { display: none; }
.back-link { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 16px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; padding: 8px 12px; border-radius: 999px; background: rgba(8,8,10,.6); border: 1px solid var(--line); }
.back-link b { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.panel {
  width: 100%; max-width: 400px; padding: 28px 24px 22px; border-radius: 24px; text-align: center;
  background: linear-gradient(180deg, rgba(24, 24, 29, 0.92), rgba(12, 12, 15, 0.94));
  border: 1px solid var(--line-gold);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 0 50px -20px rgba(217, 180, 90, 0.35);
  animation: rise 0.35s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.kicker { margin: 0 0 8px; color: var(--gold); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.title { font-size: 2.2rem; font-weight: 800; margin-bottom: 22px; }
.title span { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.play-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: block; text-align: left; }
.field span { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px 4px; }
.field input {
  width: 100%; padding: 14px 16px; border-radius: 14px; font-size: 1.05rem; font-weight: 600;
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(217, 180, 90, 0.12); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.5) inset; transition: transform 0.15s; }
.swatch[aria-checked="true"] { border-color: #fff; transform: scale(1.12); box-shadow: 0 0 0 3px rgba(217, 180, 90, 0.5); }
.play-btn { width: 100%; font-size: 1.1rem; padding: 17px; }

.arena-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; font-size: 0.88rem; color: #cfcbc1; }
.arena-actions { display: flex; justify-content: center; gap: 18px; margin-top: 6px; }
.link-btn { all: unset; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--gold); padding: 6px 2px; }
.link-btn:hover { text-decoration: underline; }
.controls-hint { margin: 14px 0 0; font-size: 0.8rem; color: var(--muted); }
kbd { font-family: inherit; font-size: 0.75rem; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: rgba(255,255,255,.05); }

.death-title { font-size: 1.5rem; margin-bottom: 18px; }
.death-title small { display: block; font-family: var(--font-body); font-size: 0.9rem; font-weight: 500; color: var(--muted); margin-top: 6px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 20px; }
.stats div { padding: 12px 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); }
.stats dt { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.death-actions { display: flex; flex-direction: column; gap: 10px; }
.death-actions .btn { width: 100%; }
.revive-note { margin: 10px 0 8px; font-size: 0.8rem; color: var(--muted); min-height: 1.2em; }
.panel.guard .btn { pointer-events: none; }

/* Publicités dans les menus : espacées des boutons, jamais au-dessus du jeu actif */
.ad-menu, .ad-death { width: 300px; max-width: 100%; min-height: 250px; margin-top: 8px; }
.ad-death.guard { pointer-events: none; }
@media (max-width: 760px), (max-height: 760px) {
  .ad-menu { width: 320px; min-height: 50px; }
  .ad-death { width: 320px; min-height: 100px; }
}

/* Mode test publicitaire (développement) */

.announce {
  position: absolute; z-index: 9; left: 50%; top: max(70px, calc(env(safe-area-inset-top) + 60px)); transform: translateX(-50%);
  max-width: min(560px, calc(100% - 32px)); padding: 12px 20px; border-radius: 14px; text-align: center; font-weight: 700;
  background: rgba(20, 16, 6, 0.92); border: 1px solid var(--gold); color: var(--gold-hi); box-shadow: 0 10px 40px -10px rgba(217,180,90,.5);
  animation: rise 0.3s ease; pointer-events: none;
}
.announce[hidden] { display: none; }
.maint-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 0.85rem; color: var(--gold-hi); background: rgba(217,180,90,.08); border: 1px solid var(--line-gold); }
.maint-note[hidden] { display: none; }
.conn { position: absolute; z-index: 8; left: 50%; top: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 999px; background: rgba(8,8,10,.85); border: 1px solid var(--line); font-size: 0.85rem; }
.conn[hidden] { display: none; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--gold); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.arena-dialog { width: min(380px, calc(100% - 32px)); padding: 22px; border-radius: 20px; border: 1px solid var(--line-gold); background: var(--surface); color: var(--text); }
.arena-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.arena-dialog h3 { font-size: 1rem; margin-bottom: 14px; }
.arena-dialog ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.arena-dialog li button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.3); font-size: 0.9rem; }
.arena-dialog li button:hover, .arena-dialog li button.current { border-color: var(--gold); }
.arena-dialog li span { color: var(--muted); font-size: 0.8rem; }

@media (max-width: 600px) {
  .hud-board { width: 156px; padding: 8px 10px; }
  #lbList { font-size: 0.74rem; }
  .hud-score { padding: 7px 12px; }
  .hud-score b { font-size: 1rem; }
  .hud-score { gap: 6px; padding: 7px 10px; }
  .hud-score .lbl { font-size: 0.6rem; letter-spacing: 0.08em; }
  .hud-score .sector-item { display: none; }
  .title { font-size: 1.9rem; }
  .panel { padding: 22px 18px 18px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .overlay { justify-content: flex-start; padding-top: 56px; }
  .ad-menu, .ad-death { display: none !important; }
}
