:root {
  --bg: #181a1c;
  --bg-alt: #202327;
  --card: #25282c;
  --card-strong: #2c3035;
  --text: #f3f4f6;
  --muted: #aeb4bb;
  --muted-strong: #7d8288;
  --accent: #3b82f6;
  --accent-strong: #60a5fa;
  --danger: #ef4444;
  --shadow: rgba(153, 217, 227, 0.35);
  --border: #99d9e3;
  --input-bg: #2f3338;
  --input-border: #99d9e3;
  --glow: rgba(59, 130, 246, 0.12);
  --glow-strong: rgba(59, 130, 246, 0.25);
}

body[data-theme="light"],
body.light-mode {
  --bg: #ffffff;
  --bg-alt: #eef1f5;
  --card: #e3e6eb;
  --card-strong: #dadddf;
  --text: #1f2933;
  --muted: #374151;
  --muted-strong: #6b7280;
  --accent: #2563eb;
  --accent-strong: #3b82f6;
  --shadow: rgba(0, 0, 0, 0.18);
  --border: #99d9e3;
  --input-bg: #ffffff;
  --input-border: #99d9e3;
  --glow: rgba(37, 99, 235, 0.06);
  --glow-strong: rgba(37, 99, 235, 0.12);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

body {
  position: relative;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -16%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  background:
    radial-gradient(circle at 18% 24%, rgba(59, 130, 246, 0.18), transparent 60%),
    radial-gradient(circle at 80% 18%, rgba(34, 211, 238, 0.14), transparent 65%);
  filter: blur(12px);
  animation: none;
}

body::after {
  opacity: 0.35;
  background:
    radial-gradient(circle at 70% 65%, rgba(245, 158, 11, 0.12), transparent 62%);
  animation: none;
}

.glow-orb {
  position: fixed;
  width: clamp(200px, 28vw, 320px);
  height: clamp(200px, 28vw, 320px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-strong), transparent 60%);
  filter: blur(10px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  display: none;
  animation: none;
}

.orb-a {
  top: -80px;
  right: -60px;
  animation-duration: 62s;
  animation-delay: -6s;
}

.orb-b {
  bottom: -120px;
  left: -90px;
  animation-duration: 68s;
  animation-delay: -12s;
  animation-direction: alternate-reverse;
}

@keyframes orbDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(0.9);
    opacity: 0.35;
  }
  50% {
    transform: translate3d(-45px, 35px, 0) scale(1.08);
    opacity: 0.75;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(0.9);
    opacity: 0.4;
  }
}

@keyframes bgFlow {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-4%, 3%, 0) scale(1.06);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes bgFlowAlt {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(3%, -4%, 0) scale(1.05);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .glow-orb {
    animation: none;
  }
}

.app-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
}

.top-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.brand-logo {
  height: 48px;
  width: auto;
  display: block;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.brand-link:focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 4px;
  border-radius: 14px;
}

.top-left h1 {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card-strong);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Arial Black", "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  position: relative;
  line-height: 1.1;
}

.top-left h1::after {
  content: "";
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  background: url("/assets/img/quizzonelogo.png") no-repeat center center;
  background-size: contain;
}

body.games-page .brand-logo {
  display: block;
}

body.games-page .top-left h1::after {
  background: url("/assets/img/gameslogo.png") no-repeat center center;
  background-size: contain;
}

.brand-live {
  font-size: 0.8rem;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--text);
  letter-spacing: 0.12em;
}

.top-left p {
  margin: 0.7rem 0 0 0.15rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  cursor: pointer;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
  text-transform: uppercase;
}

.user-chip:disabled {
  opacity: 0.7;
  cursor: default;
}

.user-caret {
  font-size: 0.75rem;
  opacity: 0.7;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.user-menu-wrap {
  position: relative;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(240px, 90vw);
  min-width: 200px;
  background: var(--card);
  border: 1px solid rgba(153, 217, 227, 0.35);
  border-radius: 16px;
  padding: 0.6rem;
  display: grid;
  gap: 0.5rem;
  z-index: 10;
  font-size: 0.9rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 18px 28px rgba(153, 217, 227, 0.22);
  backdrop-filter: blur(8px);
}

.user-menu button,
.user-menu .secondary {
  width: 100%;
  text-align: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
}

.user-menu button:hover,
.user-menu .secondary:hover {
  border-color: rgba(153, 217, 227, 0.5);
  background: rgba(255, 255, 255, 0.06);
  transform: none;
}

.quiz-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
  margin-bottom: 0.6rem;
}

.quiz-button {
  min-width: 170px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(37, 40, 44, 0.9), rgba(47, 51, 56, 0.9));
  color: var(--text);
  padding: 0.65rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.quiz-button:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.quiz-button-active {
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.45), rgba(37, 99, 235, 0.95));
  color: #f9fafb;
  border-color: var(--accent);
  box-shadow: 0 16px 24px rgba(37, 99, 235, 0.3);
}

