:root {
  color-scheme: dark;
  font-family: "Aptos", "Segoe UI", sans-serif;
  background: #0f0d0a;
  color: #f8efe1;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 218, 152, 0.16), transparent 34%),
    radial-gradient(circle at 82% 20%, rgba(83, 129, 164, 0.16), transparent 30%),
    #11100e;
}

.stage-shell {
  position: fixed;
  inset: 0;
}

#webgl-stage,
#tear-stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
}

#webgl-stage {
  z-index: 0;
}

#tear-stage {
  z-index: 1;
  touch-action: none;
  cursor: grab;
}

#tear-stage:active {
  cursor: grabbing;
}

.hud {
  position: fixed;
  top: 22px;
  left: 24px;
  right: 24px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.hud-copy {
  pointer-events: none;
  transition: opacity 0.18s ease;
  user-select: none;
}

.kicker,
.hint {
  margin: 0;
  color: rgba(248, 239, 225, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  max-width: min(680px, 72vw);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 7vw, 96px);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.65);
}

button {
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(248, 239, 225, 0.5);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(10, 10, 10, 0.46);
  color: #f8efe1;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  backdrop-filter: blur(16px);
  white-space: nowrap;
}

button:hover,
button:focus-visible {
  background: rgba(248, 239, 225, 0.18);
  outline: none;
}

.actions {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: min(620px, 52vw);
  transition: opacity 0.18s ease;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.hand-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
  transition: opacity 0.18s ease;
}

.hand-video {
  width: 180px;
  height: 112px;
  object-fit: cover;
  border: 1px solid rgba(248, 239, 225, 0.42);
  border-radius: 8px;
  opacity: 0;
  transform: scaleX(-1);
  transition: opacity 0.2s ease;
}

.hand-video.visible {
  opacity: 0.5;
}

.hand-status {
  margin: 0;
  max-width: 260px;
  color: rgba(248, 239, 225, 0.76);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
  text-shadow: 0 2px 12px #000;
}

.hint {
  position: fixed;
  left: 24px;
  bottom: 22px;
  z-index: 2;
  max-width: calc(100vw - 48px);
  text-shadow: 0 2px 12px #000;
  pointer-events: none;
  transition: opacity 0.18s ease;
  user-select: none;
}

.stage-shell.ui-hidden .hud-copy,
.stage-shell.ui-hidden .hint {
  opacity: 0;
}

.stage-shell.ui-hidden .actions,
.stage-shell.ui-hidden .hand-panel {
  opacity: 0;
}

.stage-shell.ui-hidden .actions:hover,
.stage-shell.ui-hidden .actions:focus-within,
.stage-shell.ui-hidden .hand-panel:hover,
.stage-shell.ui-hidden .hand-panel:focus-within {
  opacity: 1;
}

@media (max-width: 640px) {
  .hud {
    top: 14px;
    left: 14px;
    right: 14px;
  }

  .hint {
    left: 14px;
    bottom: 14px;
  }

  .actions {
    max-width: 48vw;
  }

  button {
    padding: 8px 12px;
    font-size: 13px;
  }

  .hand-panel {
    right: 14px;
    bottom: 14px;
  }

  .hand-video {
    width: 120px;
    height: 76px;
  }

  .hand-status {
    max-width: 180px;
  }
}
