/* ==========================================================================
   GameBuddy prototype - layout (FOUNDATION owns this file)
   App frame (web / launcher), sidebar, topbar, beta strip, tab bar, page layout helpers, responsive rules.
   Breakpoints: >=1280 full sidebar | 1024-1279 icon rail | 720-1023 overlay sidebar | <720 mobile tab bar
   The shell sets data-rail / data-overlay / data-mobile / data-nav-open / data-frame on .pd-app (js/shell.js).
   ========================================================================== */

/* ---------- frame ---------- */
.pd-app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg-canvas); overflow: hidden; }
.pd-app[data-frame="launcher"] { background: var(--bg-backdrop); padding: clamp(10px, 1.6vw, 24px); }
.pd-window { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg-canvas); }
.pd-app[data-frame="launcher"] .pd-window { border-radius: var(--r-window); overflow: hidden; box-shadow: var(--shadow-window); border: 1px solid var(--border-subtle); }
.pd-app[data-frame="launcher"][data-maximized="true"] { padding: 0; }
.pd-app[data-frame="launcher"][data-maximized="true"] .pd-window { border-radius: 0; border: 0; box-shadow: none; }
.pd-shell { position: relative; flex: 1; min-height: 0; display: flex; }

/* ---------- launcher title bar ---------- */
.pd-titlebar { display: none; }
.pd-app[data-frame="launcher"] .pd-titlebar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; flex: none;
  height: var(--titlebar-h); padding: 0 12px; background: var(--bg-sunken); border-bottom: 1px solid var(--border-subtle); user-select: none;
}
.pd-titlebar__left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pd-titlebar__ctl { display: flex; align-items: center; gap: 8px; }
.pd-titlebar__nav { display: flex; align-items: center; gap: 2px; }
.pd-titlebar__title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 600; color: var(--text-2); }
.pd-titlebar__right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pd-wc { width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; transition: filter var(--dur-1), transform var(--dur-1); }
.pd-wc--close { background: var(--wc-close); }
.pd-wc--min { background: var(--wc-min); }
.pd-wc--max { background: var(--wc-max); }
.pd-wc:hover { filter: brightness(1.15); }
.pd-wc:active { transform: scale(.9); }
/* in the Windows launcher the buttons are 46px wide and as tall as the title bar: an outer focus ring would be clipped by the window edge, so it is drawn inside */
html[data-desktop="true"] .pd-wincontrols .pd-wc:focus-visible { outline-offset: -2px; }

/* ---------- sidebar ---------- */
.pd-sidebar {
  position: relative; z-index: var(--z-sidebar); flex: none; width: var(--sidebar-w); display: flex; flex-direction: column;
  background: var(--bg-sunken); border-right: 1px solid var(--border-subtle);
  transition: width var(--dur-3) var(--ease), transform var(--dur-3) var(--ease);
}
.pd-sidebar__top { flex: none; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.pd-logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); border-radius: 8px; }
.pd-logo:hover { text-decoration: none; }
.pd-logo__name { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.pd-sidebar__collapse {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--text-3);
  background: var(--bg-raised); border: 1px solid var(--border-subtle); transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}
.pd-sidebar__collapse:hover { color: var(--text); background: var(--bg-hover); border-color: var(--border); }
.pd-sidebar__collapse:active { background: var(--bg-active); }
/* the middle of the sidebar: the nav groups and, in the Real world, the recently played games under them. It scrolls as one; the foot stays at the bottom. */
.pd-sidebar__scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.pd-nav { flex: none; padding: 8px 20px 12px; }
.pd-nav__group { margin-bottom: 4px; }
.pd-nav__sep { height: 0; margin: 0; }
.pd-nav__group-btn {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 17px 8px 13px; font-size: var(--fs-base); line-height: 21px; font-weight: 500; color: var(--text-3); text-align: left;
  border-radius: 8px; transition: color var(--dur-1);
}
.pd-nav__group-btn:hover { color: var(--text); }
.pd-nav__group-btn svg { transition: transform var(--dur-2) var(--ease); }
.pd-nav__group[data-collapsed="true"] .pd-nav__group-btn svg { transform: rotate(-90deg); }
.pd-nav__group[data-collapsed="true"] .pd-nav__items { display: none; }
.pd-nav__items, .pd-nav__children { display: flex; flex-direction: column; gap: 4px; }
.pd-nav__item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 35px; padding: 0 10px; border-radius: 10px; border: 1px solid transparent;
  color: var(--text-2); font-size: var(--fs-nav); font-weight: 500; text-align: left; white-space: nowrap;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}