.quiz-button-active::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.85;
}

.quiz-catalog {
  position: relative;
}

.quiz-catalog-btn {
  width: 100%;
  justify-content: space-between;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(14, 18, 24, 0.5);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
  box-shadow: none;
}

.quiz-catalog-btn.is-open {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.quiz-catalog-label {
  display: inline-block;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-catalog-caret {
  opacity: 0.7;
}

.quiz-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(360px, 90vw);
  background: rgba(20, 26, 34, 0.96);
  border: 1px solid rgba(153, 217, 227, 0.3);
  border-radius: 18px;
  padding: 0.8rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  z-index: 30;
}

.quiz-search input {
  margin-bottom: 0.6rem;
}

.quiz-popover-section {
  margin-top: 0.4rem;
}

.quiz-popover-title {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.4rem 0 0.4rem;
}

.quiz-popover-list {
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 0.35rem;
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
  overscroll-behavior: contain;
}

.quiz-popover-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.quiz-group {
  display: grid;
  gap: 0.35rem;
}

.quiz-group-title {
  font-size: 0.8rem;
  color: var(--muted);
  padding-left: 0.2rem;
}

.quiz-catalog-item {
  border: 1px solid rgba(153, 217, 227, 0.2);
  background: rgba(11, 14, 20, 0.35);
  color: var(--text);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.quiz-catalog-item:hover {
  border-color: var(--accent-strong);
}

.quiz-catalog-item.is-selected {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.6);
}

.quiz-item-check {
  opacity: 0;
  font-weight: 700;
}

.quiz-catalog-item.is-selected .quiz-item-check {
  opacity: 0.85;
}

.quiz-empty {
  padding: 0.8rem 0.4rem;
  color: var(--muted);
}

body.light-mode .quiz-button {
  color: #1f2933;
  background: #f4f6f9;
}

body.light-mode .quiz-button-active {
  color: #ffffff;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.option-grid {
  display: grid;
  gap: 0.5rem;
}

.option-row {
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  gap: 0.5rem;
}

.option-row span {
  color: var(--muted);
  font-size: 0.85rem;
}

.option-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.6);
}

.card {
  background: var(--card);
  border: 1px solid rgba(153, 217, 227, 0.35);
  border-radius: 20px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 18px 28px rgba(153, 217, 227, 0.22);
  margin-bottom: 1rem;
  animation: rise 0.6s ease forwards;
}

body.live-page .card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.card h2 {
  margin-top: 0;
  font-size: 1.6rem;
}

.panel {
  background: transparent;
  border-radius: 12px;
  padding: 0;
  border: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-header h3 {
  margin: 0;
}

.open-rooms-panel {
  margin-bottom: 1.2rem;
}

.open-rooms-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.8rem;
  max-height: 320px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(153, 217, 227, 0.35) transparent;
}

.open-room {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem 1rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
}

body.light-mode .open-room {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(0, 0, 0, 0.08);
}

.open-room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.open-room-title {
  font-weight: 700;
  color: var(--text);
}

.open-room button {
  justify-self: end;
}

.secondary.small {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}

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

.grid {
  display: grid;
  gap: 1.2rem;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid.two-compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem 1.2rem;
}

.live-lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  column-gap: 2rem;
  row-gap: 1.6rem;
  align-items: start;
}

