:root {
  --bg: #0c0e12;
  --bg-2: #12151a;
  --surface: #161a21;
  --surface-2: #1c2129;
  --ink: #e6e4df;
  --muted: #8a8780;
  --accent: #a8976a;
  --accent-2: #8f7f55;
  --accent-ink: #14120e;
  --line: #2a2e36;
  --danger: #c44b4b;
  --warning: #c9a227;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  /* Манифест кнопок — see BUTTONS.md; sizes enforced here */
  --btn-radius: 10px;
  --btn-pad-y: 0.65rem;
  --btn-pad-x: 1.1rem;
  --btn-font: 1rem;
  --btn-min-h: 2.5rem;
  --btn-sm-pad-y: 0.45rem;
  --btn-sm-pad-x: 0.85rem;
  --btn-sm-font: 0.92rem;
  --btn-sm-min-h: 2.1rem;
  --btn-lg-pad-y: 0.85rem;
  --btn-lg-pad-x: 1.25rem;
  --btn-lg-font: 1.05rem;
  --btn-lg-min-h: 2.85rem;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

html {
  scrollbar-width: thin;
  scrollbar-color: #3a414c #12151a;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #12151a;
}
::-webkit-scrollbar-thumb {
  background: #3a414c;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: #4a5568;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #cbb98a; text-decoration: none; }

#app, .app-shell {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-size: 1.15rem;
  text-decoration: none;
}
.brand:hover { color: var(--accent); text-decoration: none; }
.sidebar-brand {
  display: block;
  padding: 0.15rem 0.1rem 0.35rem;
}
.sidebar-builds {
  margin-top: 0.4rem;
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
}
.sidebar-search {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.35rem;
}
.sidebar-search .form-control { min-width: 0; flex: 1 1 auto; }

.app-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.profile-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 35;
}
.profile-drawer-backdrop.open { display: block; }

.profile-sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  padding: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.profile-card .btn {
  overflow: visible;
}
.profile-card .btn.position-relative {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.profile-card .btn .notify-badge {
  position: static;
  top: auto;
  right: auto;
  transform: none;
  flex: 0 0 auto;
}
.profile-card .d-grid {
  padding-top: 0.2rem;
}

.profile-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.9rem;
}

.profile-name { font-weight: 700; font-size: 1.05rem; }
.profile-meta { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; }

.main-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 10% -10%, rgba(168, 151, 106, 0.08), transparent 42%),
    linear-gradient(180deg, #101319 0%, var(--bg) 55%, #0a0c10 100%);
}

.scroll-pane {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 1.1rem 1.15rem 1.5rem;
  -webkit-overflow-scrolling: touch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.panel-body { padding: 1.15rem; }

.section-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 8.25rem;
  padding: 1.15rem 1.15rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  transition: border-color .15s ease, background .15s ease;
  color: inherit;
  text-decoration: none;
}
.section-card:hover {
  border-color: rgba(168, 151, 106, 0.45);
  background: rgba(168, 151, 106, 0.06);
  text-decoration: none;
  color: inherit;
}
.section-card-extra {
  margin-top: auto;
  min-height: 1.7rem;
  padding-top: 0.5rem;
}

.topic-row {
  border-bottom: 1px solid var(--line);
  padding: 0.95rem 0;
}
.topic-row:last-child { border-bottom: 0; }

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.topic-card {
  display: block;
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color .15s ease, background .15s ease;
}
.topic-card:hover {
  border-color: rgba(168, 151, 106, 0.4);
  background: rgba(168, 151, 106, 0.06);
}
.topic-card-title {
  font-size: 1.22rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
}
.topic-card-title:hover { color: var(--accent); }
.topic-card .meta { font-size: 0.98rem; }
.topic-card-excerpt {
  margin-top: 0.45rem;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
}

.badge-private {
  background: rgba(201, 162, 39, 0.12);
  color: var(--warning);
  border: 1px solid rgba(201, 162, 39, 0.3);
}
.badge-public {
  background: rgba(168, 151, 106, 0.12);
  color: var(--accent);
  border: 1px solid rgba(168, 151, 106, 0.3);
}

.meta, .text-muted-2, .text-muted { color: var(--muted) !important; font-size: 0.92rem; }