.pd-nav__item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.pd-nav__item:active { background: var(--bg-active); }
.pd-nav__item.is-active { background: var(--bg-raised); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.pd-nav__ico { display: grid; place-items: center; width: 18px; height: 18px; flex: none; color: var(--text-3); }
.pd-nav__item:hover .pd-nav__ico, .pd-nav__item.is-active .pd-nav__ico { color: var(--text); }
.pd-nav__label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pd-nav__item.has-tile { padding-left: 5px; }
.pd-nav__item.is-child { height: 34px; }
.pd-nav__dot { flex: none; margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--orange-solid); box-shadow: 0 0 0 3px var(--orange-bg); }
.pd-nav__badge {
  flex: none; margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 10px;
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); background: var(--bg-active); border: 1px solid var(--border);
}
.pd-nav__children { position: relative; margin: 4px 0 0; }
.pd-nav__children > .pd-nav__item { margin-left: 24px; width: calc(100% - 24px); }
/* tree line: one continuous vertical hairline with a rounded elbow into every child (first child starts below the parent icon) */
.pd-nav__children > .pd-nav__item::before {
  content: ''; position: absolute; left: -10px; top: -21px; width: 14px; height: 38px; pointer-events: none;
  border-left: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); border-bottom-left-radius: 9px;
}
.pd-nav__children > .pd-nav__item:first-child::before { top: -12px; height: 29px; }
.pd-sidebar__foot { flex: none; display: flex; flex-direction: column; }
.pd-sidebar__links { display: flex; flex-direction: column; gap: 9px; padding: 0 20px 24px; margin-bottom: 22px; border-bottom: 1px solid var(--border-subtle); }
.pd-user {
  display: flex; align-items: center; gap: 10px; margin: 0 20px 20px; width: calc(100% - 40px); height: 54px; padding: 0 10px; text-align: left;
  border-radius: var(--r-card); background: var(--bg-raised); border: 1px solid var(--border); transition: border-color var(--dur-1), background var(--dur-1);
}
.pd-user:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.pd-user:active { background: var(--bg-active); }
.pd-user__text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.pd-user__name { font-size: var(--fs-base); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-user__mail { font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-user .pd-avatar { --av-s: 34px; }
.pd-user__chev { color: var(--text-4); flex: none; }

/* recently played (Real world, signed in): a short list under the nav groups; a row is a small cover, the title (cut with an ellipsis) and a quiet time */
.pd-recent { flex: none; padding: 0 20px 12px; }
.pd-recent__title { margin: 0; padding: 13px 8px 11px; font-size: var(--fs-base); line-height: 21px; font-weight: 500; color: var(--text-3); }
.pd-recent__list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.pd-recent__list > li { min-width: 0; }
.pd-recent__item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 35px; padding: 0 10px 0 7px; border-radius: 10px; border: 1px solid transparent;
  color: var(--text-2); font-size: var(--fs-base); font-weight: 500; white-space: nowrap; transition: background var(--dur-1), color var(--dur-1);
}
.pd-recent__item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.pd-recent__item:active { background: var(--bg-active); }
.pd-recent__cover { flex: none; width: 24px; height: 24px; border-radius: 7px; overflow: hidden; background: var(--bg-active); }
.pd-recent__cover .pd-cover { height: 100%; border-radius: inherit; }
.pd-recent__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pd-recent__time { flex: none; font-size: var(--fs-xs); font-weight: 400; color: var(--text-4); }
.pd-recent__empty { margin: 0; padding: 2px 8px 0; font-size: var(--fs-md); line-height: 1.5; color: var(--text-4); }
.pd-recent:not([data-empty="true"]) .pd-recent__empty, .pd-recent[data-empty="true"] .pd-recent__list { display: none; }
.pd-recent[data-empty="unknown"] { visibility: hidden; }

/* rail: icons only */
.pd-app[data-rail="true"] .pd-sidebar { width: var(--sidebar-w-rail); }
.pd-app[data-rail="true"] .pd-sidebar__top { flex-direction: column; justify-content: center; gap: 10px; height: auto; padding: 14px 0 10px; }
.pd-app[data-rail="true"] .pd-logo__name,
.pd-app[data-rail="true"] .pd-nav__label,
.pd-app[data-rail="true"] .pd-nav__group-btn span,
.pd-app[data-rail="true"] .pd-nav__group-btn svg,
.pd-app[data-rail="true"] .pd-user__text,
.pd-app[data-rail="true"] .pd-user__chev,
.pd-app[data-rail="true"] .pd-nav__badge { display: none; }
.pd-app[data-rail="true"] .pd-nav { padding: 4px 12px 12px; }
.pd-app[data-rail="true"] .pd-nav__item { justify-content: center; padding: 0; gap: 0; }
.pd-app[data-rail="true"] .pd-nav__item.has-tile { padding: 0; }
.pd-app[data-rail="true"] .pd-nav__dot { position: absolute; top: 5px; right: 8px; margin: 0; }
.pd-app[data-rail="true"] .pd-nav__group-btn { height: 14px; padding: 0; margin: 8px 8px 4px; border-top: 1px solid var(--border-subtle); border-radius: 0; pointer-events: none; }
.pd-app[data-rail="true"] .pd-nav__sep { margin: 0; }
.pd-app[data-rail="true"] .pd-nav__children { margin: 2px 0 0; }
.pd-app[data-rail="true"] .pd-nav__children > .pd-nav__item { margin-left: 0; width: 100%; }
.pd-app[data-rail="true"] .pd-nav__children > .pd-nav__item::before { display: none; }
.pd-app[data-rail="true"] .pd-recent { padding: 0 12px 12px; }
.pd-app[data-rail="true"] .pd-recent__title { height: 14px; padding: 0; margin: 8px 8px 4px; overflow: hidden; font-size: 0; border-top: 1px solid var(--border-subtle); }   /* the heading stays for screen readers */
.pd-app[data-rail="true"] .pd-recent__name, .pd-app[data-rail="true"] .pd-recent__time, .pd-app[data-rail="true"] .pd-recent__empty { display: none; }
.pd-app[data-rail="true"] .pd-recent__item { justify-content: center; padding: 0; gap: 0; }
.pd-app[data-rail="true"] .pd-recent:not([data-empty="false"]) { display: none; }
.pd-app[data-rail="true"] .pd-sidebar__links { padding: 0 12px 12px; margin-bottom: 14px; gap: 4px; }
.pd-app[data-rail="true"] .pd-user { width: calc(100% - 24px); margin: 0 12px 14px; justify-content: center; padding: 0; }
.pd-app[data-rail="true"] .pd-sidebar__collapse svg { transform: rotate(180deg); }
.pd-app[data-rail-locked="true"] .pd-sidebar__collapse { display: none; }

.pd-app[data-no-anim="true"] .pd-sidebar, .pd-app[data-no-anim="true"] .pd-scrim--nav { transition: none !important; }

/* overlay sidebar (720-1023 and mobile) */
.pd-scrim--nav { display: none; }
.pd-app[data-overlay="true"] .pd-sidebar {
  position: fixed; inset: 0 auto 0 0; width: min(312px, 86vw); transform: translateX(-104%); box-shadow: var(--shadow-lg); visibility: hidden;
  z-index: calc(var(--z-scrim) + 1); /* the open menu must sit ABOVE its own scrim, otherwise clicks on menu items hit the scrim */
  transition: transform var(--dur-3) var(--ease), visibility 0s linear var(--dur-3);
}
.pd-app[data-overlay="true"][data-nav-open="true"] .pd-sidebar { transform: none; visibility: visible; transition: transform var(--dur-3) var(--ease), visibility 0s; }
.pd-app[data-overlay="true"] .pd-scrim--nav { display: block; position: fixed; inset: 0; z-index: var(--z-scrim); background: var(--bg-overlay); opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease); }
.pd-app[data-overlay="true"][data-nav-open="true"] .pd-scrim--nav { opacity: 1; pointer-events: auto; }
.pd-app[data-frame="launcher"][data-overlay="true"] .pd-sidebar, .pd-app[data-frame="launcher"][data-overlay="true"] .pd-scrim--nav { position: absolute; }