@media (max-width: 980px) {
  .live-lobby-grid {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  margin-bottom: 1rem;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(1rem + 2px), calc(100% - 15px) calc(1rem + 2px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

button {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--accent);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.primary:hover,
.primary:focus {
  background: var(--accent-strong);
  color: #ffffff;
}

.create-room-cta {
  width: 100%;
  border-radius: 14px;
  padding: 0.85rem 1.2rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(153, 217, 227, 0.7);
}

.secondary {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

a.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}

a.games-button {
  border: 2px solid var(--border);
  background: var(--card);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: "Arial Black", "Segoe UI", sans-serif;
  padding: 0.4rem 0.9rem;
  gap: 0.4rem;
}

a.games-button::after {
  content: "";
  width: 22px;
  height: 22px;
  background: url("/assets/img/gameslogo.png") no-repeat center center;
  background-size: contain;
}

a.live-button,
a.quiz-zone-button {
  border: 2px solid var(--border);
  background: var(--card);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: "Arial Black", "Segoe UI", sans-serif;
  padding: 0.4rem 0.9rem;
  gap: 0.4rem;
}

a.live-button::after,
a.quiz-zone-button::after {
  content: "";
  width: 22px;
  height: 22px;
  background: url("/assets/img/quizzonelogo.png") no-repeat center center;
  background-size: contain;
}

.secondary:hover,
.secondary:focus,
a.secondary:hover,
a.secondary:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.danger {
  background: linear-gradient(135deg, #f87171, var(--danger));
  color: #1f0d0d;
}

.hidden {
  display: none !important;
}

.hint {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.focus-mode .room-card {
  display: none;
}

.focus-mode .top-bar {
  display: none;
}

.focus-mode .app-container {
  padding: 0;
  min-height: 100vh;
}

.focus-mode main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.focus-mode .question-card {
  width: min(1040px, 90vw);
  margin: 0;
  padding: clamp(1.2rem, 2.8vw, 2.2rem);
  box-sizing: border-box;
  max-height: calc(100vh - clamp(3rem, 8vw, 6rem));
  overflow: visible;
}

body.focus-mode,
body.scoreboard-full {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

body.scoreboard-full .top-bar,
body.scoreboard-full .glow-orb {
  display: none !important;
}

body.scoreboard-full main {
  padding: 0 !important;
  margin: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  position: fixed !important;
  inset: 0 !important;
  overflow: hidden !important;
}

body.scoreboard-full #liveAppRoot {
  width: 100% !important;
  height: 100% !important;
}

.room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  align-items: center;
}

.room-close-btn {
  margin-left: auto;
  align-self: center;
}

.host-play-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1;
}

.host-play-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  margin: 0;
  transform: translateY(1px);
}

body:not(.is-host) #hostPanel {
  display: none;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.player-list li {
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
}

.room-card .panel {
  background: var(--card);
  border: 1px solid rgba(153, 217, 227, 0.25);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  box-shadow: 0 14px 22px rgba(153, 217, 227, 0.18);
  display: flex;
  flex-direction: column;
}

.room-card .panel h3 {
  margin: 0 0 0.8rem;
  font-size: 1.15rem;
}

.room-card .grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 1.2rem;
}

.room-card .player-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  justify-items: stretch;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(153, 217, 227, 0.25) transparent;
}

.room-card .player-list::-webkit-scrollbar {
  width: 4px;
}

.room-card .player-list::-webkit-scrollbar-thumb {
  background: rgba(153, 217, 227, 0.25);
  border-radius: 4px;
}

.room-card .player-list li {
  padding: 0.4rem 0.6rem;
  border-radius: 14px;
  background: var(--card-strong);
  border: 1px solid rgba(153, 217, 227, 0.2);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.22);
}

.room-card .player-avatar {
  width: 36px;
  height: 36px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.room-card .player-name {
  font-size: 0.88rem;
  text-align: center;
}

.room-card .meta-row {
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(153, 217, 227, 0.15);
}

/* Room Chat - subtiler Chat unter Room-Info */
.room-chat {
  margin-top: auto;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(153, 217, 227, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.room-chat-messages {
  height: 100px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  font-size: 0.8rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(153, 217, 227, 0.25) transparent;
}

.room-chat-messages:empty::before {
  content: "Noch keine Nachrichten...";
  color: var(--muted-strong);
  font-style: italic;
  font-size: 0.75rem;
  opacity: 0.7;
}

.room-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.room-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(153, 217, 227, 0.25);
  border-radius: 4px;
}

.room-chat-msg {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  line-height: 1.35;
  word-break: break-word;
}

.room-chat-msg-name {
  font-weight: 600;
  color: var(--accent-strong);
  flex-shrink: 0;
}

.room-chat-msg-text {
  color: var(--text);
  opacity: 0.92;
}

.room-chat-msg-system {
  color: var(--muted);
  font-style: italic;
  font-size: 0.75rem;
}

.room-chat-input-wrap {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.room-chat-input-wrap input {
  flex: 1;
  margin: 0;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(153, 217, 227, 0.2);
  color: var(--text);
}

.room-chat-input-wrap input:focus {
  border-color: rgba(153, 217, 227, 0.45);
  outline: none;
}

.room-chat-input-wrap input::placeholder {
  color: var(--muted-strong);
  opacity: 0.7;
}

.room-chat-send {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--accent-strong);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.room-chat-send:hover {
  background: rgba(59, 130, 246, 0.35);
  border-color: var(--accent);
  transform: none;
}

body.light-mode .room-chat-messages {
  background: rgba(0, 0, 0, 0.05);
}

body.light-mode .room-chat-input-wrap input {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.12);
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text);
  background: rgba(59, 130, 246, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.2);
  background-size: cover;
  background-position: center;
}

.player-name {
  font-weight: 600;
  color: var(--text);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.meta-row:last-child {
  border-bottom: none;
}

.question-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.question-card {
  position: relative;
  overflow: hidden;
}

.countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.82);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.countdown-overlay::before,
.countdown-overlay::after {
  content: none;
  display: none;
}

.countdown-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.countdown-overlay canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 1;
}


