/* ==========================================================================
   Royal Chess — y8.css  (v7.2.0)
   Styles for Y8 Games SDK integration:
   - Top-right real user avatar profile widget & profile modal
   - Big permanent Y8 Ad buttons (Main Menu & Pause Menu)
   - In-game ad perk buttons (Free Takeback, +60s Time, Grandmaster Hint)
   - Zero-scrollbar policy & 16:9 / 9:16 aspect ratio framing
   ========================================================================== */

/* ---------------------------------------------------------------- Zero Scrollbars */
*, *::before, *::after, html, body, #app, .screen, .panel, .modal, aside, div, ul, ol, section {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

::-webkit-scrollbar, *::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* ---------------------------------------------------------------- Top-Center Y8 Avatar Widget */
.y8-profile-widget {
  position: absolute;
  top: calc(12px + var(--safe-top));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(38, 14, 18, 0.94), rgba(12, 6, 7, 0.96));
  border: 1.5px solid rgba(246, 217, 138, 0.75);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.65), 0 0 12px rgba(246, 217, 138, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  z-index: 50;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.y8-profile-widget:hover {
  transform: translateX(-50%) translateY(-2px) scale(1.03);
  border-color: #ffd875;
  box-shadow: 0 0 20px rgba(246, 217, 138, 0.5), 0 6px 20px rgba(0, 0, 0, 0.75);
}

.y8-profile-widget:active {
  transform: translateX(-50%) translateY(0) scale(0.98);
}

.y8-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #341820, #0d0608);
  box-shadow: 0 0 0 1.5px rgba(246, 217, 138, 0.85);
  overflow: visible;
}

.y8-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.y8-badge-icon {
  position: absolute;
  bottom: -3px;
  right: -5px;
  background: linear-gradient(135deg, #e51b24, #b00f16);
  color: #ffffff;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 8px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.04em;
}

.y8-verified-badge {
  position: absolute;
  top: -3px;
  left: -4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd700, #b8860b);
  color: #120905;
  font-size: 10px;
  font-weight: 900;
  display: grid;
  place-items: center;
  border: 1px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.y8-info-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.y8-player-name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 13px;
  color: var(--gold-light);
  letter-spacing: 0.04em;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.y8-player-status {
  font-family: var(--font-body);
  font-size: 11px;
  font-style: italic;
  color: var(--gold);
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------- Big Permanent Y8 Ad Button (Main Menu) */
.y8-main-ad-btn {
  position: relative;
  width: 100%;
  margin-top: clamp(3px, 0.8vh, 6px);
  padding: clamp(5px, 0.9vh, 8px) clamp(8px, 1.2vw, 12px);
  border-radius: 9px;
  border: 1.5px solid #e5b95c !important;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(229, 27, 36, 0.35), transparent 70%),
    linear-gradient(180deg, #3d0c15 0%, #1c050a 100%) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 12px rgba(229, 185, 92, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s ease, border-color 0.2s ease;
}

.y8-main-ad-btn:hover {
  transform: translateY(-2.5px) scale(1.015);
  border-color: #ffe699 !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.7), 0 0 24px rgba(246, 217, 138, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.y8-main-ad-btn:active {
  transform: translateY(0) scale(0.99);
}

.y8-ad-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 230, 150, 0.15) 0%, transparent 60%);
  pointer-events: none;
  animation: y8Sweep 4s infinite linear;
}

@keyframes y8Sweep {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.y8-ad-tag {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #ffdf78;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  margin-bottom: 3px;
  display: block;
}

.y8-ad-content {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.y8-ad-icon-badge {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #e51b24 0%, #99000a 100%);
  border: 1.5px solid #ffdf78;
  color: #ffffff;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.05em;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.y8-ad-labels {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.y8-ad-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(14px, 2.2vmin, 16px);
  color: #ffffff;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.y8-ad-desc {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: #f7e099;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------- Big Permanent Y8 Ad Button (Pause Menu) */
.y8-pause-ad-btn {
  position: relative;
  width: 100%;
  margin: 3px 0 2px 0;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1.5px solid #e5b95c !important;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(229, 27, 36, 0.32), transparent 70%),
    linear-gradient(180deg, #380d15 0%, #180509 100%) !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(229, 185, 92, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.y8-pause-ad-btn:hover {
  transform: translateY(-1.5px);
  border-color: #ffd875 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7), 0 0 14px rgba(246, 217, 138, 0.4);
}

.y8-pause-ad-btn .y8-ad-tag {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  margin-bottom: 1px;
}

.y8-pause-ad-btn .y8-ad-content {
  gap: 7px;
}

.y8-pause-ad-btn .y8-ad-icon-badge {
  width: 20px;
  height: 20px;
  font-size: 10px;
  border-radius: 4px;
}

.y8-pause-ad-btn .y8-ad-title {
  font-size: 11px;
}

.y8-pause-ad-btn .y8-ad-desc {
  font-size: 9px;
}

.y8-pause-perks-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  margin-bottom: 2px;
}

.btn-y8-perk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 6px;
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold-light);
  border-radius: 6px;
  min-height: 25px;
  border: 1px solid rgba(246, 217, 138, 0.5);
  background: linear-gradient(180deg, rgba(50, 18, 22, 0.85), rgba(20, 8, 10, 0.9));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-y8-perk:hover {
  border-color: #ffd875;
  background: linear-gradient(180deg, rgba(80, 25, 32, 0.9), rgba(30, 10, 14, 0.95));
}

.btn-y8-perk img {
  width: 12px;
  height: 12px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.btn-y8-perk .y8-tag {
  font-size: 8px;
  padding: 1px 3px;
  border-radius: 2px;
  background: #e51b24;
  color: #fff;
  font-weight: 900;
}

/* ---------------------------------------------------------------- In-Game HUD Rewarded Ad Hint Button */
.icon-btn.btn-y8-ad-hint {
  position: relative;
  overflow: visible !important;
}

.hud-ad-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  background: linear-gradient(135deg, #e51b24 0%, #a6000a 100%);
  color: #ffffff;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 10px;
  line-height: 1;
  padding: 2.5px 4.5px;
  border-radius: 4px;
  border: 1.5px solid #ffdf78;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.75), 0 0 8px rgba(229, 27, 36, 0.65);
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.icon-btn.btn-y8-ad-hint:hover .hud-ad-badge {
  background: linear-gradient(135deg, #ff2f38 0%, #c40a15 100%);
  border-color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.8), 0 0 12px rgba(255, 47, 56, 0.9);
  transform: scale(1.1);
}

/* ---------------------------------------------------------------- Y8 Royal Profile Modal */
.y8-profile-card {
  width: min(540px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 20px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background:
    url('../assets/images/royal/damask.svg') 0 0 / 120px padding-box,
    linear-gradient(180deg, #2b0c12 0%, #120508 100%) padding-box,
    linear-gradient(180deg, #ffd778 0%, #b88624 50%, #593e0e 100%) border-box;
  border: 2px solid transparent;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(229, 185, 92, 0.25);
  position: relative;
  text-align: center;
}

.y8-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(246, 217, 138, 0.25);
  text-align: left;
}

.y8-modal-avatar-frame {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px #ffd778, 0 6px 14px rgba(0, 0, 0, 0.6);
  background: #2a0b10;
}

.y8-modal-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.y8-modal-user-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.y8-modal-name {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 20px;
  color: var(--gold-light);
  letter-spacing: 0.04em;
}

.y8-modal-subrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ivory);
}

.y8-pill {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(246, 217, 138, 0.15);
  border: 1px solid rgba(246, 217, 138, 0.4);
  font-size: 11px;
  font-family: var(--font-head);
  color: #ffdf78;
}

.y8-modal-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.btn-y8-action {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(46, 17, 22, 0.8), rgba(20, 8, 10, 0.9));
  border: 1px solid rgba(246, 217, 138, 0.45);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--ivory);
  letter-spacing: 0.03em;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn-y8-action:hover {
  transform: translateY(-1.5px);
  border-color: #ffd875;
  background: linear-gradient(180deg, rgba(70, 24, 30, 0.9), rgba(30, 10, 14, 0.95));
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.6);
}

.btn-y8-action img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}

.btn-y8-action.primary {
  grid-column: span 2;
  justify-content: center;
  background: linear-gradient(180deg, #b82b35 0%, #701119 100%);
  border-color: #ffd778;
  font-size: 15px;
  padding: 13px;
}

.btn-y8-action.primary:hover {
  background: linear-gradient(180deg, #d43743 0%, #881620 100%);
}

.y8-cloud-status {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 12px;
  color: var(--gold);
  margin-top: -6px;
}

/* ---------------------------------------------------------------- Banner Container */
.y8-banner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 6px 0;
  min-height: 0;
  overflow: hidden;
}

/* ---------------------------------------------------------------- 16:9 & 9:16 Aspect Framing */
@media (orientation: landscape) {
  /* On desktop / wide displays, ensure content fits elegantly in 16:9 bounds without scrollbars */
  #app {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .screen {
    max-width: 100vw;
    max-height: 100vh;
  }
}

@media (orientation: portrait) {
  /* On mobile portrait displays, ensure clean 9:16 vertical stack without overflow */
  .panel {
    width: min(420px, 94vw);
    max-height: calc(100vh - 20px);
    padding: 16px 14px;
    gap: 8px;
  }

  .title-corner {
    top: calc(8px + var(--safe-top));
    gap: 6px;
  }

  .y8-profile-widget {
    top: calc(8px + var(--safe-top));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    padding: 3px 10px 3px 4px;
    gap: 6px;
  }

  .y8-avatar-wrap {
    width: 30px;
    height: 30px;
  }

  .y8-player-name {
    font-size: 11px;
    max-width: 80px;
  }

  .y8-player-status {
    font-size: 9px;
  }

  .y8-main-ad-btn {
    padding: 8px 12px;
  }

  .y8-modal-actions-grid {
    grid-template-columns: 1fr;
  }

  .btn-y8-action.primary {
    grid-column: span 1;
  }
}

@media (max-height: 640px) {
  .y8-pause-ad-btn {
    padding: 2px 8px;
    margin: 2px 0 1px 0;
  }
  .y8-pause-ad-btn .y8-ad-tag {
    font-size: 7.5px;
  }
  .y8-pause-ad-btn .y8-ad-title {
    font-size: 10px;
  }
  .y8-pause-ad-btn .y8-ad-desc {
    display: none;
  }
  .y8-pause-ad-btn .y8-ad-icon-badge {
    width: 17px;
    height: 17px;
    font-size: 8.5px;
  }
  .btn-y8-perk {
    min-height: 22px;
    font-size: 9px;
    padding: 2px 4px;
  }
}

@media (max-height: 480px) {
  .y8-pause-ad-btn {
    display: none;
  }
  .y8-pause-perks-row {
    margin-bottom: 1px;
  }
  .btn-y8-perk {
    min-height: 20px;
    font-size: 8.5px;
    padding: 1px 3px;
  }
}

