/* Portal hub — five130.space / */
:root {
  --bg: #12352c;
  --bg2: #0c241e;
  --felt: #164536;
  --text: #f5f0e6;
  --muted: rgba(245, 240, 230, 0.72);
  --accent: #c9a227;
  --accent-dim: rgba(201, 162, 39, 0.22);
  --line: rgba(245, 240, 230, 0.12);
  --card: rgba(20, 48, 40, 0.92);
  --danger: #ff8a9a;
  /* Was 720px; +40% shell for manifesto / header / tabs */
  --app-max: 1008px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  font-family: "Segoe UI", "PT Sans", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(201, 162, 39, 0.14), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(59, 130, 246, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}
a { color: var(--accent); }
button { font: inherit; }

.wrap {
  width: 100%;
  max-width: min(calc(100% - 32px), var(--app-max));
  margin: 0 auto;
  /* Tighter top so brand+tabs sit higher, level with auth row */
  padding: 4px 16px 48px;
}

/* Hub header: desktop brand LEFT · auth+wallet RIGHT; each in own flow box (no absolute) */
.hub-header {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 8px;
  width: 100%;
  max-width: 100%;
}
.hub-header .brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  flex: 1 1 14rem;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  /* Optical match with #portal-auth-bar padding + button mid-line */
  padding-top: 6px;
}
.hub-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 6px;
  flex: 1 1 16rem;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
}
.hub-header #portal-auth-bar {
  margin: 0;
  padding: 4px 10px;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}
