/* ─── Nebula guide sidebar (Xbox-inspired shell navigation) ─── */

:root {
  --guide-rail-width: 88px;
  --guide-panel-width: min(400px, 92vw);
  --guide-glass: rgba(8, 10, 22, 0.92);
  --guide-glass-border: rgba(79, 216, 255, 0.14);
  --guide-accent-glow: rgba(79, 216, 255, 0.35);
}

.guide-shell {
  position: relative;
  flex-shrink: 0;
  width: var(--guide-rail-width);
  height: 100%;
  z-index: 30;
}

.body-no-sidebar .guide-shell,
.body-no-sidebar .guide-backdrop {
  display: none;
}

/* ─── Collapsed rail ─── */
.guide-rail {
  width: var(--guide-rail-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 12px;
  background: linear-gradient(180deg, rgba(10, 12, 24, 0.98) 0%, rgba(7, 9, 18, 0.98) 100%);
  border-right: 1px solid var(--guide-glass-border);
  transition: opacity var(--nebula-duration-nav) var(--nebula-ease-standard);
}

.guide-expanded .guide-rail {
  opacity: 0;
  pointer-events: none;
}

.guide-rail-brand {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid rgba(79, 216, 255, 0.3);
  background: radial-gradient(circle at 38% 32%, rgba(79, 216, 255, 0.55), rgba(157, 79, 224, 0.75) 55%, rgba(30, 16, 60, 1));
  color: var(--nebula-color-text);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  cursor: pointer;
  padding: 0;
}

.guide-brand-mark {
  font-size: 20px;
  line-height: 1;
  text-shadow: 0 0 12px var(--guide-accent-glow);
}

.guide-rail-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guide-rail-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin: 0 8px;
  border-radius: var(--nebula-radius-md);
  border: 2px solid transparent;
  border-left: 3px solid transparent;
  color: var(--nebula-color-muted);
  cursor: pointer;
  transition:
    color var(--nebula-duration-fast) var(--nebula-ease-standard),
    background var(--nebula-duration-fast) var(--nebula-ease-standard),
    border-color var(--nebula-duration-fast) var(--nebula-ease-standard),
    box-shadow var(--nebula-duration-fast) var(--nebula-ease-standard);
}

.guide-rail-item.is-active {
  color: var(--nebula-color-text);
  background: rgba(79, 216, 255, 0.08);
  border-left-color: var(--nebula-color-accent);
  box-shadow: inset 3px 0 0 var(--nebula-color-accent);
}

.guide-rail-item.is-focused {
  color: var(--nebula-color-text);
  background: rgba(79, 216, 255, 0.14);
  border-color: rgba(79, 216, 255, 0.45);
  border-left-color: var(--nebula-color-accent);
  box-shadow:
    0 0 0 1px rgba(79, 216, 255, 0.25),
    0 0 18px rgba(79, 216, 255, 0.12);
  transform: none;
}

.guide-rail-icon {
  font-size: 22px;
  line-height: 1;
}

.guide-rail-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  width: 100%;
}

.guide-rail-expand,
.guide-rail-profile {
  width: 48px;
  height: 48px;
  border-radius: var(--nebula-radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--nebula-color-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.guide-rail-expand.is-focused,
.guide-rail-profile.is-focused {
  border-color: var(--nebula-color-accent);
  color: var(--nebula-color-text);
  transform: none;
}

.guide-rail-expand-icon {
  font-size: 20px;
}

.guide-rail-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(145deg, rgba(79, 216, 255, 0.35), rgba(157, 79, 224, 0.5));
  border: 2px solid rgba(79, 216, 255, 0.35);
  color: var(--nebula-color-text);
}

/* ─── Expanded guide panel (overlay) ─── */
.guide-panel {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--guide-panel-width);
  z-index: 35;
  transform: translateX(-104%);
  transition: transform var(--nebula-duration-slow) var(--nebula-ease-console);
  pointer-events: none;
}

.guide-expanded .guide-panel {
  transform: translateX(0);
  pointer-events: auto;
}

.guide-panel-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--guide-glass);
  border-right: 1px solid var(--guide-glass-border);
  box-shadow:
    8px 0 40px rgba(0, 0, 0, 0.45),
    inset -1px 0 0 rgba(157, 79, 224, 0.12);
}

.guide-header {
  padding: 20px 22px 16px;
  display: grid;
  gap: 12px;
}

.guide-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.guide-profile-avatar,
.guide-footer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  background: linear-gradient(145deg, rgba(79, 216, 255, 0.4), rgba(157, 79, 224, 0.55));
  border: 2px solid rgba(79, 216, 255, 0.4);
  color: var(--nebula-color-text);
  box-shadow: 0 0 20px rgba(79, 216, 255, 0.15);
}

.guide-profile-name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.guide-profile-status {
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--nebula-color-muted);
}

.guide-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--nebula-color-success);
  box-shadow: 0 0 8px rgba(79, 255, 136, 0.6);
}

.guide-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.guide-header-time {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.guide-header-date {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--nebula-color-muted);
}

.guide-header-indicators {
  display: flex;
  gap: 10px;
  color: var(--nebula-color-accent);
  font-size: 14px;
  opacity: 0.85;
}

