:root{
  /* Токены: styles/coobo/tokens.css (--coobo-*). Ниже — только хаб. */
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:Inter,system-ui,-apple-system,Segoe UI,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 520px at 88% -6%,var(--coobo-bg-accent),transparent 58%),
    var(--bg);
}

[data-coobo-theme="light"] body{
  background:
    radial-gradient(900px 520px at 88% -6%,var(--coobo-bg-accent),transparent 58%),
    linear-gradient(180deg,#f4f6fa 0%,var(--bg) 40%);
}

.layout{
  width:min(1120px,92vw);
  margin:28px auto 56px;
  display:grid;
  gap:16px;
}

.layout--hub{
  width:100%;
  max-width:none;
  margin:28px 0 56px;
  padding:0;
  gap:20px;
}

.layout__inner{
  width:min(1120px,92vw);
  margin:0 auto;
  display:grid;
  gap:16px;
}

.card{
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--surface);
  padding:18px;
}

.hero h1{
  margin:0;
  font-size:clamp(30px,5.4vw,54px);
  line-height:1.04;
}
.kicker{
  margin:0 0 8px;
  color:var(--accent);
  letter-spacing:.11em;
  font-size:12px;
  text-transform:uppercase;
}
.lead{
  margin:10px 0 0;
  color:var(--muted);
  max-width:780px;
}
.hero-actions{
  margin-top:14px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.hint{
  margin:10px 0 0;
  color:var(--muted);
  font-size:14px;
}

.btn{
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px 14px;
  font:inherit;
  font-weight:700;
  cursor:pointer;
  background:transparent;
  color:var(--text);
}
.btn-accent{
  background:var(--accent);
  border-color:var(--accent);
  color:#111;
}
.btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.btn-ghost{
  border-color:color-mix(in oklab,var(--accent) 38%,var(--line));
}

.stats-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
}
.stat-label{
  margin:0;
  color:var(--muted);
  font-size:13px;
}
.stat-value{
  margin:8px 0 0;
  font-size:30px;
  font-weight:800;
  letter-spacing:-.02em;
}

.controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.controls__right{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px;
}
.filters{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.chip{
  border:1px solid var(--line);
  border-radius:999px;
  padding:7px 12px;
  background:transparent;
  color:var(--text);
  cursor:pointer;
}
.chip.is-active{
  border-color:var(--accent);
  color:var(--accent);
}
.sort-wrap{
  color:var(--muted);
  font-size:14px;
}
.sort-wrap select{
  margin-left:8px;
  border:1px solid var(--line);
  border-radius:8px;
  background:color-mix(in oklab, var(--surface) 88%, var(--bg));
  color:var(--coobo-on-surface, var(--text));
  padding:7px 10px;
}

.games-catalog{
  width:100%;
  padding:0 clamp(12px,3vw,40px);
}

.games-order-hint{
  margin:0 auto 12px;
  width:min(1120px,92vw);
  max-width:100%;
  padding:0 4px;
  color:var(--muted);
  font-size:13px;
  text-align:center;
}

.games-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(var(--hub-card-w,296px),var(--hub-card-w,296px)));
  justify-content:center;
  gap:14px;
  width:100%;
  max-width:none;
  margin:0 auto;
}

.game-card{
  width:var(--hub-card-w,296px);
  max-width:100%;
  min-height:100%;
  display:flex;
  flex-direction:column;
}

.game-card .game-desc{
  flex:1;
}

.game-card--draggable{
  cursor:grab;
  position:relative;
}

.game-card--draggable:active{
  cursor:grabbing;
}

.game-card.is-dragging{
  opacity:.55;
  border-color:var(--accent);
  box-shadow:0 12px 40px rgba(0,0,0,.35);
}

.game-card.is-drag-over{
  outline:2px dashed color-mix(in oklab,var(--accent) 55%,var(--line));
  outline-offset:3px;
}

