*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg: #050816;
  --bg-card: rgba(16,24,40,0.9);
  --accent: #4f46e5;
  --accent-soft: rgba(79,70,229,0.15);
  --border-subtle: rgba(148,163,184,0.3);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --radius-lg: 18px;
  --radius-pill: 999px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: radial-gradient(circle at top, #0b1120 0, #020617 55%, #000 100%);
  color: var(--text-main);
  min-height: 100vh;
}

.container {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  border-bottom: 1px solid rgba(148,163,184,0.25);
  backdrop-filter: blur(18px);
  background: linear-gradient(to right, rgba(15,23,42,0.9), rgba(15,23,42,0.75));
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #a855f7, #4f46e5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.brand-title {
  font-weight: 600;
  letter-spacing: .03em;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.nav a {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
  transition: .15s ease;
}

.nav a:hover {
  background: rgba(148,163,184,0.12);
  color: #e5e7eb;
}

.nav a.active {
  background: var(--accent-soft);
  color: #fff;
}

.user-zone {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(148,163,184,0.35);
  font-size: 12px;
}

.btn {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148,163,184,0.4);
  background: rgba(15,23,42,0.8);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #e5e7eb;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: .15s ease;
}

.btn.small {
  padding: 5px 10px;
  font-size: 12px;
}

.btn.primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border-color: transparent;
}

.btn.danger {
  background: rgba(239,68,68,0.12);
  border-color: rgba(248,113,113,0.7);
  color: #fecaca;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(15,23,42,0.35);
}

.main {
  padding-top: 22px;
  padding-bottom: 32px;
}

/* hero + cards */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 26px;
  margin-bottom: 28px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(26px, 4vw, 32px);
  margin: 0 0 8px;
}

.hero .muted {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.tips {
  margin-top: 16px;
}

.tip {
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(148,163,184,0.4);
  background: rgba(15,23,42,0.7);
}

.hero-right .glasscard {
  border-radius: 22px;
  padding: 18px;
  background: radial-gradient(circle at top left, rgba(79,70,229,0.22), rgba(15,23,42,0.95));
  border: 1px solid rgba(129,140,248,0.6);
  box-shadow: 0 18px 40px rgba(15,23,42,0.75);
}

.glasscard .stat {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.glasscard .stat-value {
  font-weight: 600;
}

.glasscard .divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(148,163,184,0.8), transparent);
  margin: 12px 0;
}

.mini-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.mini-list {
  list-style: none;
  padding: 0;
  margin: 4px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.mini-list li {
  margin-bottom: 2px;
}

/* grid of games */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.card {
  border-radius: 20px;
  padding: 14px 14px 12px;
  background: linear-gradient(145deg, rgba(15,23,42,0.96), rgba(15,23,42,0.82));
  border: 1px solid rgba(148,163,184,0.3);
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: .16s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(15,23,42,0.85);
  border-color: rgba(129,140,248,0.8);
}

.card-icon {
  font-size: 22px;
}

.card-title {
  font-weight: 600;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.card-meta {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.pill {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.4);
  font-size: 11px;
  color: var(--text-muted);
}

/* layout jeux */
.game-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 18px;
}

.panel {
  border-radius: 18px;
  padding: 14px 14px 12px;
  background: linear-gradient(145deg, rgba(15,23,42,0.96), rgba(15,23,42,0.86));
  border: 1px solid rgba(148,163,184,0.4);
  font-size: 13px;
}

.panel h2 {
  font-size: 15px;
  margin: 0 0 8px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.hr {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(148,163,184,0.72), transparent);
  margin: 10px 0;
}

.muted {
  color: var(--text-muted);
}

/* inputs */
.pillselect {
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(15,23,42,0.9);
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 13px;
}

/* sudoku */
.sudoku .board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
  background: rgba(15,23,42,1);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,0.6);
}

.sudoku .cell {
  width: 100%;
  padding-top: 100%;
  position: relative;
  background: rgba(15,23,42,0.96);
  color: #e5e7eb;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
}

.sudoku .cell-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sudoku .cell.prefilled {
  background: rgba(15,23,42,0.98);
  font-weight: 600;
}

.sudoku .cell.selected {
  outline: 2px solid var(--accent);
  z-index: 2;
}

.sudoku .cell.error {
  background: rgba(239,68,68,0.25);
}

.sudoku .numbers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.sudoku .num {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.4);
  padding: 6px 0;
  text-align: center;
  font-size: 13px;
  cursor: pointer;
  background: rgba(15,23,42,0.9);
}

/* tictactoe */
.ttt #grid {
  display: grid;
  grid-template-columns: repeat(3,80px);
  grid-template-rows: repeat(3,80px);
  gap: 4px;
  margin-top: 10px;
}

.ttt .cell {
  border-radius: 18px;
  background: rgba(15,23,42,0.96);
  border: 1px solid rgba(148,163,184,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  cursor: pointer;
}

.ttt .cell.win {
  background: rgba(79,70,229,0.35);
}

.mode .radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 4px;
}

/* snake canvas */
#game {
  width: 100%;
  border-radius: 18px;
  background: radial-gradient(circle at top, #020617, #020617);
  border: 1px solid rgba(148,163,184,0.5);
}

/* small components */
.callout {
  border-radius: 14px;
  border: 1px solid rgba(248,113,113,0.6);
  background: rgba(239,68,68,0.12);
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 8px;
}

/* responsive */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .game-wrap {
    grid-template-columns: minmax(0, 1fr);
  }
  .topbar-inner {
    flex-wrap: wrap;
  }
}
