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

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #202333, #050509);
  color: #fff;
}

a { color: inherit; text-decoration: none; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(0,0,0,0.9), rgba(10,10,30,0.7));
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 14px;
}

.nav a { margin-left: 12px; font-size: 13px; opacity: 0.85; }
.nav a:hover { opacity: 1; }

.footer {
  padding: 8px 16px;
  font-size: 11px;
  color: #aaa;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.7);
}

#app { min-height: calc(100vh - 80px); }
.page { min-height: calc(100vh - 80px); }

/* IMPORTANT : max-width augmenté pour “écran plus grand” */
.page-inner {
  padding: 18px 16px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, #7649ff, #ff4bc0);
  color: #fff;
}
.btn.secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
}

/* Home */
.hero { margin-top: 30px; }
.hero h1 { font-size: 26px; margin: 0 0 8px; }
.hero p { max-width: 420px; color: #ccc; }

/* Forms */
.form-card {
  background: rgba(0,0,0,0.55);
  border-radius: 16px;
  padding: 16px;
  max-width: 520px;
}
.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 4px; }

.input, select {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(5,5,10,0.85);
  color: #fff;
}

/* Catalog */
.catalog-wrapper { margin-top: 14px; }
.catalog-section { margin-bottom: 24px; }
.catalog-section h2 { font-size: 18px; margin: 0 0 10px 4px; }

.game-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.game-row::-webkit-scrollbar { height: 6px; }
.game-row::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
}

.game-card {
  width: 170px;
  flex: 0 0 auto;
  background: rgba(0,0,0,0.45);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s ease-out, box-shadow 0.1s ease-out, background 0.1s;
}
.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
  background: rgba(255,255,255,0.04);
}

.game-cover {
  width: 100%;
  height: 96px;
  background-size: cover;
  background-position: center;
  background-color: #181818;
}
.game-meta { padding: 7px 8px 10px; }
.game-meta h3 { font-size: 13px; margin: 0 0 3px; }
.game-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ff9fe0;
}
.game-players { font-size: 11px; color: #bbb; }

/* Game view */
.game-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 16px;
}

.game-info {
  background: rgba(0,0,0,0.6);
  border-radius: 16px;
  padding: 12px;
}

.game-cover-large {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: #111;
}

.game-info h2 { font-size: 20px; margin: 10px 0 4px; }
.game-description { font-size: 13px; color: #ccc; }
.game-details { margin-top: 8px; font-size: 12px; color: #aaa; }

/* IMPORTANT : zone jeu + iframe pleine hauteur */
.game-player {
  background: rgba(0,0,0,0.7);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  height: calc(100vh - 170px);
  min-height: 560px;
}

.html-game-frame {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: none;
  background: #000;
}

/* Admin table */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 6px 4px;
}
.table th { text-align: left; font-weight: 600; font-size: 12px; color: #ddd; }

@media (max-width: 900px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .game-player { height: 70vh; min-height: 420px; }
}

/* ================== ÉCRAN TV LOBBY ================== */
.page-tv {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(circle at top, #2b3246 0, #050712 55%, #020308 100%);
}

.tv-inner {
  max-width: 900px;
  width: 100%;
  text-align: center;
  padding: 32px 32px 40px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.6));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

.tv-title { font-size: 40px; margin: 0 0 8px; color: #fff; }
.tv-sub { font-size: 15px; color: #d0d3e6; margin: 0 0 24px; }

.tv-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
  gap: 32px;
  align-items: center;
}
.tv-left, .tv-right { display: flex; flex-direction: column; align-items: center; }

/* CODE LOBBY */
.tv-code-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border-radius: 18px;
  background: radial-gradient(circle at top left, #313b60, #161927);
  box-shadow:
    0 0 0 2px rgba(106, 220, 255, 0.3),
    0 16px 40px rgba(0, 0, 0, 0.9);
  margin-bottom: 18px;
}
.tv-code-label {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #9fb3ff;
  margin-right: 12px;
}
.tv-code {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #e9f3ff;
}

/* QR */
.tv-qr {
  width: 240px;
  height: 240px;
  padding: 12px;
  border-radius: 24px;
  background: radial-gradient(circle at top, #ffffff, #dbe0f5);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.85),
    0 0 0 2px rgba(255, 255, 255, 0.1);
}
.tv-qr canvas, .tv-qr img { width: 100%; height: 100%; }

/* JOUEURS */
.tv-players-title {
  margin: 4px 0 12px;
  font-size: 16px;
  color: #d0d6ff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.tv-players {
  width: 100%;
  max-width: 260px;
  border-radius: 18px;
  background: rgba(7, 10, 24, 0.85);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  padding: 10px 14px;
  text-align: left;
  min-height: 52px;
}
.tv-player-item {
  display: flex;
  align-items: center;
  padding: 4px 2px;
  font-size: 14px;
  color: #f3f5ff;
}
.tv-player-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 8px;
  background: radial-gradient(circle at center, #4cffb2, #1ea678);
}

/* START */
.tv-start {
  margin-top: 24px;
  padding: 12px 30px;
  font-size: 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff4ad8, #ffb35e);
  color: #111;
  font-weight: 600;
  border: 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4),
    0 20px 40px rgba(0, 0, 0, 0.9);
}
.tv-start:hover { transform: translateY(-1px); }
.tv-start:active { transform: translateY(1px) scale(0.98); }

@media (max-width: 900px) {
  .tv-layout { grid-template-columns: 1fr; gap: 24px; }
  .tv-title { font-size: 32px; }
  .tv-code { font-size: 32px; }
}
