/**
 * <side-drawer> — pixel-perfect rebuild of the 333y888.vip aside panel.
 *
 * Reference measurements (from captured production CSS):
 *  - Panel: width 4.6rem, bg skin__bg_2, z-index 2001, slides from left
 *  - Sticky top: back circle .45rem, logo height .74rem
 *  - Auth buttons: width 2rem (--btn-width), height .7rem, radius .1rem
 *  - Deposit card: radius .14rem, padding .2rem, gradient 84deg primary 20%
 *  - Grid: 3 cols, item height 1.45rem, icon .8rem, text .24rem
 *  - Support rows: icon .53rem, row height .8rem
 *  - Divider: height .36rem, font .24rem, hairline rules
 *
 * Tokens: all values come from ../../css/tokens.css (--y888-*).
 */

/* Host element: full-viewport fixed layer, inert until open */
side-drawer {
  position: fixed;
  inset: 0;
  z-index: 2001;
  pointer-events: none;
  font-family: var(--y888-font-family);
  color: var(--y888-text);
}
side-drawer.is-open {
  pointer-events: auto;
}

.sd-root {
  position: absolute;
  inset: 0;
}

/* Backdrop */
.sd-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.3s ease;
}
side-drawer.is-open .sd-overlay {
  opacity: 1;
}

/* Sliding panel — left edge aligns with the centered content column
   (desktop letterbox formula), matching the reference overlay behavior. */
.sd-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: max(0px, calc((100vw - min(100vw, 56.2219vh)) / 2));
  width: 4.6rem;
  max-width: 86vw;
  background-color: #141414;
  transform: translateX(-102%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-sizing: border-box;
}
side-drawer.is-open .sd-panel {
  transform: translateX(0);
}

.sd-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.4rem;
  /* Hide scrollbar for clean aesthetic like reference */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sd-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* ---- Sticky top: back + logo ---- */
.sd-top {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #141414;
  padding: 0.1rem 0.2rem 0;
  margin: 0;
  display: flex;
  align-items: flex-start;
}
.sd-back {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.14rem;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background-color: #2b2b2b;
  color: #cfcfcf;
  font-size: 0.16rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 0;
}
.sd-back svg {
  transform: rotate(180deg);
  width: 0.2rem;
  height: 0.2rem;
}
.sd-logo-box {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.sd-logo {
  height: 0.74rem;
  max-width: 2.86rem;
  object-fit: contain;
  display: block;
}

/* ---- Auth: Login / Register (sticky below header) ---- */
.sd-auth {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 0.2rem 0.2rem;
  position: sticky;
  top: 0.94rem;
  z-index: 2;
  background-color: #141414;
}
.sd-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 0;
  font-family: inherit;
}
.sd-btn-login,
.sd-btn-register {
  width: 2rem;
  height: 0.7rem;
  padding: 0 0.1rem;
  font-size: 0.22rem;
  border-radius: 0.1rem;
  white-space: nowrap;
}
.sd-btn-login {
  margin-right: 0.2rem;
  background-color: rgba(255, 255, 255, 0.12);
  color: #e8e8e8;
}
.sd-btn-register {
  position: relative;
  background-color: var(--y888-primary);
  color: #ffffff;
}
.sd-badge {
  position: absolute;
  top: -0.06rem;
  right: -0.02rem;
  z-index: 1;
  background-color: var(--y888-success);
  color: #ffffff;
  font-size: 0.16rem;
  line-height: 1.4;
  padding: 0 0.08rem;
  border-radius: 0.14rem;
  white-space: nowrap;
}