/* ---------- main column ---------- */
.pd-col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg-canvas); }
.pd-main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: auto; position: relative; }
.pd-screen { min-height: 100%; display: flex; flex-direction: column; }
.pd-screen--enter { animation: pd-screen-in var(--dur-3) var(--ease) both; }
/* full-bleed screens (play page, consoles): put pd-fill on the root node a screen returns, it then fills the whole content area; use pd-grow on a child to stretch it */
.pd-fill { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pd-fill > .pd-grow { flex: 1 1 0; min-height: 0; }

/* ---------- beta strip ---------- */
.pd-beta {
  flex: none; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 14px 6px 24px;
  background: var(--accent-soft); border-bottom: 1px solid var(--border-subtle); color: var(--text-2); font-size: var(--fs-md);
}
.pd-beta svg { color: var(--accent-text); flex: none; }
.pd-beta__text b { color: var(--accent-text); font-weight: 600; }
.pd-beta__more { margin-left: 4px; font-size: var(--fs-md); color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; border-radius: 4px; }
.pd-beta__more:hover { color: var(--text); }
.pd-beta__close { margin-left: auto; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--text-3); flex: none; }
.pd-beta__close:hover { background: var(--bg-active); color: var(--text); }

/* ---------- topbar ---------- */
.pd-topbar { flex: none; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 14px 0 24px; border-bottom: 1px solid var(--border); background: var(--bg-canvas); position: relative; z-index: var(--z-topbar); }
.pd-topbar__left { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 120px; }      /* the breadcrumb takes whatever the right group leaves */
.pd-topbar__right { display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; }
.pd-topbar__right > * { flex: none; }
.pd-topbar__crumbs { flex: 1 1 auto; min-width: 0; }
.pd-topbar .pd-topbar__menu, .pd-topbar .pd-topbar__searchicon, .pd-topbar .pd-topbar__mtitle { display: none; }
.pd-topbar__vr { margin: 0 6px; }
.pd-topbar__lang { margin: 0 4px 0 6px; display: inline-flex; }
.pd-topbar__primary-host { margin-left: 8px; display: inline-flex; }
.pd-topbar__primary-host:empty { display: none; }
.pd-topbar__right > .pd-search { flex: 0 1 268px; min-width: 150px; }
.pd-topbar .pd-topbar__ghost { color: var(--text); }
.pd-search {
  display: flex; align-items: center; gap: 8px; width: 268px; height: var(--control-h); padding: 0 6px 0 10px; border-radius: var(--r-btn); text-align: left;
  background: var(--bg-raised); border: 1px solid var(--border-subtle); color: var(--text-3); font-size: var(--fs-md);
  transition: border-color var(--dur-1), background var(--dur-1), color var(--dur-1);
}
.pd-search:hover { border-color: var(--border); color: var(--text-2); background: var(--bg-hover); }
.pd-search__ph { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-search__short { display: none; }
.pd-iconbtn {
  position: relative; display: inline-grid; place-items: center; width: var(--control-h); height: var(--control-h); border-radius: var(--r-btn); color: var(--text-2);
  transition: background var(--dur-1), color var(--dur-1);
}
.pd-iconbtn:hover { background: var(--bg-hover); color: var(--text); }
.pd-iconbtn:active { background: var(--bg-active); }
.pd-bell__dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange-solid); box-shadow: 0 0 0 2px var(--bg-canvas); }
.pd-dl-btn__badge { position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-fg); font-size: 10px; font-weight: 700; display: grid; place-items: center; }