.timer-shell {
  width: 100%;
  height: 8px;
  background: var(--card-strong);
  border-radius: 999px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #facc15, var(--accent-strong));
  transition: width 0.2s linear;
}

.options {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.option-btn {
  background: var(--card-strong);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.8rem 1rem;
  border-radius: 14px;
  text-align: left;
  font-size: 0.95rem;
}

.option-btn.selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.18);
}

.option-btn.correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.2);
}

.answer-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.scoreboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.scoreboard li {
  border-radius: 16px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  padding: 0.9rem 1rem 1.1rem;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(153, 217, 227, 0.08);
}

.score-entry {
  display: grid;
  gap: 0.7rem;
}

.score-entry.score-rank-1 {
  box-shadow: 0 0 0 2px rgba(99, 217, 227, 0.25), 0 18px 36px var(--shadow);
}

.score-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
}

.score-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

.score-name {
  font-size: 1rem;
}

.score-points {
  font-size: 1.05rem;
}


.scoreboard-card {
  position: relative;
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0 0 1.6rem;
  animation: none;
}

.scoreboard-card::before {
  content: none;
}

.scoreboard-card > * {
  position: relative;
  z-index: 1;
}

.scoreboard-layout {
  --scoreboard-gap: 1.2rem;
  --scoreboard-side: clamp(200px, 22vw, 320px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--scoreboard-side);
  gap: var(--scoreboard-gap);
  align-items: stretch;
  position: relative;
}

body.is-host .scoreboard-side {
  padding-left: calc(var(--scoreboard-gap) / 2);
}

body:not(.is-host) .scoreboard-layout {
  grid-template-columns: minmax(0, 1fr);
}

body:not(.is-host) .scoreboard-side {
  display: none;
}

body.is-host #endActions {
  display: none !important;
}

body.scoreboard-centered .scoreboard-layout {
  grid-template-columns: minmax(0, 1fr);
}

body.scoreboard-centered .scoreboard-side {
  display: none;
}

body.scoreboard-full .app-container {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.scoreboard-full .scoreboard-card {
  position: fixed !important;
  inset: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow: hidden !important;
  border-radius: 0 !important;
  border: none !important;
  background: transparent !important;
}

body.scoreboard-full .scoreboard-layout {
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
  gap: 0 !important;
  align-items: stretch !important;
  width: 100% !important;
  height: 100% !important;
}

body:not(.is-host).scoreboard-full .scoreboard-layout {
  justify-content: center;
}

body.scoreboard-full .score-pixi-table {
  flex: 1 1 auto;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  min-height: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.scoreboard-full .scoreboard-side {
  display: none !important;
}

.scoreboard-full.scoreboard-centered .scoreboard-layout {
  justify-content: center;
}

.scoreboard-full.scoreboard-centered .scoreboard-side {
  display: none;
}

.score-pixi-table {
  position: relative;
  min-height: 600px;
  height: clamp(600px, 78vh, 880px);
  border-radius: 26px;
  border: none;
  background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.2), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(250, 204, 21, 0.16), transparent 45%),
    rgba(10, 12, 16, 0.6);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.score-pixi-table::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.08), transparent 45%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.06) 0px,
      rgba(255, 255, 255, 0.02) 2px,
      rgba(0, 0, 0, 0.04) 4px,
      rgba(0, 0, 0, 0.04) 6px
    );
  opacity: 0.5;
  pointer-events: none;
}

.score-pixi-table canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 960px) {
  .scoreboard-layout {
    grid-template-columns: 1fr;
  }

  .score-pixi-table {
    min-height: 480px;
    height: clamp(480px, 70vh, 640px);
  }

  body.scoreboard-full .scoreboard-layout {
    flex-direction: column;
  }

  body.scoreboard-full .score-pixi-table {
    flex: 1 1 auto;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
  }
}

.scoreboard-card h2 {
  margin-bottom: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.scoreboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.scoreboard-header h2 {
  margin: 0;
}

.scoreboard-celebration .scoreboard-header,
body.scoreboard-full .scoreboard-header {
  display: none;
}

body.scoreboard-celebration.scoreboard-full .top-bar,
body.scoreboard-celebration.scoreboard-full .glow-orb {
  display: none !important;
}

body.scoreboard-celebration.scoreboard-full .app-container {
  padding: 0;
  margin: 0;
  max-width: none;
}

body.scoreboard-celebration.scoreboard-full main {
  padding: 0;
  margin: 0;
}

body.scoreboard-celebration.scoreboard-full .scoreboard-card {
  padding: 0;
}

body.scoreboard-celebration.scoreboard-full .scoreboard-layout {
  width: 100%;
  height: 100%;
}

body.scoreboard-celebration.scoreboard-full .scoreboard-side {
  display: none;
}

body.scoreboard-celebration.scoreboard-full .score-pixi-table {
  border-radius: 0;
}

.scoreboard-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.end-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.scoreboard-side {
  display: flex;
  align-items: center;
  justify-content: center;
}

.focus-controls {
  display: none;
  flex-direction: column;
  gap: 0.9rem;
  align-items: center;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

body.is-host .focus-controls:not(.hidden) {
  display: flex;
}

body.scoreboard-full .focus-controls {
  display: none !important;
}

.focus-controls .focus-end {
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
  opacity: 0.7;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  box-shadow: none;
}

.next-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.35);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.25);
}