.game-card__grip{
  display:inline-block;
  width:14px;
  height:18px;
  margin-right:6px;
  flex-shrink:0;
  opacity:.45;
  background:
    radial-gradient(circle,var(--muted) 1.5px,transparent 1.6px) 0 2px/7px 6px,
    radial-gradient(circle,var(--muted) 1.5px,transparent 1.6px) 0 2px/7px 6px;
  background-position:0 0, 7px 0;
  background-size:7px 6px;
  background-repeat:repeat-y;
}

.coobo-hub-admin .game-card__grip{
  opacity:.75;
}
.game-card h3{
  margin:8px 0 8px;
  font-size:24px;
}
.card-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.card-top .game-type{
  display:flex;
  align-items:center;
  min-width:0;
}
.game-type{
  margin:0;
  color:var(--accent);
  font-weight:700;
  font-size:12px;
  letter-spacing:.08em;
  text-transform:uppercase;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.game-catalog{
  font-family:ui-monospace,Consolas,monospace;
  font-size:11px;
  letter-spacing:.04em;
  color:var(--text);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:6px;
  padding:2px 6px;
  text-transform:none;
  font-weight:600;
}
.tags{display:flex;gap:6px;flex-wrap:wrap}
.tag{
  font-size:11px;
  color:var(--muted);
  border:1px solid var(--line);
  border-radius:999px;
  padding:3px 8px;
}
.game-desc{
  margin:0;
  color:var(--muted);
  line-height:1.45;
}
.game-meta{
  margin:8px 0 12px;
  color:var(--muted);
  font-size:13px;
}
.card-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.btn-card-settings{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  padding:8px 12px;
}
.btn-card-settings .coobo-ico{
  width:16px;
  height:16px;
  color:var(--accent);
}
.is-locked{
  opacity:.92;
}

.meta-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
.meta-grid h2{
  margin:0 0 10px;
  font-size:22px;
}
.simple-list{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:8px;
}
.simple-list li{
  border:1px solid color-mix(in oklab,var(--line) 88%,transparent);
  border-radius:10px;
  padding:9px 10px;
  color:var(--muted);
}
.simple-list li.ok{
  border-color:color-mix(in oklab,var(--accent) 45%,var(--line));
  color:var(--text);
}

.toast{
  position:fixed;
  right:14px;
  bottom:14px;
  border:1px solid color-mix(in oklab,var(--accent) 45%,var(--line));
  border-radius:10px;
  background:var(--coobo-chrome-bg);
  color:var(--coobo-chrome-text);
  padding:10px 12px;
  opacity:0;
  transform:translateY(6px);
  transition:opacity .2s ease, transform .2s ease;
  pointer-events:none;
}
.toast.show{
  opacity:1;
  transform:translateY(0);
}

/* Приветствие при входе на хаб */
.hub-welcome{
  position:fixed;
  inset:0;
  z-index:50;
  display:grid;
  place-items:center;
  padding:max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.hub-welcome[hidden]{
  display:none;
}
.hub-welcome__backdrop{
  position:absolute;
  inset:0;
  background:rgba(8,10,14,.72);
  backdrop-filter:blur(4px);
}
.hub-welcome__card{
  position:relative;
  width:min(440px, 94vw);
  margin:0;
  box-shadow:0 24px 64px rgba(0,0,0,.45);
  border-color:color-mix(in oklab,var(--accent) 28%,var(--line));
}
.hub-welcome__title{
  margin:0;
  font-size:clamp(22px,4.5vw,28px);
  line-height:1.15;
}
.hub-welcome__lead{
  margin:12px 0 0;
  color:var(--muted);
  font-size:15px;
  line-height:1.5;
}
.hub-welcome__stats{
  margin:14px 0 0;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--line);
  background:color-mix(in oklab, var(--coobo-chrome-bg) 88%, transparent);
  color:var(--coobo-chrome-text);
  font-size:14px;
  line-height:1.45;
}
.hub-welcome__actions{
  margin-top:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
  align-items:flex-start;
}
.hub-welcome__skip{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size:13px;
  cursor:pointer;
  user-select:none;
}
.hub-welcome__skip input{
  accent-color:var(--accent);
}

/* Скрытый вход в админ-режим хаба (ПК / мобилка) */
#btnAdminSettings{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
#btnAdminSettings .coobo-ico{
  width:16px;
  height:16px;
}
.hub-admin-nub{
  position:fixed;
  left:50%;
  bottom:max(10px, env(safe-area-inset-bottom, 10px));
  transform:translateX(-50%);
  width:44px;
  height:44px;
  padding:0;
  margin:0;
  border:0;
  background:transparent;
  cursor:pointer;
  z-index:40;
  -webkit-tap-highlight-color:transparent;
  display:flex;
  align-items:center;
  justify-content:center;
}
.hub-admin-nub::after{
  content:"";
  width:11px;
  height:11px;
  border-radius:50%;
  background:#94a3b8;
  opacity:0.5;
  box-shadow:0 0 0 1px rgba(148,163,184,0.3);
}
.hub-admin-nub:hover::after,
.hub-admin-nub:focus-visible::after{
  opacity:0.85;
}
.hub-admin-nub:focus-visible{
  outline:2px solid rgba(148,163,184,0.5);
  outline-offset:2px;
}

