:root {
  --accent: #2e7dff;
  --accent2: #4bc2ff;
  --bg: #f7f9fc;
  --txt: #111;
  --card-bg: #fff;
  --header-bg: rgba(255,255,255,.75);
}

body.dark {
  --bg: #0d1117;
  --txt: #f0f0f0;
  --card-bg: #161b22;
  --header-bg: rgba(22,27,34,.9);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
  font-family: 'Segoe UI', Roboto, sans-serif;
  transition: background .3s, color .3s;
}

body {
  background: var(--bg);
  color: var(--txt);
  line-height: 1.7;
  font-size: 1rem;
  opacity: 0;
  transition: background-color 0.4s ease, color 0.4s ease, opacity 0.4s ease;
}
body.loaded { opacity: 1; }

header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(10px);
  background: var(--header-bg);
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

nav a {
  margin-left: 1rem; text-decoration: none; color: var(--txt);
  font-weight: 500; position: relative;
}
nav a::after {
  content:""; position:absolute; left:0; bottom:-3px;
  width:0; height:2px; background:var(--accent);
  transition:width .3s;
}
nav a:hover::after { width:100%; }

.theme-toggle {
  margin-left: 1rem;
  background: none; border: 2px solid var(--accent);
  color: var(--accent); border-radius: 20px;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--accent); color: #fff; }

.hero {
  display:flex; flex-direction:column; justify-content:center; align-items:center;
  text-align:center; padding: 6rem 1rem 5rem;
  background:linear-gradient(135deg,var(--accent) 0%,var(--accent2) 100%);
  color:#fff;
}
.hero h1{ font-size: clamp(2.2rem, 5vw, 3.5rem); margin-bottom:.8rem; font-weight:700; }
.hero p{ font-size: clamp(1rem, 2.5vw, 1.25rem); max-width:40ch; }
.cta{
  margin-top:2rem; padding:1rem 2rem; border:none; border-radius:14px;
  background:#fff; color:var(--accent); font-weight:600; cursor:pointer;
}
.cta:hover{ transform:scale(1.05); box-shadow:0 8px 18px rgba(0,0,0,.15); }
.hero-actions{
  display:flex; flex-wrap:wrap; justify-content:center; gap:1rem;
  margin-top:2rem;
}
.hero-actions .cta{ margin-top:0; }
.cta--doom{
  background:linear-gradient(135deg,#ff4b4b,#ff8f4b);
  color:#fff;
  text-decoration:none; display:inline-flex; align-items:center; gap:0.5rem;
  box-shadow:0 12px 24px rgba(255,75,75,.35);
}
.cta--doom:hover{
  box-shadow:0 16px 32px rgba(255,75,75,.4);
}

section{ padding:3rem 1rem; max-width:1100px; margin:0 auto; }
section h2{ font-size: clamp(1.5rem,3vw,2rem); margin-bottom:1rem; text-align:center; }

.grid{ display:grid; gap:1.5rem; }
.about-grid{ grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); }

.card{
  background: var(--card-bg); border-radius:14px; padding:1.5rem;
  box-shadow:0 3px 10px rgba(0,0,0,.06);
  opacity: 0; transform: translateY(30px);
}
.card.visible{ opacity:1; transform: translateY(0); transition: transform .6s ease, opacity .6s ease; }
.card:hover{ transform:translateY(-5px); box-shadow:0 10px 18px rgba(0,0,0,.1); }

#contact p{ text-align:center; font-size:1.1rem; }

footer{
  background:#111; color:#ccc; text-align:center;
  padding:1.5rem 1rem; font-size:.9rem;
}
footer a{ color:var(--accent2); }

