:root {
  --bg: #0e0e10;
  --surface: #18181b;
  --surface-2: #1f1f23;
  --border: #2c2c35;
  --text: #efeff1;
  --text-muted: #adadb8;
  --purple: #9147ff;
  --purple-soft: rgba(145, 71, 255, 0.18);
  --green: #00f593;
  --red: #f55353;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(1200px, 100% - 2.5rem);
  margin-inline: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1.15rem;
}

.brand strong { color: var(--purple); }
.brand-icon { width: 26px; height: 26px; color: var(--purple); }

/* Sidebar layout (events page) */
body.with-sidebar { flex-direction: row; }

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.1rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-nav { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 1.5rem; }

.side-section {
  margin: 1rem 0 0.25rem;
  padding-inline: 0.7rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.side-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}

.side-link:hover { color: var(--text); background: var(--surface-2); }
.side-link.active { color: var(--text); background: var(--surface-2); box-shadow: inset 3px 0 0 var(--purple); }

.main-col { flex: 1; min-width: 0; }
.container-fluid { padding: 0 1.75rem; }

.breadcrumb {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Header (badges page) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(14, 14, 16, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.header-nav { display: flex; gap: 0.25rem; }

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--purple); }

/* Page head */
.page-head { padding: 2rem 0 1.25rem; }
.page-head h1 { margin: 0 0 0.4rem; font-size: 2rem; font-weight: 800; }
.subtitle { margin: 0; color: var(--text-muted); }

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.3rem;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 0.8rem;
  border-radius: 7px;
  cursor: pointer;
}

.tab:hover { color: var(--text); }
.tab.active { background: var(--purple); color: #fff; }
.tab .count { opacity: 0.75; font-weight: 500; }

.search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 340px; }

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  translate: 0 -50%;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
}

#searchInput, #channelInput, #badgeSearchInput, #emoteSearchInput {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.85rem 0.6rem 2.4rem;
  font: inherit;
  font-size: 0.9rem;
}

#searchInput:focus, #channelInput:focus, #badgeSearchInput:focus, #emoteSearchInput:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

/* Channel badges page */
.quick-channels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.quick-label { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }

.quick-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.quick-chip:hover { border-color: var(--purple); color: var(--purple); }

.channel-heading { margin: 0 0 1rem; font-size: 1.2rem; font-weight: 800; color: var(--purple); }

/* Schedule timeline */
.schedule-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 2rem;
  overflow: hidden;
}