/*
 * Манифест кнопок
 * ---------------
 * Стандарт сайта: .btn  (pad 0.65/1.1, font 1rem, min-h 2.5rem, radius 10px)
 * Компактный:     .btn-sm (pad 0.45/0.85, font 0.92rem, min-h 2.1rem) — сайдбар, тулбары
 * Крупный:        .btn-lg (pad 0.85/1.25, font 1.05rem, min-h 2.85rem) — auth, download CTA
 * Варианты (.btn-accent / outline / light) только меняют цвет, не размеры.
 * Не задавать padding/font-size инлайном на .btn — только классы + переменные :root.
 * Подробности: html/assets/css/BUTTONS.md
 */
.btn {
  --bs-btn-padding-y: var(--btn-pad-y);
  --bs-btn-padding-x: var(--btn-pad-x);
  --bs-btn-font-size: var(--btn-font);
  --bs-btn-border-radius: var(--btn-radius);
  min-height: var(--btn-min-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none !important;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, transform 0.08s ease;
  position: relative;
  user-select: none;
}
.btn:hover {
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.btn:focus {
  text-decoration: none !important;
  box-shadow: 0 0 0 2px rgba(168, 151, 106, 0.35);
}
.btn:active, .btn.active {
  text-decoration: none !important;
  transform: translateY(1.5px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;
}

.btn-sm {
  --bs-btn-padding-y: var(--btn-sm-pad-y);
  --bs-btn-padding-x: var(--btn-sm-pad-x);
  --bs-btn-font-size: var(--btn-sm-font);
  min-height: var(--btn-sm-min-h);
}

.btn-lg {
  --bs-btn-padding-y: var(--btn-lg-pad-y);
  --bs-btn-padding-x: var(--btn-lg-pad-x);
  --bs-btn-font-size: var(--btn-lg-font);
  min-height: var(--btn-lg-min-h);
}

.btn-accent {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-2);
  --bs-btn-hover-border-color: var(--accent-2);
  --bs-btn-active-bg: var(--accent-2);
  --bs-btn-active-border-color: var(--accent-2);
  --bs-btn-color: var(--accent-ink);
  --bs-btn-hover-color: var(--accent-ink);
  --bs-btn-active-color: var(--accent-ink);
}

.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: rgba(255, 255, 255, 0.05);
  --bs-btn-hover-border-color: #3a404a;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: rgba(255, 255, 255, 0.08);
  --bs-btn-active-border-color: #3a404a;
  --bs-btn-active-color: #fff;
}

.btn-outline-success {
  --bs-btn-color: var(--accent);
  --bs-btn-border-color: rgba(168, 151, 106, 0.4);
  --bs-btn-hover-bg: rgba(168, 151, 106, 0.12);
  --bs-btn-hover-border-color: var(--accent);
  --bs-btn-hover-color: #fff;
}

.btn-outline-danger, .btn-icon-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-border-color: rgba(196, 75, 75, 0.45);
  --bs-btn-hover-bg: rgba(196, 75, 75, 0.14);
  --bs-btn-hover-border-color: var(--danger);
  --bs-btn-hover-color: #fff;
}

.btn-light, .btn-outline-light {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--surface-2);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: #232833;
  --bs-btn-hover-border-color: #3a404a;
  --bs-btn-hover-color: #fff;
}

