html {
  -ms-touch-action: none;
  width: 100%;
  height: 100%;
  height: var(--screen-height, var(--app-height, 100dvh));
  background: #15110c;
  overscroll-behavior: none;
}

body, canvas, div {
  display: block;
  outline: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);

  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -khtml-user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Remove spin of input type number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  /* display: none; <- Crashes Chrome on hover */
  -webkit-appearance: none;
  margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}

body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  width: var(--screen-width, var(--app-width, 100vw));
  height: var(--screen-height, var(--app-height, 100dvh));
  padding: 0;
  border: 0;
  margin: 0;

  cursor: default;
  color: #888;
  background-color: #15110c;

  text-align: center;
  font-family: Helvetica, Verdana, Arial, sans-serif;

  display: flex;
  flex-direction: column;
  
  /* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
  /* overflow cannot be applied in Cocos2dGameContainer, 
  otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

#Cocos2dGameContainer {
  position: fixed;
  margin: 0;
  left: 0;
  top: 0;
  width: var(--stage-width, 100vw);
  height: var(--stage-height, 100dvh);

  display: -webkit-box;
  -webkit-box-orient: horizontal;
  -webkit-box-align: center;
  -webkit-box-pack: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#GameCanvas {
  width: var(--stage-width, 100vw);
  height: var(--stage-height, 100dvh);
  transform-origin: 0 0;
}

#ddz-stage-ui {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 18;
  width: var(--stage-width, 100vw);
  height: var(--stage-height, 100dvh);
  pointer-events: none;
  transform-origin: 0 0;
}

body.is-portrait #ddz-stage-ui {
  left: var(--screen-width, 100vw);
  top: 0;
  transform: rotate(90deg);
}

#bean-wallet {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: clamp(5px, 1.2vw, 8px);
  pointer-events: none;
  font-family: Helvetica, Verdana, Arial, sans-serif;
}

.bean-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  height: clamp(28px, 5.4vw, 34px);
  padding: 0 clamp(8px, 1.8vw, 12px);
  color: #fff8d8;
  background: rgba(57, 25, 9, .82);
  border: 1px solid rgba(255, 208, 91, .72);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}

.bean-label {
  font-size: clamp(10px, 2vw, 12px);
  color: #ffd970;
}

#bean-balance-value {
  min-width: clamp(40px, 9vw, 52px);
  font-size: clamp(13px, 2.4vw, 16px);
  line-height: 1;
  text-align: right;
}

#bean-checkin {
  height: clamp(28px, 5.4vw, 34px);
  padding: 0 clamp(8px, 1.8vw, 12px);
  color: #4b1d06;
  font-size: clamp(11px, 2.1vw, 13px);
  font-weight: 700;
  background: linear-gradient(#ffe18a, #f1a724);
  border: 1px solid #fff0a8;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  pointer-events: auto;
}

#bean-checkin:disabled {
  color: #7b6a44;
  background: linear-gradient(#d9cba4, #a9966a);
  border-color: rgba(255, 255, 255, .38);
}

#bean-toast {
  position: absolute;
  top: calc(max(46px, env(safe-area-inset-top) + 44px));
  left: 50%;
  z-index: 21;
  max-width: min(82vw, 420px);
  padding: 9px 14px;
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  background: rgba(35, 13, 5, .88);
  border: 1px solid rgba(255, 205, 87, .55);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: opacity .18s ease, transform .18s ease;
}

#bean-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#ddz-touch-layer {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: none;
  pointer-events: none;
}

#ddz-touch-layer.is-login,
#ddz-touch-layer.is-hall {
  display: block;
}

.ddz-hit {
  position: absolute;
  display: none;
  padding: 0;
  background: transparent;
  border: 0;
  pointer-events: auto;
}

#ddz-touch-layer.is-login .ddz-hit-login {
  display: block;
  right: 29%;
  bottom: 7%;
  width: 17%;
  height: 13%;
}

#ddz-touch-layer.is-hall .ddz-hit-classic {
  display: block;
  left: 33%;
  top: 24%;
  width: 28%;
  height: 62%;
}

#ddz-room-menu {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(18, 10, 5, .58);
  pointer-events: none;
}

#ddz-room-menu.is-open {
  display: flex;
  pointer-events: auto;
}

.ddz-room-panel {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: clamp(8px, 1.5vw, 14px);
  width: min(94vw, 980px);
  max-height: 88vh;
  padding: clamp(18px, 3vw, 28px);
  background: rgba(77, 37, 14, .94);
  border: 2px solid rgba(255, 215, 104, .78);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .42);
}

.ddz-room-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 38px;
  height: 38px;
  color: #4c1b06;
  font-size: 28px;
  font-weight: 700;
  line-height: 34px;
  background: linear-gradient(#fff2ac, #df9d22);
  border: 2px solid #fff5bd;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
  pointer-events: auto;
}

.ddz-room-card {
  min-height: clamp(128px, 25vh, 210px);
  padding: clamp(12px, 2vw, 18px);
  color: #fff7cf;
  text-align: center;
  background: linear-gradient(180deg, #96511d 0%, #66300f 48%, #3c1b09 100%);
  border: 2px solid rgba(255, 218, 107, .8);
  border-radius: 8px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .18), 0 8px 18px rgba(0, 0, 0, .25);
  pointer-events: auto;
}

.ddz-room-card strong,
.ddz-room-card span,
.ddz-room-card em {
  display: block;
}

.ddz-room-card strong {
  margin-bottom: clamp(10px, 2vw, 18px);
  color: #fff0a0;
  font-size: clamp(20px, 3.6vw, 34px);
  line-height: 1.1;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .45);
}

.ddz-room-card span {
  margin-bottom: 8px;
  color: #ffe8bd;
  font-size: clamp(12px, 2vw, 17px);
  line-height: 1.25;
}

.ddz-room-card em {
  color: #ffe46c;
  font-style: normal;
  font-weight: 700;
  font-size: clamp(13px, 2.2vw, 18px);
  line-height: 1.25;
}

canvas {
  background-color: rgba(0, 0, 0, 0);
  max-width: 100%;
  max-height: 100%;
}

a:link, a:visited {
  color: #666;
}

a:active, a:hover {
  color: #666;
}

p.header {
  font-size: small;
}

p.footer {
  font-size: x-small;
}

#splash {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--stage-width, 100vw);
  height: var(--stage-height, 100dvh);
  /* background: #171717 url(./splash.png) no-repeat center; */
  background-size: 45%;
  transform-origin: 0 0;
}

