:root {
  --bg: #090b0a;
  --bg-alt: #0c0f0d;
  --surface: #0f1311;
  --surface-2: #141916;
  --surface-3: #1a211d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #edf2ef;
  --text-dim: #9aa69f;
  --text-muted: #68746d;
  --emerald: #10b981;
  --signal: #00e58b;
  --warn: #fbbf24;
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);
  --danger-line: rgba(239, 68, 68, 0.36);
  --font-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 6px;
  --hub-accent: #10b981;
  --hub-accent-hi: #00e58b;
  --hub-glow: rgba(16, 185, 129, 0.14);
  --hub-bg: #090b0a;
  --hub-card: #0f1311;
  --hub-font: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  background: var(--hub-bg);
  color: var(--text);
  overflow-x: hidden;
}

body.portal-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--hub-font), var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  background: var(--hub-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font-family: inherit;
}

:is(a, button, input):focus-visible {
  outline: 2px solid var(--hub-accent-hi);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: min(100%, 1440px);
  margin-inline: auto;
  padding-inline: clamp(16px, 2.5vw, 48px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: rgba(9, 11, 10, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-in {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  min-width: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #06120c;
  background: var(--hub-accent-hi);
  border-radius: 4px;
  flex-shrink: 0;
}

.brand-text {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-slug {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--hub-accent-hi);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.15s ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--hub-accent-hi);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
}

.btn-xs {
  height: 30px;
  padding: 0 11px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.btn-primary {
  background: var(--hub-accent);
  color: #06120c;
  border-color: var(--hub-accent);
}

.btn-primary:hover:not([disabled]) {
  filter: brightness(1.1);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-ghost:hover:not([disabled]) {
  background: var(--surface-2);
  border-color: rgba(255, 255, 255, 0.25);
}

.portal-shell {
  flex: 1 0 auto;
  width: 100%;
  max-width: min(100%, 1440px);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 52px) clamp(16px, 2.5vw, 48px) 64px;
}

.portal-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 3.5vw, 48px);
  align-items: start;
  margin-bottom: 48px;
}

.portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--hub-accent-hi);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hub-accent-hi);
  display: inline-block;
  flex-shrink: 0;
}

.portal-title {
  margin: 0 0 8px;
  font-size: clamp(32px, 4.2vw, 50px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.portal-sub {
  color: var(--hub-accent-hi);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
}

.portal-bio {
  color: var(--text-dim);
  font-size: 15.5px;
  max-width: 560px;
  margin: 14px 0 24px;
  line-height: 1.65;
}

.portal-loader-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--hub-accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.portal-loader-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--hub-accent-hi);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  font-weight: 700;
}

.portal-loader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-loader-row code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  word-break: break-all;
  flex: 1;
  min-width: 180px;
}

.tok-kw { color: #10b981; font-weight: 700; }
.tok-gl { color: #7ee7b8; }
.tok-fn { color: #00e58b; }
.tok-str { color: #d6c58a; }

.portal-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.portal-stat-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.portal-stat-box b {
  display: block;
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
}

.portal-stat-box span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 3px;
}

.portal-card {
  background: var(--hub-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
}

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

.cp-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cp-progress-wrap {
  width: 100%;
  height: 5px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0 18px;
}

.cp-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--hub-accent-hi);
  transition: width 0.3s ease;
}

.cp-dots {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
}

.cp-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cp-dot.done {
  background: var(--hub-accent);
  border-color: var(--hub-accent-hi);
}

.cp-dot.active {
  border-color: var(--hub-accent-hi);
  background: var(--surface-2);
}

.cp-dot-key {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-muted);
}

.cp-dot-key svg {
  width: 13px;
  height: 13px;
}

.cp-dot-key.done {
  background: var(--hub-accent);
  border-color: var(--hub-accent-hi);
  color: #06120c;
}

.cp-msg {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 14px 0 18px;
  line-height: 1.55;
}

.cp-msg.is-ok {
  color: var(--hub-accent-hi);
}

.cp-msg.is-err {
  color: #fca5a5;
}

.cp-providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cp-prov-skeleton {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 6px 2px;
}

.cp-prov-prompt {
  color: var(--hub-accent-hi);
}

.cp-prov-btn {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 13px 15px;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cp-prov-btn:hover:not([disabled]) {
  border-color: var(--hub-accent-hi);
  background: var(--surface-3);
}

.cp-prov-btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.cp-prov-ic {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 5px;
  background: #0a0d0b;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--hub-accent-hi);
}

.cp-prov-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.cp-prov-tx {
  flex: 1;
  min-width: 0;
}

.cp-prov-tx b {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
}

.cp-prov-tx span {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.cp-prov-arrow {
  color: var(--hub-accent-hi);
  font-size: 16px;
  font-weight: 700;
}

.btn-portal {
  background: var(--hub-accent);
  color: #06120c;
  border: 1px solid var(--hub-accent-hi);
  font-weight: 700;
  cursor: pointer;
  padding: 13px 20px;
  border-radius: var(--radius);
  font-size: 14.5px;
  width: 100%;
  margin-top: 12px;
  transition: filter 0.15s ease;
}

.btn-portal:hover:not([disabled]) {
  filter: brightness(1.1);
}

.btn-portal[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.key-box-reveal {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--hub-accent);
}

.key-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

.key-timer {
  color: var(--hub-accent-hi);
}

.key-code-display {
  font-family: var(--font-mono);
  font-size: clamp(17px, 2.8vw, 22px);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--hub-accent-hi);
  word-break: break-all;
  margin: 10px 0 10px;
}

.key-script-box {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #090b0a;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: #dbe7df;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

.key-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.games-sec-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.games-title {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.games-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.preset-chip:hover,
.preset-chip.active {
  color: var(--hub-accent-hi);
  border-color: var(--hub-accent-hi);
  background: var(--surface-2);
}

.game-search-input {
  width: 240px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.game-search-input:focus {
  outline: none;
  border-color: var(--hub-accent-hi);
}

.games-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.hub-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.game-item-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color 0.15s ease;
  overflow: hidden;
}

.game-item-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--hub-accent);
}

.game-item-card.mode-free::before {
  background: var(--warn);
}

.game-item-card:hover {
  border-color: var(--line-strong);
}

.game-item-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
}

.game-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-live-tag {
  position: absolute;
  left: 4px;
  bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  background: rgba(9, 11, 10, 0.85);
  padding: 2px 6px;
  border-radius: 4px;
}

.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--hub-accent-hi);
  display: inline-block;
}

.game-item-info {
  flex: 1;
  min-width: 0;
}

.game-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.game-item-name {
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.game-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.badge-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-players {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--hub-accent-hi);
  font-weight: 600;
}

.game-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 11px;
  flex-wrap: wrap;
}

.game-mini-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 4px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  transition: color 0.14s ease, border-color 0.14s ease;
  display: inline-flex;
  align-items: center;
}

.game-mini-btn:hover {
  color: var(--text);
  border-color: var(--hub-accent-hi);
}

.game-mini-link {
  color: var(--hub-accent-hi);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-locked {
  color: var(--hub-accent-hi);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
}

.status-free {
  color: var(--warn);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.portal-footer {
  margin-top: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.portal-footer-in {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.portal-footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-footer-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.portal-footer-sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

.portal-footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 1024px) {
  .portal-hero-grid,
  .games-list-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .nav-links,
  .brand-slug {
    display: none;
  }

  .portal-stats-row {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .games-controls,
  .game-search-input {
    width: 100%;
  }

  .portal-footer-in {
    padding: 18px;
  }
}