.btn-link {
  color: var(--accent);
  text-decoration: none !important;
  font-weight: 600;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.btn-link:hover { color: #cbb98a; text-decoration: none !important; }

/* Icon action buttons: visible on hover / always on touch */
.action-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none !important;
}
.icon-btn svg { width: 1rem; height: 1rem; display: block; }

.hover-actions:hover .icon-btn,
.hover-actions:focus-within .icon-btn,
.icon-btn:focus {
  opacity: 1;
  pointer-events: auto;
}

.icon-btn.edit:hover {
  color: var(--ink);
  border-color: #3a404a;
  background: rgba(255,255,255,0.05);
}
.icon-btn.danger {
  color: var(--danger);
  border-color: transparent;
}
.icon-btn.danger:hover {
  background: rgba(196, 75, 75, 0.15);
  border-color: rgba(196, 75, 75, 0.5);
  color: #e07070;
}

@media (hover: none), (max-width: 768px) {
  .icon-btn {
    opacity: 0.85;
    pointer-events: auto;
  }
}

.reaction-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  position: relative;
}
.reaction-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: auto;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.reaction-chip:hover {
  color: var(--ink);
  border-color: #3a404a;
  background: rgba(255,255,255,0.05);
}
.reaction-chip.active {
  color: var(--ink);
  border-color: rgba(168, 151, 106, 0.55);
  background: rgba(168, 151, 106, 0.14);
}
.reaction-add {
  width: 2.1rem;
  min-width: 2.1rem;
  padding: 0;
  font-size: 1rem;
}
.reaction-num { font-size: 0.75rem; color: var(--muted); }
.reaction-chip.active .reaction-num { color: #d4c49a; }
.reaction-summary { white-space: nowrap; }
.reaction-pop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.reaction-pop {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem;
}
.reaction-pop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  font-weight: 600;
}
.reaction-pop-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.reaction-pop-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.page-title-sm {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--muted);
  margin: 0;
}

.badge-guests {
  background: rgba(168, 151, 106, 0.12);
  color: var(--accent);
  border: 1px solid rgba(168, 151, 106, 0.3);
  font-weight: 600;
}

.comment-link { color: var(--muted); text-decoration: none; font-weight: 700; }
.comment-link:hover { color: var(--accent); }
.comment.deleted { opacity: 0.85; }
.comment-flash {
  outline: 1px solid rgba(168, 151, 106, 0.55);
  border-radius: 8px;
  background: rgba(168, 151, 106, 0.06);
}
.bb-deleted { color: var(--muted); font-style: italic; }
.bb-deleted-flag { margin-top: 0.35rem; font-size: 0.85rem; color: var(--danger); }

.comment {
  border-left: 2px solid #2f353f;
  padding-left: 0.85rem;
  margin-top: 0.9rem;
}
.comment-nested { margin-left: 0.7rem; }

.captcha-box img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 0;
  background: var(--surface);
}
.qr-login-img,
.qr-login img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
.save-files-list {
  max-height: 360px;
  overflow-y: auto;
  background: var(--surface-2);
}

.form-control, .form-select {
  background-color: #101319;
  border-color: var(--line);
  color: var(--ink);
  min-height: 2.75rem;
  font-size: 1rem;
  border-radius: 10px;
}
.form-control:focus, .form-select:focus {
  background-color: #141820;
  border-color: rgba(168, 151, 106, 0.5);
  color: var(--ink);
  box-shadow: 0 0 0 0.2rem rgba(168, 151, 106, 0.15);
}
.form-control::placeholder { color: #5c5a55; }

.form-check-input {
  background-color: #101319;
  border-color: var(--line);
}
.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.form-check-label, .form-label, .form-text { color: var(--muted); }

.alert {
  border-radius: 10px;
}
.alert-danger {
  background: rgba(196, 75, 75, 0.12);
  border-color: rgba(196, 75, 75, 0.35);
  color: #e09090;
}
.alert-light, .alert-success {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
  color: var(--ink);
}

.badge.text-bg-light {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--ink) !important;
}

.pagination-wrap .page-link {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
  padding: 0.55rem 0.9rem;
  text-decoration: none;
}
.pagination-wrap .page-link:hover {
  background: #232833;
  border-color: #3a404a;
  color: #fff;
}
.pagination-wrap .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.pagination-wrap .page-item.disabled .page-link {
  background: transparent;
  color: #4a4e56;
}

.rich-toolbar { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.45rem; }
.rt-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.rt-btn:hover {
  border-color: rgba(168, 151, 106, 0.45);
  background: rgba(168, 151, 106, 0.1);
}
.rich-editor { position: relative; }
.rich-editor.compact .rich-toolbar { margin-bottom: 0.35rem; }
.rt-emoji-toggle { font-size: 1rem; line-height: 1; }
.emoji-pop {
  position: relative;
  z-index: 40;
  margin: 0 0 0.45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.55rem;
  max-height: min(280px, 45vh);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.emoji-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}
