/* Footballer OS v6.2 - layout stabilization patch
   목적: PC/태블릿/모바일에서 본문 카드 짤림, 좌측 밀림, 우측 플로팅 버튼 불균형을 방지한다. */
html, body, #root {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden !important;
  background: #0d1b3e;
}
* { box-sizing: border-box; }

/* 기존 앱이 max-w-2xl(42rem)로 대부분의 화면을 제한해 PC에서 과도하게 좁아지던 문제 보정 */
#root .max-w-2xl {
  max-width: min(1120px, calc(100vw - 32px)) !important;
}
#root .max-w-xs { max-width: min(20rem, calc(100vw - 32px)) !important; }

/* 카드/패널이 viewport 밖으로 밀리는 문제 방지 */
#root [class*="rounded"],
#root [class*="grid"],
#root [class*="flex"] {
  min-width: 0;
}
#root table { max-width: 100%; }
#root .overflow-x-auto { max-width: 100%; }

/* 상단 탭: 잘림 대신 스크롤 가능, 터치 사용성 확보 */
#root .no-scrollbar,
#root [class*="overflow-x-auto"] {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
#root button { touch-action: manipulation; }

/* 우측 보조 버튼 스택 통일: 위치/폭/높이/간격 */
.fos-floating-action-stack-v62,
#fos-floating-action-stack,
.fos-action-stack {
  position: fixed !important;
  right: max(16px, env(safe-area-inset-right)) !important;
  bottom: max(18px, env(safe-area-inset-bottom)) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px !important;
  z-index: 80 !important;
  width: 190px !important;
  max-width: calc(100vw - 32px) !important;
}
.fos-floating-action-stack-v62 button,
#fos-floating-action-stack button,
.fos-action-stack button,
button[data-fos-action],
button[data-fos-float] {
  width: 100% !important;
  min-height: 48px !important;
  padding: 0 14px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
  font-weight: 800 !important;
  box-shadow: 0 12px 24px rgba(0,0,0,.25) !important;
}

/* 잠금/PIN 화면에서는 보조 버튼 숨김: 화면 방해 및 오작동 방지 */
body.fos-lock-screen-active .fos-floating-action-stack-v62,
body.fos-lock-screen-active #fos-floating-action-stack,
body.fos-lock-screen-active .fos-action-stack,
body.fos-lock-screen-active button[data-fos-action],
body.fos-lock-screen-active button[data-fos-float] {
  display: none !important;
}

/* 중형 화면: 플로팅 버튼은 하단 가로형으로 압축 */
@media (max-width: 760px) {
  #root .max-w-2xl { max-width: calc(100vw - 20px) !important; }
  .fos-floating-action-stack-v62,
  #fos-floating-action-stack,
  .fos-action-stack {
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    width: auto !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    padding: 0 0 4px 0 !important;
  }
  .fos-floating-action-stack-v62 button,
  #fos-floating-action-stack button,
  .fos-action-stack button,
  button[data-fos-action],
  button[data-fos-float] {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 138px !important;
    min-height: 44px !important;
  }
}

/* DevTools로 viewport가 좁을 때 본문이 좌측으로 잘리는 현상 완화 */
@media (max-width: 520px) {
  #root .px-4 { padding-left: 10px !important; padding-right: 10px !important; }
  #root .py-5 { padding-top: 14px !important; padding-bottom: 14px !important; }
  #root .text-xl { font-size: 1.05rem !important; }
}