/* Аккаунт COOBO */
.coobo-auth-mount{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-right:4px;
}
.btn-sm{
  padding:8px 14px;
  font-size:13px;
  min-height:36px;
}
.coobo-auth-user{
  display:inline-flex;
  align-items:center;
  padding:6px 12px;
  border-radius:var(--coobo-radius-pill, 999px);
  border:1px solid var(--line);
  background:color-mix(in oklab, var(--surface) 90%, var(--bg));
  font-size:13px;
  font-weight:600;
  color:var(--accent);
}
.coobo-auth{
  position:fixed;
  inset:0;
  z-index:90;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.coobo-auth[hidden]{
  display:none;
}
.coobo-auth__backdrop{
  position:absolute;
  inset:0;
  background:rgba(8,10,14,0.72);
  backdrop-filter:blur(6px);
}
.coobo-auth__card{
  position:relative;
  width:min(420px, 100%);
  max-height:min(92vh, 720px);
  overflow:auto;
  text-align:left;
}
.coobo-auth__title{
  margin:0 0 12px;
  font-size:22px;
}
.coobo-auth__tabs{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.coobo-auth__tab{
  border:1px solid var(--line);
  border-radius:var(--coobo-radius-pill, 999px);
  padding:5px 12px;
  background:transparent;
  color:var(--muted);
  font:inherit;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
}
.coobo-auth__tab.is-active{
  border-color:var(--accent);
  color:var(--accent);
}
.coobo-auth__panel{
  display:none;
  flex-direction:column;
  gap:10px;
}
.coobo-auth__panel.is-active{
  display:flex;
}
.coobo-auth__field{
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:13px;
}
.coobo-auth__field span{
  color:var(--muted);
  font-size:12px;
}
.coobo-auth__field input{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:color-mix(in oklab, var(--surface) 88%, var(--bg));
  color:var(--coobo-on-surface, var(--text));
  font:inherit;
}
.coobo-auth__hint-block{
  margin:4px 0 0;
  font-size:12px;
  font-weight:700;
  color:var(--text);
}
.coobo-auth__hint-block em{
  font-weight:400;
  color:var(--muted);
}
.coobo-auth__note{
  margin:0;
  font-size:11px;
  color:var(--muted);
  line-height:1.45;
}
.coobo-auth__error{
  margin:0 0 10px;
  padding:8px 10px;
  border-radius:8px;
  background:rgba(225,29,72,0.12);
  color:#fda4af;
  font-size:13px;
}
.coobo-auth__error[hidden]{
  display:none;
}
.coobo-auth__close{
  margin-top:14px;
  width:100%;
}

@media (max-width:980px){
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .meta-grid{grid-template-columns:1fr}
}

@media (max-width:720px){
  .layout--hub{margin-top:16px}
  .layout__inner{width:94vw}
  .games-catalog{padding:0 3vw}
  .card{padding:14px}
  .hero-actions .btn{min-height:42px}
  .stat-value{font-size:26px}
}