.next-cta .next-label {
  font-size: 0.95rem;
}

.next-cta .keycap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  height: 48px;
  padding: 0.2rem 0.7rem;
  border-radius: 14px;
  background: #f8fafc url("/assets/img/space-key.svg") center/cover no-repeat;
  border: 1px solid #cbd5e1;
  color: #111827;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
}

.next-cta .keycap-bar {
  width: 62%;
  height: 6px;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.65),
    0 1px 2px rgba(15, 23, 42, 0.35);
  margin-bottom: 4px;
}

.next-cta .keycap-text {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
}

body.light-mode .next-cta {
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid #b8c2cc;
  color: #1f2937;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

body.light-mode .next-cta .keycap {
  background: #ffffff url("/assets/img/space-key.svg") center/cover no-repeat;
  border-color: #cbd5e1;
}

@media (max-width: 900px) {
  .scoreboard-layout {
    grid-template-columns: 1fr;
  }

  .scoreboard-side {
    justify-content: flex-start;
  }

  .focus-controls {
    flex-direction: row;
  }
}

.focus-controls .focus-end:hover,
.focus-controls .focus-end:focus {
  opacity: 1;
  border-color: var(--danger);
  color: var(--text);
}

.stats-panel {
  margin-top: 1.4rem;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  background: var(--card-strong);
  border: 1px solid var(--border);
}

.stats-options {
  display: grid;
  gap: 0.5rem;
}

body.is-host .stats-panel {
  margin-top: 0.8rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  background: transparent;
  border: none;
}

body.is-host .stats-panel h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

body.is-host #statsSummary {
  font-size: 0.85rem;
}

body.is-host .stats-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.8rem;
}

body.is-host .stats-row {
  font-size: 0.8rem;
}

body.is-host .stats-bar {
  height: 6px;
}

.room-ended-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.room-ended-overlay.hidden {
  display: none;
}

body.games-page .card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

body.games-page .games-library {
  padding: 0.2rem 0;
}

body.games-page .lobby-card {
  max-width: 980px;
  margin: 0 auto;
}

body.games-page .lobby-card h2 {
  margin-bottom: 0.8rem;
}

.pong-lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.6rem;
  align-items: start;
  margin-top: 0.6rem;
}

body.games-page .open-rooms-panel {
  margin-bottom: 0;
}

body.games-page .pong-lobby-grid .panel {
  background: var(--card);
  border: 1px solid rgba(153, 217, 227, 0.35);
  border-radius: 20px;
  padding: 1.2rem 1.3rem;
  box-shadow: 0 18px 28px rgba(153, 217, 227, 0.22);
}

body.games-page .pong-lobby-grid .room-actions {
  margin-top: 0.8rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  gap: 1.1rem;
  margin-top: 1.2rem;
  overflow: visible;
  justify-content: start;
}

.game-tile {
  border: 1px solid rgba(153, 217, 227, 0.2);
  background: var(--card);
  border-radius: 22px;
  padding: 0;
  text-align: left;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  box-shadow: 0 16px 26px rgba(153, 217, 227, 0.16);
  transition: transform 200ms ease, box-shadow 200ms ease, filter 200ms ease;
  cursor: pointer;
  position: relative;
  transform-origin: center;
}

.game-tile::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 35%,
    rgba(153, 217, 227, 0.25) 50%,
    rgba(255, 255, 255, 0) 65%
  );
  opacity: 0;
  transform: translateX(-40%) rotate(12deg);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.game-tile:hover {
  transform: translateY(-6px) scale(1.03) rotate(-0.3deg);
  box-shadow: 0 26px 44px rgba(153, 217, 227, 0.3);
  filter: saturate(1.08);
  z-index: 20;
}

.game-tile:hover::after {
  opacity: 0.35;
  transform: translateX(20%) rotate(12deg);
}

.game-tile.is-locked {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.game-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b0f14;
  border-radius: 22px 22px 0 0;
  overflow: hidden;
}

.game-thumb--pong {
  padding: 0;
  position: relative;
  overflow: hidden;
  background: #0b0f14;
}

.game-thumb--pong .game-thumb-image {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: none;
  z-index: 0;
  transition: transform 260ms ease;
}


.game-thumb--pong .game-chip {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
}

