:root {
  --ink: #041428;
  --surface: #112035;
  --cyan: #00f1fe;
  --pink: #ff33ff;
  --gold: #ffe16d;
  --coral: #ffb4ab;
  --white: #d5e3ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--white);
  font-family: "Be Vietnam Pro", "Google Sans", Arial, sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 104%, rgb(0 241 254 / 18%), transparent 44%),
    radial-gradient(circle at 50% 10%, rgb(255 51 255 / 10%), transparent 36%),
    var(--ink);
}

.camera-feed,
.camera-shade,
.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-feed {
  z-index: -3;
  object-fit: cover;
  transform:
    scaleX(var(--camera-preview-mirror-x, 1))
    scale(var(--camera-preview-zoom, 1));
  transform-origin: 50% 65%;
  background: var(--ink);
}

.camera-shade {
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgb(4 20 40 / 52%), transparent 25%, transparent 68%, rgb(4 20 40 / 70%)),
    radial-gradient(circle at 50% 50%, transparent 38%, rgb(4 20 40 / 48%) 100%);
}

.game-canvas {
  z-index: 1;
  display: block;
  outline: none;
  touch-action: none;
}

.brand-rail {
  position: absolute;
  z-index: 4;
  top: clamp(16px, 2.2vw, 32px);
  left: clamp(18px, 2.6vw, 42px);
  display: flex;
  align-items: center;
  gap: 20px;
  pointer-events: none;
}

.brand {
  display: grid;
  line-height: 0.88;
  letter-spacing: -0.05em;
  font-style: italic;
  transform: skewX(-6deg);
}

.brand span {
  font-size: clamp(18px, 2.1vw, 32px);
  font-weight: 900;
  text-shadow: 0 0 18px rgb(255 51 255 / 48%);
}

.brand strong {
  color: var(--cyan);
  font-size: clamp(13px, 1.35vw, 21px);
  letter-spacing: 0.14em;
}

.privacy {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid rgb(0 241 254 / 38%);
  border-radius: 999px;
  background: rgb(4 20 40 / 68%);
  color: rgb(229 253 255 / 82%);
  font: 700 clamp(9px, 0.72vw, 12px) / 1 ui-monospace, monospace;
  letter-spacing: 0.08em;
  backdrop-filter: blur(10px);
}

.privacy i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
}

.loading-pill {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgb(8 17 38 / 78%);
  color: var(--cyan);
  font: 800 12px/1 ui-monospace, monospace;
  letter-spacing: 0.12em;
}

.install-button {
  position: absolute;
  z-index: 7;
  top: clamp(16px, 2.2vw, 32px);
  right: clamp(18px, 2.6vw, 42px);
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid rgb(255 154 213 / 58%);
  border-radius: 999px;
  background: rgb(22 12 54 / 82%);
  color: #ffe9f7;
  box-shadow: 0 10px 30px rgb(243 72 154 / 16%);
  font: 800 11px/1 ui-monospace, monospace;
  letter-spacing: 0.08em;
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.install-button span {
  color: #ff9ad5;
}

.install-button:hover {
  border-color: #ff9ad5;
  background: rgb(57 18 75 / 92%);
}

.control-hand-status {
  position: absolute;
  z-index: 7;
  bottom: clamp(42px, 6vh, 68px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgb(255 199 51 / 52%);
  border-radius: 999px;
  transform: translateX(-50%);
  background: rgb(8 17 38 / 84%);
  color: #fff3c0;
  box-shadow: 0 8px 26px rgb(0 0 0 / 28%);
  font: 800 clamp(9px, 0.72vw, 11px) / 1 ui-monospace, monospace;
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.control-hand-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgb(255 199 51 / 72%);
  animation: control-search-pulse 900ms ease-in-out infinite alternate;
}

@keyframes control-search-pulse {
  to {
    opacity: 0.35;
    transform: scale(0.72);
  }
}

.install-help {
  position: absolute;
  z-index: 9;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 9px;
  width: min(440px, calc(100vw - 36px));
  padding: 28px;
  border: 1px solid rgb(255 154 213 / 54%);
  border-radius: 22px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 50% 0%, rgb(243 72 154 / 20%), transparent 56%),
    rgb(10 16 42 / 96%);
  box-shadow: 0 28px 90px rgb(0 0 0 / 58%);
  text-align: center;
  backdrop-filter: blur(24px);
}

.install-help small {
  color: #ff9ad5;
  font: 800 10px/1 ui-monospace, monospace;
  letter-spacing: 0.14em;
}

.install-help strong {
  font-size: clamp(18px, 3vw, 25px);
}

.install-help p {
  margin: 0;
  color: rgb(234 244 255 / 76%);
  font-size: 14px;
  line-height: 1.55;
}

.install-help-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: rgb(255 255 255 / 68%);
  font-size: 28px;
  cursor: pointer;
}

.permission-card {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: clamp(54px, 8vh, 104px);
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 2.3vw, 34px);
  width: min(920px, calc(100vw - 36px));
  padding: clamp(17px, 2vw, 26px);
  border: 1px solid rgb(51 239 255 / 42%);
  border-radius: 22px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 12% 0%, rgb(255 51 255 / 15%), transparent 44%),
    linear-gradient(105deg, rgb(4 20 40 / 94%), rgb(17 32 53 / 86%));
  box-shadow: 0 24px 80px rgb(0 0 0 / 48%), 0 0 34px rgb(255 51 255 / 12%), inset 0 1px rgb(255 255 255 / 10%);
  backdrop-filter: blur(22px);
}

.error-card {
  grid-template-columns: 1fr;
  text-align: center;
}

.hand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 32px rgb(51 239 255 / 22%);
}

.hand-mark::before,
.hand-mark::after,
.hand-mark span {
  content: "";
  position: absolute;
  width: 8px;
  border-radius: 8px;
  background: var(--cyan);
}

.hand-mark::before {
  height: 28px;
  transform: translate(-10px, -9px) rotate(-10deg);
}

.hand-mark span {
  height: 34px;
  transform: translate(2px, -12px);
}

.hand-mark::after {
  height: 25px;
  transform: translate(14px, -7px) rotate(10deg);
}

.permission-copy {
  display: grid;
  gap: 4px;
}

.permission-copy small {
  color: var(--cyan);
  font: 800 11px/1.2 ui-monospace, monospace;
  letter-spacing: 0.14em;
}

.permission-copy strong {
  font-size: clamp(17px, 1.6vw, 24px);
  letter-spacing: -0.02em;
}

.permission-copy span {
  max-width: 520px;
  color: rgb(234 244 255 / 68%);
  font-size: clamp(12px, 1vw, 15px);
}

.start-button {
  min-height: 58px;
  padding: 0 25px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--cyan), #74f5ff);
  color: var(--ink);
  box-shadow: 0 10px 30px rgb(51 239 255 / 24%);
  font-weight: 950;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.start-button:hover {
  transform: translateY(-1px);
  background: white;
}

.start-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.control-hint {
  position: absolute;
  z-index: 4;
  bottom: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 14px;
  transform: translateX(-50%);
  color: rgb(237 248 255 / 64%);
  font: 700 clamp(9px, 0.72vw, 12px) / 1 ui-monospace, monospace;
  letter-spacing: 0.07em;
  white-space: nowrap;
  pointer-events: none;
}

.control-hint i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
}

@media (max-width: 700px), (max-height: 560px) {
  .privacy {
    display: none;
  }

  .permission-card {
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 12px;
    bottom: 50px;
    text-align: center;
  }

  .hand-mark {
    display: none;
  }

  .permission-copy span {
    display: none;
  }

  .start-button {
    min-height: 52px;
  }

  .control-hint {
    display: none;
  }

  .install-button {
    top: 14px;
    right: 14px;
    min-height: 36px;
    padding: 0 12px;
    font-size: 9px;
  }
}

@media (orientation: portrait) {
  .brand-rail {
    top: 14px;
    left: 14px;
    gap: 10px;
  }

  .brand span {
    font-size: 20px;
  }

  .brand strong {
    font-size: 12px;
  }

  .privacy {
    padding: 7px 10px;
    font-size: 8px;
  }
}

.hidden {
  display: none !important;
}

/* Tracking stays active, but the camera image never enters the composition. */
.camera-feed { opacity: 0; }
.camera-shade { display: none; }
