/* ───── App shell: tgplay top bar + couple sidebar ───── */

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--shell-h) 1fr;
  grid-template-areas:
    "top top"
    "side main";
}

/* tgplay top bar */
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: oklch(0.1 0.018 320 / 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--ink-3);
  position: sticky; top: 0; z-index: 50;
}
.topbar__brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.topbar__brand-dot {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, oklch(0.65 0.22 275), oklch(0.7 0.2 320));
  display: grid; place-items: center;
  font-size: 13px; color: white; font-weight: 900;
}
.topbar__crumb {
  color: var(--text-3); font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.topbar__crumb svg { opacity: .5; }
.topbar__crumb b { color: var(--text-1); font-weight: 600; }
.topbar__spacer { flex: 1; }
.topbar__search {
  display: flex; align-items: center; gap: 8px;
  background: oklch(1 0 0 / 0.05);
  border: 1px solid oklch(1 0 0 / 0.05);
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--text-3);
  font-size: 13px;
  width: 240px;
}
.topbar__user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: oklch(1 0 0 / 0.04);
  border: 1px solid oklch(1 0 0 / 0.05);
}
.topbar__avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.7 0.2 340), oklch(0.7 0.2 30));
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px; color: white;
}

/* sidebar */
.sidebar {
  grid-area: side;
  background: oklch(0.13 0.02 320 / 0.5);
  border-right: 1px solid var(--ink-3);
  padding: 20px 14px;
  display: flex; flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.sidebar__game {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--ink-3);
}
.sidebar__icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-lo), var(--brand-hi));
  display: grid; place-items: center;
  box-shadow: 0 8px 20px -8px var(--brand-glow);
  position: relative; overflow: hidden;
}
.sidebar__icon svg { color: white; }
.sidebar__game-meta { line-height: 1.2; }
.sidebar__game-name { font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: -0.01em; }
.sidebar__game-tag { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.nav__section {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--text-4); text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
  position: relative;
  width: 100%; text-align: left;
}
.nav__item:hover { background: oklch(1 0 0 / 0.04); color: var(--text-1); }
.nav__item--active {
  background: oklch(0.55 0.2 var(--hue-primary) / 0.14);
  color: var(--text-1);
}
.nav__item--active::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  background: var(--brand); border-radius: 0 3px 3px 0;
  box-shadow: 0 0 12px var(--brand-glow);
}
.nav__item svg { width: 18px; height: 18px; opacity: .85; flex-shrink: 0; }
.nav__item-badge {
  margin-left: auto;
  background: var(--brand);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 18px; text-align: center;
}
.nav__item-badge--ghost {
  background: oklch(1 0 0 / 0.08);
  color: var(--text-2);
}

.sidebar__pair {
  margin-top: auto;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(160deg, oklch(0.55 0.18 var(--hue-primary) / 0.12), oklch(0.55 0.18 var(--hue-cool) / 0.06));
  border: 1px solid oklch(0.55 0.18 var(--hue-primary) / 0.18);
}
.sidebar__pair-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.sidebar__pair-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.avatar-pair { display: flex; align-items: center; }
.avatar-pair__a, .avatar-pair__b {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px; color: white;
  border: 2px solid var(--ink-1);
}
.avatar-pair__a { background: linear-gradient(135deg, oklch(0.65 0.2 340), oklch(0.7 0.18 320)); }
.avatar-pair__b { background: linear-gradient(135deg, oklch(0.6 0.16 210), oklch(0.7 0.14 230)); margin-left: -10px; }
.sidebar__pair-names { font-size: 13px; font-weight: 600; }
.sidebar__pair-streak {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--warm); font-weight: 700;
}

/* main */
.main {
  grid-area: main;
  padding: var(--page-pad);
  overflow-x: hidden;
  min-height: calc(100vh - var(--shell-h));
}

/* mobile shell */
.mobile-tabs { display: none; }
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; grid-template-rows: var(--shell-h) 1fr 64px; grid-template-areas: "top" "main" "tabs"; }
  .sidebar { display: none; }
  .topbar__search { display: none; }
  .topbar__crumb { font-size: 12px; }
  .main { padding: 18px 16px 24px; }

  .mobile-tabs {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 64px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: oklch(0.1 0.02 320 / 0.92);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--ink-3);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-tabs__btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    color: var(--text-3);
    font-size: 10px; font-weight: 600;
  }
  .mobile-tabs__btn svg { width: 22px; height: 22px; }
  .mobile-tabs__btn--active { color: var(--brand-hi); }
}

