/* ============================================================
   MJERAD.FR — PORTFOLIO-JEU RÉTRO
   Fait main. Zéro framework. Comme promis dans le footer.
   ============================================================ */

:root {
  --bg: #07070f;
  --bg-panel: #0c0c1a;
  --bg-panel-2: #101024;
  --line: #2a2a4a;
  --green: #00ff9c;
  --green-dark: #00b86f;
  --cyan: #00e5ff;
  --yellow: #ffd400;
  --red: #ff3860;
  --text: #d6d6e7;
  --text-dim: #8b8ba8;
  --rare: #4fc3f7;
  --epic: #b388ff;
  --legendary: #ffb300;
  --font-pixel: 'Press Start 2P', monospace;
  --font-body: 'VT323', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 70px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 21px;
  line-height: 1.45;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

::selection { background: var(--green); color: #000; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--green); }

/* ---------- FOND & CRT ---------- */
#starfield {
  position: fixed; inset: 0; z-index: -2;
  width: 100%; height: 100%;
}
.crt {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,10,.45) 100%);
  animation: flicker 6s infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: .82; }
  94% { opacity: 1; }
  97% { opacity: .9; }
  98% { opacity: 1; }
}

/* ---------- BOOT ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100;
  background: #050509;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .6s, visibility .6s;
}
#boot.off { opacity: 0; visibility: hidden; }
.boot-inner { width: min(640px, 90vw); text-align: center; }
#boot-log {
  font-family: var(--font-body); font-size: 22px; color: var(--green);
  text-align: left; min-height: 200px; white-space: pre-wrap;
  text-shadow: 0 0 8px rgba(0,255,156,.45);
}
#press-start {
  margin-top: 28px;
  font-family: var(--font-pixel); font-size: clamp(14px, 3vw, 22px);
  color: var(--yellow); background: none; border: none; cursor: pointer;
  animation: blink-slow 1.1s step-end infinite;
  text-shadow: 0 0 12px rgba(255,212,0,.5);
}
.boot-hint { color: var(--text-dim); margin-top: 14px; font-size: 18px; }
.hidden { display: none !important; }
@keyframes blink-slow { 50% { opacity: 0; } }

/* ---------- HUD ---------- */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px;
  background: rgba(7,7,15,.92);
  border-bottom: 2px solid var(--line);
  backdrop-filter: blur(4px);
}
.hud-logo {
  font-family: var(--font-pixel); font-size: 16px; color: #c9a063;
  display: flex; align-items: center; gap: 3px;
  text-shadow: 0 0 10px rgba(201,160,99,.45);
}
.hud-logo .logo-mj { width: 30px; height: 30px; filter: drop-shadow(0 0 5px rgba(201,160,99,.4)); }
.hud-logo:hover { color: var(--green); text-shadow: 0 0 10px rgba(0,255,156,.5); }
.hud-logo:hover .logo-mj { filter: drop-shadow(0 0 6px rgba(0,255,156,.5)); }
.blink { animation: blink-slow 1s step-end infinite; }
.hud-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.hud-nav a {
  font-family: var(--font-pixel); font-size: 9px; color: var(--text-dim);
  letter-spacing: 1px; padding: 6px 2px; text-transform: uppercase;
}
.hud-nav a:hover { color: var(--green); text-shadow: 0 0 8px rgba(0,255,156,.6); }
.hud-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.hud-bugs { font-size: 19px; color: var(--red); cursor: help; }
#sound-toggle, #lang-toggle {
  font-family: var(--font-pixel); font-size: 9px;
  background: var(--bg-panel); color: var(--text);
  border: 2px solid var(--line); padding: 6px 9px; cursor: pointer;
}
#sound-toggle:hover, #lang-toggle:hover { border-color: var(--green); color: var(--green); }
#sound-toggle[aria-pressed="true"] { color: var(--yellow); border-color: var(--yellow); }