.emoji-pop-close {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.emoji-pop-close:hover {
  border-color: rgba(168, 151, 106, 0.45);
  background: rgba(168, 151, 106, 0.12);
}
.emoji-pop-search .form-control { font-size: 0.88rem; }
.emoji-pop-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.emoji-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  cursor: pointer;
}
.emoji-tab.active {
  color: var(--ink);
  border-color: rgba(168, 151, 106, 0.45);
  background: rgba(168, 151, 106, 0.12);
}
.emoji-pop-grid {
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2rem, 1fr));
  gap: 0.15rem;
  min-height: 0;
}
.emoji-cell {
  width: 2rem;
  height: 2rem;
  padding: 0.15rem;
  border: 0;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
}
.emoji-cell:hover { background: rgba(168, 151, 106, 0.14); }
.emoji-cell img, img.twemoji, .bb-content img.twemoji {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  vertical-align: -0.2em;
  border: 0;
  margin: 0;
}

.bb-content { line-height: 1.55; word-break: break-word; }
.bb-content .bb-img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 0.5rem 0;
  display: block;
}
.bb-content .bb-code {
  background: #0e1116;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  color: #d8d4cc;
  font-size: 0.9rem;
}
.bb-content .bb-spoiler {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
}
.bb-content .bb-spoiler summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}
.bb-content .bb-quote {
  border-left: 3px solid var(--accent);
  margin: 0.5rem 0;
  padding: 0.3rem 0.75rem;
  color: var(--muted);
  background: rgba(168, 151, 106, 0.05);
  border-radius: 0 8px 8px 0;
}
.bb-content .bb-video {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  margin: 0.7rem 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}
.bb-content .bb-video iframe,
.bb-content .bb-video-file {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.bb-hashtag {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.bb-hashtag:hover { color: #cbb98a; text-decoration: none; }

.notify-badge {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 0.68rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}
.notify-badge.is-zero {
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
}
.sidebar-icon-row {
  display: flex;
  gap: 0.4rem;
}
.sidebar-icon-btn {
  flex: 1 1 0;
  min-width: 0;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
}
.sidebar-icon-btn .sidebar-ico {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  opacity: 0.9;
}
.sidebar-icon-btn .notify-badge {
  position: static;
  transform: none;
  margin-left: 0.15rem;
}
.admin-charts {
  margin-top: 0.5rem;
}
.admin-chart-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem 0.5rem;
  background: transparent;
}
.admin-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.admin-chart-last {
  color: var(--text);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.admin-chart-canvas {
  width: 100%;
  height: 180px;
  display: block;
}
.save-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.save-meta-grid > div {
  min-width: 0;
}
@media (max-width: 767px) {
  .save-meta-grid { grid-template-columns: 1fr; }
}
.notify-item { cursor: pointer; }
.notify-item.unread {
  background: rgba(168, 151, 106, 0.06);
  border-radius: 8px;
  padding: 0.7rem;
}
.notify-item:hover { background: rgba(255,255,255,0.03); border-radius: 8px; }

.pm-layout {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  flex: 1 1 auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--surface);
}
.pm-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pm-list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-2);
}
.pm-list-scroll {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}
.pm-thread {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
}
.pm-thread:hover { background: rgba(255,255,255,0.03); }
.pm-thread.active { background: rgba(168, 151, 106, 0.12); }
.pm-thread.unread { font-weight: 700; }
.pm-thread-name { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }
.pm-preview { color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-feed {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: visible;
}
.pm-feed-head {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.pm-feed-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.pm-bubble {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  word-break: break-word;
}
.pm-bubble-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.pm-bubble.mine {
  align-self: flex-end;
  background: rgba(168, 151, 106, 0.16);
}
.pm-bubble.deleted { opacity: 0.75; }
.pm-bubble-meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.2rem; }
.pm-bubble.hover-actions .reaction-add,
.pm-bubble.hover-actions .icon-btn {
  opacity: 0;
  pointer-events: none;
}
.pm-bubble.hover-actions:hover .reaction-add,
.pm-bubble.hover-actions:hover .icon-btn,
.pm-bubble.hover-actions:focus-within .reaction-add,
.pm-bubble.hover-actions:focus-within .icon-btn,
.pm-bubble.hover-actions.active .reaction-add,
.pm-bubble.hover-actions.active .icon-btn {
  opacity: 1;
  pointer-events: auto;
}
.pm-compose {
  padding: 0.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pm-compose .rich-editor { min-width: 0; }
.pm-compose .emoji-pop {
  /* keep in document flow so toolbar / close stay clickable */
  position: relative;
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
}
.pm-new {
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
}
.pm-user-hit {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  padding: 0.35rem 0.45rem;
  cursor: pointer;
}
.pm-user-hit:hover { background: rgba(168, 151, 106, 0.12); }
@media (hover: none), (max-width: 768px) {
  .pm-bubble.hover-actions .reaction-add,
  .pm-bubble.hover-actions .icon-btn {
    opacity: 0.85;
    pointer-events: auto;
  }
}
@media (max-width: 768px) {
  .pm-layout { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .pm-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; min-height: 0; }
  .pm-layout:not(.pm-open) .pm-feed { display: none; }
  .pm-layout.pm-open .pm-list { display: none; }
  .pm-layout.pm-open { grid-template-rows: 1fr; }
  .pm-back { display: inline-flex; }
  .pm-bubble {
    max-width: 100%;
    width: 100%;
  }
  .pm-bubble-head {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.35rem;
  }
  .pm-bubble-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
@media (min-width: 769px) {
  .pm-back { display: none !important; }
}

.download-page { max-width: 1100px; margin: 0 auto; }
.download-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: stretch;
}
@media (min-width: 860px) {
  .download-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1200px) {
  .download-page { max-width: 1400px; }
  .download-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.download-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.55rem 1.55rem 1.4rem;
  display: flex;
  flex-direction: column;
  min-height: 26rem;
}
.download-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.download-card-desc {
  color: var(--muted);
  margin: 0.7rem 0 1.1rem;
  line-height: 1.5;
  flex: 1 1 auto;
}
.download-cta {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.download-btn {
  /* size via .btn-lg; only layout extras here */
  gap: 0.55rem;
  width: 100%;
  min-height: 3.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.download-secondary {
  min-height: 2.35rem;
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.win11-icon { width: 1.25rem; height: 1.25rem; display: block; }
.download-os-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.45rem;
}
.download-meta {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  line-height: 1.45;
}
a.topic-card { color: inherit; text-decoration: none; }
a.topic-card:hover { color: inherit; }

/* Game shell — no page scroll, internal panes only */
.game-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.game-top {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  padding: 0.55rem 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.game-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.game-top-main { min-width: 0; }
.game-title {
  font-weight: 700;
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-res {
  display: flex;
  gap: 0.45rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.game-res .res-i {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  color: var(--ink);
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0,0,0,0.2);
}
.res-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  image-rendering: auto;
}
.game-res .res-i::after,
.cost-chip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(8, 10, 14, 0.95);
  border: 1px solid var(--line);
  color: #c8c2b4;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 20;
}
.game-res .res-i:hover::after,
.cost-chip:hover::after {
  opacity: 1;
}
.cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.cost-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0,0,0,0.18);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}
.cost-chip.is-inline {
  padding: 0.05rem 0.25rem;
  font-size: 0.72rem;
}
.obj-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.obj-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.55rem;
}
.obj-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
}
.obj-stat span {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.obj-stat strong {
  font-size: 0.82rem;
  font-weight: 600;
  word-break: break-word;
}
.rocket-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.2rem;
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: transparent;
  color: inherit;
  text-align: left;
}
.rocket-card.rocket-build { cursor: pointer; }
.rocket-card.rocket-build:hover { background: rgba(255,255,255,0.03); }
.rocket-img {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: #0a0c10;
  flex-shrink: 0;
}
.mod-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: #0a0c10;
  flex-shrink: 0;
}
.g-dot.ns {
  background: #dce6ff;
  box-shadow: 0 0 8px rgba(140, 180, 255, 0.7);
}
.game-tabs {
  display: flex;
  gap: 0;
}
.game-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.game-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.game-body-map { grid-template-columns: 1fr; }
.game-body-map .game-map-col {
  border-right: 0;
  padding: 0.5rem;
  height: 100%;
}
.game-body-map .game-map { min-height: 0; height: 100%; }

