/* Roblox-style light theme — matches roblox.com */
:root {
  --bg-primary: #fff;
  --bg-secondary: #f2f4f5;
  --bg-tertiary: #e9ecef;
  --bg-hover: #dee2e6;
  --bg-nav: #fff;
  --text-primary: #191b1d;
  --text-secondary: #606162;
  --text-muted: #898989;
  --accent-green: #02b757;
  --accent-blue: #0074bd;
  --accent-red: #e2231a;
  --border: #d4d6d8;
  --card-bg: #fff;
  --card-hover: #f8f9fa;
  --card-radius: 12px;
  --nav-height: 56px;
  --sidebar-width: 220px;
  --font: "Builder Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow-card: 0 1px 4px rgba(0,0,0,.08);
  --shadow-hover: 0 6px 20px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; }

/* ---- navbar ---- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.nav-logo {
  display: flex; align-items: center; gap: 0;
  flex-shrink: 0;
}
.nav-logo svg { width: 110px; height: 30px; }

.nav-search {
  flex: 1; max-width: 420px;
  position: relative;
}
.nav-search input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font: inherit; font-size: 14px;
  outline: none;
}
.nav-search input:focus { border-color: var(--accent-blue); background: #fff; }
.nav-search input::placeholder { color: var(--text-muted); }
.nav-search-icon {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.nav-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto; flex-shrink: 0;
}
.nav-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
}
.nav-user:hover { background: var(--bg-hover); }
.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

.nav-robux {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent-green);
  color: #fff;
  font-size: 13px; font-weight: 700;
  border: none;
}

/* ---- layout ---- */
.layout {
  display: flex;
  margin-top: var(--nav-height);
  min-height: calc(100vh - var(--nav-height));
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-nav);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  flex-shrink: 0;
  position: fixed;
  top: var(--nav-height);
  bottom: 0;
  overflow-y: auto;
}
.sidebar-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 22px;
  color: var(--text-secondary);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.sidebar-item:hover { background: var(--bg-secondary); }
.sidebar-item.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.sidebar-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 18px;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px 32px 40px;
  min-width: 0;
}

/* ---- section headers ---- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.02em;
}
.section-see-all {
  font-size: 13px; font-weight: 700;
  color: var(--accent-blue);
  cursor: pointer;
}

/* ---- game grid ---- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.game-card {
  display: flex; flex-direction: column;
  border-radius: var(--card-radius);
  overflow: visible;
  cursor: pointer;
  transition: transform .15s;
}
.game-card:hover {
  transform: translateY(-4px);
}
.game-card:hover .game-thumb {
  box-shadow: var(--shadow-hover);
}
.game-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-tertiary);
  overflow: hidden;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  transition: box-shadow .15s;
}
.game-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.game-info {
  padding: 8px 2px 4px;
}
.game-name {
  font-size: 13px; font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.game-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex; align-items: center; gap: 4px;
}
.game-meta .active-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
}

/* ---- game detail page ---- */
.game-detail {
  max-width: 1100px;
}
.game-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
  aspect-ratio: 16 / 7;
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-card);
}
.game-hero img {
  width: 100%; height: 100%; object-fit: cover;
}
.game-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 60%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 28px;
}
.game-hero-title {
  font-size: 30px; font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: #fff;
}
.game-hero-creator {
  font-size: 14px;
  color: rgba(255,255,255,.8);
}

.game-actions {
  display: flex; gap: 10px;
  margin-bottom: 20px;
}
.btn-play {
  padding: 12px 52px;
  border-radius: 10px;
  border: none;
  background: var(--accent-green);
  color: #fff;
  font-size: 17px; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: 0.02em;
}
.btn-play:hover { filter: brightness(1.08); }
.btn-play svg { width: 20px; height: 20px; }
.btn-secondary {
  padding: 12px 22px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px; font-weight: 700;
}
.btn-secondary:hover { background: var(--bg-secondary); }

.game-stats {
  display: flex; gap: 28px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.game-stat-value {
  font-size: 20px; font-weight: 800;
}
.game-stat-label {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}

.game-description {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  max-width: 700px;
}

/* ---- login page ---- */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - var(--nav-height));
  padding: 32px 20px;
  background: var(--bg-secondary);
}
.login-card {
  width: 100%; max-width: 440px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.login-card h1 {
  font-size: 22px; font-weight: 800;
  margin-bottom: 8px;
}
.login-card .lede {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 22px; line-height: 1.5;
}
.login-card label {
  display: block; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 6px; font-weight: 600;
}
.login-card textarea, .login-card input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font: inherit; font-size: 13px;
  outline: none;
  resize: vertical; min-height: 80px;
  font-family: ui-monospace, Consolas, monospace; font-size: 11px;
}
.login-card textarea:focus { border-color: var(--accent-blue); }
.login-card .btn-primary {
  width: 100%; margin-top: 16px;
  padding: 12px; border-radius: 10px; border: none;
  background: var(--accent-green);
  color: #fff; font: inherit; font-weight: 700; font-size: 15px;
  cursor: pointer;
}
.login-card .btn-primary:disabled { opacity: .55; }
.login-card .btn-ghost {
  padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-primary); color: var(--text-primary);
  font: inherit; font-weight: 600; cursor: pointer;
}
.login-card .btn-ghost:hover { background: var(--bg-secondary); }
.login-card .err { color: var(--accent-red); font-size: 13px; margin-top: 10px; }
.login-card .ok { color: var(--accent-green); }
.login-card .row { display: flex; gap: 10px; margin-top: 18px; }
.login-card .row > * { flex: 1; }
.login-card .note { margin-top: 16px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.login-card .pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-secondary);
  margin-bottom: 16px; background: var(--bg-secondary);
}
.login-card .pill b { color: var(--text-primary); font-weight: 700; }

/* ---- loading shimmer ---- */
.shimmer {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, #fff 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--card-radius);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- responsive ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .nav-search { max-width: 200px; }
}
