/* Additive platform navigation; product styles and state remain independent. */
html.pnav-enabled {
  --pnav-height: calc(56px + env(safe-area-inset-top, 0px));
  scroll-padding-top: calc(var(--pnav-height) + 64px);
}
.pnav-bar,
.pnav-drawer,
.pnav-bar *,
.pnav-drawer * { box-sizing: border-box; }
.pnav-bar {
  position: sticky;
  top: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 12px;
  width: 100%;
  min-height: var(--pnav-height);
  margin: 0;
  padding: calc(6px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px));
  border: 0;
  border-bottom: 1px solid #e2ddcf;
  background: #f8f5ee;
  color: #302c26;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}
.pnav-menu,
.pnav-close,
.pnav-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #ddd5c4;
  border-radius: 10px;
  background: transparent;
  color: #57472f;
  font: 650 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pnav-menu { width: 44px; padding: 11px; }
.pnav-menu-glyph { display: grid; gap: 4px; width: 20px; }
.pnav-menu-glyph > span { display: block; height: 2px; width: 20px; border-radius: 2px; background: currentColor; }
.pnav-menu:hover,
.pnav-home:hover { background: #eee7d9; color: #7b4c19; }
.pnav-menu:focus-visible,
.pnav-home:focus-visible,
.pnav-close:focus-visible,
.pnav-link:focus-visible { outline: 3px solid #b47c2c; outline-offset: 3px; }

html.pnav-enabled .pnav-root-header {
  position: sticky;
  top: 0;
  z-index: 110;
  justify-content: flex-start;
  gap: 16px;
  padding-top: max(16px, env(safe-area-inset-top, 0px));
  background: #f8f5ee;
}
.pnav-bar.pnav-root-controls {
  position: static;
  width: auto;
  min-height: 44px;
  padding: 0;
  border: 0;
}
html.pnav-enabled[data-pnav-product="super"] .flow-navigation,
html.pnav-enabled[data-pnav-product="remake"] body > .navigation {
  top: var(--pnav-height);
  min-height: 58px;
  padding-top: 6px;
}
/* Keep every original free-product sidebar/toolbar destination. Only its
   redundant mobile hamburger is replaced by the platform-wide control. */
html.pnav-enabled[data-pnav-product="free"] .topbar .mobile-menu { display: none !important; }
html.pnav-enabled[data-pnav-product="free"] .app-shell > .sidebar { top: var(--pnav-height); }
html.pnav-enabled[data-pnav-product="free"] .topbar { top: var(--pnav-height); }

.pnav-drawer {
  position: fixed;
  z-index: 1000;
  inset: 0 auto 0 0;
  width: min(320px, calc(100vw - 28px));
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px max(24px, env(safe-area-inset-bottom, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  background: #202220;
  color: #eeeae1;
  box-shadow: 16px 0 56px #17191440;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.pnav-drawer:not([open]) { display: none; }
.pnav-drawer::backdrop { background: #17191480; }
.pnav-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 27px; }
.pnav-drawer .pnav-title { margin: 0; color: #f6eddc; font-size: 21px; font-weight: 700; letter-spacing: .06em; line-height: 1.5; }
.pnav-drawer .pnav-close { border-color: #5b574c; color: #e8d9bb; }
.pnav-close-glyph { font-size: 29px; font-weight: 400; line-height: 22px; }
.pnav-links { display: grid; gap: 8px; }
.pnav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #d5d1c8;
  font-size: 15px;
  font-weight: 550;
  line-height: 1.6;
  text-decoration: none;
  touch-action: manipulation;
}
.pnav-link:hover { background: #ffffff0c; color: #fff7e7; }
.pnav-link[aria-current] { background: #d98b2b1f; border-color: #d98b2b28; color: #f4c573; }
.pnav-link-glyph { width: 24px; flex: 0 0 auto; text-align: center; font-size: 24px; line-height: 1; }
.pnav-free-links { display: grid; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #ffffff18; }
.pnav-tool-link { padding-left: 49px; }

/* Put controls within the existing modal's sticky navigation. The player,
   close/restart handlers, media controls and native top layer are untouched. */
html.pnav-enabled .player-navigation.pnav-player-host { grid-template-areas: "platform platform" "back home"; }
.pnav-bar.pnav-in-player {
  grid-area: platform;
  position: static;
  min-height: 48px;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 1px solid #e2ddcf;
  background: transparent;
}
.pnav-in-player .pnav-menu,
.pnav-in-player .pnav-home { font-size: 12px; }

@media (max-width: 350px) {
  .pnav-bar { padding-right: max(12px, env(safe-area-inset-right, 0px)); padding-left: max(12px, env(safe-area-inset-left, 0px)); }
  .pnav-bar.pnav-root-controls,
  .pnav-bar.pnav-in-player { padding-inline: 0; }
  html.pnav-enabled .pnav-root-header { gap: 12px; }
  .pnav-home { font-size: 13px; }
}
