html {
  -ms-touch-action: none;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

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: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  padding: 0;
  border: 0;
  margin: 0;

  cursor: default;
  color: #888;
  background-color: #333;

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

  display: flex;
  flex-direction: column;
}

canvas {
  background-color: rgba(0, 0, 0, 0);
}

#GameDiv, #Cocos3dGameContainer, #GameCanvas {
  width: 100%;
  height: 100%;
}

/* Keep the interactive canvas inside the phone's visible viewport and away
   from notches/home indicators. 100dvh follows collapsing browser chrome. */
#GameDiv {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px);
  left: env(safe-area-inset-left, 0px);
  width: auto;
  height: auto;
  overflow: hidden;
}

:root {
  --safe-top: env(safe-area-inset-top);
  --safe-right: env(safe-area-inset-right);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
}

.inn-chef-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 24px calc(24px + env(safe-area-inset-bottom, 0px));
  color: #fff5d7;
  background:
    radial-gradient(circle at 50% 38%, rgba(195, 86, 39, 0.3), transparent 34%),
    linear-gradient(160deg, #3c1c17 0%, #1f100e 58%, #130a09 100%);
  opacity: 1;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.inn-chef-loading::before,
.inn-chef-loading::after {
  position: absolute;
  width: min(72vw, 520px);
  height: min(72vw, 520px);
  border: 1px solid rgba(227, 174, 87, 0.12);
  border-radius: 50%;
  content: "";
}

.inn-chef-loading::after {
  width: min(54vw, 390px);
  height: min(54vw, 390px);
  border-color: rgba(227, 174, 87, 0.08);
}

.inn-chef-loading.is-hidden {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.loading-card {
  position: relative;
  z-index: 2;
  width: min(84vw, 420px);
  text-align: center;
}

.loading-seal {
  display: grid;
  width: 78px;
  height: 78px;
  margin: 0 auto 18px;
  place-items: center;
  border: 3px solid #f5d48d;
  border-radius: 24px;
  color: #fff5d7;
  background: #a93528;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28), inset 0 0 0 4px #a93528, inset 0 0 0 6px rgba(255, 239, 190, 0.65);
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: 42px;
  font-weight: 800;
  transform: rotate(-4deg);
  animation: seal-breathe 1.5s ease-in-out infinite;
}

.loading-card h1 {
  margin: 0;
  color: #fff2c8;
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: clamp(34px, 9vw, 48px);
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.42);
}

.loading-card p {
  margin: 14px 0 0;
  color: #e7bd78;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.loading-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: dot-bounce 1s ease-in-out infinite;
}

.loading-dots i:nth-child(2) { animation-delay: 0.14s; }
.loading-dots i:nth-child(3) { animation-delay: 0.28s; }

.loading-stove {
  position: relative;
  width: 230px;
  height: 142px;
  margin: 20px auto 8px;
}

.loading-wok {
  position: absolute;
  left: 39px;
  bottom: 35px;
  width: 150px;
  height: 54px;
  border: 7px solid #d6a95f;
  border-top: 0;
  border-radius: 0 0 90px 90px;
  background: linear-gradient(#3c3029, #17110f);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
  animation: wok-rock 1.35s ease-in-out infinite;
}

.loading-wok::after {
  position: absolute;
  right: -49px;
  top: 2px;
  width: 52px;
  height: 10px;
  border-radius: 0 10px 10px 0;
  background: #d6a95f;
  content: "";
}

.loading-flame {
  position: absolute;
  bottom: 13px;
  width: 31px;
  height: 48px;
  border-radius: 52% 48% 58% 42% / 70% 65% 35% 30%;
  background: linear-gradient(180deg, #ffe58d 0%, #f3a22e 46%, #c43d25 100%);
  filter: drop-shadow(0 0 9px rgba(239, 107, 34, 0.65));
  transform-origin: 50% 100%;
  animation: flame-dance 0.72s ease-in-out infinite alternate;
}

.flame-one { left: 69px; transform: rotate(-8deg) scale(0.86); }
.flame-two { left: 102px; height: 59px; animation-delay: -0.24s; }
.flame-three { left: 137px; transform: rotate(8deg) scale(0.82); animation-delay: -0.46s; }

.steam {
  position: absolute;
  top: 4px;
  width: 12px;
  height: 48px;
  border: 4px solid rgba(255, 244, 217, 0.55);
  border-top: 0;
  border-bottom: 0;
  border-radius: 50%;
  opacity: 0;
  animation: steam-rise 1.45s ease-out infinite;
}

.steam-one { left: 76px; }
.steam-two { left: 108px; animation-delay: 0.38s; }
.steam-three { left: 140px; animation-delay: 0.76s; }

.loading-track {
  width: min(70vw, 310px);
  height: 7px;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 1px solid rgba(244, 210, 141, 0.28);
  border-radius: 99px;
  background: rgba(14, 7, 6, 0.45);
}

.loading-track span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #e9bd70, #fff1b7, transparent);
  animation: loading-sweep 1.35s ease-in-out infinite;
}

.loading-card small {
  color: rgba(255, 239, 201, 0.68);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.loading-lantern {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  width: 44px;
  height: 62px;
  border: 3px solid #d6a95f;
  border-radius: 16px 16px 22px 22px;
  background: radial-gradient(circle, #ec8e42, #a92f24 68%);
  box-shadow: 0 0 26px rgba(232, 107, 47, 0.28);
  transform-origin: 50% -28px;
  animation: lantern-sway 2.4s ease-in-out infinite alternate;
}

.loading-lantern::before {
  position: absolute;
  left: 18px;
  top: -31px;
  width: 3px;
  height: 30px;
  background: #d6a95f;
  content: "";
}

.loading-lantern::after {
  position: absolute;
  left: 18px;
  bottom: -22px;
  width: 3px;
  height: 20px;
  background: #d6a95f;
  box-shadow: -7px 4px 0 #d6a95f, 7px 4px 0 #d6a95f;
  content: "";
}

.loading-lantern-left { left: 9vw; }
.loading-lantern-right { right: 9vw; animation-delay: -1.2s; }

.inn-chef-loading.has-error .loading-track span,
.inn-chef-loading.has-error .loading-flame {
  animation-play-state: paused;
}

.nickname-dialog {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: max(22px, env(safe-area-inset-top, 0px)) 22px max(22px, env(safe-area-inset-bottom, 0px));
  background: rgba(24, 12, 9, 0.78);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.nickname-dialog[hidden] {
  display: none !important;
}

.nickname-card {
  width: min(100%, 390px);
  box-sizing: border-box;
  padding: 28px 28px 22px;
  border: 3px solid #d8a654;
  border-radius: 28px;
  background: linear-gradient(155deg, #fff7df, #f2dca8);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.46), inset 0 0 0 5px rgba(119, 62, 32, 0.08);
  color: #3d2319;
  text-align: left;
}

.nickname-seal {
  width: 62px;
  height: 62px;
  margin: -58px auto 12px;
  border: 4px solid #f4d894;
  border-radius: 50%;
  background: #bd382d;
  box-shadow: 0 8px 22px rgba(85, 25, 19, 0.34);
  color: #fff3ce;
  font-size: 29px;
  font-weight: 800;
  line-height: 62px;
  text-align: center;
}

.nickname-card h2 {
  margin: 0 0 8px;
  color: #7b211d;
  font-size: 28px;
  text-align: center;
}

.nickname-card p {
  margin: 0 0 22px;
  color: #72503c;
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}

.nickname-card label {
  display: block;
  margin: 0 0 8px;
  color: #513123;
  font-size: 14px;
  font-weight: 700;
}

.nickname-card input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 13px 15px;
  border: 2px solid #a66c40;
  border-radius: 14px;
  outline: none;
  background: rgba(255, 253, 243, 0.94);
  color: #3d2319;
  font: 700 18px/1.35 Helvetica, Verdana, Arial, sans-serif;
  user-select: text;
  -webkit-user-select: text;
}

.nickname-card input:focus {
  border-color: #4b7e67;
  box-shadow: 0 0 0 4px rgba(75, 126, 103, 0.2);
}

.nickname-card button {
  width: 100%;
  min-height: 50px;
  border-radius: 25px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

.nickname-confirm {
  margin-top: 18px;
  border: 2px solid #7e1f1a;
  background: #c2382d;
  color: #fff5d8;
  box-shadow: 0 5px 0 #7e1f1a;
}

.nickname-cancel {
  margin-top: 11px;
  border: 0;
  background: transparent;
  color: #795b48;
}

@keyframes seal-breathe {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50% { transform: rotate(-2deg) scale(1.06); }
}

@keyframes dot-bounce {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-5px); }
}

@keyframes wok-rock {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(-4px); }
}

@keyframes flame-dance {
  from { opacity: 0.8; scale: 0.9 0.86; }
  to { opacity: 1; scale: 1.08 1.13; }
}

@keyframes steam-rise {
  0% { opacity: 0; transform: translateY(18px) scale(0.7); }
  35% { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(-30px) scale(1.15); }
}

@keyframes loading-sweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(340%); }
}

@keyframes lantern-sway {
  from { transform: rotate(-5deg); }
  to { transform: rotate(5deg); }
}

@media (prefers-reduced-motion: reduce) {
  .inn-chef-loading *,
  .inn-chef-loading *::before,
  .inn-chef-loading *::after {
    animation: none !important;
  }
}

.security-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: rgba(35, 18, 12, 0.72);
  backdrop-filter: blur(5px);
}

.security-dialog[hidden] {
  display: none;
}

.security-card {
  width: min(88vw, 390px);
  box-sizing: border-box;
  padding: 26px 22px 20px;
  border: 3px solid #e2a94e;
  border-radius: 28px;
  background: #fff5d9;
  color: #6f3d24;
  text-align: center;
  box-shadow: 0 24px 70px rgba(24, 11, 7, 0.42);
}

.security-seal {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  border: 3px solid #7e1f1a;
  border-radius: 50%;
  background: #c2382d;
  color: #fff7e0;
  font-size: 26px;
  font-weight: 800;
}

.security-card h2 {
  margin: 0;
  color: #7e1f1a;
  font-size: 23px;
}

.security-card p {
  margin: 8px 0 14px;
  font-size: 16px;
}

#InnChefTurnstile {
  display: flex;
  min-height: 4px;
  justify-content: center;
}

#InnChefSecurityCancel {
  margin-top: 14px;
  padding: 8px 24px;
  border: 0;
  border-radius: 999px;
  background: #6f3d24;
  color: #fff7e0;
  font: inherit;
  font-weight: 700;
}
