@font-face {
  font-family: 'Pixelify Sans';
  src: url('../fonts/pixelify-sans-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Pixelify Sans';
  src: url('../fonts/pixelify-sans-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

:root {
  --night0: #0B1030; --night1: #1B2A5C; --night2: #2E4A8A; --sil: #141A33;
  --snow: #F4F7FF; --snow-s: #A8BDE0; --red: #D6283B; --red-d: #8A1630;
  --gold: #F2C14E; --gold-d: #B5832A; --green: #39FF8A; --green-d: #0F5132;
  --cyan: #3EE8FF; --alert: #FF3B6B;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--night0); color: var(--snow);
  font-family: 'Pixelify Sans', ui-monospace, monospace; overflow: hidden;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
#game { position: fixed; inset: 0; touch-action: none; }
#game canvas { image-rendering: pixelated; }
img { image-rendering: pixelated; image-rendering: crisp-edges; }

.hidden { display: none !important; }

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background-color: rgba(11, 16, 48, .55);
  background-image: repeating-conic-gradient(var(--night0) 0 25%, transparent 0 50%);
  background-size: 4px 4px;
}
.overlay.scroll { align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#detail { z-index: 20; }

.panel {
  width: 100%; max-width: 380px; padding: 20px;
  background: var(--night0);
  border: 4px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--gold-d), 0 0 0 4px var(--night0);
}
.center { text-align: center; }

.kicker {
  margin: 0 0 12px; color: var(--gold); font-weight: 700; font-size: 22px;
  text-transform: uppercase; text-shadow: 2px 2px 0 var(--red-d);
}
h1, h2 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; color: var(--gold); text-shadow: 2px 2px 0 var(--red-d); }
h2 { font-size: 20px; }
.muted { color: var(--snow-s); margin: 6px 0 16px; font-size: 15px; }

.icon-xl { width: 128px; height: 128px; margin: 4px auto 12px; display: block; }
.icon-lg { width: 80px; height: 80px; flex: none; background: var(--night1); border: 3px solid var(--night2); }
.icon-md { width: 48px; height: 48px; flex: none; }

.btn {
  display: block; width: 100%; margin-top: 12px; padding: 13px 12px;
  font: 700 18px 'Pixelify Sans', ui-monospace, monospace; text-transform: uppercase;
  color: var(--night0); background: var(--green); border: 3px solid var(--green);
  box-shadow: 0 4px 0 var(--green-d); cursor: pointer; text-decoration: none; text-align: center;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-d); }
.btn.alt { color: var(--cyan); background: transparent; border-color: var(--cyan); box-shadow: none; }
.btn.alt:active { background: rgba(62, 232, 255, .12); }

/* ---- Inventaire ---- */
.inv { width: 100%; max-width: 420px; margin: 0 auto; padding-bottom: 24px; }
.inv-head {
  display: flex; gap: 12px; align-items: center; padding: 14px;
  background: var(--night0); border: 4px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--gold-d); margin-bottom: 14px;
}
.inv-head .muted { margin: 4px 0 0; }
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding: 12px; background: var(--sil); border: 4px solid var(--night2);
}
.slot {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1.15; padding: 6px 4px; cursor: pointer;
  background: var(--night1); border: 3px solid var(--night2);
  box-shadow: inset -3px -3px 0 var(--sil), inset 3px 3px 0 #24386f;
  color: var(--snow); font: 400 12px/1.15 'Pixelify Sans', monospace; text-align: center;
}
.slot img { width: 64%; height: auto; }
.slot span { margin-top: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.slot:active, .slot:focus-visible { border-color: var(--gold); outline: none; }
.slot.new::after {
  content: '★'; position: absolute; top: 3px; right: 5px; color: var(--gold); font-size: 13px;
}

/* ---- Fiche détail ---- */
.detail-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
dl { margin: 0 0 8px; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 16px; }
dt { color: var(--gold); text-transform: uppercase; font-size: 14px; padding-top: 2px; }
dd { margin: 0; }
#d-links .btn { font-size: 15px; text-transform: none; display: flex; justify-content: space-between; gap: 8px; }
#d-links .btn small { color: var(--snow-s); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links-title { color: var(--gold); text-transform: uppercase; font-size: 14px; margin: 14px 0 0; }
.empty { color: var(--snow-s); font-style: italic; margin: 0 0 8px; }