.game-thumb--locked {
  background: linear-gradient(130deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
}

.game-thumb--locked-alt {
  background: linear-gradient(130deg, rgba(15, 23, 42, 0.9), rgba(14, 116, 144, 0.6));
}

.game-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.game-chip.chip-live {
  background: rgba(16, 185, 129, 0.95);
  color: #ffffff;
}

.game-chip.chip-soft {
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: var(--text);
  text-transform: none;
  letter-spacing: 0.02em;
}

.game-chip.chip-muted {
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: var(--muted);
}

.game-body {
  padding: 0.7rem 0.9rem 0.95rem;
  display: grid;
  gap: 0.55rem;
  background: var(--card-strong);
}

.game-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.game-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.03em;
}

.game-chip-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.game-subtitle {
  color: var(--muted);
  font-size: 0.72rem;
}

.game-desc {
  color: var(--text);
  opacity: 0.85;
  font-size: 0.78rem;
  line-height: 1.4;
}

.game-action {
  color: rgba(148, 163, 184, 0.9);
  font-weight: 700;
  font-size: 1.15rem;
  transition: transform 180ms ease, color 180ms ease;
}

.game-tile:hover .game-action {
  color: var(--text);
  transform: translateX(3px);
}

.game-tile:hover .game-thumb-image {
  transform: scale(1.02);
}

@keyframes tileSweep {
  0% {
    opacity: 0;
    transform: translateX(-60%) rotate(15deg);
  }
  20% {
    opacity: 0.6;
  }
  100% {
    opacity: 0;
    transform: translateX(60%) rotate(15deg);
  }
}

@keyframes tilePulse {
  0% {
    box-shadow: 10px 12px 28px rgba(255, 255, 255, 0.08);
  }
  50% {
    box-shadow: 12px 16px 44px rgba(96, 165, 250, 0.35);
  }
  100% {
    box-shadow: 14px 18px 40px rgba(255, 255, 255, 0.12);
  }
}

body.games-page .auth-card,
body.games-page .lobby-card {
  padding: 0.2rem 0;
}

.games-auth-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.72);
  backdrop-filter: blur(6px);
  z-index: 80;
}

.games-auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) !important;
  z-index: 90;
  width: min(520px, 92vw);
  margin: 0;
  animation: none;
}

body.games-page .game-card {
  padding: 0.4rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: calc(100vh - 180px);
}

body.games-page .top-bar {
  margin-bottom: 1.4rem;
}

body.games-page {
  font-family: "Orbitron", "Segoe UI", sans-serif;
}

body.games-page button,
body.games-page .user-chip,
body.games-page a.secondary {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.games-page a.quiz-zone-button,
body.games-page a.live-button,
body.games-page a.games-button {
  font-family: "Arial Black", "Segoe UI", sans-serif;
  font-weight: 700;
}

body.pong-prestart .pong-stage {
  display: none;
}

body.pong-prestart .game-card {
  gap: 0.6rem;
  min-height: auto;
}

body.pong-prestart .pong-speed {
  display: none;
}

body.profile-page .auth-card,
body.profile-page .profile-card {
  max-width: 960px;
  margin: 0 auto;
}

body.profile-page .top-bar {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

body.profile-page .profile-card {
  display: grid;
  gap: 1.2rem;
}

body.profile-page .auth-card .panel {
  max-width: none;
  margin: 0;
}

body.profile-page .panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

body.profile-page .panel + .panel {
  margin-top: 1rem;
  padding-top: 0;
  border-top: none;
}

body.profile-page .profile-actions {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.theme-options {
  display: inline-flex;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.theme-options .active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
}

body.faq-page .faq-card {
  max-width: 1100px;
  margin: 0 auto;
}

.faq-card {
  display: grid;
  gap: 1.4rem;
}

.faq-section h3 {
  margin: 0 0 0.6rem 0;
}

.faq-section h4 {
  margin: 0 0 0.4rem 0;
  font-size: 1rem;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem 1.6rem;
}

.faq-grid ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.faq-grid li {
  margin-bottom: 0.35rem;
}

.faq-card a {
  color: var(--accent-strong);
  font-weight: 600;
}

.faq-close {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ---- Games / Pong ---- */
.game-card {
  display: grid;
  gap: 1.2rem;
}

.pong-vs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1.8rem;
  margin-bottom: -0.35rem;
  margin-top: -0.1rem;
  font-weight: 700;
  color: var(--muted);
  width: fit-content;
  justify-self: center;
  text-align: center;
  align-self: center;
  margin-left: auto;
  margin-right: auto;
  transform: translateX(-2px);
}

.vs-player {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.vs-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text);
  background: rgba(59, 130, 246, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.2);
  background-size: cover;
  background-position: center;
}

.vs-name {
  color: var(--text);
  font-size: 1.15rem;
  font-family: "Orbitron", "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.vs-label {
  font-size: 0.9rem;
  letter-spacing: 0.25em;
  color: var(--muted-strong);
  font-family: "Press Start 2P", "Orbitron", sans-serif;
  text-transform: uppercase;
}

body.pong-fullscreen {
  overflow: hidden;
  cursor: none;
}

body.pong-fullscreen .top-bar,
body.pong-fullscreen .auth-card,
body.pong-fullscreen .lobby-card {
  display: none;
}

body.pong-fullscreen.pong-finished .game-header,
body.pong-fullscreen.pong-finished .game-footer,
body.pong-fullscreen.pong-finished .pong-speed,
body.pong-fullscreen.pong-finished .pong-vs,
body.pong-fullscreen.pong-finished .game-meta,
body.pong-fullscreen.pong-finished #gameMeta,
body.pong-fullscreen.pong-finished #gameHint {
  display: none;
}

body.pong-fullscreen .app-container {
  max-width: none;
  padding: 0;
}

body.pong-fullscreen .game-card {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1.2rem 1.1rem;
  gap: 0.6rem;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 30%, rgba(20, 28, 38, 0.9), rgba(7, 10, 14, 0.98));
}

