/* --- GLOBAL VARIABLES & THEME --- */
:root {
  --primary: #00d4ff;
  --accent-blue: #00d4ff;
  --bg: #0b0e14;
  --panel: #161b22;
  --text: #ffffff;
  --border: #30363d;
  --muted: #8b949e;
  --sidebar-width: 160px;
  --sidebar-collapsed: 70px;
  --banner-height: 70px;
}

@media (min-width: 1024px) {
  :root {
    --banner-height: 120px;
  }
}

/* --- BASE RESET --- */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* --- HEADER --- */
.header-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1100;
  width: 100%;
  height: var(--banner-height);
  display: flex;
  align-items: center;
  box-sizing: border-box;
  background-color: #000;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
    url("https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?w=1200");
  background-size: cover;
  background-position: center;
  border-bottom: 2px solid var(--accent-blue);
}

.header-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
}

.banner-title {
  display: flex;
  gap: 8px;
  max-width: 50%;
  margin: 0;
  color: #ffffff;
  font-size: clamp(0.8rem, 3vw, 2.5rem);
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  direction: ltr;
  unicode-bidi: isolate;
  flex-direction: row;
}

.banner-title span {
  direction: ltr;
  unicode-bidi: isolate;
}

html[dir="rtl"] .banner-title {
  direction: ltr;
  unicode-bidi: isolate;
  flex-direction: row;
}

html[dir="rtl"] #toggleSidebar {
  left: 15px;
  right: auto;
}

html[dir="rtl"] #user-section {
  right: 15px;
  left: auto;
}

#toggleSidebar {
  position: absolute;
  left: 15px;
  z-index: 1200;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
}

#user-section {
  position: absolute;
  right: 15px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- BUTTONS --- */
.btn-main,
.btn-login,
.btn-join,
.btn-live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #000000;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-join {
  background: #00ff88;
}

.btn-logout {
  background: #ff4d4d;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 700;
}

.admin-badge {
  margin-left: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--primary);
  color: #000000;
  font-size: 0.5rem;
  font-weight: 900;
}

/* --- SIDEBAR --- */
#sidebar {
  position: fixed;
  top: var(--banner-height);
  bottom: 0;
  left: calc(var(--sidebar-width) * -1);
  z-index: 1000;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  background: #0d1117;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.55) rgba(4, 13, 20, 0.45);
  overscroll-behavior: contain;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body,
.main-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.38) rgba(4, 13, 20, 0.85);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(4, 13, 20, 0.92);
}

::-webkit-scrollbar-thumb {
  border: 2px solid rgba(4, 13, 20, 0.92);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.55), rgba(0, 92, 120, 0.58));
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.9), rgba(0, 121, 160, 0.86));
}

#sidebar::-webkit-scrollbar {
  width: 7px;
}

#sidebar::-webkit-scrollbar-track {
  background: rgba(4, 13, 20, 0.45);
  border-left: 1px solid rgba(255, 255, 255, 0.04);
}

#sidebar::-webkit-scrollbar-thumb {
  min-height: 42px;
  border: 2px solid rgba(13, 17, 23, 0.92);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.62), rgba(0, 92, 120, 0.62));
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.9), rgba(0, 121, 160, 0.86));
}

#sidebar.active {
  left: 0;
}