/* ---------- mobile tab bar ---------- */
.pd-tabbar { display: none; flex: none; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--bg-sunken); border-top: 1px solid var(--border); }
.pd-tab-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }
.pd-tab-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-tab-item:hover { text-decoration: none; color: var(--text); }
.pd-tab-item:focus-visible { outline-offset: -3px; border-radius: 10px; }     /* the item fills the bar edge to edge: the ring goes inside */
.pd-tab-item.is-active { color: var(--accent-text); }
.pd-app[data-mobile="true"] .pd-tabbar { display: flex; }

/* ==========================================================================
   Page layout helpers
   ========================================================================== */
.pd-page { width: 100%; max-width: 1680px; margin: 0 auto; padding: 22px var(--page-pad) 48px; }
.pd-page--wide { max-width: 1680px; }
.pd-page--narrow { max-width: 980px; }
.pd-page--text { max-width: 760px; }
.pd-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 22px; }
.pd-page-head__main { min-width: 0; }
.pd-page-head__title { font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.pd-page-head__sub { margin-top: 4px; font-size: var(--fs-base); color: var(--text-3); }
.pd-page-head__eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-4); font-weight: 600; margin-bottom: 4px; }
.pd-page-head__back { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-md); color: var(--text-3); margin-bottom: 8px; }
.pd-page-head__back:hover { color: var(--text); text-decoration: none; }
.pd-page-head__side { display: flex; align-items: center; gap: 12px; flex: none; padding-top: 4px; }

