/* Roblox 2016-inspired fan recreation UI */
@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&display=swap");

:root {
  --rbx-green: #00a2ff; /* 2016 era shifted — classic was green then blue; use mid-2016 blue */
  --rbx-green-old: #02b757;
  --nav-bg: #191919;
  --nav-h: 40px;
  --page-bg: #e3e3e3;
  --card: #fff;
  --text: #191919;
  --muted: #666;
  --link: #0055b3;
  --border: #c3c3c3;
  --header-blue: #00a2ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  font-family: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  font-size: 14px;
  /* Classic Roblox-style cursors */
  cursor: url("../assets/cursor-default.png") 1 1, auto;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

/* Clickable / hover = classic hand; brick cursor for game cards */
a, button, .nav-link, .tab, .game-card, .item-cell, .swatch,
.part-tabs button, .settings-nav button, .btn, select, label.toggle,
#modal-close, #modal-preview, #modal-play, .logo {
  cursor: url("../assets/cursor-pointer.png") 6 1, pointer !important;
}
.game-card, .game-card * {
  cursor: url("../assets/cursor-brick.png") 4 4, pointer !important;
}
input[type="text"], input[type="search"], input[type="password"], textarea {
  cursor: url("../assets/cursor-text.png") 8 12, text !important;
}

/* Top black nav — classic */
#top-nav {
  height: var(--nav-h);
  background: var(--nav-bg);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #000;
}
.logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: #fff;
  margin-right: 12px;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo .mark {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #e2231a, #c41e16);
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 900;
}
.nav-link {
  color: #ddd;
  padding: 0 12px;
  height: var(--nav-h);
  display: flex; align-items: center;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none !important;
  border-bottom: 3px solid transparent;
}
.nav-link:hover, .nav-link.active {
  color: #fff;
  background: #2c2c2c;
  border-bottom-color: var(--header-blue);
}
.nav-spacer { flex: 1; }
.nav-search {
  display: flex; align-items: center;
  background: #fff;
  border-radius: 3px;
  overflow: hidden;
  height: 26px;
  margin-right: 10px;
}
.nav-search input {
  border: none; outline: none; padding: 0 8px;
  width: 160px; font-size: 12px; height: 100%;
}
.nav-search button {
  border: none; background: var(--header-blue); color: #fff;
  height: 100%; padding: 0 10px; font-size: 12px; font-weight: 700;
}
.nav-user {
  display: flex; align-items: center; gap: 8px;
  color: #ddd; font-size: 12px; font-weight: 600;
}
.nav-user .robux { color: #e0b020; }
.nav-avatar-sm {
  width: 28px; height: 28px; border-radius: 3px;
  background: #00a2ff; border: 1px solid #444;
}

/* Subheader */
#sub-header {
  background: var(--header-blue);
  color: #fff;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 16px;
}
#sub-header h1 {
  font-size: 22px; font-weight: 700; letter-spacing: 0.01em;
}
#sub-header .tabs { display: flex; gap: 4px; margin-left: auto; }
#sub-header .tab {
  background: rgba(255,255,255,0.15);
  border: none; color: #fff; padding: 6px 14px;
  border-radius: 3px; font-weight: 600; font-size: 13px;
}
#sub-header .tab.active, #sub-header .tab:hover {
  background: #fff; color: var(--header-blue);
}

/* Layout */
#app { max-width: 1100px; margin: 0 auto; padding: 16px; min-height: calc(100vh - 120px); }
.page { display: none; }
.page.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Cards / panels */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.panel h2 {
  font-size: 18px; margin-bottom: 12px;
  border-bottom: 1px solid #eee; padding-bottom: 8px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav-search input { width: 90px; }
  .nav-link { padding: 0 8px; font-size: 12px; }
}