.sidebar-toggle-area {
  display: flex;
  justify-content: center;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.nav-links {
  padding: 10px 5px;
  box-sizing: border-box;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 2px;
  padding: 6px 10px;
  box-sizing: border-box;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: 0.2s;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(0, 212, 255, 0.08);
  color: var(--primary);
}

.nav-item i {
  min-width: 20px;
  margin-right: 5px;
  flex-shrink: 0;
  font-size: 0.9rem;
  font-style: normal;
  line-height: 1;
  text-align: center;
}

.nav-item span {
  color: #a0a7b0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  line-height: 1.15;
}

.nav-item:hover span,
.nav-item.active span {
  color: var(--primary);
}

.admin-label,
.admin-section-label {
  display: block;
  width: 100%;
  margin: 0;
  padding: 18px 4px 8px;
  box-sizing: border-box;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  white-space: normal;
}

/* --- CONTENT WRAPPER --- */
.main-content {
  margin-top: var(--banner-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

/* --- MODALS --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.9);
}

.login-box {
  width: 100%;
  max-width: 340px;
  padding: 25px;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px;
  box-sizing: border-box;
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.divider {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  margin: 0 10px;
  border-bottom: 1px solid var(--border);
}

.manual-input {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px;
  box-sizing: border-box;
  background: #0d1117;
  color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
}

.manual-input:focus {
  border-color: var(--primary);
  outline: none;
}

/* --- ORGANIZER SETUP MODAL --- */
#organizerProfileModal .login-box,
#organizerProfileModal .organizer-setup-box {
  width: min(92vw, 540px);
  max-width: 540px;
  padding: 34px 30px 28px;
  box-sizing: border-box;
  border-radius: 18px;
}

#organizerProfileModal h2 {
  margin: 0 0 16px;
  font-size: 2rem;
  line-height: 1.2;
  text-align: center;
}

#organizerProfileModal p,
.organizer-setup-note {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
}

#organizerProfileModal .manual-input {
  margin-bottom: 12px;
}

#organizerProfileModal label,
.organizer-contact-section {
  text-align: left;
}

.organizer-contact-section {
  margin-top: 4px;
}

.organizer-contact-label {
  display: block;
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#organizerPhoneGroup,
.organizer-phone-group {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.organizer-phone-group {
  display: none;
}

.country-code-compact,
#organizerCountryCode {
  width: 104px !important;
  min-width: 104px !important;
  max-width: 104px !important;
  margin-bottom: 0 !important;
  padding: 0 6px !important;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 0.9rem;
}

#modalVenueContactNumber {
  flex: 1;
  min-width: 0;
  margin-bottom: 0 !important;
}

.same-as-phone-row,
.same-as-phone-toggle-row,
#organizerProfileModal .same-as-phone-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
}

.same-as-phone-toggle-row {
  justify-content: space-between;
  gap: 12px;
}

.same-as-phone-row,
.same-as-phone-row input[type="checkbox"] {
  cursor: pointer;
}

.same-as-phone-row input[type="checkbox"],
#organizerProfileModal .same-as-phone-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.organizer-save-btn,
#organizerProfileModal .btn-join {
  width: 100%;
  margin-top: 16px !important;
  padding: 14px 16px !important;
  font-size: 1rem !important;
  font-weight: 900;
}

/* --- MINI SWITCH --- */
.mini-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.mini-switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.mini-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: var(--border);
  border: 1px solid #484f58;
  border-radius: 999px;
  transition: 0.2s ease;
}

.mini-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 3px;
  width: 18px;
  height: 18px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: 0.2s ease;
}

.mini-switch input:checked + .mini-slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

.mini-switch input:checked + .mini-slider::before {
  transform: translateX(20px);
}

/* --- RESPONSIVE --- */
@media (min-width: 1024px) {
  .header-content {
    padding: 0 40px;
  }

  #toggleSidebar {
    color: var(--muted);
  }

  #sidebar {
    left: 0;
    width: var(--sidebar-width);
  }

  #sidebar.collapsed {
    width: var(--sidebar-collapsed);
  }

  .nav-links {
    padding: 14px 12px;
  }

  .nav-item {
    width: 100%;
    min-height: 46px;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 14px;
    text-align: left;
  }

  .nav-item i {
    width: 24px;
    min-width: 24px;
    margin: 0;
    font-size: 1rem;
  }

  .nav-item span {
    display: block;
    width: auto;
    max-width: none;
    font-size: 0.78rem;
    line-height: 1.25;
    text-align: left;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  .admin-label,
  .admin-section-label {
    padding: 18px 8px 8px;
    font-size: 0.68rem;
    text-align: left;
  }

  #sidebar.collapsed .nav-item {
    justify-content: center;
    min-height: 46px;
    padding: 10px 0;
    gap: 0;
  }

  #sidebar.collapsed .nav-item span,
  #sidebar.collapsed .admin-label,
  #sidebar.collapsed .admin-section-label {
    display: none;
  }

  #sidebar.collapsed .nav-item i {
    width: 100%;
    min-width: 0;
    font-size: 1.1rem;
  }

  .main-content {
    margin-left: var(--sidebar-width);
    padding: 40px;
  }

  .main-content.expanded {
    margin-left: var(--sidebar-collapsed);
  }

  .btn-main,
  .btn-login,
  .btn-join,
  .btn-live {
    padding: 10px 20px;
    font-size: 1rem;
  }

  .btn-logout {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}

@media (min-width: 1024px) and (max-height: 900px),
  (min-width: 1024px) and (max-width: 1440px) {
  .nav-links {
    padding: 10px 8px;
  }

  .nav-item {
    min-height: 40px;
    margin-bottom: 1px;
    gap: 9px;
    padding: 7px 10px;
  }

  .nav-item i {
    width: 22px;
    min-width: 22px;
    font-size: 0.95rem;
  }

  .nav-item span {
    font-size: 0.72rem;
    line-height: 1.18;
  }

  .admin-label,
  .admin-section-label {
    padding: 12px 8px 6px;
    font-size: 0.62rem;
    letter-spacing: 0.9px;
  }

  #sidebar.collapsed .nav-item {
    min-height: 40px;
    padding: 7px 0;
  }
}

@media (min-width: 1024px) and (max-height: 760px) {
  .nav-links {
    padding: 8px 7px;
  }

  .nav-item {
    min-height: 36px;
    padding: 6px 9px;
  }

  .nav-item span {
    font-size: 0.7rem;
    line-height: 1.12;
  }

  .admin-label,
  .admin-section-label {
    padding: 9px 7px 5px;
    font-size: 0.58rem;
  }
}

@media (max-width: 1024px) {
  .banner-title {
    flex-direction: column;
    gap: 0;
    max-width: 45%;
    font-size: 0.8rem;
    line-height: 1.1;
  }

  .banner-title span {
    display: block;
  }
}

@media (max-width: 1023px) {
  #user-section span:first-child,
  .sidebar-toggle-area {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .modal-overlay {
    padding: 16px;
  }

  .login-box {
    max-width: 420px;
    padding: 22px;
  }

  #organizerProfileModal .organizer-setup-box,
  #organizerProfileModal .login-box {
    width: 100%;
    padding: 28px 22px 24px;
  }

  #organizerProfileModal h2 {
    font-size: 1.65rem;
  }

  #organizerPhoneGroup,
  .organizer-phone-group {
    gap: 8px;
  }

  .country-code-compact,
  #organizerCountryCode {
    width: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;
    font-size: 0.82rem;
  }
}


/* --- SIDEBAR SMOOTHNESS / MOBILE STABILITY --- */
#sidebar,
.main-content {
  will-change: width, left, margin-left;
}

@media (max-width: 1023px) {
  #sidebar {
    left: calc(var(--sidebar-width) * -1);
  }

  #sidebar.active {
    left: 0;
  }

  .main-content,
  .main-content.expanded {
    margin-left: 0 !important;
  }
}

/* --- DESKTOP ADAPTIVE STABILITY --- */
/* Page-specific CSS files now control large-screen content widths. Keep the global wrapper flexible. */
.main-content {
  box-sizing: border-box;
}

/* --- SHARED HEADER LANGUAGE SELECTOR --- */
.gbn-header-language-control {
  position: absolute;
  left: 58px;
  top: 50%;
  z-index: 1201;
  display: inline-flex;
  align-items: center;
  width: auto;
  min-width: 0;
  gap: 0;
  transform: translateY(-50%);
  color: #c9d1d9;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Keep the selector discreet: the visible control shows only EN or AR. */
.gbn-header-language-label {
  display: none !important;
}

.gbn-header-language-selector {
  width: 52px !important;
  min-width: 52px !important;
  max-width: 52px !important;
  height: 29px !important;
  margin: 0 !important;
  padding: 0 20px 0 7px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 7px !important;
  background-color: rgba(13, 17, 23, 0.72) !important;
  color: #c9d1d9 !important;
  font-size: 0.64rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  cursor: pointer;
  box-sizing: border-box;
}

.gbn-header-language-selector:hover {
  color: #ffffff !important;
  border-color: rgba(0, 212, 255, 0.38) !important;
}

.gbn-header-language-selector:focus {
  color: #ffffff !important;
  border-color: var(--primary, #00d4ff) !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.gbn-header-language-selector option {
  background: #161b22;
  color: #ffffff;
}

html[dir="rtl"] .gbn-header-language-control {
  direction: rtl;
}

html[dir="rtl"] .gbn-header-language-selector {
  direction: rtl;
  text-align: right;
  padding: 0 7px 0 20px !important;
}

@media (max-width: 760px) {
  .gbn-header-language-control {
    left: 52px;
  }

  .gbn-header-language-selector {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 27px !important;
    font-size: 0.62rem !important;
  }
}

@media (max-width: 420px) {
  .gbn-header-language-selector {
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
  }
}


/* --- HEADER RESPONSIVE USER CONTROLS --- */
#user-section {
  min-width: 0;
  max-width: min(44vw, 460px);
  overflow: visible;
}

.gbn-user-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
}

.gbn-header-greeting {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 180px;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
}

.gbn-header-name {
  display: inline-block;
  min-width: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 150px;
  overflow: hidden;
  border: none;
  border-radius: 5px;
  background: #238636;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  padding: 7px 12px;
  white-space: nowrap;
}

.btn-admin span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 1024px) and (max-width: 1440px) {
  .banner-title {
    max-width: 36%;
    font-size: clamp(1.35rem, 2.15vw, 2.05rem);
  }

  #user-section {
    right: 12px;
    max-width: min(38vw, 390px);
  }

  .gbn-user-header {
    gap: 7px;
  }

  .gbn-header-greeting {
    max-width: 145px;
    font-size: 0.76rem;
  }

  .gbn-header-name {
    max-width: 92px;
  }

  .btn-admin {
    max-width: 130px;
    padding: 7px 10px;
    font-size: 0.76rem;
  }
}

@media (min-width: 1024px) and (max-width: 1220px) {
  .banner-title {
    max-width: 32%;
    font-size: clamp(1.15rem, 1.95vw, 1.65rem);
    gap: 6px;
  }

  #user-section {
    max-width: min(42vw, 340px);
  }

  .gbn-header-hi {
    display: none;
  }

  .gbn-header-greeting {
    max-width: 96px;
  }

  .gbn-header-name {
    max-width: 96px;
  }

  .gbn-notification-btn {
    width: 30px;
    height: 30px;
  }

  .btn-admin {
    max-width: 112px;
    padding: 7px 9px;
    font-size: 0.72rem;
  }

  .btn-logout {
    padding: 7px 10px;
    font-size: 0.74rem;
  }
}

@media (max-width: 1023px) {
  .gbn-user-header {
    gap: 6px;
  }

  .gbn-header-greeting {
    display: none;
  }
}


/* Manual payment modal: separated information sections */
.manual-payment-box .manual-payment-body {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: #f8fbff;
  margin: 18px 0;
  padding: 12px;
}

.manual-payment-section {
  border-radius: 12px;
  margin: 10px 0;
  padding: 12px 14px;
}

.manual-payment-section-title {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.manual-payment-section-lines {
  font-size: 0.92rem;
  line-height: 1.55;
}

.manual-payment-line + .manual-payment-line {
  margin-top: 4px;
}

.manual-payment-section-payment-info {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.85);
  border-left: 4px solid #00d4ff;
}

.manual-payment-section-payment-info .manual-payment-section-title {
  color: #00d4ff;
}