.pd-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pd-section-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 19px; padding: 15px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.pd-section-bar--flat { border: 0; padding: 0; }
.pd-section-bar__left { display: flex; align-items: center; gap: 14px; min-width: 0; flex-wrap: wrap; }
.pd-section-bar__right { display: flex; align-items: center; gap: 8px; flex: none; }
.pd-section-bar__title { font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.pd-vr { display: inline-block; width: 1px; height: 16px; background: var(--border-strong); flex: none; }
.pd-section-bar__left > .pd-vr { width: 2px; height: 13px; border-radius: 1px; background: var(--text-3); }
.pd-kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: stretch; margin-top: 17px; }

/* generic layout utilities */
.pd-stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.pd-stack--sm { gap: var(--sp-2); }
.pd-stack--lg { gap: var(--sp-6); }
.pd-row { display: flex; align-items: center; gap: var(--sp-3); }
.pd-row--wrap { flex-wrap: wrap; }
.pd-row--spread { justify-content: space-between; }
.pd-row--top { align-items: flex-start; }
.pd-grow { flex: 1; min-width: 0; }
.pd-grid { display: grid; gap: var(--sp-4); }
.pd-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pd-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pd-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pd-grid--auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pd-grid--cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pd-gap-1 { gap: var(--sp-1); } .pd-gap-2 { gap: var(--sp-2); } .pd-gap-3 { gap: var(--sp-3); } .pd-gap-4 { gap: var(--sp-4); } .pd-gap-6 { gap: var(--sp-6); }
.pd-mt-2 { margin-top: var(--sp-2); } .pd-mt-4 { margin-top: var(--sp-4); } .pd-mt-6 { margin-top: var(--sp-6); } .pd-mt-8 { margin-top: var(--sp-8); }
.pd-mb-2 { margin-bottom: var(--sp-2); } .pd-mb-4 { margin-bottom: var(--sp-4); } .pd-mb-6 { margin-bottom: var(--sp-6); }
.pd-show-sm { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */
/* compact topbar: Export / Share become icon buttons and the search shrinks, so the breadcrumb keeps room (Russian labels are long) */
@media (max-width: 1599px) {
  .pd-topbar .pd-topbar__ghost .pd-btn__label { display: none; }
  .pd-topbar .pd-topbar__ghost { width: var(--control-h); padding: 0; }
  .pd-topbar__right > .pd-search { flex-basis: 200px; }
  .pd-search__long { display: none; }
  .pd-search__short { display: inline; }
}
@media (max-width: 1359px) {
  .pd-topbar__right > .pd-search { flex-basis: 150px; min-width: 110px; }
}
/* below 1280 the sidebar is a rail and the breadcrumb needs the room: the primary action is an icon (its name stays in aria-label and in the tooltip,
   see shell.js syncPrimaryTitle), the search is a short field without the shortcut hint */
@media (max-width: 1279px) {
  .pd-topbar .pd-topbar__primary:not(.is-textonly) .pd-btn__label { display: none; }
  .pd-topbar .pd-topbar__primary:not(.is-textonly) { width: var(--control-h); padding: 0; }
  .pd-topbar__primary-host { margin-left: 4px; }
  .pd-search .pd-kbd { display: none; }
  .pd-topbar__right > .pd-search { flex-basis: 120px; min-width: 96px; }
  .pd-topbar__vr { margin: 0 2px; }
  .pd-topbar { gap: 10px; }
}
/* four board columns need about 250 px each: below 1360 px the board has two */
@media (max-width: 1359px) {
  .pd-kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 1023px) {
  :root { --page-pad: 20px; }
  .pd-topbar { padding: 0 12px 0 14px; }
  .pd-topbar .pd-topbar__menu { display: inline-grid; place-items: center; width: var(--control-h); height: var(--control-h); border-radius: var(--r-btn); color: var(--text-2); margin-left: -4px; }
  .pd-topbar .pd-topbar__menu:hover { background: var(--bg-hover); color: var(--text); }
  .pd-topbar__right > .pd-search { display: none; }
  .pd-topbar .pd-topbar__searchicon { display: inline-grid; }
  .pd-topbar .pd-topbar__ghost, .pd-topbar__vr { display: none; }
  .pd-beta { padding-left: 14px; }
}
@media (max-width: 899px) {
  .pd-page-head { flex-wrap: wrap; }
}
@media (max-width: 719px) {
  :root { --page-pad: 16px; --topbar-h: 52px; }
  .pd-app[data-frame="launcher"] { padding: 0; }
  .pd-app[data-frame="launcher"] .pd-window { border-radius: 0; border: 0; box-shadow: none; }
  .pd-app[data-frame="launcher"] .pd-titlebar { display: none; }
  .pd-topbar__crumbs { display: none; }
  .pd-topbar .pd-topbar__mtitle { display: block; font-size: var(--fs-lg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pd-topbar__lang { display: none; }
  .pd-topbar .pd-topbar__primary:not(.is-textonly) .pd-btn__label { display: none; }
  .pd-topbar .pd-topbar__primary:not(.is-textonly) { width: var(--control-h); padding: 0; }
  .pd-topbar__primary-host { margin-left: 4px; }
  .pd-page { padding-top: 16px; padding-bottom: 28px; }
  .pd-page-head__title { font-size: var(--fs-lg); }
  .pd-kpis { grid-template-columns: minmax(0, 1fr); }
  .pd-section-bar { gap: 10px; }
  .pd-section-bar__left > .pd-vr { display: none; }
  .pd-section-bar__right { width: 100%; }
  .pd-section-bar__right .pd-btn { flex: 1; }
  .pd-section-bar__left { width: 100%; }
  .pd-kanban {
    display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin-left: calc(var(--page-pad) * -1); margin-right: calc(var(--page-pad) * -1);
    padding: 0 var(--page-pad) 12px; scroll-padding: 0 var(--page-pad); -webkit-overflow-scrolling: touch;
  }
  .pd-kanban > .pd-kcol { flex: 0 0 min(86vw, 330px); scroll-snap-align: start; }
  .pd-grid--2, .pd-grid--3, .pd-grid--4 { grid-template-columns: minmax(0, 1fr); }
  .pd-hide-sm { display: none !important; }
  .pd-show-sm { display: initial !important; }
}
@media (min-width: 720px) and (max-width: 1023px) {
  .pd-app[data-frame="launcher"] .pd-titlebar { padding: 0 10px; }
}

/* ==========================================================================
   Accounts (wave 1): the layout mode "bare" (full-window screens), the bare bar, auth cards, banners, the guest block,
   the world-switch transition, the start-up splash. Colors are tokens only.
   ========================================================================== */

/* ---------- start-up splash: replaced by the shell once the session is known ---------- */
.pd-boot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--bg-canvas); color: var(--text-3); font-size: var(--fs-md); }
.pd-boot__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pd-boot-pulse 1s ease-in-out infinite; }
@keyframes pd-boot-pulse { 50% { opacity: .35; transform: scale(.8); } }

