/* ————— Thèmes ————— */
:root[data-theme="dark"] {
  --bg: #0c1118;
  --bg-glow: radial-gradient(1100px 600px at 50% -10%, #16202e 0%, #0c1118 60%);
  --card: #161e2b;
  --row: #1c2637;
  --row-hover: #24314a;
  --border: #232e42;
  --text: #e9eef6;
  --muted: #8b98ad;
  --ring: rgba(255, 255, 255, 0.14);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);

  --game-sky: #161e2b;
  --game-fg: #93a3b8;
  --game-dino: #8fb05c;
  --game-dino-dark: #6d8a41;
  --game-cap: #c94f42;
  --game-cactus: #5f9d72;
  --game-cloud: #26324a;
  --game-text: #8b98ad;
}
:root[data-theme="light"] {
  --bg: #eef1f6;
  --bg-glow: radial-gradient(1100px 600px at 50% -10%, #ffffff 0%, #eef1f6 60%);
  --card: #ffffff;
  --row: #f2f5fa;
  --row-hover: #e7ecf4;
  --border: #e3e8f0;
  --text: #18222f;
  --muted: #64748b;
  --ring: rgba(0, 0, 0, 0.1);
  --shadow: 0 24px 60px rgba(23, 32, 46, 0.12);

  --game-sky: #ffffff;
  --game-fg: #535353;
  --game-dino: #6d8a41;
  --game-dino-dark: #55702f;
  --game-cap: #c04437;
  --game-cactus: #3e8654;
  --game-cloud: #dde3ec;
  --game-text: #757575;
}

/* ————— Base ————— */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

body {
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-glow);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  transition: background-color 0.25s ease;
}

main {
  display: flex;
  justify-content: center;
  padding: 96px 16px 48px;
}

/* ————— Boutons flottants ————— */
.icon-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 30;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: background 0.15s ease, transform 0.1s ease;
}
.icon-btn:hover { background: var(--row-hover); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn--right { left: auto; right: 16px; }

:root[data-theme="dark"] .ic-moon { display: none; }
:root[data-theme="light"] .ic-sun { display: none; }

/* ————— Menu latéral ————— */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(0, 0, 0, 0.45);
}
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  width: 232px;
  padding: 76px 14px 20px;
  background: var(--card);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
body.menu-open #sidebar { transform: translateX(0); }
body.menu-open #menu-btn { z-index: 40; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
.nav-link svg { width: 19px; height: 19px; opacity: 0.85; }
.nav-link:hover { background: var(--row); }
.nav-link.active { background: var(--row-hover); }

/* ————— Cartes ————— */
.card {
  width: min(448px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 44px 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.card--jeu { width: min(880px, 100%); }

h1 { font-size: 26px; font-weight: 700; letter-spacing: 0.2px; }
.tagline { margin-top: 6px; color: var(--muted); font-size: 14px; }
.footer { margin-top: 30px; color: var(--muted); font-size: 13px; }

/* ————— Avatar ————— */
.avatar {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 18px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--ring), 0 8px 24px rgba(0, 0, 0, 0.25);
  background: linear-gradient(135deg, #26324a, #161e2b);
}
:root[data-theme="light"] .avatar { background: linear-gradient(135deg, #dde6f2, #f6f8fb); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-fallback { display: none; }
.avatar.no-photo img { display: none; }
.avatar.no-photo .avatar-fallback {
  display: block;
  width: 62%;
  height: 62%;
  margin: 19% auto 0;
}

/* ————— Liste de liens ————— */
.links {
  list-style: none;
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.link-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--row);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
}
.link-row:hover {
  background: var(--row-hover);
  border-color: var(--ring);
  transform: translateY(-1px);
}
.link-row .brand { width: 21px; height: 21px; flex: none; }
.link-row .ext { width: 17px; height: 17px; margin-left: auto; color: var(--muted); flex: none; }

/* ————— Jeu ————— */
.game-wrap {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--game-sky);
}
#game {
  display: block;
  width: 100%;
  touch-action: manipulation;
  cursor: pointer;
}
.hint { margin-top: 14px; color: var(--muted); font-size: 13px; }
kbd {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--row);
  font-family: Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 520px) {
  main { padding-top: 84px; }
  .card { padding: 36px 20px 24px; }
}