body.pong-fullscreen .pong-stage {
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  width: min(88vw, 1400px);
  margin: 0 auto;
  border-radius: 22px;
  cursor: none;
}

body.pong-fullscreen .game-header {
  padding: 0 0.4rem;
}

body.pong-fullscreen .game-footer {
  padding: 0 0.4rem;
}

.pong-fullscreen-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.55);
  backdrop-filter: blur(6px);
  z-index: 50;
}

.pong-fullscreen-card {
  width: min(420px, 90vw);
  background: var(--card);
  border: 1px solid rgba(153, 217, 227, 0.35);
  border-radius: 20px;
  padding: 1.6rem 1.8rem;
  text-align: center;
  box-shadow: 0 18px 28px rgba(153, 217, 227, 0.22);
}

.pong-fullscreen-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.3rem;
}

.pong-fullscreen-card p {
  margin: 0.4rem 0;
}

body.pong-fullscreen .pong-fullscreen-overlay {
  display: none;
}

.pong-exit-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 12, 0.7);
  backdrop-filter: blur(8px);
  z-index: 60;
}

.pong-exit-card {
  width: min(520px, 92vw);
  background: var(--card);
  border: 1px solid rgba(153, 217, 227, 0.35);
  border-radius: 20px;
  padding: 1.8rem 2rem;
  text-align: center;
  box-shadow: 0 18px 28px rgba(153, 217, 227, 0.22);
}

.pong-exit-card h3 {
  margin: 0 0 0.7rem;
  font-size: 1.4rem;
}

.pong-exit-card p {
  margin: 0.4rem 0 1.2rem;
}

.pong-exit-actions {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.1rem;
}

.pong-score {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 2rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  font-family: "Orbitron", "Segoe UI", sans-serif;
}

.games-page .pong-score {
  display: none;
}

.pong-score span.score-pop {
  animation: scorePop 420ms ease-out;
}

@keyframes scorePop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

.score-sep {
  opacity: 0.6;
}

.pong-stage {
  width: 100%;
  height: auto;
  min-height: clamp(520px, 82vh, 940px);
  border-radius: 18px;
  border: 2px solid rgba(153, 217, 227, 0.65);
  background: radial-gradient(circle at 50% 45%, rgba(24, 32, 44, 0.9), rgba(9, 12, 16, 0.95));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  position: relative;
  flex: 1 1 auto;
}

.pong-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.pong-stage::after {
  content: "";
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle at 50% 50%, rgba(17, 24, 39, 0) 40%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
  opacity: 0.7;
}

.pong-speed {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-family: "Orbitron", "Segoe UI", sans-serif;
  margin-top: -0.2rem;
}