.schedule-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.schedule-head h2 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.78rem; color: var(--text-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-line { width: 3px; height: 14px; background: var(--red); border-radius: 2px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.live-dot { background: var(--purple); }
.upcoming-dot { background: rgba(145, 71, 255, 0.35); border: 1px dashed rgba(145,71,255,0.6); }
.ended-dot { background: #5c5c66; }

.timeline-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a2a30 var(--bg);
}
.timeline-scroll::-webkit-scrollbar {
  height: 10px;
}
.timeline-scroll::-webkit-scrollbar-track {
  background: var(--bg);
}
.timeline-scroll::-webkit-scrollbar-thumb {
  background: #2a2a30;
  border-radius: 10px;
  border: 2px solid var(--bg);
}
.timeline-scroll::-webkit-scrollbar-thumb:hover {
  background: #3a3a42;
}

.timeline { position: relative; min-height: 160px; }

.day-col {
  position: absolute;
  top: 0;
  bottom: 0;
  border-right: 1px solid var(--border);
}

.day-col.today { background: rgba(145, 71, 255, 0.06); }

.day-label {
  display: block;
  padding: 0.8rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.day-col.today .day-label { color: var(--purple); }

.event-bar {
  position: absolute;
  text-decoration: none;
  align-items: flex-start;
  height: 48px;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  cursor: default;
}

.event-bar.live { background: var(--purple); color: #fff; box-shadow: 0 0 0 1px rgba(145, 71, 255, 0.7); }
.event-bar.upcoming { background: rgba(145, 71, 255, 0.22); color: rgba(255,255,255,0.65); border: 1px dashed rgba(145,71,255,0.5); }
.event-bar.ended { background: #3a3a44; color: var(--text-muted); }
.event-bar:hover { filter: brightness(1.15); cursor: pointer; }

.bar-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: max-content;
  max-width: 100%;
  overflow: hidden;
}

.bar-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: rgba(255,255,255,0.12);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
}

.bar-badge img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: contain;
}

.bar-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: max-content;
  max-width: 100%;
}

.bar-title {
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-sub {
  font-size: 0.7rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red);
  z-index: 2;
  pointer-events: none;
}

/* Badge detail page */
.detail-heading {
  margin: 0 0 1.5rem;
  font-size: 1.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

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

.size-previews {
  display: flex;
  align-items: flex-end;
  gap: 2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.size-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.size-wrap span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.badge-preview-1 { width: 18px; height: 18px; }
.badge-preview-2 { width: 36px; height: 36px; }
.badge-preview-4 { width: 72px; height: 72px; }

.detail-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-field {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.detail-label {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.detail-value {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
}

.detail-link {
  color: var(--purple);
  text-decoration: none;
  word-break: break-all;
}
.detail-link:hover { text-decoration: underline; }

.section-heading {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.avail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  margin-bottom: 1rem;
}

.avail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.avail-chip {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.avail-chip.muted { color: var(--text-muted); }

.avail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
}

.avail-row { border-top: 1px solid var(--border); padding-top: 0.6rem; }

.ctx-section { margin-top: 1rem; }
.ctx-body { margin: 0; font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); }

/* Make badge-tile work as <a> */
a.badge-tile {
  display: block;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
}

a.badge-tile:hover { transform: translateY(-3px); border-color: var(--purple); }
a.badge-tile[hidden] { display: none; }

/* Home preview panels */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 3.5rem 1.2rem 1.3rem;
  margin-bottom: 1rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.preview-panel:hover { border-color: var(--purple); background: var(--surface-2); }

.preview-text h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.preview-text p {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.preview-row { display: flex; gap: 0.7rem; align-items: center; min-height: 56px; }
.preview-row img { width: 56px; height: 56px; border-radius: 8px; object-fit: contain; }
.preview-loading { color: var(--text-muted); font-size: 0.85rem; }

.preview-arrow {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  translate: 0 -50%;
  font-size: 1.6rem;
  color: var(--text);
}

/* Live badge tiles (badges page) */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.9rem;
  padding-bottom: 3rem;
}

.badge-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.badge-tile:hover { transform: translateY(-3px); border-color: var(--purple); }
.badge-tile img { width: 56px; height: 56px; }

.badge-title {
  margin: 0.6rem 0 0.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.badge-set {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 0;
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 760px) {
  body.with-sidebar { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-section { display: none; }
  .controls { flex-direction: column; align-items: stretch; }
  .search-wrap { max-width: none; }
  .tabs { overflow-x: auto; }
}

/* --- Home page social cards --- */
.social-section { margin-bottom: 28px; }
.social-heading { font-size: 20px; font-weight: 800; margin: 0 0 4px; }
.social-sub { color: var(--text-muted); margin: 0 0 14px; font-size: 14px; }
.social-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.social-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
  min-width: 220px;
  transition: filter 0.15s, transform 0.15s;
}
.social-card:hover { filter: brightness(1.12); transform: translateY(-2px); }
.social-card.twitch { background: #9147ff; }
.social-card.discord { background: #5865f2; }
.social-icon { width: 34px; height: 34px; flex-shrink: 0; }
.social-text { display: flex; flex-direction: column; line-height: 1.25; }
.social-text strong { font-size: 17px; font-weight: 800; }
.social-text span { font-size: 13px; opacity: 0.85; }

/* Where-to-earn link on badge detail page */
.where-earn { margin: 10px 0 14px; }
.where-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--purple);
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--purple);
  border-radius: 8px;
  padding: 7px 14px;
}
.where-link:hover { background: var(--purple); color: #fff; }

/* Jump-to-now button */
.jump-now-btn {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.jump-now-btn:hover { background: var(--red); color: #fff; }

/* Now-line clickable */
.now-line { cursor: pointer; }

/* Current Time legend item — clickable to jump to now */
.legend-now-link {
  cursor: pointer;
  text-decoration: underline dotted;
  color: var(--text-muted);
  transition: color 0.15s;
}
.legend-now-link:hover { color: var(--red); }

/* Footer credit link */
.footer-link { color: var(--purple); font-weight: 700; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }
