html,
body {
  width: 100%;
  height: 100%;
}

#c2canvasdiv {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#c2canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  display: block;
}

body.tg-portrait-play #c2canvas {
  transform: translate(-50%, -50%) rotate(90deg);
}

.tg-ad-anchor {
  position: fixed;
  z-index: 50;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 0;
  right: 0;
  width: 100%;
  pointer-events: none;
}

.tg-ad-anchor.is-hidden {
  display: none;
}

#tg-ad-slot {
  pointer-events: auto;
}

.tg-ad-panel {
  display: grid;
  gap: 0;
}

.tg-ad-panel__top {
  display: flex;
  justify-content: center;
  padding: 0 12px;
}

.tg-ad-panel__sides {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.tg-ad-rail {
  position: fixed;
  top: clamp(170px, 31vh, 300px);
  pointer-events: auto;
  display: grid;
  gap: 10px;
}

.tg-ad-rail--left {
  left: max(10px, env(safe-area-inset-left, 0px) + 8px);
}

.tg-ad-rail--right {
  right: max(10px, env(safe-area-inset-right, 0px) + 8px);
}

.tg-ad-button,
.tg-ad-status,
.tg-ad-banner-shell {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.tg-ad-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  background: rgba(34, 24, 58, 0.88);
  color: #fff;
  font: 800 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
}

.tg-ad-button--prominent {
  width: min(70vw, 250px);
  min-height: 58px;
  background: linear-gradient(180deg, rgba(195, 69, 203, 0.96), rgba(116, 39, 164, 0.96));
}

.tg-ad-rail .tg-ad-button {
  width: 88px;
  min-height: 74px;
  padding: 10px 8px;
  border-radius: 18px;
}

.tg-ad-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.tg-ad-button__title {
  font-size: 13px;
  font-weight: 900;
}

.tg-ad-button__reward {
  color: #ffef8f;
  font-size: 12px;
  font-weight: 800;
}

.tg-ad-rail .tg-ad-button__title {
  font-size: 11px;
}

.tg-ad-rail .tg-ad-button__reward {
  font-size: 10px;
  line-height: 1.15;
}

.tg-ad-banner-shell {
  width: 88px;
  min-height: 74px;
  padding: 6px;
  background: rgba(16, 18, 33, 0.5);
}

.tg-ad-banner-shell[data-empty="1"] {
  display: none;
}

.tg-ad-banner-shell [data-banner] {
  width: 100%;
  min-height: 60px;
}

.tg-ad-status {
  width: min(88vw, 320px);
  margin: 12px auto 0;
  padding: 9px 12px;
  background: rgba(18, 23, 31, 0.88);
  color: #d8e3ef;
  font: 700 12px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
}

.tg-ad-status.is-hidden {
  display: none;
}

.tg-ad-status.is-success {
  background: rgba(19, 98, 57, 0.9);
  color: #dfffb2;
}

.tg-ad-status.is-warn {
  background: rgba(102, 79, 19, 0.92);
  color: #ffe8a1;
}

.tg-ad-status.is-error {
  background: rgba(116, 33, 33, 0.92);
  color: #ffd2d2;
}

@media (max-width: 720px) {
  .tg-ad-rail {
    top: clamp(130px, 26vh, 230px);
  }

  .tg-ad-rail .tg-ad-button,
  .tg-ad-banner-shell {
    width: 74px;
    min-height: 68px;
  }
}

@media (orientation: portrait) and (max-width: 1024px) {
  .tg-orientation-tip {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    transform: translateX(-50%);
    z-index: 80;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(28, 23, 44, 0.84);
    color: #efe6ff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    font: 700 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  .tg-orientation-tip.is-hidden {
    display: none;
  }
}
