@font-face {
  font-family: "Figtree";
  src: url("/assets/fonts/figtree-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #111216;
  --surface: #191a1f;
  --surface-2: #232529;
  --surface-3: #2e3035;
  --border: #33353a;
  --text: #f7f7f8;
  --muted: #a1a3a8;
  --blue: #335fff;
  --blue-hover: #4a71ff;
  --green: #00b06f;
  --green-hover: #00c47b;
  --ingame: #00a2ff;
  --danger: #ff4d4f;
  --radius: 10px;
  --topbar: 60px;
  --sidenav: 220px;
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  cursor: pointer;
}
input {
  font: inherit;
  color: var(--text);
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.muted {
  color: var(--muted);
}
.error {
  color: var(--danger);
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  color: #fff;
  background: var(--surface-3);
  transition: background 0.15s, transform 0.1s;
}
.btn:hover {
  background: #3a3c42;
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  background: var(--blue);
}
.btn.primary:hover {
  background: var(--blue-hover);
}
.btn.play {
  background: var(--green);
  height: 56px;
  font-size: 18px;
  width: 100%;
}
.btn.play:hover {
  background: var(--green-hover);
}
.btn.play .icon {
  width: 28px;
  height: 28px;
}
.btn.ghost {
  background: transparent;
  color: var(--muted);
}
.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn.small {
  height: 32px;
  padding: 0 12px;
  font-size: 14px;
}
.btn.light {
  background: #fff;
  color: #1f1f1f;
}
.btn.light:hover {
  background: #e9e9ea;
}

.field {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
}
.field:focus {
  border-color: var(--blue);
}

/* Top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #fff;
  transform: rotate(-15deg);
  position: relative;
}
.logo-mark::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 2px;
  background: var(--bg);
}
.topnav {
  display: flex;
  gap: 4px;
}
.topnav a {
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  color: var(--muted);
}
.topnav a:hover,
.topnav a.active {
  color: var(--text);
  background: var(--surface-2);
}
.search {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
}
.search:focus-within {
  border-color: var(--blue);
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  height: 100%;
}
.spacer {
  flex: 1;
}
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.avatar {
  border-radius: 50%;
  background: var(--surface-3);
  object-fit: cover;
  flex: none;
}

/* Side nav */
.sidenav {
  position: fixed;
  top: var(--topbar);
  bottom: 0;
  left: 0;
  width: var(--sidenav);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidenav a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 700;
  color: var(--muted);
}
.sidenav a:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidenav a.active {
  background: var(--surface-2);
  color: var(--text);
}
.sidenav .count {
  margin-left: auto;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-3);
}

.content {
  margin: var(--topbar) 0 0 var(--sidenav);
  padding: 28px 36px 64px;
  max-width: 1400px;
}

/* Sections */
.section {
  margin-bottom: 36px;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: 22px;
}
.section-head a {
  margin-left: auto;
  font-weight: 700;
  color: var(--muted);
}
.section-head a:hover {
  color: var(--text);
}
.greeting {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}
.greeting h1 {
  font-size: 32px;
}

/* Friends row */
.friends-row {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  /* Room for the in-game ring, which overflow would otherwise clip. */
  padding: 8px 8px 6px;
  margin: -8px -8px 0;
}
.friend {
  width: 92px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.friend-pic {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.friend-pic .avatar {
  width: 84px;
  height: 84px;
}
.friend-pic.ingame {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--ingame);
}
.status-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: var(--ingame);
}
.friend-name {
  font-weight: 700;
  font-size: 14px;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-status {
  font-size: 12px;
  color: var(--muted);
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-status.ingame {
  color: var(--ingame);
}
.friend.add .friend-pic {
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--muted);
}
.friend.add:hover .friend-pic {
  border-color: var(--muted);
  color: var(--text);
}

/* Game tiles */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px 16px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}
.tile:hover .thumb img {
  transform: scale(1.05);
}
.thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 64px;
  font-weight: 900;
  color: #fff;
}
.thumb .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.65);
}
.tile-title {
  font-weight: 800;
  font-size: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.tile-meta .icon {
  width: 14px;
  height: 14px;
}
.live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}
.empty {
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* Game details */
.game-hero {
  display: grid;
  grid-template-columns: minmax(260px, 480px) minmax(280px, 420px);
  gap: 32px;
  align-items: start;
}
.game-hero .thumb {
  border-radius: 14px;
}
.game-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.game-info h1 {
  font-size: 34px;
  line-height: 1.1;
}
.by {
  color: var(--muted);
  font-weight: 600;
}
.by b {
  color: var(--text);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface);
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.stat-value {
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
}
.about {
  margin-top: 36px;
  max-width: 932px;
}
.about h2 {
  font-size: 20px;
  margin-bottom: 10px;
}
.about p {
  color: #d5d6d9;
  margin: 0 0 12px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 6px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
}
.port-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Modal (consent) */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}
.modal {
  width: min(440px, 100%);
  padding: 24px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.modal-head .thumb {
  width: 64px;
  border-radius: 10px;
}
.modal h2 {
  font-size: 20px;
}
.modal ul {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 600;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* Play view */
.play-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #000;
}
.play-bar {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.play-bar .thumb {
  width: 32px;
  border-radius: 6px;
}
.play-bar strong {
  font-weight: 800;
}
.play-stage {
  position: relative;
  flex: 1;
  display: flex;
}
#frame {
  flex: 1;
  display: flex;
}
#frame iframe {
  flex: 1;
  border: 0;
  width: 100%;
  height: 100%;
  background: #111;
}
.joining {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 40%, #1d2030, #0b0c10 70%);
  transition: opacity 0.35s ease;
}
.joining.done {
  opacity: 0;
  pointer-events: none;
}
.joining .thumb {
  width: 160px;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.joining h2 {
  font-size: 24px;
}
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.devinfo {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 360px;
  max-height: calc(100% - 24px);
  overflow: auto;
  padding: 14px;
  border-radius: 10px;
  background: rgba(25, 26, 31, 0.95);
  border: 1px solid var(--border);
  font-size: 13px;
}
.devinfo[hidden] {
  display: none;
}
.log {
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  color: #cfd0d4;
  margin-top: 8px;
}

/* Sign in */
.signin {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}
.collage {
  position: fixed;
  inset: -20%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 18px;
  transform: rotate(-10deg);
  opacity: 0.45;
}
.collage img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 18px;
}
.signin::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(17, 18, 22, 0.35), var(--bg) 75%);
}
.signin-card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: 32px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}
.signin-card .logo {
  justify-content: center;
  font-size: 22px;
}
.signin-card h1 {
  font-size: 24px;
}
.signin-card form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Create page */
.steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 820px;
}
.step {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.step-num {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: var(--blue);
}
.step h3 {
  font-size: 18px;
  margin-bottom: 6px;
}
.step p {
  margin: 0 0 10px;
  color: #d5d6d9;
}
.code {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0b0c0f;
  border: 1px solid var(--border);
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
}
.code code {
  flex: 1;
  white-space: pre;
}
pre.code {
  display: block;
  white-space: pre;
  margin: 0;
}

/* Friends page */
.friend-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.friend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.friend-card .avatar {
  width: 48px;
  height: 48px;
}
.friend-card .grow {
  flex: 1;
  min-width: 0;
}
.add-friend {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin-bottom: 8px;
}
.add-friend .field {
  flex: 1;
}

@media (max-width: 860px) {
  .sidenav {
    display: none;
  }
  .content {
    margin-left: 0;
    padding: 20px;
  }
  .game-hero {
    grid-template-columns: 1fr;
  }
  .topnav {
    display: none;
  }
}

.icon.big {
  width: 32px;
  height: 32px;
}
.lede {
  margin: -6px 0 20px;
}
.spaced {
  margin-top: 20px;
}
.link {
  text-decoration: underline;
}
.fb-0 { background: linear-gradient(135deg, #335fff, #1b2a7a); }
.fb-1 { background: linear-gradient(135deg, #00b06f, #035c3c); }
.fb-2 { background: linear-gradient(135deg, #ff6a3d, #8a2a0e); }
.fb-3 { background: linear-gradient(135deg, #b14dff, #4b1a7a); }
.fb-4 { background: linear-gradient(135deg, #ffb800, #8a5a00); }
.fb-5 { background: linear-gradient(135deg, #00b8d9, #0a4f61); }
.fb-6 { background: linear-gradient(135deg, #ff4d8d, #7a1640); }
.fb-7 { background: linear-gradient(135deg, #7ad100, #345a00); }
.friends-here {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.friends-here .avatar {
  width: 28px;
  height: 28px;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ingame);
}
.friends-here span {
  margin-left: 6px;
}