.guide-header-brand {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nebula-color-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-header-brand-mark {
  color: var(--nebula-color-accent);
  text-shadow: 0 0 10px var(--guide-accent-glow);
}

.guide-divider {
  border: none;
  height: 1px;
  margin: 0 18px;
  background: linear-gradient(90deg, transparent, rgba(79, 216, 255, 0.2), transparent);
}

.guide-section {
  padding: 12px 18px;
  min-height: 0;
}

.guide-section-recent {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.guide-section-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nebula-color-muted);
}

.guide-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--nebula-radius-md);
  border: 2px solid transparent;
  border-left: 3px solid transparent;
  color: var(--nebula-color-muted);
  cursor: pointer;
  transition:
    background var(--nebula-duration-fast) var(--nebula-ease-standard),
    border-color var(--nebula-duration-fast) var(--nebula-ease-standard),
    color var(--nebula-duration-fast) var(--nebula-ease-standard);
}

.guide-nav-item.is-active {
  color: var(--nebula-color-text);
  background: rgba(79, 216, 255, 0.08);
  border-left-color: var(--nebula-color-accent);
}

.guide-nav-item.is-active::after {
  content: "";
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nebula-color-accent);
  box-shadow: 0 0 8px var(--guide-accent-glow);
}

.guide-nav-item.is-focused {
  color: var(--nebula-color-text);
  background: rgba(79, 216, 255, 0.16);
  border-color: rgba(79, 216, 255, 0.45);
  border-left-color: var(--nebula-color-accent);
  box-shadow: 0 0 22px rgba(79, 216, 255, 0.1);
  transform: none;
}

.guide-nav-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.guide-nav-label {
  font-size: 16px;
  font-weight: 600;
}

.guide-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.guide-quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--nebula-radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--nebula-color-muted);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.guide-quick-item.is-focused {
  border-color: var(--nebula-color-accent);
  color: var(--nebula-color-text);
  background: rgba(79, 216, 255, 0.12);
  transform: none;
}

.guide-quick-icon {
  font-size: 16px;
  opacity: 0.9;
}

.guide-quick-label {
  font-size: 13px;
  font-weight: 600;
}

.guide-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: min(220px, 28vh);
}

.guide-recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: var(--nebula-radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  color: var(--nebula-color-text);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.guide-recent-item.is-focused {
  border-color: var(--nebula-color-accent);
  background: rgba(79, 216, 255, 0.1);
  transform: none;
}

.guide-recent-cover {
  width: 40px;
  height: 40px;
  border-radius: var(--nebula-radius-sm);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--recent-accent, #1a2a44), rgba(0, 0, 0, 0.5));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.guide-recent-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.guide-recent-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide-recent-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--nebula-color-muted);
}

.guide-source-badge {
  padding: 2px 7px;
  border-radius: var(--nebula-radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(79, 216, 255, 0.12);
  color: var(--nebula-color-accent);
}

.guide-source-badge[data-source="steam"] {
  background: rgba(27, 40, 56, 0.9);
  color: #66c0f4;
}

.guide-source-badge[data-source="gog"] {
  background: rgba(60, 20, 90, 0.5);
  color: #c9a0ff;
}

.guide-source-badge[data-source="epic"] {
  background: rgba(30, 30, 30, 0.8);
  color: #f0f0f0;
}

.guide-recent-empty {
  padding: 20px 12px;
  text-align: center;
  border-radius: var(--nebula-radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.guide-recent-empty-icon {
  font-size: 28px;
  opacity: 0.4;
  display: block;
  margin-bottom: 8px;
}

.guide-recent-empty-title {
  margin: 0 0 6px;
  font-weight: 600;
}

.guide-recent-empty-copy {
  margin: 0;
  font-size: 13px;
  color: var(--nebula-color-muted);
}

.guide-footer {
  margin-top: auto;
  padding: 14px 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.guide-footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--nebula-radius-pill);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--nebula-color-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.guide-footer-btn.is-focused {
  border-color: var(--nebula-color-accent);
  color: var(--nebula-color-text);
  transform: none;
}

.guide-footer-avatar {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.guide-version {
  flex: 1 1 100%;
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--nebula-color-muted);
  opacity: 0.75;
}

/* Dim layer over main content when guide is open (scoped to .app-main-area) */
.guide-backdrop {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(3, 5, 14, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--nebula-duration-slow) var(--nebula-ease-standard);
}

body.guide-expanded .guide-backdrop,
.guide-backdrop:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.guide-backdrop[hidden] {
  display: block !important;
  opacity: 0;
  pointer-events: none;
}

/* Focus overrides for guide items */
.guide-rail-item.focusable.is-focused,
.guide-nav-item.focusable.is-focused,
.guide-quick-item.focusable.is-focused,
.guide-recent-item.focusable.is-focused,
.guide-footer-btn.focusable.is-focused,
.guide-rail-brand.focusable.is-focused,
.guide-rail-expand.focusable.is-focused,
.guide-rail-profile.focusable.is-focused {
  transform: none;
}

@media (max-width: 720px) {
  :root {
    --guide-rail-width: 72px;
    --guide-panel-width: min(100vw, 100%);
  }
}
