/* Auth modals + logged-in header — Stake style */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-overlay.open { display: flex; }

.auth-modal {
  width: 100%;
  max-width: 420px;
  background: #1a2c38;
  border-radius: 8px;
  border: 1px solid #2f4553;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.auth-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2f4553;
}

.auth-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #f7fafc;
}

.auth-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #b1bad3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.auth-close:hover { background: rgba(255,255,255,0.06); color: #fff; }

.auth-modal-body { padding: 20px; }

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: #0f212e;
  border-radius: 8px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  height: 40px;
  border-radius: 6px;
  color: #b1bad3;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.active {
  background: #2f4553;
  color: #fff;
}

.auth-field { margin-bottom: 14px; }
.auth-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #b1bad3;
}
.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #2f4553;
  background: #0f212e;
  color: #f7fafc;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.auth-input:focus { border-color: #1475e1; }
.auth-input::placeholder { color: #557086; }

.auth-error {
  display: none;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(252, 87, 74, 0.12);
  color: #fc574a;
  font-size: 14px;
}
.auth-error.show { display: block; }

.auth-submit {
  width: 100%;
  height: 48px;
  border-radius: 8px;
  background: #1475e1;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-top: 4px;
  transition: background 0.15s;
}
.auth-submit:hover { background: #4391e7; }

.auth-switch {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: #b1bad3;
}
.auth-switch button {
  color: #1475e1;
  font-weight: 600;
  font-size: 14px;
}
.auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

/* Logged-in header */
.hdr-guest { display: flex; align-items: center; gap: 8px; }
.hdr-user { display: none; align-items: center; gap: 8px; }
.hdr-user.show { display: flex !important; }
.hdr-guest.hide { display: none !important; }

.wager-chip {
  display: inline-flex;
  align-items: center;
  align-self: center;
  height: 28px;
  padding: 0 10px;
  margin: 0 6px 0 0;
  border-radius: 8px;
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.35);
  color: #ffd27a;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wager-chip[hidden] { display: none !important; }
@media (max-width: 900px) {
  .wager-chip { max-width: 90px; font-size: 10px; padding: 0 6px; margin-right: 4px; }
}

.wallet-wrap {
  display: flex;
  align-items: stretch;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
}

.wallet-balance {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.32);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  border-radius: 8px 0 0 8px;
  min-width: 0;
  flex-shrink: 0;
}
.wallet-balance #wallet-amount {
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.wallet-balance svg { width: 20px; height: 20px; flex-shrink: 0; }
.wallet-balance .chev { width: 14px; height: 14px; opacity: 0.7; }

.btn-deposit {
  padding: 12px 20px;
  background: #1475e1;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  border-radius: 0 8px 8px 0;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-deposit:hover { background: #4391e7; }

.hdr-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  color: #f7fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s;
}
.hdr-icon-btn:hover { background: rgba(255,255,255,0.06); }
.hdr-icon-btn svg { width: 20px; height: 20px; }
.hdr-icon-btn .dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1475e1;
  border: 1.5px solid #1a2e39;
}

.profile-wrap { position: relative; }

.btn-profile {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: transparent;
  color: #f7fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0;
  transition: background 0.15s;
}
.btn-profile:hover { background: rgba(255,255,255,0.06); }
.btn-profile svg { width: 20px; height: 20px; }

.profile-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: #1a2c38;
  border: 1px solid #2f4553;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 200;
  overflow: hidden;
}
.profile-menu.open { display: block; }

.profile-menu-user {
  padding: 14px 16px;
  border-bottom: 1px solid #2f4553;
}
.profile-menu-name {
  color: #f7fafc;
  font-weight: 600;
  font-size: 14px;
}
.profile-menu-email {
  color: #b1bad3;
  font-size: 12px;
  margin-top: 2px;
  word-break: break-all;
}

.profile-menu a,
.profile-menu button.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  color: #b1bad3;
  font-size: 14px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.profile-menu a:hover,
.profile-menu button.menu-item:hover {
  background: rgba(255,255,255,0.05);
  color: #f7fafc;
}
.profile-menu svg { width: 18px; height: 18px; flex-shrink: 0; }
.profile-menu a.menu-admin-link {
  color: #4391e7;
  font-weight: 700;
}
.profile-menu a.menu-admin-link:hover {
  color: #7eb6f5;
}
.profile-menu-sep {
  height: 1px;
  background: #2f4553;
  margin: 4px 0;
}

/* ── Settings / cabinet — tokens from live Stake scrape ── */
body.cab-page {
  overflow: hidden;
}

.cab-content-scroll {
  padding-top: 0;
}

.cab-inner {
  padding-top: 24px;
  padding-bottom: 32px;
}

.cab-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  min-height: 36px;
}

.cab-h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #f7fafc;
  font-size: 24px;
  font-weight: 700;
  line-height: 36px;
}

.cab-h1 svg { flex-shrink: 0; color: #f7fafc; }

.cab-x {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #b1bad3;
  transition: background 0.15s, color 0.15s;
}
.cab-x:hover { background: rgba(255,255,255,0.06); color: #f7fafc; }

.cab-grid {
  display: flex;
  align-items: flex-start;
  gap: 48px;
}

.cab-nav {
  width: 248px;
  flex-shrink: 0;
}

.cab-nav-item {
  display: block;
  width: 100%;
  height: 48px;
  padding: 12px 20px;
  text-align: left;
  color: #f7fafc;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  border-radius: 0;
  background: transparent;
  transition: background 0.15s;
}
.cab-nav-item:hover { background: rgba(255,255,255,0.04); }
.cab-nav-item.active {
  background: #395565;
  color: #fff;
}

.cab-main {
  flex: 1;
  min-width: 0;
  max-width: 798px;
}

.cab-sec { width: 100%; }

.cab-block { margin-bottom: 40px; }

.cab-block h2 {
  margin: 0 0 8px;
  color: #f7fafc;
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
}

.cab-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.cab-block-head h2 { margin: 0; }

.cab-subh {
  margin: 16px 0 12px;
  color: #f7fafc;
  font-size: 16px;
  font-weight: 700;
}

.cab-desc {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 21px;
  color: #9fbed0;
  max-width: 640px;
}

.cab-label {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 21px;
  color: #9fbed0;
}

.cab-input {
  width: 100%;
  height: 42px;
  padding: 8px 12px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid #395565;
  border-radius: 8px;
  color: #f7fafc;
  font-size: 16px;
  line-height: 24px;
  outline: none;
  transition: border-color 0.15s;
}
.cab-input:focus { border-color: #1475e1; }
.cab-input[readonly] { color: #b1bad3; }
select.cab-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b1bad3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.cab-field {
  position: relative;
  margin-bottom: 16px;
}
.cab-field .cab-input { margin-bottom: 0; padding-right: 44px; }

.cab-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b1bad3;
  border-radius: 6px;
}
.cab-eye:hover { color: #f7fafc; background: rgba(255,255,255,0.06); }

.cab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 10px 20px;
  background: #1475e1;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s;
}
.cab-btn:hover { background: #4391e7; }
.cab-btn.ghost {
  background: #2f4553;
  color: #f7fafc;
}
.cab-btn.ghost:hover { background: #3d5a6c; }

.cab-row-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cab-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(0, 231, 1, 0.15);
  color: #00e701;
  line-height: 1;
}

.cab-phone {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  max-width: 560px;
}
.cab-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cab-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid #2f4553;
}
.cab-toggle-title {
  color: #f7fafc;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.cab-muted { font-size: 13px; color: #9fbed0; line-height: 1.4; }

.cab-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}
.cab-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.cab-switch span {
  position: absolute;
  inset: 0;
  background: #2f4553;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.cab-switch span::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.cab-switch input:checked + span { background: #1475e1; }
.cab-switch input:checked + span::after { transform: translateX(20px); }

.cab-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #2f4553;
  border-radius: 8px;
}
.cab-session strong { color: #f7fafc; display: block; margin-bottom: 2px; font-size: 14px; }

.cab-code {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid #395565;
  border-radius: 8px;
  color: #00e701;
  font-size: 13px;
  overflow-x: auto;
}
.cab-file {
  width: 100%;
  padding: 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed #395565;
  border-radius: 8px;
  color: #b1bad3;
}
.cab-empty {
  padding: 40px 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #2f4553;
  border-radius: 8px;
  color: #9fbed0;
}
.cab-msg { margin-top: 12px; font-size: 14px; }
.cab-msg.ok { color: #00e701; }
.cab-msg.err { color: #fc574a; }

.cab-support {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1475e1;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 40;
}
.cab-support:hover { filter: brightness(1.08); }

/* Header wallet polish */
.hdr-user { gap: 4px; }
.wallet-wrap { height: 48px; }
.wallet-balance {
  height: 48px;
  padding: 0 12px 0 16px;
  box-sizing: border-box;
  min-width: 0;
}
.btn-deposit {
  height: 48px;
  padding: 0 18px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}
.hdr-right {
  margin-left: auto;
}
.hdr-user.show {
  margin-left: auto;
}

@media (max-width: 960px) {
  .cab-grid { flex-direction: column; gap: 16px; }
  .cab-nav {
    width: 100%;
    display: flex;
    overflow-x: auto;
    gap: 0;
    border-bottom: 1px solid #2f4553;
    padding-bottom: 0;
  }
  .cab-nav-item {
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .cab-phone, .cab-2col { grid-template-columns: 1fr; }
  .cab-main { max-width: none; }
}

/* ── Mobile auth modal + header ── */
body.auth-open {
  overflow: hidden !important;
  touch-action: none;
}

@media (max-width: 720px) {
  .auth-overlay {
    padding: 0;
    align-items: flex-end;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
  }
  .auth-modal {
    max-width: none;
    width: 100%;
    max-height: min(94dvh, 94vh);
    border-radius: 16px 16px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
  }
  .auth-modal-head {
    padding: 14px 16px;
    flex-shrink: 0;
  }
  .auth-modal-title { font-size: 17px; }
  .auth-modal-body {
    padding: 16px 16px max(20px, env(safe-area-inset-bottom, 16px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .auth-tabs { margin-bottom: 16px; }
  .auth-tab { height: 38px; font-size: 13px; }
  .auth-input { height: 46px; font-size: 16px; }
  .auth-submit { height: 48px; }

  .hdr {
    height: 56px;
    min-height: 56px;
    padding: 0 8px !important;
    gap: 6px;
    overflow: visible !important;
  }
  .hdr-left {
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
  }
  .hdr-logo img { height: 26px !important; width: auto !important; }
  .hdr-right {
    gap: 4px;
    flex-shrink: 0;
    max-width: none !important;
    overflow: visible !important;
  }
  .hdr-guest {
    gap: 6px;
    flex-shrink: 0;
  }
  .btn-login,
  .btn-register {
    height: 36px !important;
    min-height: 36px;
    padding: 0 12px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .btn-register { padding: 0 14px !important; }

  .hdr-user.show {
    gap: 4px;
    max-width: none;
    overflow: visible !important;
    flex-shrink: 0;
    flex-wrap: nowrap;
  }
  #btn-search,
  #btn-chat,
  #btn-notify { display: none !important; }
  .wager-chip { display: none !important; }
  .wallet-wrap {
    height: 34px !important;
    max-width: min(46vw, 168px);
    flex-shrink: 1;
    min-width: 0;
  }
  .wallet-balance {
    height: 34px !important;
    padding: 0 6px !important;
    font-size: 12px !important;
    min-width: 0;
    gap: 4px !important;
    flex: 1;
  }
  .wallet-balance #wallet-amount {
    max-width: 5.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
  }
  .wallet-balance .chev { display: none; }
  .btn-deposit {
    height: 34px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    flex-shrink: 0;
  }
  .hdr-icon-btn {
    width: 34px !important;
    height: 34px !important;
    flex-shrink: 0;
  }
  .profile-wrap {
    flex-shrink: 0;
    z-index: 5;
  }
  .btn-profile {
    display: flex !important;
    width: 34px !important;
    height: 34px !important;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
  }
  .profile-menu {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0px));
    right: 8px;
    left: auto;
    width: min(300px, calc(100vw - 16px));
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
    z-index: 400;
  }
}

.sb-admin-item {
  color: #7eb6f5 !important;
  font-weight: 800 !important;
  border: 1px solid rgba(20, 117, 225, 0.45);
  border-radius: 10px;
  margin: 4px 8px 8px !important;
  background: rgba(20, 117, 225, 0.12);
}
.sb-admin-item:hover {
  color: #fff !important;
  background: rgba(20, 117, 225, 0.28);
}

@media (max-width: 380px) {
  .btn-login,
  .btn-register {
    padding: 0 10px !important;
    font-size: 11px !important;
  }
  .btn-deposit {
    padding: 0 8px !important;
    font-size: 11px !important;
  }
  .wallet-balance {
    padding: 0 6px !important;
    font-size: 12px !important;
  }
  .wallet-balance svg:first-of-type {
    width: 16px;
    height: 16px;
  }
}

