* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0d1117;
  color: #f0f3f6;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(88, 166, 255, 0.18), transparent 60%),
    radial-gradient(ellipse 700px 400px at 100% 100%, rgba(240, 136, 62, 0.10), transparent 60%),
    #0d1117;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.5vw;
  padding: 4vh 3vw 2vh;
}

.brand {
  font-size: 2.6vw;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-icon { margin-right: 0.3em; }

.tagline {
  font-size: 1.1vw;
  color: #8b949e;
  font-weight: 400;
}

.page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2vh 4vw 6vh;
  text-align: center;
}

.section-title {
  font-size: 2vw;
  margin: 0 0 3vh;
  color: #8b949e;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.loading { color: #8b949e; font-size: 1.4vw; }

.picker-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 4vw;
  width: 100%;
}

.picker-main-col {
  flex: 1;
  min-width: 0;
  max-width: 1200px;
}

.site-qr-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(160deg, #161b22, #10141a);
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 1.6vw;
  margin-top: 4.8vh;
}

.site-qr-panel img {
  width: 130px;
  height: 130px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.site-qr-panel p {
  font-size: 0.9vw;
  color: #8b949e;
  max-width: 150px;
  text-align: center;
  margin: 1.2vh 0 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2vw;
  width: 100%;
  max-width: 1200px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  background: linear-gradient(160deg, #161b22, #10141a);
  border: 2px solid #30363d;
  border-radius: 18px;
  padding: 2.5vh 1.6vw;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 0%, rgba(88, 166, 255, 0.14), transparent 55%);
  opacity: 0;
  transition: opacity 0.2s;
}

.game-card:hover, .game-card:focus, .game-card.remote-highlighted {
  border-color: #58a6ff;
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.game-card:hover::before, .game-card:focus::before, .game-card.remote-highlighted::before {
  opacity: 1;
}

.game-card.remote-highlighted {
  box-shadow: 0 0 0 3px #58a6ff, 0 12px 28px rgba(0, 0, 0, 0.4);
}

.card-icon {
  font-size: 3.4vw;
  margin-bottom: 1.2vh;
}

.card-name {
  font-size: 1.7vw;
  font-weight: 700;
}

.card-tagline {
  color: #8b949e;
  font-size: 1.05vw;
  margin-top: 0.6vh;
  min-height: 2.6vh;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2vh;
  padding-top: 1.6vh;
  border-top: 1px solid #21262d;
}

.player-badge {
  font-size: 0.95vw;
  color: #8b949e;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 999px;
  padding: 0.4vh 1vw;
}

.play-cta {
  font-size: 1.05vw;
  font-weight: 700;
  color: #58a6ff;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s, transform 0.15s;
}

.game-card:hover .play-cta, .game-card:focus .play-cta {
  opacity: 1;
  transform: translateX(0);
}

.game-card.coming-soon {
  cursor: default;
  opacity: 0.55;
  border-style: dashed;
}

.game-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
  border-color: #30363d;
}

.player-badge.locked {
  color: #8b949e;
}

.lobby {
  display: flex;
  gap: 6vw;
  align-items: center;
  background: linear-gradient(160deg, #161b22, #10141a);
  border: 1px solid #30363d;
  border-radius: 20px;
  padding: 4vh 4vw;
}

.lobby .qr-panel {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
}

.lobby .qr-panel img {
  display: block;
  width: 280px;
  height: 280px;
}

.join-code {
  font-size: 4vw;
  font-weight: 700;
  letter-spacing: 0.3em;
  margin-top: 2vh;
  color: #58a6ff;
}

.roster {
  text-align: left;
  min-width: 320px;
}

.roster ul {
  list-style: none;
  padding: 0;
  margin: 2vh 0;
  font-size: 1.8vw;
}

.roster li {
  padding: 0.6vh 0;
  color: #f0f3f6;
}

.roster li.disconnected {
  color: #8b949e;
  text-decoration: line-through;
}

button.start-btn {
  font-size: 1.8vw;
  padding: 1.2vh 3vw;
  border-radius: 12px;
  border: none;
  background: #238636;
  color: white;
  cursor: pointer;
  margin-top: 2vh;
}

button.start-btn:disabled {
  background: #30363d;
  color: #8b949e;
  cursor: not-allowed;
}

.lobby-status {
  font-size: 1.3vw;
  color: #8b949e;
  margin-top: 2vh;
  padding: 1.2vh 1.5vw;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
}

.host-badge {
  color: #e3b341;
  font-size: 0.85em;
}

#game-canvas {
  width: 100vw;
  height: 100vh;
  display: block;
}

.game-over {
  font-size: 2vw;
}

.error-banner {
  background: #7d2020;
  padding: 1vh 2vw;
  border-radius: 8px;
  margin-bottom: 2vh;
}
