/* Sazan Core v4 — single authoritative frame contract.
   Loaded after legacy consolidated CSS and Sazan v2. Website Cards only.
   Navigation, permanent Panels, authentication/payment gates and game Pads excluded. */
body.tsm-universal-nav-enabled:not(.tsm-game-page){
  --tsm-sazan-card-width:var(--sv2-canvas-width,min(760px,calc(100vw - 28px)))!important;
  --tsm-card-top:var(--tsm-content-top,90px);
  --tsm-card-bottom:var(--tsm-content-bottom,94px);
  --tsm-sazan-card-height:max(0px,calc(100svh - var(--tsm-card-top) - var(--tsm-card-bottom)))!important;
  --tsm-sazan-card-radius:20px;
}
/* Safari's small viewport unit remains stable while browser toolbars collapse or expand.
   The Shell and bottom nav retain their reserved geometry regardless of their
   visibility classes; only deliberate device/orientation resize alters it. */
@supports not (height:100svh){
 body.tsm-universal-nav-enabled:not(.tsm-game-page){
  --tsm-sazan-card-height:max(0px,calc(100vh - var(--tsm-card-top) - var(--tsm-card-bottom)))!important;
 }
}
/* Each registered Card has the identical immutable outer box.
   Do not position the card relative to its content or document scroll. */
body.tsm-universal-nav-enabled:not(.tsm-game-page) :is(
  aside.sazan-drawer,aside.tsm-admin-panel,aside.tsm-reaction-picker,
  .profile-editor,.avatar-frame-editor,
  .v51-achievement-detail:not(.tsm13-award-transition-card),
  [data-achievement-detail]:not(.tsm13-award-transition-card),
  dialog.tsm-media-dialog.sazan-card,
  .tsm-wall-conversation-card
){
  position:fixed!important;
  inset:var(--tsm-card-top) auto auto 50%!important;
  width:var(--tsm-sazan-card-width)!important;
  min-width:0!important;
  max-width:var(--tsm-sazan-card-width)!important;
  height:var(--tsm-sazan-card-height)!important;
  min-height:var(--tsm-sazan-card-height)!important;
  max-height:var(--tsm-sazan-card-height)!important;
  aspect-ratio:auto!important;
  box-sizing:border-box!important;
  margin:0!important;
  border-radius:var(--tsm-sazan-card-radius)!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch;
}
body.tsm-universal-nav-enabled:not(.tsm-game-page) :is(
  aside.sazan-drawer,aside.tsm-admin-panel,aside.tsm-reaction-picker,
  .profile-editor,.avatar-frame-editor,
  .v51-achievement-detail:not(.tsm13-award-transition-card),
  [data-achievement-detail]:not(.tsm13-award-transition-card)
){
  z-index:1108!important;
  transform:translate(-50%,calc(100svh + 24px))!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  visibility:hidden!important;
  opacity:0!important;
  pointer-events:none!important;
  transition:transform .32s cubic-bezier(.22,.65,.28,1),opacity .22s ease,visibility 0s linear .32s!important;
}
body.tsm-universal-nav-enabled:not(.tsm-game-page) :is(
  aside.sazan-drawer,aside.tsm-admin-panel,aside.tsm-reaction-picker,
  .profile-editor,.avatar-frame-editor,
  .v51-achievement-detail:not(.tsm13-award-transition-card),
  [data-achievement-detail]:not(.tsm13-award-transition-card)
).open{
  transform:translate(-50%,0)!important;
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto!important;
  transition:transform .32s cubic-bezier(.22,.65,.28,1),opacity .22s ease!important;
}
/* Native dialog is in the browser top layer and maintains its own [open] state.
   Moving a Media card shuffles the whole frame without changing its measured size. */
body.tsm-page-media.tsm-universal-nav-enabled dialog.tsm-media-dialog.sazan-card{
  transform:translateX(-50%)!important;
  overflow:hidden!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
}
body.tsm-page-media.tsm-universal-nav-enabled dialog.tsm-media-dialog.sazan-card [data-media-viewer]{
  width:100%!important;height:100%!important;max-height:100%!important;
  min-height:0!important;overflow:hidden!important;
}
/* Reward backdrop stays below the Card and Shell, above permanent Panels. */
body.tsm-universal-nav-enabled .v51-achievement-backdrop{z-index:1107!important;}
/* Hide the bottom rail without removing its measured layout reservation. */
body.tsm-card-active > nav.tsm-universal-sazan{
  visibility:hidden!important;
  pointer-events:none!important;
}
/* The enclosing frame never scrolls the body. Only its interior is scrollable. */
@media(prefers-reduced-motion:reduce){
  body.tsm-universal-nav-enabled:not(.tsm-game-page) :is(
    aside.sazan-drawer,aside.tsm-admin-panel,aside.tsm-reaction-picker,
    .profile-editor,.avatar-frame-editor,.v51-achievement-detail,
    [data-achievement-detail]
  ){transition-duration:.01ms!important;}
}

/* Unified Card lifecycle state presentation (previously a separately injected v5 stylesheet). */
/* Sazan Core v5: mutually exclusive visible website Cards.
   The shared lifecycle sets data-sazan-suspended; component state and DOM remain.
   This does not modify permanent panels, authentication gates or game controls. */
body.tsm-universal-nav-enabled:not(.tsm-game-page) [data-sazan-suspended]{
  display:none!important;
  visibility:hidden!important;
  pointer-events:none!important;
}
/* An active child Card is always above its suspended parent, including
   a Reaction Sazan opened from a Wall Conversation. */
body.tsm-universal-nav-enabled:not(.tsm-game-page) :is(
 aside.sazan-drawer.open,aside.tsm-admin-panel.open,aside.tsm-reaction-picker.open,
 .profile-editor.open,.avatar-frame-editor.open,
 .v51-achievement-detail.open,[data-achievement-detail].open,
 .tsm-wall-conversation-card.open,[data-public-chat],.wall-chat-sazan.open
):not([data-sazan-suspended]){
  z-index:15000!important;
}
body.tsm-universal-nav-enabled[data-sazan-private-suspended] [data-public-chat-backdrop]{display:none!important;pointer-events:none!important;}
body.tsm-universal-nav-enabled[data-sazan-achievement-suspended] [data-achievement-detail-backdrop]{display:none!important;pointer-events:none!important;}
/* Top-layer native dialogs are managed by the browser and are exempt
   from the CSS z-index ordering. */