/* ---- Deposit Gift card ---- */
.sd-deposit {
  position: relative;
  border-radius: 0.14rem;
  background-color: #1e1e1e;
  padding: 0.2rem;
  margin: 0 0.2rem 0.1rem;
  overflow: hidden;
}
.sd-deposit::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  border-radius: 0.14rem;
  background: linear-gradient(84deg, rgba(235, 5, 242, 0.2), rgba(235, 5, 242, 0));
  pointer-events: none;
}
.sd-deposit-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  font-size: 0.24rem;
  font-weight: 600;
  color: #f2f2f2;
  margin-bottom: 0.21rem;
}
.sd-deposit-gift {
  width: 0.35rem;
  height: 0.35rem;
  margin-right: 0.1rem;
  object-fit: contain;
}
.sd-badge-plus {
  margin-left: auto;
  background-color: var(--y888-success);
  color: #ffffff;
  font-size: 0.16rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 0 0.1rem;
  border-radius: 0.14rem;
}
.sd-deposit-btns {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
}
.sd-btn-withdraw,
.sd-btn-deposit {
  height: 0.6rem;
  font-size: 0.22rem;
  border-radius: 0.1rem;
  gap: 0.08rem;
}
.sd-btn-withdraw {
  margin-right: 0.2rem;
  padding: 0 0.24rem;
  background-color: rgba(255, 255, 255, 0.12);
  color: #e8e8e8;
}
.sd-btn-withdraw img {
  width: 0.3rem;
  height: 0.3rem;
  object-fit: contain;
}
.sd-btn-deposit {
  flex: 1;
  background-color: var(--y888-primary);
  color: #ffffff;
}
.sd-btn-deposit img {
  width: 0.34rem;
  height: 0.34rem;
  object-fit: contain;
}

/* ---- 12-item grid ---- */
.sd-grid {
  display: flex;
  flex-wrap: wrap;
  padding: 0.3rem 0.2rem 0.1rem;
  margin: 0 auto;
  text-align: center;
}
.sd-grid-item {
  flex: 1 1 33.3333%;
  max-width: 33.3333%;
  height: 1.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
  color: #b5b5b5;
  padding: 0;
  box-sizing: border-box;
}
.sd-grid-item img {
  width: 0.8rem;
  height: 0.8rem;
  object-fit: contain;
  display: block;
}
.sd-grid-item span {
  display: block;
  max-width: 1.3rem;
  height: 0.6rem;
  padding: 0.05rem 0 0;
  font-size: 0.24rem;
  line-height: 1.2;
  overflow: hidden;
  word-break: break-word;
}

/* ---- Support list ---- */
.sd-support {
  margin: 0 0.2rem 0.1rem;
  background-color: #1e1e1e;
  padding: 0 0.2rem;
  border-radius: 0.14rem;
}
.sd-support-item {
  display: flex;
  align-items: center;
  height: 0.8rem;
  text-decoration: none;
  color: #dcdcdc;
  font-size: 0.24rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sd-support-item:last-child {
  border-bottom: 0;
}
.sd-support-icon {
  width: 0.53rem;
  height: 0.4rem;
  object-fit: contain;
  margin-right: 0.12rem;
}
.sd-support-item span {
  flex: 1;
}
.sd-chevron {
  width: 0.2rem;
  height: 0.2rem;
  color: #8a8a8a;
  flex-shrink: 0;
}

/* ---- Panel boxes: Quick login / Official Channel ---- */
.sd-box {
  margin: 0.1rem 0.2rem;
  background-color: #1e1e1e;
  padding: 0 0.2rem;
  border-radius: 0.14rem;
  overflow: hidden;
}
.sd-divider {
  height: 0.36rem;
  margin: 0.2rem 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.24rem;
  color: #cfcfcf;
}
.sd-divider i {
  display: block;
  flex: 1;
  min-width: 0.2rem;
  height: 1px;
  background: #333333;
}
.sd-divider span {
  display: inline-block;
  margin: 0 0.2rem;
  flex-shrink: 0;
}
.sd-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 0.6rem;
  padding: 0.2rem 0;
  margin: 0;
}
.sd-social a {
  display: block;
  line-height: 0;
}
.sd-social img {
  width: 0.5rem;
  height: 0.5rem;
  object-fit: contain;
  border-radius: 50%;
  display: block;
}
.sd-channels img {
  border-radius: 0.12rem;
}

@media (prefers-reduced-motion: reduce) {
  .sd-overlay,
  .sd-panel {
    transition: none;
  }
}