/* ---------- LAYOUT ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.section { padding: 90px 0 30px; }
.section-title {
  font-family: var(--font-pixel); font-size: clamp(18px, 4vw, 30px);
  color: var(--green); text-shadow: 0 0 14px rgba(0,255,156,.4);
  margin-bottom: 10px;
}
.section-title::before { content: "// "; color: var(--line); }
.section-sub { color: var(--text-dim); font-size: 22px; margin-bottom: 34px; }

.panel {
  background: var(--bg-panel);
  border: 3px solid var(--line);
  box-shadow: 0 0 0 1px #000, 6px 6px 0 rgba(0,0,0,.55);
  padding: 22px;
}
.panel-title {
  font-family: var(--font-pixel); font-size: 11px; color: var(--text-dim);
  margin-bottom: 16px; letter-spacing: 1px;
}

/* ---------- BOUTONS ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-pixel); font-size: 11px; letter-spacing: .5px;
  color: var(--text); background: var(--bg-panel-2);
  border: none; cursor: pointer; padding: 15px 20px;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px),
                     calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  box-shadow: inset 0 0 0 2px var(--line);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-2px, -2px); color: var(--green); box-shadow: inset 0 0 0 2px var(--green); }
.btn:active { transform: translate(1px, 1px); }
.btn-primary { background: var(--green); color: #04130c; box-shadow: inset 0 0 0 2px var(--green-dark); }
.btn-primary:hover { background: var(--cyan); color: #021317; box-shadow: inset 0 0 0 2px var(--cyan); }
.btn-accent { background: var(--yellow); color: #1a1400; box-shadow: inset 0 0 0 2px #b89900; }
.btn-accent:hover { background: #ffe34d; color: #1a1400; box-shadow: inset 0 0 0 2px var(--yellow); }
.btn-big { font-size: 13px; padding: 20px 26px; }

/* ---------- HERO ---------- */
.hero { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-top: 90px; padding-bottom: 40px; }
.hero-ready {
  font-family: var(--font-pixel); font-size: 12px; color: var(--yellow);
  margin-bottom: 18px; animation: blink-slow 1.4s step-end infinite;
}
.glitch {
  font-family: var(--font-pixel);
  font-size: clamp(26px, 6.5vw, 58px);
  color: #fff; position: relative; line-height: 1.25;
  text-shadow: 0 0 18px rgba(0,255,156,.35);
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0; overflow: hidden;
}
.glitch::before { color: var(--cyan); animation: glitch-a 3.2s infinite steps(1); }
.glitch::after  { color: var(--red);  animation: glitch-b 2.7s infinite steps(1); }
@keyframes glitch-a {
  0%, 91%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  92% { clip-path: inset(10% 0 55% 0); transform: translate(-4px, 0); }
  94% { clip-path: inset(70% 0 5% 0); transform: translate(4px, 0); }
  96% { clip-path: inset(40% 0 40% 0); transform: translate(-2px, 0); }
}
@keyframes glitch-b {
  0%, 88%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  89% { clip-path: inset(60% 0 15% 0); transform: translate(4px, 0); }
  92% { clip-path: inset(5% 0 80% 0); transform: translate(-4px, 0); }
  95% { clip-path: inset(30% 0 50% 0); transform: translate(3px, 0); }
}
.hero-class { font-family: var(--font-pixel); font-size: clamp(9px, 2vw, 13px); color: var(--text-dim); margin: 18px 0 8px; }
.hero-tagline { font-size: 26px; color: var(--green); min-height: 38px; margin-bottom: 36px; }
.cursor { animation: blink-slow .8s step-end infinite; }