.pong-speed strong {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.game-status {
  font-size: 0.95rem;
  color: var(--muted);
}

.control-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.control-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.keycap-arrow {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.keycap-arrow svg {
  width: 18px;
  height: 18px;
  fill: #1f2933;
}

body.light-mode .keycap-arrow {
  background: #ffffff;
  border-color: #cbd5e1;
}

.keycap-esc {
  min-width: 46px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: #1f2933;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

body.light-mode .keycap-esc {
  background: #ffffff;
  border-color: #cbd5e1;
}

.game-controls {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0.2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.inline-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.create-room-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.create-room-panel .inline-check {
  margin: 0.4rem 0 0.7rem;
}

.create-room-panel .primary {
  align-self: flex-start;
}

.create-room-panel .create-room-cta {
  align-self: stretch;
}

.panel.live-card {
  background: var(--card);
  border-radius: 20px;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 18px 28px rgba(153, 217, 227, 0.22);
  border: 1px solid rgba(153, 217, 227, 0.35);
}

.panel-title {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
}

.empty-state {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem 0.2rem 0.2rem;
  color: var(--muted);
}

.empty-state.is-message {
  padding: 0.8rem 0;
}

.empty-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(153, 217, 227, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.2);
}

.empty-text strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
}

.empty-text span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
}

.live-page .open-room {
  border: 1px solid rgba(153, 217, 227, 0.2);
  background: rgba(14, 18, 24, 0.35);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.live-page .lobby-card {
  margin-top: 0.6rem;
}

.live-page .create-room-panel .grid.two-compact {
  margin-top: 0.2rem;
}

.live-page .open-rooms-panel .panel-header {
  margin-bottom: 0.6rem;
}

.room-ended-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 2.4rem;
  text-align: center;
  box-shadow: 0 18px 28px rgba(153, 217, 227, 0.22);
  max-width: 360px;
}

.room-ended-card h2 {
  margin-top: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.9rem;
}

.stats-bar {
  height: 8px;
  background: var(--card);
  border-radius: 999px;
  overflow: hidden;
}

.stats-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), #facc15);
}

.stats-row.is-correct span {
  color: #86efac;
}

.stats-row.is-correct .stats-bar span {
  background: linear-gradient(90deg, #22c55e, #86efac);
}

.toast {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  padding: 0.8rem 1.2rem;
  background: var(--card-strong);
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 14, 0.94);
  backdrop-filter: blur(2px);
}

#authModal .modal-backdrop {
  background: rgba(6, 10, 14, 0.78);
  backdrop-filter: blur(14px);
}

.modal-card {
  position: relative;
  width: min(680px, 92vw);
  background: var(--card);
  border: 1px solid rgba(153, 217, 227, 0.35);
  border-radius: 20px;
  padding: 1.2rem 1.4rem 1.4rem;
  box-shadow: 0 18px 28px rgba(153, 217, 227, 0.22);
  z-index: 1;
}

.modal-card .auth-card {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

#authModal .modal-card {
  width: min(720px, 92vw);
  padding: 2rem 2rem 1.7rem;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

#authModal .modal-title {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

#authModal .auth-tabs {
  margin: 0 0 1rem;
}

#authModal .auth-tab {
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 600;
  padding: 0.4rem 1rem;
}

#authModal .auth-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: none;
}

#authModal .auth-panel {
  max-width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

#authModal .auth-switch {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

#authModal .auth-switch .link-button {
  font-size: 0.9rem;
}

#authModal .auth-panel label {
  display: block;
  margin: 0.5rem 0 0.3rem;
  font-weight: 600;
  color: var(--text-muted, var(--muted));
}

#authModal .auth-panel input {
  width: 100%;
  height: 2.4rem;
  border-radius: 12px;
}

#authModal .modal-close {
  display: none;
}

#authModal button {
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
}

#authModal button:hover {
  transform: none;
}

#authModal .primary {
  box-shadow: none;
}

.auth-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  margin: 0.8rem 0 1rem;
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.auth-tab.is-active {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.25);
}

.auth-panel {
  max-width: 520px;
}

.auth-switch {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.link-button {
  border: none;
  background: none;
  color: var(--accent-strong);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.link-button:hover {
  text-decoration: underline;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.profile-avatar {
  margin-top: 1.1rem;
}

.avatar-preview {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.avatar-preview img {
  position: absolute;
  object-fit: cover;
}

.avatar-preview.has-image {
  cursor: grab;
}

.avatar-preview.is-dragging {
  cursor: grabbing;
}

.avatar-preview::after {
  content: "Ändern";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: rgba(15, 23, 42, 0.75);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.avatar-dropzone {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(16, 22, 30, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.avatar-dropzone:hover,
.avatar-dropzone:focus-within {
  border-color: rgba(153, 217, 227, 0.3);
  box-shadow: 0 10px 18px rgba(153, 217, 227, 0.12);
}

.avatar-dropzone:hover .avatar-preview::after,
.avatar-dropzone.is-dragover .avatar-preview::after {
  opacity: 1;
}

.avatar-dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(21, 32, 45, 0.55);
}

.avatar-dropzone-body {
  display: grid;
  gap: 0.35rem;
}

.avatar-dropzone-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.avatar-dropzone-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.avatar-adjust {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.avatar-adjust input[type="range"] {
  width: 120px;
  accent-color: var(--accent);
}

.avatar-select-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.avatar-select-link:hover {
  text-decoration: underline;
}

.avatar-status {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.avatar-status[data-state="success"] {
  color: #34d399;
}

.avatar-status[data-state="error"] {
  color: #f87171;
}

.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

@keyframes rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .room-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .question-meta {
    grid-template-columns: 1fr;
  }
}