/* Game cards — 2016 style */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.game-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  transition: box-shadow 0.15s;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.game-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  text-decoration: none;
}
.game-card .thumb {
  width: 100%; aspect-ratio: 1;
  background: #cfd8e3 center/cover no-repeat;
  position: relative;
}
.game-card .thumb .players {
  position: absolute; left: 6px; bottom: 6px;
  background: rgba(0,0,0,0.65); color: #fff;
  font-size: 11px; padding: 2px 6px; border-radius: 2px;
}
.game-card .meta { padding: 8px; flex: 1; }
.game-card .title {
  font-weight: 700; font-size: 13px; color: #191919;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-card .by { font-size: 11px; color: #777; margin-top: 2px; }
.game-card .likes { font-size: 11px; color: #02b757; margin-top: 4px; }

/* Featured banner */
.featured {
  display: grid; grid-template-columns: 220px 1fr; gap: 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 3px;
  padding: 14px; margin-bottom: 14px;
}
.featured .big-thumb {
  width: 220px; height: 220px; background: #cfd8e3 center/cover;
  border-radius: 3px; border: 1px solid #ddd;
}
.featured h3 { font-size: 22px; margin-bottom: 6px; }
.featured p { color: #555; margin-bottom: 10px; line-height: 1.45; }
.btn {
  display: inline-block;
  background: var(--header-blue); color: #fff !important;
  border: 1px solid #0074bd; padding: 8px 18px;
  border-radius: 3px; font-weight: 700; font-size: 14px;
  text-decoration: none !important;
}
.btn:hover { filter: brightness(1.06); }
.btn.green { background: #02b757; border-color: #018a42; }
.btn.gray { background: #f2f2f2; color: #333 !important; border-color: #bbb; }
.btn.danger { background: #e2231a; border-color: #b11; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters select, .filters input {
  border: 1px solid var(--border); border-radius: 3px;
  padding: 6px 8px; font-size: 13px; background: #fff;
}

/* Modal game preview */
#modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.55);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
#modal.on { display: flex; }
.modal-box {
  background: #fff; border-radius: 4px; max-width: 640px; width: 100%;
  overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.modal-box .hero {
  height: 220px; background: #222 center/cover;
  position: relative;
}
.modal-box .hero .close {
  position: absolute; right: 10px; top: 10px;
  background: rgba(0,0,0,0.6); color: #fff; border: none;
  width: 32px; height: 32px; border-radius: 3px; font-size: 18px;
}
.modal-body { padding: 16px 18px 20px; }
.modal-body h2 { font-size: 22px; margin-bottom: 4px; }
.modal-body .by { color: #666; margin-bottom: 10px; }
.modal-body p { color: #444; line-height: 1.5; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Avatar editor */
.avatar-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 14px;
}
@media (max-width: 800px) { .avatar-layout { grid-template-columns: 1fr; } }
.avatar-stage {
  background: linear-gradient(180deg, #b8d4f0 0%, #dce8f5 60%, #e8e8e8 60%);
  border: 1px solid var(--border);
  border-radius: 3px;
  min-height: 360px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; padding: 20px;
}
#r6-canvas { width: 200px; height: 280px; image-rendering: pixelated; }
.avatar-stage .name-tag {
  margin-top: 10px; font-weight: 700; font-size: 16px;
  background: rgba(255,255,255,0.85); padding: 4px 12px; border-radius: 3px;
}
.editor-panel .section { margin-bottom: 14px; }
.editor-panel h3 { font-size: 14px; margin-bottom: 8px; color: #333; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 28px; height: 28px; border-radius: 3px;
  border: 2px solid #ccc; cursor: pointer;
}
.swatch.active { border-color: #00a2ff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #00a2ff; }
.part-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.part-tabs button {
  border: 1px solid var(--border); background: #f5f5f5;
  padding: 5px 10px; border-radius: 3px; font-size: 12px; font-weight: 600;
}
.part-tabs button.active { background: #00a2ff; color: #fff; border-color: #0074bd; }
.item-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px;
}
.item-cell {
  border: 1px solid var(--border); border-radius: 3px; background: #fafafa;
  aspect-ratio: 1; display: grid; place-items: center; cursor: pointer;
  font-size: 11px; text-align: center; padding: 4px; font-weight: 600;
}
.item-cell:hover, .item-cell.on { border-color: #00a2ff; background: #e8f6ff; }
.item-cell .ico { font-size: 28px; line-height: 1; margin-bottom: 2px; }

/* Settings */
.settings-nav {
  display: flex; flex-direction: column; gap: 2px; min-width: 180px;
}
.settings-nav button {
  text-align: left; border: none; background: transparent;
  padding: 10px 12px; font-weight: 600; border-radius: 3px; color: #333;
}
.settings-nav button.active, .settings-nav button:hover {
  background: #00a2ff; color: #fff;
}
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 14px; }
@media (max-width: 700px) { .settings-layout { grid-template-columns: 1fr; } }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 700; margin-bottom: 4px; font-size: 13px; }
.form-row input[type=text], .form-row input[type=password], .form-row select {
  width: 100%; max-width: 360px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 3px; font-size: 14px;
}
.form-row .hint { font-size: 12px; color: #777; margin-top: 4px; }
.toggle {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.toggle input { width: 18px; height: 18px; }

/* Home feed */
.feed-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid #eee;
}
.feed-item .av {
  width: 48px; height: 48px; background: #00a2ff; border-radius: 3px; flex-shrink: 0;
}
.feed-item .txt { flex: 1; }
.feed-item .txt strong { font-size: 13px; }
.feed-item .txt p { color: #555; font-size: 13px; margin-top: 2px; }
.feed-item .time { color: #999; font-size: 11px; }

/* Footer */
footer {
  background: #191919; color: #999; text-align: center;
  padding: 20px; font-size: 12px; margin-top: 20px;
}
footer a { color: #bbb; margin: 0 8px; }
.banner-note {
  background: #fff3cd; border: 1px solid #e6d58a; color: #6a5a10;
  padding: 8px 12px; border-radius: 3px; margin-bottom: 12px; font-size: 12px;
}

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  background: #191919; color: #fff; padding: 12px 18px;
  border-radius: 4px; font-weight: 600; display: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.toast.on { display: block; animation: fade 0.2s ease; }