body.is-portrait #splash {
  margin-left: var(--screen-width, 100vw);
  transform: rotate(90deg);
}

@media (max-width: 520px), (max-height: 420px) {
  #bean-wallet {
    transform: scale(.86);
    transform-origin: left top;
  }

  #bean-toast {
    font-size: 12px;
    padding: 7px 10px;
  }
}

@media (orientation: portrait) {
  #Cocos2dGameContainer {
    width: var(--stage-width, 100vh);
    height: var(--stage-height, 100vw);
  }

  #bean-wallet {
    top: max(7px, env(safe-area-inset-top));
    left: max(7px, env(safe-area-inset-left));
  }

  #ddz-touch-layer.is-login .ddz-hit-login {
    right: 23%;
    bottom: 7%;
    width: 26%;
    height: 10%;
  }

  #ddz-touch-layer.is-hall .ddz-hit-classic {
    left: 18%;
    top: 28%;
    width: 46%;
    height: 42%;
  }

  .ddz-room-panel {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    width: min(92vw, 520px);
  }

  .ddz-room-card {
    min-height: clamp(118px, 20vh, 170px);
  }
}

body.is-portrait .ddz-room-panel {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  width: min(calc(var(--stage-width, 100vh) * .94), 760px);
  max-height: calc(var(--stage-height, 100vw) * .84);
  padding: clamp(12px, 2.2vw, 20px);
}

body.is-portrait #ddz-touch-layer.is-login .ddz-hit-login {
  right: 29%;
  bottom: 7%;
  width: 17%;
  height: 13%;
}

body.is-portrait #ddz-touch-layer.is-hall .ddz-hit-classic {
  left: 33%;
  top: 24%;
  width: 28%;
  height: 62%;
}

body.is-portrait .ddz-room-card {
  min-height: clamp(100px, 27vw, 142px);
  padding: clamp(9px, 1.8vw, 14px);
}

body.is-portrait .ddz-room-card strong {
  margin-bottom: clamp(6px, 1.4vw, 12px);
  font-size: clamp(18px, 4vw, 25px);
}

body.is-portrait .ddz-room-card span {
  font-size: clamp(11px, 2.2vw, 14px);
}

body.is-portrait .ddz-room-card em {
  font-size: clamp(12px, 2.3vw, 15px);
}

.progress-bar {
    position: absolute;
    left: 27.5%;
    top: 80%;
    height: 3px;
    padding: 2px;
    width: 45%;
    border-radius: 7px;
    box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;           
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width .4s ease-in-out;
    background-color: #3dc5de;
}

.stripes span {
    background-size: 30px 30px;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
                        transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
                        transparent 75%, transparent);            
    
    animation: animate-stripes 1s linear infinite;             
}

@keyframes animate-stripes {
    0% {background-position: 0 0;} 100% {background-position: 60px 0;}
}