.g-section {
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0.15rem 1rem;
}
.g-section:last-child { border-bottom: 0; }
.g-label {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.g-title { font-weight: 700; font-size: 1.05rem; }
.g-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.g-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.15rem;
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.g-row:first-of-type { border-top: 0; }
.g-row:hover { background: rgba(255,255,255,0.03); }
.g-row.static { cursor: default; }
.g-row.static:hover { background: transparent; }
.g-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.g-dot.bh {
  background: #0a0a0c;
  box-shadow: 0 0 0 2px #c9a56a, 0 0 8px rgba(160, 100, 200, 0.55);
}
.bh-badge {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border: 1px solid rgba(168, 151, 106, 0.45);
  color: #d4c49a;
  border-radius: 4px;
  vertical-align: middle;
}
.game-star-dot.bh {
  background: #050508 !important;
  border: 2px solid #c9a56a !important;
  box-shadow: 0 0 10px 2px rgba(140, 90, 180, 0.55), inset 0 0 6px #000 !important;
}
.game-thumb-xs {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: cover;
}
.g-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.g-metrics > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.g-metrics strong { font-size: 0.95rem; }

.game-legend { display: none; }
.game-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  gap: 0;
  overflow: hidden;
}
.game-body-single {
  grid-template-columns: 1fr;
}
.game-map-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.65rem;
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.game-side-scroll {
  min-height: 0;
  overflow: auto;
  padding: 0.65rem;
  -webkit-overflow-scrolling: touch;
}
.game-map {
  position: relative;
  flex: 1 1 auto;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #090b0f;
  overflow: hidden;
}
.game-map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  opacity: 0.55;
}
.game-map-core {
  display: none !important;
}
.game-star-dot {
  position: absolute;
  margin: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  padding: 0;
  z-index: 2;
  transition: transform .12s ease, box-shadow .12s ease;
}
.game-star-dot:hover { transform: translate(-50%, -50%) scale(1.25); z-index: 4; }
.game-star-dot.active {
  outline: 2px solid rgba(240, 226, 176, 0.85);
  outline-offset: 2px;
  z-index: 5;
}
.game-star-dot.here {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.game-star-dot.bh { border-radius: 50%; }
.game-map-hud {
  position: absolute;
  left: 0.55rem;
  top: 0.55rem;
  z-index: 3;
  background: rgba(10, 12, 16, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
  pointer-events: none;
}
.game-map-hud strong { color: var(--ink); font-weight: 700; }
.game-map-tip {
  position: absolute;
  left: 0.55rem;
  bottom: 0.55rem;
  z-index: 3;
  background: rgba(10, 12, 16, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  max-width: 80%;
  pointer-events: none;
}
.game-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0.1rem 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.game-legend .lg {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.2rem;
  vertical-align: middle;
}
.lg.O { background: #78a0ff; }
.lg.B { background: #96b4ff; }
.lg.A { background: #c8dcff; }
.lg.F { background: #f0f0dc; }
.lg.G { background: #ffe0a0; }
.lg.K { background: #ffbe78; }
.lg.M { background: #ff8c64; }
.lg.BH { background: #222; box-shadow: 0 0 0 1px #666; }

.game-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #0e1116;
}
.game-thumb-sm { width: 40px; height: 40px; }
.game-thumb-lg { width: 120px; height: 120px; border-radius: 12px; }
.game-planet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
}
.res-chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.82rem;
  background: var(--surface-2);
}
.res-chip.accent {
  border-color: rgba(168, 151, 106, 0.45);
  color: #d4c49a;
}
.char-avatar {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #2a2620, #161412);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-size: 1.15rem;
  flex-shrink: 0;
}
.char-avatar-img {
  width: 112px;
  height: 112px;
  border-radius: 12px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #0a0c10;
  flex-shrink: 0;
}
.game-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #090b0f;
  position: relative;
  touch-action: manipulation;
}
.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
  touch-action: manipulation;
}
.game-canvas.is-map { cursor: crosshair; }
.game-canvas.is-hidden-snap {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}
.game-map-static {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.game-canvas-wrap.is-static {
  pointer-events: none;
}
.game-zoom-controls {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  gap: 6px;
  z-index: 5;
}
.game-zoom-controls button {
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid rgba(168, 151, 106, 0.45);
  background: rgba(10, 12, 16, 0.82);
  color: #c8c2b4;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.game-zoom-controls button:hover {
  background: rgba(28, 24, 18, 0.9);
  border-color: rgba(240, 226, 176, 0.7);
}
.game-zoom-controls button.wide {
  min-width: 36px;
}
.game-canvas-wrap.is-static .game-zoom-controls {
  display: none;
}

@media (max-width: 900px) {
  .game-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 44%) minmax(0, 1fr);
  }
  .game-map-col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .game-body.is-mobile-map {
    grid-template-rows: minmax(140px, 32%) minmax(0, 1fr);
  }
  .game-body.is-mobile-map .game-side-scroll {
    min-height: 0;
  }
}
.g-metrics-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-metrics-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.obj-search {
  display: flex;
  gap: 0.45rem;
}
.obj-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.obj-kind {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
}
.obj-kind.active {
  color: var(--ink);
  border-color: rgba(168, 151, 106, 0.55);
  background: rgba(168, 151, 106, 0.08);
}
.obj-kind.is-badge {
  cursor: default;
  color: var(--ink);
  border-color: rgba(168, 151, 106, 0.4);
  background: rgba(168, 151, 106, 0.1);
  pointer-events: none;
}
.obj-pager {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.stat-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
}
.stat-val { font-weight: 700; font-size: 1.05rem; margin-top: 0.15rem; }
.prog {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 999px;
}

/* Saves quota — same look as .prog, accent (not Bootstrap green) */
.quota-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.quota-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.2s ease;
}
.quota-bar-fill.danger {
  background: var(--danger);
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 8px;
  width: 2.3rem;
  height: 2.3rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.menu-toggle-float {
  position: fixed;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 45;
  box-shadow: var(--shadow);
}

hr { border-color: var(--line); opacity: 1; }
h1, h2, h3, h4, h5, .h3, .h4, .h5, .h6 { color: var(--ink); }

.install-page {
  background: linear-gradient(180deg, #12151a, #0c0e12);
  color: var(--ink);
  min-height: 100vh;
  overflow: auto;
}
.install-page .card {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

/* Version Footer Bar & Badges */
.version-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.82rem;
}

.version-pill.app {
  border-color: rgba(168, 151, 106, 0.4);
  color: var(--accent);
}

.version-pill.site {
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}

/* Info Knowledge Base Styles */
.info-nav {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.info-nav-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.88rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.info-nav-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: #3a404a;
}

.info-nav-btn.active {
  background: rgba(168, 151, 106, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.info-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card h3 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.info-card h3:first-of-type {
  margin-top: 0.35rem;
}

.info-card ul.small {
  padding-left: 1.15rem;
}

.info-card ul.small li {
  margin-bottom: 0.35rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.feature-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
}

.feature-box strong {
  color: var(--ink);
  display: block;
  margin-bottom: 0.25rem;
}

.feature-box p {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0;
}

@media (max-width: 992px) {
  .menu-toggle { display: inline-flex; }
  .main-wrap {
    padding-top: 3.2rem;
  }
  .game-shell {
    padding-top: 0;
  }
  .pm-shell {
    padding-top: 0;
  }
  .profile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 36;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .profile-sidebar.open { transform: translateX(0); }
  .sidebar-brand {
    padding-left: 3.2rem;
  }
  .game-body:not(.game-body-map):not(.game-body-single) {
    grid-template-columns: 1fr;
  }
  .g-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .game-tab { white-space: nowrap; }
}

@media (max-width: 576px) {
  .panel-body { padding: 0.95rem; }
  .comment-nested { margin-left: 0.3rem; }
  .scroll-pane { padding: 0.85rem; }
  .game-res { gap: 0.4rem; font-size: 0.78rem; }
  .game-tab { padding: 0.45rem 0.55rem; font-size: 0.88rem; }
}

/* AIPilot live page — full width */
.ai-page {
  width: 100%;
  max-width: none;
  min-height: 0;
}
.ai-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.ai-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.ai-layout {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  min-height: min(72vh, 820px);
  width: 100%;
}
.ai-sidebar {
  flex: 0 0 260px;
  max-width: 280px;
  min-height: 0;
}
.ai-sidebar-inner {
  min-height: 0;
}
.ai-sidebar-toggle {
  display: none;
}
.ai-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ai-main .panel-body {
  min-height: 0;
  flex: 1 1 auto;
}
.ai-main--detail .ai-runs-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 38%);
  gap: 1rem;
  min-height: 0;
  flex: 1 1 auto;
}
.ai-runs-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ai-runs-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-right: 0.15rem;
}
.ai-run--clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ai-run--clickable:hover {
  border-color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.06);
}
.ai-run--clickable.active {
  border-color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25);
}
.ai-run-preview {
  opacity: 0.88;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}
.ai-run-detail {
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  padding: 0.75rem 0.85rem;
  min-height: 0;
  overflow: auto;
  max-height: min(72vh, 820px);
}
.ai-run-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.ai-run-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.ai-run-goal {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--accent, #6366f1);
}
.ai-timeline {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-right: 0.15rem;
}
.ai-event-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.ai-event-item {
  border: 1px dashed var(--border, rgba(255,255,255,0.12));
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.84rem;
}
.ai-event-item .ai-duration {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  opacity: 0.75;
}
.ai-live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: ai-pulse 2s infinite;
}
.ai-live-dot.paused {
  background: #94a3b8;
  animation: none;
  box-shadow: none;
}
@keyframes ai-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.ai-stat-card {
  background: var(--panel-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.ai-stat-val {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}
.ai-stat-label {
  font-size: 0.78rem;
  opacity: 0.75;
}
.ai-project-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(42vh, 360px);
  overflow: auto;
}
.ai-project-chips {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.ai-selected-project {
  font-family: ui-monospace, monospace;
  font-weight: 500;
  max-width: min(100%, 420px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chip {
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chip.active {
  border-color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.12);
}
.ai-project-row {
  text-align: left;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: transparent;
  color: inherit;
  width: 100%;
}
.ai-project-row.active {
  border-color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.08);
}
.ai-project-id {
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  word-break: break-all;
}
.ai-project-row.active .ai-project-id {
  color: var(--accent, #6366f1);
}
.ai-sync-list {
  padding-left: 1.1rem;
  max-height: 140px;
  overflow: auto;
}
.ai-run {
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: rgba(255,255,255,0.02);
}
.ai-run-head {
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  padding-bottom: 0.55rem;
  margin-bottom: 0.55rem;
}
.ai-steps {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ai-step {
  border-left: 3px solid var(--line, rgba(255,255,255,0.15));
  padding: 0.45rem 0 0.45rem 0.65rem;
}
.ai-step--user { border-left-color: #6366f1; }
.ai-step--reasoning { border-left-color: #eab308; }
.ai-step--answer { border-left-color: #22c55e; }
.ai-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.35rem;
}
.ai-duration {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  white-space: nowrap;
}
.ai-step-prompt {
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.35rem;
}
.ai-step-response {
  font-size: 0.84rem;
  opacity: 0.82;
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 0.55rem;
  border-left: 2px solid var(--line, rgba(255,255,255,0.08));
}
.ai-legacy {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line, rgba(255,255,255,0.12));
}
.ai-feed-item {
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
}
.ai-feed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

@media (max-width: 768px) {
  .ai-layout {
    flex-direction: column;
    min-height: 0;
  }
  .ai-sidebar {
    flex: none;
    max-width: none;
    width: 100%;
  }
  .ai-sidebar-toggle {
    display: inline-flex;
  }
  .ai-sidebar-inner:not(.open) {
    display: none;
  }
  .ai-project-chips {
    display: flex;
  }
  .ai-project-list {
    display: none;
  }
  .ai-timeline {
    max-height: min(65vh, 640px);
  }
  .ai-main--detail .ai-runs-wrap {
    grid-template-columns: 1fr;
  }
  .ai-run-detail {
    max-height: min(55vh, 520px);
  }
}

@media (min-width: 769px) {
  .ai-sidebar-inner {
    display: block !important;
  }
}