/* Secret minimal red dot access */
.secret-access { 
  display:flex; justify-content:center; padding:4rem 0 2rem; 
}
.red-dot {
  width:54px; height:54px; border-radius:50%;
  background:radial-gradient(circle at 30% 30%, #ffb3b3, #ff0000 55%, #7a0000 90%);
  box-shadow:0 0 12px 4px rgba(255,0,0,.55), 0 0 28px 10px rgba(255,60,0,.35);
  position:relative; cursor:pointer; text-decoration:none;
  animation:pulse 2.6s ease-in-out infinite;
}
.red-dot::after {
  content:""; position:absolute; inset:-10px; border-radius:50%;
  background:radial-gradient(circle, rgba(255,0,0,.25), transparent 70%);
  filter:blur(6px); opacity:.85; animation: aura 4.2s linear infinite;
}
.red-dot:active { transform:scale(.9); box-shadow:0 0 8px 2px rgba(255,0,0,.6); }
@keyframes pulse {
  0%,100% { transform:scale(1); box-shadow:0 0 12px 4px rgba(255,0,0,.55),0 0 28px 10px rgba(255,60,0,.35);} 
  50% { transform:scale(1.13); box-shadow:0 0 16px 6px rgba(255,0,0,.65),0 0 38px 14px rgba(255,80,0,.45);} 
}
@keyframes aura {
  0% { opacity:.9; }
  50% { opacity:.4; }
  100% { opacity:.9; }
}

body.dark .cta--doom{
  box-shadow:0 18px 32px rgba(255,140,90,.4);
}
body.dark .red-dot {
  background:radial-gradient(circle at 30% 30%, #ffc4c4, #ff2626 55%, #520000 90%);
  box-shadow:0 0 14px 5px rgba(255,40,40,.6), 0 0 40px 16px rgba(255,0,0,.25);
}

/* === Shooter (DOOM-like) styles merged from portfolio version === */
.game-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem 1rem 4rem;
}

.hero--game {
  background: radial-gradient(circle at top, #5a2a82, #2b1846 60%, #151027);
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(20, 10, 40, 0.45);
}

.hero__note {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  opacity: 0.85;
}

.game-wrapper {
  position: relative;
  background: linear-gradient(160deg, rgba(24, 18, 36, 0.85), rgba(12, 10, 22, 0.98));
  border-radius: 18px;
  box-shadow: 0 25px 50px rgba(12, 8, 22, 0.6);
  padding: 1.5rem 1.5rem 2.25rem;
  max-width: 1100px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.game-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(226, 85, 85, 0.18);
  pointer-events: none;
}

#gameCanvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #090b10;
}

.hud {
  display: flex;
  justify-content: center;
  gap: 2rem;
  color: #ffe0d8;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 1rem;
}
.hud-meta { font-size: 0.7rem; letter-spacing: 2px; opacity: 0.65; align-self: center; }
.health-wrapper { display:flex; align-items:center; gap:.4rem; }
.health-bar { position:relative; width:140px; height:14px; background:rgba(255,255,255,0.12); border:1px solid rgba(255,255,255,0.25); border-radius:8px; overflow:hidden; }
.health-bar__fill { position:absolute; inset:0; background:linear-gradient(90deg,#36d95f,#e2d755,#e25555); transition: width .35s ease; box-shadow:0 0 6px rgba(255,80,80,.5) inset; }
.weapon-info { font-size:.7rem; letter-spacing:1px; opacity:.75; display:flex; flex-direction:column; justify-content:center; }
body.dark .health-bar { background:rgba(255,255,255,0.09); }

.fs-btn {
  position:absolute; top:10px; right:12px; z-index:40; cursor:pointer;
  background:rgba(0,0,0,0.5); color:#fff; border:1px solid rgba(255,255,255,0.2);
  padding:0.45rem 0.6rem; border-radius:8px; font-size:0.85rem; backdrop-filter:blur(4px);
}
.fs-btn:hover { background:rgba(255,255,255,0.15); }
.fs-btn:active { transform:scale(.9); }

/* Pause overlay */
.pause-overlay {
  position:absolute; inset:0; display:flex; flex-direction:column; justify-content:center; align-items:center;
  background:rgba(10,8,15,0.78); backdrop-filter:blur(6px); border-radius:14px; z-index:50; gap:1rem;
  animation: fadeIn .35s ease;
  color:#ffffff;
}
.pause-overlay.hidden { display:none; }
.pause-overlay h3 { font-size:2rem; letter-spacing:2px; }
.pause-actions { display:flex; gap:0.8rem; flex-wrap:wrap; justify-content:center; }
.pause-overlay .menu-btn, .pause-overlay .menu-btn.alt { color:#ffffff; background:rgba(255,255,255,0.14); border:1px solid rgba(255,255,255,0.3); }
.pause-overlay .menu-btn:hover, .pause-overlay .menu-btn.alt:hover { background:rgba(255,255,255,0.22); }
.pause-overlay .menu-hint { color:#fff; opacity:.75; }

/* Name entry overlay */
.name-entry-overlay {
  position:absolute; inset:0; z-index:70;
  display:flex; justify-content:center; align-items:center;
  background:rgba(10,8,15,0.82); backdrop-filter:blur(8px);
  border-radius:14px; animation:fadeIn .35s ease;
}
.name-entry-overlay.hidden { display:none; }
.name-entry-panel { background:linear-gradient(155deg,#ffffff,#f3f5fa); color:#1d1824; padding:1.8rem 1.6rem 2rem; border-radius:16px; width: min(360px,85%); box-shadow:0 16px 42px -8px rgba(0,0,0,0.35),0 4px 18px -4px rgba(0,0,0,0.18); border:1px solid rgba(0,0,0,0.1); text-align:center; }
body.dark .name-entry-panel { background:linear-gradient(155deg,#16131d,#211b2a); color:#f4f4f6; border-color:rgba(255,255,255,0.08); }
.name-entry-panel h3 { margin:0 0 .6rem; font-size:1.4rem; letter-spacing:1px; }
.name-entry-msg { font-size:.8rem; opacity:.75; margin:0 0 1rem; }
#nameEntryForm { display:flex; flex-direction:column; gap:.9rem; }
#nameEntryInput { padding:.75rem .85rem; border-radius:10px; border:1px solid #cfc9d8; background:#fff; font-size:.95rem; font-weight:600; letter-spacing:.5px; text-align:center; }
#nameEntryInput:focus { outline:2px solid #ff6a3c; }
body.dark #nameEntryInput { background:#221b2b; border-color:#3d314f; color:#f4f4f6; }
.name-entry-actions { display:flex; gap:.8rem; justify-content:center; }
.name-entry-hint { margin-top:.9rem; font-size:.6rem; letter-spacing:1px; opacity:.55; }
body.dark .name-entry-hint { opacity:.65; }

/* Enlarge mode */
.game-wrapper.enlarged {
  position: relative;
  max-width:none;
  width: 100%;
  /* Subtract only what we need; ensure padding included via border-box to avoid overflow */
  height: calc(100vh - 130px);
  box-sizing: border-box;
  display:flex;
  flex-direction:column;
  padding: 1rem 1rem 1.1rem; /* tighter padding so canvas fits visually */
  overflow:hidden; /* prevent tiny bleed at bottom */
}
/* Keep aspect ratio: remove forced 100% height that caused overflow with padding. */
.game-wrapper.enlarged #gameCanvas {
  flex: 1 1 auto;
  width:100%;
  height:auto;            /* let natural aspect ratio drive height */
  max-height:100%;        /* never exceed container */
  aspect-ratio: 4 / 3;    /* modern browsers: lock ratio; ignored gracefully otherwise */
  object-fit:contain;
  align-self:center;
}

.overlay {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: rgba(226, 85, 85, 0.82);
  color: #fff;
  font-weight: bold;
  border-radius: 999px;
  letter-spacing: 1px;
  box-shadow: 0 12px 30px rgba(226, 85, 85, 0.4);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.overlay.hidden { opacity: 0; }

/* Game Menu */
.game-menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  justify-content: center;
  align-items: center;
  background: linear-gradient(160deg,#ffffff,#f5f7fb 70%);
  border-radius: 14px;
  z-index: 30;
  animation: fadeIn .5s ease;
  padding: 2rem 1.6rem 2.4rem;
  text-align: center;
  border:1px solid rgba(0,0,0,0.08);
  box-shadow: 0 18px 42px -10px rgba(0,0,0,0.18), 0 4px 18px -4px rgba(0,0,0,0.12);
  color:#1d1824;
}
.game-menu h2 { color:#2b2035; text-shadow:0 1px 0 rgba(255,255,255,0.6); }
.game-menu label { color:#4a3d56; opacity:.85; }
.game-menu select { background:#ffffff; color:#1d1824; border:1px solid #cfc9d8; box-shadow:0 1px 2px rgba(0,0,0,0.06) inset; }
.game-menu select:focus { outline:2px solid #ff6a3c; }
.menu-btn.start { background:linear-gradient(135deg,#ff6a4b,#ff934b); box-shadow:0 6px 20px rgba(255,105,70,0.35); }
.menu-btn.start:hover { box-shadow:0 10px 28px rgba(255,105,70,0.45); }
.menu-btn.alt { background:#ece8f1; color:#2d2238; border:1px solid #cbc3d4; }
.menu-btn.alt:hover { background:#e2dde9; }
body.dark .game-menu { background: linear-gradient(160deg,#f8f9fb,#eceff4 75%); color:#1d1824; }
body.dark .game-menu select { background:#ffffff; color:#1d1824; border:1px solid #cfc9d8; }

/* Leaderboard */
.leaderboard {
  background:#ffffff;
  border:1px solid rgba(0,0,0,0.08);
  border-radius:14px;
  padding:1.2rem 1.3rem 1.4rem;
  box-shadow:0 10px 30px -8px rgba(0,0,0,0.15);
  max-width:680px;
  margin:0 auto 0.75rem;
}
.leaderboard__header { display:flex; align-items:center; justify-content:space-between; margin-bottom:0.6rem; }
.leaderboard h2 { font-size:1.15rem; margin:0; letter-spacing:.5px; color:#2b2035; }
.leaderboard__list { list-style:decimal; margin:0; padding-left:1.4rem; display:flex; flex-direction:column; gap:.25rem; }
.leaderboard__list li { background:linear-gradient(135deg,#fafbfe,#f1f3f9); border:1px solid #e0e4ed; border-radius:8px; padding:.45rem .7rem; display:flex; justify-content:space-between; font-size:.82rem; color:#2a2732; }
.leaderboard__list li span.lb-name { font-weight:600; letter-spacing:.5px; }
.leaderboard__list li span.lb-score { font-family:monospace; }
.leaderboard__list li span.lb-date { font-size:.65rem; opacity:.6; margin-left:.6rem; }
.leaderboard__list li.lb-empty { background:none; border:1px dashed #d0d4dc; font-style:italic; color:#666; }
.leaderboard__hint { font-size:.65rem; opacity:.65; margin:.6rem 0 0; }
.lb-btn { cursor:pointer; background:#ece8f1; color:#2d2238; border:1px solid #cbc3d4; border-radius:8px; padding:.35rem .7rem; font-size:.7rem; font-weight:600; letter-spacing:.5px; }
.lb-btn:hover { background:#e2dde9; }
.lb-btn:active { transform:scale(.92); }
body.dark .leaderboard { background:#f4f6fa; border-color:rgba(0,0,0,0.15); }
body.dark .leaderboard__list li { background:linear-gradient(135deg,#f7f9fc,#eef1f6); border-color:#d9dde5; }
.leaderboard__list li.lb-new {
  position:relative;
  background:linear-gradient(135deg,#fff6e8,#ffe2cc);
  border-color:#ffc08a;
  box-shadow:0 0 0 0 rgba(255,140,60,0.6);
  animation: lbPulse 2.4s ease forwards;
}
@keyframes lbPulse {
  0% { box-shadow:0 0 0 0 rgba(255,140,60,0.7); }
  40% { box-shadow:0 0 0 10px rgba(255,140,60,0); }
  100% { box-shadow:0 0 0 0 rgba(255,140,60,0); }
}
body.dark .leaderboard__list li.lb-new { background:linear-gradient(135deg,#2c1f28,#3d2a22); border-color:#ff9d55; }
.game-menu h2 { font-size: 1.8rem; letter-spacing: 1px; }
.game-menu .menu-group { display: flex; flex-direction: column; gap: 0.4rem; width: min(320px, 85%); text-align: left; }
.game-menu label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.75; }
.game-menu select { padding: 0.6rem 0.75rem; border-radius: 8px; background: #1e1a28; color: #fff; border:1px solid #3a2c4d; }
.game-menu select:focus { outline: 2px solid #e25555; }
.menu-actions { display:flex; gap:1rem; flex-wrap:wrap; justify-content:center; margin-top:0.5rem; }
.menu-btn { cursor:pointer; border:none; border-radius:10px; font-weight:600; padding:0.8rem 1.4rem; font-size:0.95rem; letter-spacing:0.5px; }
.menu-btn.start { background:linear-gradient(135deg,#ff4b4b,#ff8f4b); color:#fff; box-shadow:0 8px 24px rgba(255,75,75,.35); }
.menu-btn.start:hover { transform:translateY(-2px); box-shadow:0 12px 30px rgba(255,75,75,.45); }
.menu-btn.alt { background:#262034; color:#eee; border:1px solid #3d314f; }
.menu-btn.alt:hover { background:#332846; }
.menu-hint { font-size:0.75rem; opacity:0.55; max-width:320px; line-height:1.3; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px);} to { opacity:1; transform:translateY(0);} }

body.dark .game-menu { background: linear-gradient(160deg, rgba(8,6,12,0.94), rgba(18,10,24,0.92)); }
body.dark .game-menu select { background:#14111b; border-color:#3a2c4d; }
body.dark .menu-btn.alt { background:#1d1629; }

.controls {
  max-width: 960px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.controls ul {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 0.75rem;
}

.controls li {
  background: rgba(226, 85, 85, 0.08);
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
}

body.dark .controls,
body.dark .game-wrapper,
body.dark .hero--game {
  background: rgba(12, 12, 20, 0.92);
  color: #f6f6f6;
}

body.dark .controls li { background: rgba(226, 85, 85, 0.22); }

@media (max-width: 768px) {
  .hud { flex-direction: column; align-items: center; gap: 0.5rem; }
  .controls { padding: 1.5rem 1.25rem; }
}
/* === End Shooter styles === */

/* Canvas pour animations Light/Dark */
#themeCanvas {
  position: fixed;
  top:0; left:0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 999;
}
