html, body {
  height: 100%;
  margin: 0;
  background: #0b0b0b;
  color: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

#app {
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

#stage {
  height: 100%;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

#endOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}

#endOverlay .card {
  min-width: min(520px, calc(100vw - 48px));
  padding: 18px 18px 16px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  background: rgba(0,0,0,0.60);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
#endOverlay .title {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 10px;
}
#endOverlay .word {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

#debugOverlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: auto;
  bottom: auto;
  width: min(520px, calc(100vw - 24px));
  max-height: min(55vh, 420px);
  overflow: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: auto;
  user-select: text;
  cursor: text;
  z-index: 30;
}

#debugOverlay .dbgTitle {
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.9;
  margin-bottom: 6px;
}

#debugOverlay .dbgText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  opacity: 0.95;
}

#debugOverlay .dbgHint {
  margin-top: 8px;
  opacity: 0.75;
}

#rotateOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(2px);
  z-index: 20;
}

#rotateOverlay .card {
  min-width: min(520px, calc(100vw - 48px));
  padding: 18px 18px 16px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  background: rgba(0,0,0,0.60);
}

#rotateOverlay .title {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 10px;
}

#rotateOverlay .text {
  font-size: 16px;
  opacity: 0.95;
}

#lockOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.70);
  backdrop-filter: blur(2px);
  z-index: 50;
}
#lockOverlay[hidden] { display: none !important; }

.lockCard {
  width: min(380px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.70);
  box-shadow: 0 10px 30px rgba(0,0,0,0.40);
}

.lockHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lockTitle {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  opacity: 0.9;
}

.iconBtn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.codeInput {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.35em;
  outline: none;
}

.keypad {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button {
  padding: 14px 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.keypad button.secondary {
  background: rgba(255,255,255,0.05);
  font-weight: 600;
}

.primaryBtn {
  width: 100%;
  margin-top: 12px;
  padding: 12px 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

#endOverlay[hidden] { display: none !important; }
#debugOverlay[hidden] { display: none !important; }
#rotateOverlay[hidden] { display: none !important; }