.manual-payment-section-next-step {
  background: rgba(255, 209, 102, 0.10);
  border: 1px solid rgba(255, 209, 102, 0.85);
  border-left: 4px solid #ffd166;
}

.manual-payment-section-next-step .manual-payment-section-title {
  color: #ffd166;
}

.manual-payment-section-organizer-instructions {
  background: rgba(123, 216, 143, 0.10);
  border: 1px solid rgba(123, 216, 143, 0.85);
  border-left: 4px solid #7bd88f;
}

.manual-payment-section-organizer-instructions .manual-payment-section-title {
  color: #7bd88f;
}

html[dir="rtl"] .manual-payment-section,
[dir="rtl"] .manual-payment-section {
  border-left-width: 1px;
  border-right-width: 4px;
}

/* --- 63.34B.6 CSS SIDEBAR CONTENT WIDTH RESTORE ---
   CSS-led containment for desktop/laptop layouts beside the fixed sidebar.
   The sidebar controller keeps #mainContent offset/width; these rules prevent
   page-specific vw-based sections from exceeding the remaining visible area. */
@media (min-width: 1024px) {
  html body main#mainContent.main-content {
    --gbn-content-max: 1400px;
    box-sizing: border-box !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  @media (min-width: 1700px) {
    html body main#mainContent.main-content {
      --gbn-content-max: 1440px;
    }
  }

  @media (min-width: 2100px) {
    html body main#mainContent.main-content {
      --gbn-content-max: 1560px;
    }
  }

  html body main#mainContent.main-content > *,
  html body main#mainContent.main-content .section-container,
  html body main#mainContent.main-content .home-hero,
  html body main#mainContent.main-content .listing-hero,
  html body main#mainContent.main-content .tournament-hero,
  html body main#mainContent.main-content .tournament-directory-hero,
  html body main#mainContent.main-content .tournaments-hero,
  html body main#mainContent.main-content .directory-hero,
  html body main#mainContent.main-content .tournament-listing-section,
  html body main#mainContent.main-content .tournaments-section,
  html body main#mainContent.main-content .section-heading-row,
  html body main#mainContent.main-content .section-header,
  html body main#mainContent.main-content .grid,
  html body main#mainContent.main-content .promo-grid,
  html body main#mainContent.main-content .homepage-banner-row,
  html body main#mainContent.main-content .major-sponsored-ads-grid,
  html body main#mainContent.main-content .featured-sponsor-strip-grid,
  html body main#mainContent.main-content .rankings-hero,
  html body main#mainContent.main-content .rankings-card,
  html body main#mainContent.main-content .ranking-table-wrap,
  html body main#mainContent.main-content .player-list-shell,
  html body main#mainContent.main-content .player-list-panel,
  html body main#mainContent.main-content .profile-shell,
  html body main#mainContent.main-content .profile-card,
  html body main#mainContent.main-content .profile-content,
  html body main#mainContent.main-content .admin-dashboard-page,
  html body main#mainContent.main-content .admin-page,
  html body main#mainContent.main-content .admin-section,
  html body main#mainContent.main-content .dashboard-card,
  html body main#mainContent.main-content .organizer-dashboard,
  html body main#mainContent.main-content .organizer-panel,
  html body main#mainContent.main-content .subscription-container,
  html body main#mainContent.main-content .content-card,
  html body main#mainContent.main-content .legal-container,
  html body main#mainContent.main-content .about-page,
  html body main#mainContent.main-content .sponsor-page,
  html body main#mainContent.main-content .bracket-page,
  html body main#mainContent.main-content .bracket-container {
    box-sizing: border-box !important;
    width: min(100%, var(--gbn-content-max)) !important;
    max-width: var(--gbn-content-max) !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Keep registration workspace inside the available area without forcing the whole page wider. */
  html body main#mainContent.main-content.dashboard-layout,
  html body main#mainContent.main-content.dashboard-layout.expanded {
    max-width: calc(100vw - var(--gbn-sidebar-safe-offset, var(--sidebar-width))) !important;
  }

  html body main#mainContent.main-content.dashboard-layout .admin-flex-wrapper {
    box-sizing: border-box !important;
    width: min(100%, var(--gbn-content-max)) !important;
    max-width: var(--gbn-content-max) !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  html body main#mainContent.main-content.dashboard-layout .master-list {
    flex: 0 0 clamp(210px, 18vw, 300px) !important;
    width: clamp(210px, 18vw, 300px) !important;
    min-width: clamp(210px, 18vw, 300px) !important;
    max-width: 300px !important;
  }

  html body main#mainContent.main-content.dashboard-layout .detail-view,
  html body main#mainContent.main-content.dashboard-layout #registration-view,
  html body main#mainContent.main-content.dashboard-layout #empty-state,
  html body main#mainContent.main-content.dashboard-layout .control-panel,
  html body main#mainContent.main-content.dashboard-layout .manual-entry-bar,
  html body main#mainContent.main-content.dashboard-layout .pending-registration-section,
  html body main#mainContent.main-content.dashboard-layout .table-scroll-area,
  html body main#mainContent.main-content.dashboard-layout #player-search-result {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body main#mainContent.main-content.dashboard-layout .control-panel,
  html body main#mainContent.main-content.dashboard-layout .manual-entry-bar,
  html body main#mainContent.main-content.dashboard-layout #management-actions {
    flex-wrap: wrap !important;
  }

  html body main#mainContent.main-content.dashboard-layout .panel-left,
  html body main#mainContent.main-content.dashboard-layout .hero-input-wrapper {
    min-width: 0 !important;
    flex: 1 1 260px !important;
  }

  @media (max-width: 1320px) {
    html body main#mainContent.main-content {
      padding-left: clamp(14px, 1.4vw, 22px) !important;
      padding-right: clamp(14px, 1.4vw, 22px) !important;
    }

    html body main#mainContent.main-content.dashboard-layout .master-list {
      flex-basis: 220px !important;
      width: 220px !important;
      min-width: 220px !important;
    }
  }

  /* Wide tables and brackets must scroll inside their panels, not push the viewport wider. */
  html body main#mainContent.main-content .table-scroll-area,
  html body main#mainContent.main-content .ranking-table-wrap,
  html body main#mainContent.main-content .player-list-table-wrap,
  html body main#mainContent.main-content .table-wrap,
  html body main#mainContent.main-content .admin-table-wrap,
  html body main#mainContent.main-content .bracket-wrapper,
  html body main#mainContent.main-content .bracket-scroll {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  html body main#mainContent.main-content table,
  html body main#mainContent.main-content .rankings-table,
  html body main#mainContent.main-content .player-list-table,
  html body main#mainContent.main-content .roster-table,
  html body main#mainContent.main-content .pending-roster-table {
    max-width: none !important;
  }
}

/* =========================================================
   64.1 PRE-LAUNCH MOBILE FRAME STABILITY
   Keep mobile/tablet pages centered and prevent stale desktop
   sidebar rail widths from forcing zoomed-out or off-center views.
   ========================================================= */
@media (max-width: 1023px) {
  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  body > .header-banner,
  body > #sidebar,
  body > #siteFooter,
  body > footer.site-global-footer {
    max-width: 100vw !important;
  }

  main#mainContent.main-content,
  main#mainContent.main-content.expanded,
  body.bracket-focus-mode main#mainContent.main-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: clamp(14px, 3.8vw, 24px) !important;
    padding-right: clamp(14px, 3.8vw, 24px) !important;
    box-sizing: border-box !important;
    align-items: center !important;
    overflow-x: hidden !important;
  }

  main#mainContent.main-content > * {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  main#mainContent.main-content .table-scroll-area,
  main#mainContent.main-content .ranking-table-wrap,
  main#mainContent.main-content .player-list-table-wrap,
  main#mainContent.main-content .table-wrap,
  main#mainContent.main-content .admin-table-wrap,
  main#mainContent.main-content .bracket-wrapper,
  main#mainContent.main-content .bracket-scroll {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}