/* ---------- layout mode "bare": sidebar, topbar and tab bar are hidden (the hidden attribute), a small bar stays ---------- */
.pd-app[data-layout="bare"] .pd-col { background: var(--bg-canvas) radial-gradient(70% 380px at 50% 0%, var(--accent-soft) 0%, transparent 72%) no-repeat; }
.pd-barebar { flex: none; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; position: relative; z-index: var(--z-topbar); }
.pd-barebar[hidden] { display: none; }
.pd-barebar__left, .pd-barebar__right { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* the title bar of the desktop window stays; the back and forward arrows and the Downloads button have nothing to act on before sign-in (and would let a person walk back into the wizard) */
.pd-app[data-layout="bare"] .pd-titlebar__nav, .pd-app[data-layout="bare"] .pd-dl-btn { display: none; }

.pd-auth { flex: 1 1 auto; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 16px var(--page-pad) 48px; }
.pd-auth__brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.pd-auth__logo { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.pd-auth__tag { font-size: var(--fs-md); color: var(--text-3); }
.pd-auth__card { width: min(440px, 100%); padding: 28px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-md); }
.pd-auth__card--md { width: min(600px, 100%); }
.pd-auth__card--lg { width: min(760px, 100%); }
.pd-auth__title { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
.pd-auth__title:focus { outline: none; }
.pd-auth__sub { margin-top: 6px; font-size: var(--fs-base); color: var(--text-3); line-height: 1.5; }
.pd-auth__steps { margin-bottom: 22px; }
.pd-auth__body { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.pd-auth__alt { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--border-subtle); text-align: center; font-size: var(--fs-md); color: var(--text-3); }
.pd-auth__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pd-auth__fine { font-size: var(--fs-sm); color: var(--text-3); text-align: center; max-width: 440px; }
.pd-auth__card > .pd-empty__icon { margin-bottom: 14px; }
@media (max-width: 719px) {
  .pd-barebar { padding: 0 12px; }
  .pd-auth { padding-inline: 12px; justify-content: flex-start; gap: 14px; }
  .pd-auth__card { padding: 20px 16px; }
}

/* ---------- banners above the page (App.banners): the beta strip keeps its own look (.pd-beta above) ---------- */
.pd-banners { flex: none; display: flex; flex-direction: column; }
.pd-banners:empty { display: none; }
.pd-banner { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 14px 6px 24px; background: var(--accent-soft); border-bottom: 1px solid var(--border-subtle); color: var(--text-2); font-size: var(--fs-md); }
.pd-banner > svg { flex: none; color: var(--accent-text); }
.pd-banner__text { min-width: 0; }
.pd-banner__text b { color: var(--text); font-weight: 600; }
.pd-banner__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.pd-banner--warn { background: var(--amber-bg); } .pd-banner--warn > svg { color: var(--amber-text); }
.pd-banner--danger { background: var(--red-bg); } .pd-banner--danger > svg { color: var(--red-text); }
.pd-banner--demo { background: var(--purple-bg); } .pd-banner--demo > svg { color: var(--purple-text); }
.pd-banner--success { background: var(--green-bg); } .pd-banner--success > svg { color: var(--green-text); }
@media (max-width: 1023px) { .pd-banner { padding-left: 14px; } }
@media (max-width: 719px) { .pd-banner { flex-wrap: wrap; row-gap: 4px; } .pd-banner__actions { margin-left: 24px; } }

/* ---------- the guest block in the sidebar foot, the lock on the Library item, the compact Sign in button of the topbar ---------- */
.pd-guest { display: flex; flex-direction: column; gap: 8px; margin: 0 20px 20px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-raised); }
.pd-guest__text { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.45; }
.pd-guest__fine { font-size: var(--fs-xs); color: var(--text-4); text-align: center; }
.pd-app[data-rail="true"] .pd-guest { margin: 0 12px 14px; padding: 8px 6px; align-items: center; }
.pd-app[data-rail="true"] .pd-guest__text, .pd-app[data-rail="true"] .pd-guest__fine, .pd-app[data-rail="true"] .pd-guest .pd-btn__label { display: none; }
.pd-app[data-rail="true"] .pd-guest .pd-btn { width: var(--control-h); padding: 0; }
.pd-nav__lock { flex: none; margin-left: auto; display: inline-grid; place-items: center; color: var(--text-4); }
.pd-app[data-rail="true"] .pd-nav__lock { position: absolute; top: 4px; right: 6px; margin: 0; }
.pd-topbar .pd-topbar__signin { display: none; }
@media (max-width: 1023px) { .pd-topbar .pd-topbar__signin { display: inline-flex; } }
@media (max-width: 719px) { .pd-topbar .pd-topbar__signin .pd-btn__label { display: none; } .pd-topbar .pd-topbar__signin { width: var(--control-h); padding: 0; } }

/* ---------- account menu, account switcher, settings popover extras ---------- */
.pd-acchead { align-items: flex-start; }
.pd-acchead__text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-acchead__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pd-acchead.is-link { color: inherit; text-decoration: none; transition: background var(--dur-1); }       /* the head of the account menu leads to the profile page */
.pd-acchead.is-link:hover { background: var(--bg-hover); text-decoration: none; }
.pd-acchead.is-link:focus-visible { outline-offset: -2px; }
.pd-settings__more { display: flex; justify-content: flex-end; margin-top: 4px; }
.pd-switcher__list { display: flex; flex-direction: column; gap: 8px; list-style: none; margin: 0; padding: 0; }
.pd-switcher__row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-inner); background: var(--bg-raised); }
.pd-switcher__text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.pd-switcher__name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-switcher__login { font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-switcher__note { margin-top: 12px; font-size: var(--fs-sm); color: var(--text-3); }

/* ---------- the world switch transition (inside the window, below the title bar, so the window controls keep working) ---------- */
.pd-transition { position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: var(--z-modal); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; background: var(--bg-canvas) radial-gradient(70% 380px at 50% 0%, var(--accent-soft) 0%, transparent 72%) no-repeat; text-align: center; }
.pd-transition__status { display: flex; flex-direction: column; gap: 6px; outline: none; }
.pd-transition__title { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.015em; }
.pd-transition__text { color: var(--text-3); font-size: var(--fs-base); }