.hub-header #portal-auth-bar .pab-actions {
  margin-left: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
}
/* Header scores: always shown (right). Never couple to About-panel hide. */
.hub-header #hub-wallet.wallet {
  display: flex;
  margin: 0;
  padding: 6px 12px;
  width: auto;
  max-width: 100%;
  justify-content: flex-end;
  box-sizing: border-box;
}
.hub-header #hub-wallet.wallet[hidden] {
  display: flex !important;
}
.hub-header .wallet .prem {
  margin-left: 8px;
}
.brand .name {
  font-size: clamp(1.45rem, 5vw, 2.05rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffe08a;
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.brand .tag {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 28rem;
  line-height: 1.4;
}

.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.tabs button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font-weight: 700;
}
.tabs button.on {
  color: #1a1408;
  background: linear-gradient(180deg, #ffe08a, var(--accent));
  border-color: rgba(255, 220, 120, 0.7);
}

.panel { display: none; }
.panel.on { display: block; }

.wallet {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: center;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  font-size: 0.9rem;
}
.wallet .guest { color: var(--muted); }
.wallet .dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.dot-red { background: #e85d5d; }
.dot-blue { background: #4a8fe8; }
.dot-yellow { background: #e6b422; }
.wallet .prem {
  margin-left: auto;
  font-weight: 800;
  color: #ffe08a;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wallet .prem.off { color: var(--muted); font-weight: 600; }

.games {
  display: flex; flex-direction: column; gap: 12px;
}
.game-card {
  background: var(--card);
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}
.game-card h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #ffe08a;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
}
.game-card .game-title { font-weight: 800; }
.game-card .game-status-mark {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: #1a1408;
  background: #e8b84a;
  border: 1px solid rgba(26, 20, 8, 0.25);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  vertical-align: middle;
}
.game-card .game-bot {
  font-size: 0.82rem;
  font-weight: 700;
  color: #9fd6ff;
  text-decoration: none;
  white-space: nowrap;
}
.game-card .game-bot:hover { text-decoration: underline; color: #c8e9ff; }
.game-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  flex: 0 1 auto; /* не раздувать пояснение — кнопки остаются сверху свободного места */
}
.game-card .open-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 72px;
  margin-top: 0; /* кнопки сразу под пояснением, не прижаты к низу бокса */
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffe08a 0%, var(--accent) 45%, #b8860b 100%);
  color: #1a1408;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  padding: 20px 16px;
  text-decoration: none;
  box-sizing: border-box;
}
.game-card .open-btn:active { transform: scale(0.98); }
.game-card .open-btn:disabled,
.game-card .open-btn[aria-disabled="true"] {
  opacity: 0.45;
  filter: grayscale(0.35);
  cursor: not-allowed;
  pointer-events: none;
}
.game-card .open-btn:disabled:active,
.game-card .open-btn[aria-disabled="true"]:active {
  transform: none;
}
.game-card-alert {
  color: #e85d5d;
  font-weight: 700;
}
.game-card p a {
  color: #9fd6ff;
  font-weight: 700;
  text-decoration: none;
}
.game-card p a:hover { text-decoration: underline; color: #c8e9ff; }

.about, .profile-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px 16px;
  line-height: 1.45;
  color: var(--muted);
  font-size: 0.95rem;
}
.about h2, .profile-body h2 {
  margin: 0 0 10px;
  color: #ffe08a;
  font-size: 1.1rem;
}
.about ul { margin: 8px 0 0; padding-left: 1.2rem; }

/* Manifesto is the sole about content — no redundant section title / divider */
.about .manifesto {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.about .manifesto .manifesto-title {
  margin: 0 0 10px;
  color: #ffe08a;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}
.about .manifesto-body {
  margin: 0;
  color: var(--text, #f2efe6);
  /* ~30% larger than .about 0.95rem; slightly roomier line-height */
  font-size: 1.235rem;
  line-height: 1.65;
}
.about .manifesto-body p {
  margin: 0 0 0.95em;
}
.about .manifesto-body p:last-child {
  margin-bottom: 0;
}
.about .manifesto-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.about .manifesto-body a:hover {
  color: #ffe08a;
}

.footer {
  margin-top: 28px;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

/* Board-size modal */
#board-modal {
  display: none;
  position: fixed; inset: 0; z-index: 40;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 16px;
}
#board-modal.open { display: flex; }
#board-modal .card {
  width: min(400px, 100%);
  background: #1e3f34;
  border: 2px solid rgba(232, 197, 71, 0.75);
  border-radius: 14px;
  padding: 16px;
}
#board-modal h2 {
  margin: 0 0 8px;
  color: #ffe08a;
  font-size: 1.15rem;
}
#board-modal .hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}
.modal-choice-list {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%;
}
.modal-choice-list .choice {
  display: flex; width: 100%; box-sizing: border-box;
  align-items: center; justify-content: center;
  min-height: 72px; padding: 20px 16px;
  border-radius: 12px; border: none;
  background: var(--accent); color: #1a1408;
  font-size: 1.15rem; font-weight: 800; cursor: pointer;
}
#board-modal .cancel {
  display: block; width: 100%; margin-top: 12px;
  background: transparent; border: none;
  color: var(--muted); padding: 12px; cursor: pointer;
  font-size: 0.95rem;
}

/* ——— Phone / narrow: compact hub layout (no horizontal scroll) ——— */
@media (max-width: 640px) {
  .wrap {
    max-width: 100%;
    padding: 4px 10px 32px;
  }

  /* Stack: brand → auth → points (no shared row — prevents title/CTA overflow overlap) */
  .hub-header {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 6px;
    width: 100%;
    max-width: 100%;
  }
  .hub-header .brand {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    padding-top: 0;
    min-width: 0;
  }
  .hub-header .brand .name {
    font-size: clamp(1.1rem, 5vw, 1.35rem);
    letter-spacing: 0.02em;
  }
  .hub-header .brand .tag {
    font-size: 0.82rem;
  }
  .hub-header-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    flex: 0 0 auto;
    gap: 6px;
  }
  .hub-header #portal-auth-bar {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 6px 8px;
    gap: 4px 6px;
    font-size: 0.8rem;
    justify-content: flex-end;
    align-items: flex-start;
    align-content: flex-start;
    height: auto;
    overflow: visible;
  }
  .hub-header #portal-auth-bar .pab-left {
    display: none; /* status label — buttons are enough on phone */
  }
  .hub-header #portal-auth-bar .pab-actions {
    margin-left: 0;
    gap: 4px 6px;
    width: 100%;
    justify-content: flex-end;
  }
  .hub-header #portal-auth-bar .pab-our-bots {
    font-size: 0.72rem;
    padding: 2px 1px;
  }
  .hub-header #portal-auth-bar .pab-actions button {
    padding: 5px 9px;
    font-size: 0.78rem;
    border-radius: 8px;
    min-height: 36px;
  }
  .hub-header #hub-wallet.wallet {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 6px 10px;
    justify-content: flex-start;
    gap: 8px 12px;
    font-size: 0.85rem;
  }
  .hub-header .wallet .prem {
    margin-left: auto;
  }

  .tabs {
    gap: 4px;
    margin: 0 0 8px;
    padding-bottom: 4px;
  }
  .tabs button {
    padding: 6px 10px;
    font-size: 0.86rem;
    border-radius: 8px 8px 0 0;
  }
  .tabs button.hub-tab-cabinet {
    font-size: calc(0.86rem * 1.2); /* +20% на телефоне */
  }

  .about, .profile-body {
    padding: 10px 12px 12px;
    font-size: 0.9rem;
  }
  .about .manifesto .manifesto-title {
    font-size: 1.05rem;
    margin-bottom: 8px;
  }
  .about .manifesto-body {
    /* Phone: slightly under base; desktop keeps 1.235rem (+30%) */
    font-size: 0.93rem;
    line-height: 1.55;
  }
  .about .manifesto-body p {
    margin: 0 0 0.75em;
  }

  .game-card {
    padding: 12px;
  }
  .footer {
    margin-top: 20px;
  }
}

.tabs button.hub-tab-cabinet {
  background: var(--cab-accent, var(--accent));
  color: #1a1408;
  border-color: var(--cab-accent, var(--accent));
  font-weight: 800;
  font-size: 1.2em; /* +20% vs соседние пункты меню */
}
.tabs button.hub-tab-cabinet.on {
  box-shadow: inset 0 0 0 2px rgba(26, 20, 8, 0.35);
}