.hero-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; margin-bottom: 36px; }
.player-card { display: flex; gap: 20px; align-items: center; }
.avatar-wrap {
  position: relative; width: 120px; height: 140px; flex-shrink: 0;
  border: 3px solid var(--line); background: var(--bg-panel-2);
  overflow: hidden; outline: none;
}
.avatar-wrap.has-photo { cursor: pointer; }
.avatar-wrap.has-photo:focus-visible { border-color: var(--green); }
#avatar { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
#avatar-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; clip-path: inset(0 0 100% 0);
  transition: opacity .2s, clip-path .5s steps(9);
  display: none;
}
.avatar-wrap.has-photo #avatar-photo { display: block; }
.avatar-wrap.has-photo:hover #avatar-photo,
.avatar-wrap.hd #avatar-photo { opacity: 1; clip-path: inset(0 0 0 0); }
.avatar-hint {
  position: absolute; left: 0; right: 0; bottom: 0; display: none;
  font-family: var(--font-pixel); font-size: 7px; letter-spacing: 1px;
  text-align: center; padding: 4px 0; z-index: 2;
  background: rgba(0,0,0,.78); color: var(--yellow);
  transition: opacity .2s;
}
.avatar-wrap.has-photo .avatar-hint { display: block; }
.avatar-wrap.has-photo:hover .avatar-hint, .avatar-wrap.hd .avatar-hint { opacity: 0; }
.player-name { font-family: var(--font-pixel); font-size: 13px; color: #fff; margin-bottom: 8px; }
.player-lvl { font-family: var(--font-pixel); font-size: 10px; color: var(--yellow); margin-bottom: 8px; }
.xp-bar, .stat-bar {
  height: 14px; background: #000; border: 2px solid var(--line);
  position: relative; overflow: hidden;
}
.xp-bar i, .stat-bar i {
  position: absolute; inset: 0; width: 0;
  background: repeating-linear-gradient(90deg, var(--green) 0 8px, var(--green-dark) 8px 10px);
  transition: width 1.2s cubic-bezier(.2,.7,.3,1);
}
.bars-on .xp-bar i, .bars-on .stat-bar i { width: var(--w); }
.player-badges { list-style: none; margin-top: 12px; font-size: 19px; color: var(--text-dim); }
.badge-avail { color: var(--green); }

.stats .stat { display: grid; grid-template-columns: 1fr 1.2fr 34px; gap: 12px; align-items: center; margin-bottom: 13px; }
.stats .stat span { font-family: var(--font-pixel); font-size: 9px; color: var(--text-dim); }
.stats .stat b { font-family: var(--font-pixel); font-size: 11px; color: var(--green); text-align: right; }

.hero-ctas { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- QUÊTES ---------- */
.quest { margin-bottom: 26px; position: relative; }
.quest-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  font-family: var(--font-pixel); font-size: 8px; padding: 5px 8px;
  border: 2px solid currentColor; letter-spacing: 1px;
}
.tag-main { color: var(--legendary); }
.tag-side { color: var(--rare); }
.tag-done { color: var(--green); }
.tag-new { color: var(--red); animation: blink-slow 1.2s step-end infinite; }
.quest-dates { margin-left: auto; font-size: 18px; color: var(--text-dim); }
.quest h3 { font-family: var(--font-pixel); font-size: clamp(12px, 2.4vw, 16px); color: #fff; margin-bottom: 14px; line-height: 1.6; }
.quest h3 a { color: var(--cyan); }
.guild { color: var(--cyan); }
.quest-desc { font-size: 22px; margin-bottom: 18px; }
.quest-objectives { list-style: none; margin-bottom: 16px; }
.quest-objectives li { padding-left: 26px; position: relative; margin-bottom: 6px; font-size: 21px; }
.quest-objectives li::before { content: "▸"; position: absolute; left: 4px; color: var(--green); }
.quest-loot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.loot-label { font-family: var(--font-pixel); font-size: 9px; color: var(--text-dim); }
.loot {
  font-size: 18px; padding: 3px 10px;
  background: var(--bg-panel-2); border: 2px solid var(--line); color: var(--yellow);
}
a.loot:hover { border-color: var(--yellow); }
.quest-xp { font-family: var(--font-pixel); font-size: 11px; color: var(--yellow); text-align: right; }
.quest-open { border-color: var(--red); }
.quest-open h3 { color: var(--red); text-shadow: 0 0 12px rgba(255,56,96,.4); }

/* ---------- INVENTAIRE ---------- */
.inventory-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.item {
  position: relative; text-align: center; padding: 20px 12px 14px;
  background: var(--bg-panel); border: 3px solid var(--line);
  cursor: default; transition: transform .12s;
}
.item:hover, .item:focus-visible { transform: translateY(-4px); z-index: 5; outline: none; }
.item-icon { font-size: 34px; display: block; margin-bottom: 10px; filter: drop-shadow(0 0 6px rgba(0,255,156,.25)); }
.item-name { font-family: var(--font-pixel); font-size: 9px; color: #fff; margin-bottom: 8px; line-height: 1.6; }
.item-rarity { font-family: var(--font-pixel); font-size: 7px; letter-spacing: 1px; }
.item.common    { border-color: #3c3c55; } .item.common .item-rarity { color: var(--text-dim); }
.item.rare      { border-color: var(--rare); } .item.rare .item-rarity { color: var(--rare); }
.item.epic      { border-color: var(--epic); } .item.epic .item-rarity { color: var(--epic); }
.item.legendary { border-color: var(--legendary); box-shadow: 0 0 16px rgba(255,179,0,.22); }
.item.legendary .item-rarity { color: var(--legendary); }
.item.secret    { border-style: dashed; opacity: .75; } .item.secret .item-rarity { color: var(--red); }
.tooltip {
  position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%) scale(.95);
  width: 230px; padding: 12px 14px; font-size: 18px; line-height: 1.35;
  background: #000; color: var(--text); border: 2px solid var(--green);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 10;
}
.item:hover .tooltip, .item:focus-visible .tooltip { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---------- ARBRE DE TALENTS ---------- */
.tree { display: flex; flex-direction: column; }
.tree-node { position: relative; }
.tree-year { font-family: var(--font-pixel); font-size: 11px; color: var(--yellow); display: block; margin-bottom: 10px; }
.tree-node h3 { font-family: var(--font-pixel); font-size: 12px; color: #fff; margin-bottom: 10px; line-height: 1.6; }
.tree-node p { color: var(--text-dim); font-size: 21px; }
.tree-link { width: 4px; height: 34px; margin: 0 auto; background: repeating-linear-gradient(0deg, var(--green) 0 6px, transparent 6px 12px); }
.tree-node-now { border-color: var(--green); box-shadow: 0 0 18px rgba(0,255,156,.18); }
.tree-node-now h3 { color: var(--green); }

/* ---------- SUCCÈS ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.ach { display: flex; gap: 14px; align-items: center; padding: 16px; }
.ach-icon { font-size: 30px; }
.ach-name { font-family: var(--font-pixel); font-size: 10px; color: #fff; margin-bottom: 6px; }
.ach-desc { font-size: 19px; color: var(--text-dim); }
.ach.unlocked { border-color: var(--green-dark); }
.ach.unlocked .ach-icon { filter: drop-shadow(0 0 8px rgba(0,255,156,.5)); }
.ach.locked { filter: grayscale(1); opacity: .5; }
.ach.locked.just-unlocked, .ach.locked.was-unlocked {
  filter: none; opacity: 1; border-color: var(--yellow);
}
.ach.just-unlocked { animation: ach-pop .5s; }
@keyframes ach-pop { 0% { transform: scale(.92); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }

/* ---------- CONTACT ---------- */
.contact { text-align: center; padding-bottom: 80px; }
.insert-coin { animation: coin-pulse 1.6s infinite; display: inline-block; }
.insert-coin::before { content: "" !important; }
@keyframes coin-pulse {
  0%, 100% { text-shadow: 0 0 14px rgba(0,255,156,.4); }
  50% { text-shadow: 0 0 30px rgba(0,255,156,.85), 0 0 60px rgba(0,229,255,.4); }
}
.contact-grid { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin: 40px 0 26px; }
.contact-note { color: var(--text-dim); }

/* ---------- FOOTER ---------- */
.footer {
  text-align: center; padding: 36px 20px 46px;
  border-top: 2px solid var(--line); color: var(--text-dim); font-size: 19px;
}
.footer p { margin-bottom: 6px; }
.footer-hint { font-family: var(--font-pixel); font-size: 9px; color: #2e2e4d; margin-top: 14px; letter-spacing: 2px; }

/* ---------- BUGS CACHÉS ---------- */
.bug {
  position: absolute; width: 34px; height: 34px;
  background: none; border: none; cursor: pointer; z-index: 8;
  animation: bug-crawl 2.2s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(255,56,96,.6));
}
.bug svg { width: 100%; height: 100%; }
@keyframes bug-crawl {
  0%, 100% { transform: translateX(0) rotate(-6deg); }
  50% { transform: translateX(10px) rotate(6deg); }
}
.bug.squashed { animation: bug-squash .45s forwards; pointer-events: none; }
@keyframes bug-squash {
  30% { transform: scale(1.35) rotate(20deg); }
  100% { transform: scale(0) rotate(180deg); opacity: 0; }
}

/* ---------- TOASTS ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 70; display: flex; flex-direction: column; gap: 12px; }
.toast {
  background: #000; border: 3px solid var(--yellow); padding: 14px 18px;
  display: flex; gap: 12px; align-items: center; min-width: 280px;
  box-shadow: 6px 6px 0 rgba(0,0,0,.6);
  animation: toast-in .35s cubic-bezier(.2,.9,.3,1.2), toast-out .4s 3.6s forwards;
}
.toast-icon { font-size: 26px; }
.toast-title { font-family: var(--font-pixel); font-size: 9px; color: var(--yellow); margin-bottom: 5px; }
.toast-name { font-size: 20px; color: #fff; }
@keyframes toast-in { from { transform: translateX(120%); } to { transform: translateX(0); } }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }

/* ---------- RÉVÉLATION AU SCROLL ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s, transform .6s; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- GOD MODE (KONAMI) ---------- */
body.godmode { animation: god-hue 1.2s linear infinite; }
@keyframes god-hue { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hud { gap: 10px; padding: 8px 12px; }
  .hud-nav { display: none; }
  .quest-dates { margin-left: 0; width: 100%; }
}
@media (max-width: 480px) {
  body { font-size: 19px; }
  .player-card { flex-direction: column; align-items: center; text-align: center; }
  .hero-ctas .btn { width: 100%; text-align: center; }
  .contact-grid { flex-direction: column; }
  .tooltip { width: 180px; }
}

/* ---------- ACCESSIBILITÉ ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .crt { animation: none; }
}
