:root {
  color-scheme: dark;
  --bg: #070b18;
  --surface: rgba(15, 22, 44, 0.78);
  --surface-strong: rgba(20, 29, 58, 0.92);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #b8c4d9;
  --gold: #ffd54f;
  --cyan: #5ce1e6;
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 14%, rgba(92, 225, 230, 0.14), transparent 42%),
    radial-gradient(circle at 82% 20%, rgba(255, 213, 79, 0.12), transparent 44%),
    radial-gradient(circle at 50% 85%, rgba(167, 139, 250, 0.10), transparent 50%);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  margin: 0 auto;
  padding:
    max(28px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(48px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.site-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.site-pill {
  background: rgba(255, 213, 79, 0.16);
  border: 1px solid rgba(255, 213, 79, 0.42);
  color: var(--gold);
}

.count-pill {
  background: rgba(92, 225, 230, 0.14);
  border: 1px solid rgba(92, 225, 230, 0.32);
  color: var(--cyan);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-wrap: balance;
  background: linear-gradient(135deg, #ffffff 12%, #ffd54f 58%, #5ce1e6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 0;
  max-width: 68ch;
  font-size: clamp(0.95rem, 2vw, 1.06rem);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

.toolbar {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 15px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
}

.filter-btn.active {
  background: rgba(92, 225, 230, 0.18);
  border-color: rgba(92, 225, 230, 0.65);
  color: #ffffff;
}

.search-wrap {
  flex: 1 1 240px;
  max-width: 340px;
}

.search-wrap input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.search-wrap input::placeholder {
  color: #8896b3;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  margin: 0 0 14px;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.dir-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 18px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent, var(--cyan));
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.44);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-meta {
  min-width: 0;
}

.card-meta h3 {
  margin: 0 0 3px;
  font-size: 1.22rem;
  font-weight: 800;
}

.card-tagline {
  margin: 0;
  font-size: 0.84rem;
  color: var(--accent, var(--cyan));
  font-weight: 600;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #dbe4f3;
}

.card-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.52;
  color: var(--muted);
  text-wrap: pretty;
  flex: 1;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.password-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 213, 79, 0.12);
  border: 1px solid rgba(255, 213, 79, 0.42);
  color: #fef3c7;
  font-size: 0.84rem;
  font-weight: 700;
}

.password-pill code {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--gold);
}

.quick-pw {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 213, 79, 0.14);
  border: 1px solid rgba(255, 213, 79, 0.36);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

.play-btn,
.sec-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.86rem;
  transition: filter 0.15s ease, transform 0.12s ease;
}

.play-btn {
  padding: 10px 18px;
  background: var(--accent, var(--gold));
  color: #091020;
}

.sec-link {
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.play-btn:hover,
.sec-link:hover {
  filter: brightness(1.07);
}

/* Quick Link Directory */
.quick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.quick-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(130px, 0.9fr) minmax(200px, 2fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.quick-row:last-child {
  border-bottom: 0;
}

.quick-name {
  font-weight: 800;
  color: var(--text);
}

.quick-platform {
  font-size: 0.8rem;
  color: var(--muted);
}

.quick-url {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--cyan);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-url:hover {
  text-decoration: underline;
}

.copy-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.empty-msg {
  padding: 24px;
  text-align: center;
  border-radius: 16px;
  border: 1px dashed var(--border);
  color: var(--muted);
}

.hidden {
  display: none;
}

.footer {
  padding-top: 8px;
  font-size: 0.82rem;
  color: #8b98b3;
}

.footer code {
  color: var(--gold);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid rgba(92, 225, 230, 0.55);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .quick-row {
    grid-template-columns: 1fr auto;
    row-gap: 4px;
  }

  .quick-platform {
    grid-column: 1 / -1;
  }

  .quick-url {
    grid-column: 1 / 2;
  }

  .copy-btn {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
