:root {
  --roblox-red: #e2241b;
  --bg: #0f1115;
  --card-bg: #1a1d24;
  --border: #2a2e37;
  --text: #e8e9ec;
  --muted: #9aa0ac;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
}

.topbar {
  padding: 24px 32px 8px;
  text-align: center;
  position: relative;
}

.kids-nav-link {
  position: absolute;
  top: 20px;
  right: 24px;
  display: flex;
  gap: 8px;
}

.kids-nav-link a {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}

.kids-nav-link a:hover {
  border-color: var(--roblox-red);
}

@media (max-width: 480px) {
  .kids-nav-link {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
  }
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  color: var(--roblox-red);
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.search-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 32px 24px;
}

.search-bar input {
  width: 320px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 15px;
}

.search-bar button,
.catalog-search button {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--roblox-red);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.search-bar button:hover,
.catalog-search button:hover {
  filter: brightness(1.1);
}

#search-status {
  color: var(--muted);
  font-size: 13px;
  min-width: 120px;
}

.demo-btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.demo-btn:hover {
  border-color: var(--roblox-red);
}

.demo-banner {
  text-align: center;
  font-size: 13px;
  color: #f0b232;
  padding: 0 32px 12px;
}

.demo-banner:empty {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  padding: 0 32px 40px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-height: 180px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 999px;
}

.badge-auth {
  color: #f0b232;
  background: rgba(240,178,50,0.12);
}

.card-body {
  min-height: 60px;
  font-size: 13px;
}

.empty-hint:empty::before {
  content: attr(data-empty);
  color: var(--muted);
  font-style: italic;
}

.profile-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #000;
  object-fit: cover;
}

.big {
  font-size: 17px;
  font-weight: 600;
}

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

.small {
  font-size: 12px;
}

.description {
  margin: 10px 0 4px;
  white-space: pre-wrap;
  color: #c7cad1;
  max-height: 80px;
  overflow-y: auto;
}

.stat-row {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat span {
  font-size: 18px;
  font-weight: 700;
}

.stat label {
  font-size: 11px;
  color: var(--muted);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
}

.list li .name {
  font-weight: 600;
}

.list li .meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.item-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #000;
  object-fit: cover;
  flex-shrink: 0;
}

.item-thumb.round {
  border-radius: 50%;
}

.item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.item-name-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-name-link:hover {
  color: var(--roblox-red);
  text-decoration: underline;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-thumb {
  width: 160px;
  height: 160px;
  border-radius: 10px;
  background: #000;
  object-fit: cover;
  display: block;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.modal-creator {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.modal-stats .stat-box {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
}

.modal-stats .stat-box .value {
  font-size: 15px;
  font-weight: 700;
  display: block;
}

.modal-stats .stat-box .label {
  font-size: 11px;
  color: var(--muted);
}

.modal-description {
  font-size: 13px;
  color: #c7cad1;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  margin-bottom: 14px;
}

.modal-link {
  display: block;
  text-align: center;
  color: var(--roblox-red);
  font-size: 13px;
  text-decoration: none;
}

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

.thumb-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.thumb {
  width: 140px;
  height: 140px;
  border-radius: 8px;
  background: #000;
  object-fit: cover;
}

.thumb.small {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.presence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
}

.presence-friends-label {
  margin-top: 12px;
  margin-bottom: 6px;
}

.list .dot {
  width: 8px;
  height: 8px;
  margin-right: 6px;
}

.presence .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.online { background: #3ba55d; }
.dot.offline { background: #6b7280; }
.dot.ingame { background: #5865f2; }
.dot.studio { background: #f0b232; }

.catalog-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.catalog-search input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #12141a;
  color: var(--text);
}

.error-text {
  color: #f27272;
  font-size: 12px;
}

.auth-note {
  color: #f0b232;
  font-size: 12px;
}
