:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2f3f57;
  --text: #e8eef7;
  --muted: #93a4bd;
  --accent: #a855f7;
  --green: #5ba46b;
  --amber: #d4a017;
  --red: #c75b5b;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
.page { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }
.back { color: var(--accent); text-decoration: none; font-size: 0.85rem; }
.brand { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.logo {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.brand h1 { margin: 0; font-size: 1.5rem; }
.brand p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-top: 16px;
}
.panel h2 { margin: 0 0 8px; font-size: 1rem; }
label { display: block; font-size: 0.75rem; text-transform: uppercase; color: var(--muted); margin-top: 12px; }
input, select {
  width: 100%; padding: 10px 12px; margin-top: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font: inherit;
}
.search-wrap { position: relative; }
.suggestions {
  position: absolute; z-index: 10; top: 100%; left: 0; right: 0;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  list-style: none; margin: 4px 0 0; padding: 4px 0; max-height: 260px; overflow: auto;
}
.suggestions li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.suggestions li:hover { background: rgba(168,85,247,0.12); }
.suggestions img { width: 46px; height: 18px; border-radius: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.btn {
  margin-top: 16px; margin-right: 8px; padding: 10px 18px; border: none;
  border-radius: 8px; font: inherit; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600;
}
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.hint { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; }
.selected-game {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 10px; background: rgba(168,85,247,0.1); border-radius: 8px; border: 1px solid rgba(168,85,247,0.3);
}
.selected-game img { width: 80px; height: 30px; border-radius: 3px; }
.selected-game button {
  margin-left: auto; background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 1.2rem;
}
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.tab {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted); font: inherit; cursor: pointer; font-weight: 600; font-size: 0.85rem;
}
.tab.active { background: rgba(168,85,247,0.15); border-color: var(--accent); color: #c4b5fd; }
.profile-summary {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; font-size: 0.9rem; color: var(--muted);
}
.profile-summary strong { color: var(--text); }
.stats { margin-bottom: 12px; color: var(--muted); font-size: 0.9rem; }
.loading { text-align: center; padding: 32px; color: var(--muted); }
.hidden { display: none !important; }
.event-list { display: flex; flex-direction: column; gap: 12px; }
.event-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.event-card.high-match { border-color: rgba(168,85,247,0.5); box-shadow: 0 0 0 1px rgba(168,85,247,0.15); }
.view-toggle {
  display: flex; gap: 0; margin-top: 16px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; width: fit-content;
}
.view-btn {
  padding: 10px 20px; border: none; border-radius: 8px; font: inherit;
  cursor: pointer; font-weight: 600; font-size: 0.9rem;
  background: transparent; color: var(--muted);
}
.view-btn.active { background: var(--accent); color: #fff; }
.mode-banner {
  margin-top: 14px; padding: 12px 16px; border-radius: var(--radius);
  font-size: 0.9rem; line-height: 1.5; color: var(--muted);
  border: 1px solid var(--border);
}
.mode-browse { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.25); }
.mode-match { background: rgba(168,85,247,0.08); border-color: rgba(168,85,247,0.25); }
.mode-match.active-result { background: rgba(91,164,107,0.1); border-color: rgba(91,164,107,0.35); color: var(--text); }
.empty-state { color: var(--muted); text-align: center; padding: 32px 16px; font-size: 0.95rem; }
.advanced { margin-top: 14px; color: var(--muted); font-size: 0.85rem; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.profile-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.profile-label { color: var(--muted); font-size: 0.85rem; }
.profile-stage {
  font-size: 0.75rem; padding: 2px 8px; border-radius: 999px;
  background: rgba(168,85,247,0.2); color: #c4b5fd;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 0.75rem; padding: 3px 10px; border-radius: 999px;
  background: rgba(102,192,244,0.15); color: #8fd4ff;
}
.chip-tag { background: rgba(168,85,247,0.15); color: #c4b5fd; }
.score-wrap { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.score-bar {
  flex: 1; height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden;
  min-width: 72px;
}
.score-fill { height: 100%; border-radius: 999px; }
.score-fill.score-high { background: #5ba46b; }
.score-fill.score-mid { background: #d4a017; }
.score-fill.score-low { background: #6366f1; }
.score-num { font-size: 0.85rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.event-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.match-reason { font-size: 0.82rem; color: #8fd89a; margin: 0 0 10px; }
.badge-est { background: rgba(212,160,23,0.2); color: #f0c850; }
.event-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 4px; }
.event-top h3 { margin: 0; font-size: 1.05rem; flex: 1; min-width: 180px; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
}
.badge-steam { background: rgba(102,192,244,0.2); color: #8fd4ff; }
.badge-xbox { background: rgba(16,185,50,0.2); color: #6ee77a; }
.badge-nintendo { background: rgba(230,0,18,0.2); color: #ff6b7a; }
.badge-playstation { background: rgba(0,112,204,0.25); color: #6eb5ff; }
.badge-epic { background: rgba(200,200,200,0.15); color: #ddd; }
.badge-status-upcoming { background: rgba(91,164,107,0.2); color: #8fd89a; }
.badge-status-active { background: rgba(212,160,23,0.2); color: #f0c850; }
.badge-status-ongoing { background: rgba(168,85,247,0.2); color: #c4b5fd; }
.badge-status-deadline_passed { background: rgba(199,91,91,0.2); color: #f0a0a0; }
.badge-status-past { background: rgba(147,164,189,0.15); color: var(--muted); }
.badge-score { background: rgba(168,85,247,0.25); color: #d8b4fe; }
.event-summary { margin: 8px 0 12px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.event-dates {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px;
  font-size: 0.82rem; color: var(--muted); margin-bottom: 10px;
}
.event-dates span strong { display: block; color: var(--text); font-size: 0.85rem; }
.event-req { font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; }
.event-req strong { color: var(--text); }
.event-actions a {
  color: var(--accent); text-decoration: none; font-weight: 600; font-size: 0.85rem;
}
.event-actions a:hover { text-decoration: underline; }
